diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/HTTPClient.php | 2 | ||||
-rw-r--r-- | inc/confutils.php | 31 | ||||
-rw-r--r-- | inc/io.php | 2 |
3 files changed, 32 insertions, 3 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 71844b847..1184aebee 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -32,7 +32,7 @@ class DokuHTTPClient extends HTTPClient { $this->proxy_host = $conf['proxy']['host']; $this->proxy_port = $conf['proxy']['port']; $this->proxy_user = $conf['proxy']['user']; - $this->proxy_pass = $conf['proxy']['pass']; + $this->proxy_pass = conf_decodeString($conf['proxy']['pass']); $this->proxy_ssl = $conf['proxy']['ssl']; } } diff --git a/inc/confutils.php b/inc/confutils.php index 5b48e97dd..2099ba949 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -238,5 +238,34 @@ function useHeading($linktype) { return (!empty($useHeading[$linktype])); } - +/** + * obscure config data so information isn't plain text + * + * @param string $str data to be encoded + * @param string $code encoding method, values: plain, base64, uuencode. + * @return string the encoded value + */ +function conf_encodeString($str,$code) { + switch ($code) { + case 'base64' : return '<b>'.base64_encode($str); + case 'uuencode' : return '<u>'.convert_uuencode($str); + case 'plain': + default: + return $str; + } +} +/** + * return obscured data as plain text + * + * @param string $str encoded data + * @return string plain text + */ +function conf_decodeString($str) { + switch (substr($str,0,3)) { + case '<b>' : return base64_decode(substr($str,3)); + case '<u>' : return convert_uudecode(substr($str,3)); + default: // not encode (or unknown) + return $str; + } +} //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/io.php b/inc/io.php index 1c0e86104..2eb94db0c 100644 --- a/inc/io.php +++ b/inc/io.php @@ -424,7 +424,7 @@ function io_mkdir_ftp($dir){ return false; } - if(!@ftp_login($conn, $conf['ftp']['user'], $conf['ftp']['pass'])){ + if(!@ftp_login($conn, $conf['ftp']['user'], conf_decodeString($conf['ftp']['pass']))){ msg("FTP login failed",-1); return false; } |