From 5d010348dab3fe9f0f5465ba99f59d79cab115ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 24 Nov 2008 09:14:31 +0000 Subject: [PATCH] Add phpdoc package header to some files. --- libraries/auth/config.auth.lib.php | 1 + libraries/auth/cookie.auth.lib.php | 3 +- libraries/auth/http.auth.lib.php | 1 + libraries/auth/signon.auth.lib.php | 1 + libraries/auth/swekey/swekey.auth.lib.php | 93 ++++++------ libraries/auth/swekey/swekey.php | 171 +++++++++++----------- libraries/export/codegen.php | 5 +- libraries/export/csv.php | 1 + libraries/export/excel.php | 1 + libraries/export/htmlexcel.php | 1 + libraries/export/htmlword.php | 1 + libraries/export/latex.php | 1 + libraries/export/ods.php | 3 +- libraries/export/odt.php | 3 +- libraries/export/pdf.php | 3 +- libraries/export/sql.php | 23 +-- libraries/export/texytext.php | 4 +- libraries/export/xls.php | 1 + libraries/export/yaml.php | 1 + 19 files changed, 170 insertions(+), 148 deletions(-) diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php index 347d77165..71b94e538 100644 --- a/libraries/auth/config.auth.lib.php +++ b/libraries/auth/config.auth.lib.php @@ -3,6 +3,7 @@ /** * Set of functions used to run config authentication (ie no authentication). * + * @package phpMyAdmin-Auth-Config * @version $Id$ */ diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index c9f94ec54..ffd75e09b 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -5,6 +5,7 @@ * Thanks to Piotr Roszatycki and * Dan Wilson who built this patch for the Debian package. * + * @package phpMyAdmin-Auth-Cookie * @version $Id$ */ @@ -221,7 +222,7 @@ if (top != self) { // use fieldset, don't show doc link PMA_select_language(true, false); } - + ?>
diff --git a/libraries/auth/http.auth.lib.php b/libraries/auth/http.auth.lib.php index c68e35655..9ab2d2634 100644 --- a/libraries/auth/http.auth.lib.php +++ b/libraries/auth/http.auth.lib.php @@ -4,6 +4,7 @@ * Set of functions used to run http authentication. * NOTE: Requires PHP loaded as a Apache module. * + * @package phpMyAdmin-Auth-HTTP * @version $Id$ */ diff --git a/libraries/auth/signon.auth.lib.php b/libraries/auth/signon.auth.lib.php index b5118cdf8..b26b28cc1 100644 --- a/libraries/auth/signon.auth.lib.php +++ b/libraries/auth/signon.auth.lib.php @@ -3,6 +3,7 @@ /** * Set of functions used to run single signon authentication. * + * @package phpMyAdmin-Auth-Signon * @version $Id$ */ diff --git a/libraries/auth/swekey/swekey.auth.lib.php b/libraries/auth/swekey/swekey.auth.lib.php index a4203f45f..aad555498 100644 --- a/libraries/auth/swekey/swekey.auth.lib.php +++ b/libraries/auth/swekey/swekey.auth.lib.php @@ -1,5 +1,8 @@ function Swekey_GetValidKey() { - var valids = " $value) + var valids = " $value) echo $key.','; ?>"; var connected_keys = Swekey_ListKeyIds().split(","); - for (i in connected_keys) + for (i in connected_keys) if (connected_keys[i] != null && connected_keys[i].length == 32) if (valids.indexOf(connected_keys[i]) >= 0) return connected_keys[i]; - + if (connected_keys.length > 0) if (connected_keys[0].length == 32) return "unknown_key_" + connected_keys[0]; - + return "none"; } var key = Swekey_GetValidKey(); - + function timedCheck() { if (key != Swekey_GetValidKey()) { - window.location.search = "?swekey_reset"; + window.location.search = "?swekey_reset"; } else setTimeout("timedCheck()",1000); @@ -102,14 +105,14 @@ function Swekey_auth_error() \n"; // if (file_exists($caFile)) @@ -131,10 +134,10 @@ function Swekey_auth_error() if (file_exists($caFile)) Swekey_SetCAFile($caFile); else if (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://")) - return "Internal Error: CA File $caFile not found"; - + return "Internal Error: CA File $caFile not found"; + $result = null; - parse_str($_SERVER['QUERY_STRING']); + parse_str($_SERVER['QUERY_STRING']); if (isset($swekey_id)) { unset($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY']); if (! isset($_SESSION['SWEKEY']['RND_TOKEN'])) { @@ -147,24 +150,24 @@ function Swekey_auth_error() if (! $res) { $result = $GLOBALS['strSwekeyAuthFailed'] . ' (' . Swekey_GetLastError() . ')'; } - else { + else { $_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'] = $swekey_id; $_SESSION['SWEKEY']['FORCE_USER'] = $_SESSION['SWEKEY']['VALID_SWEKEYS'][$swekey_id]; return null; - } + } } else { - $result = $GLOBALS['strSwekeyNoKey']; + $result = $GLOBALS['strSwekeyNoKey']; if ($_SESSION['SWEKEY']['CONF_DEBUG']) { - $result .= "
".$swekey_id; + $result .= "
".$swekey_id; } - unset($_SESSION['SWEKEY']['CONF_LOADED']); // reload the conf file + unset($_SESSION['SWEKEY']['CONF_LOADED']); // reload the conf file } - } + } } - else - unset($_SESSION['SWEKEY']); + else + unset($_SESSION['SWEKEY']); $_SESSION['SWEKEY']['RND_TOKEN'] = Swekey_GetFastRndToken(); if (strlen($_SESSION['SWEKEY']['RND_TOKEN']) != 64) { @@ -185,14 +188,14 @@ function Swekey_auth_error() if (url.indexOf("?") > 0) url = url.substr(0, url.indexOf("?")); Swekey_SetUnplugUrl(key, "pma_login", url + "?session_to_unset="); - var otp = Swekey_GetOtp(key, ); + var otp = Swekey_GetOtp(key, ); window.location.search="?swekey_id=" + key + "&swekey_otp=" + otp; } '; - if (empty($_SESSION['SWEKEY']['FORCE_USER'])) + if (empty($_SESSION['SWEKEY']['FORCE_USER'])) echo 'var user = null;'; else echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";'; @@ -221,7 +224,7 @@ function Swekey_login($input_name, $input_go) { window.open("http://phpmyadmin.net/auth_key"); } - + var input_username = document.getElementById(""); var input_go = document.getElementById(""); var swekey_status = document.createElement('img'); @@ -240,7 +243,7 @@ function Swekey_login($input_name, $input_go) input_username.value = user; } input_username.readOnly = true; - + if (input_username.nextSibling == null) input_username.parentNode.appendChild(swekey_status); else @@ -267,5 +270,5 @@ if (isset($_GET['swekey_reset'])) { unset($_SESSION['SWEKEY']); } - + ?> diff --git a/libraries/auth/swekey/swekey.php b/libraries/auth/swekey/swekey.php index 3438ade8d..66ce3504d 100644 --- a/libraries/auth/swekey/swekey.php +++ b/libraries/auth/swekey/swekey.php @@ -1,16 +1,17 @@ "; - + // use curl if available if (function_exists('curl_init')) { @@ -205,7 +206,7 @@ function Swekey_HttpGet($url, &$response_code) else error_log("SWEKEY_ERROR:Could not find CA file $gSwekeyCA getting $url"); } - + curl_setopt($sess, CURLOPT_SSL_VERIFYHOST, '2'); curl_setopt($sess, CURLOPT_SSL_VERIFYPEER, '2'); curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '20'); @@ -215,12 +216,12 @@ function Swekey_HttpGet($url, &$response_code) { curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '3'); curl_setopt($sess, CURLOPT_TIMEOUT, '5'); - } - - curl_setopt($sess, CURLOPT_RETURNTRANSFER, '1'); + } + + curl_setopt($sess, CURLOPT_RETURNTRANSFER, '1'); $res=curl_exec($sess); $response_code = curl_getinfo($sess, CURLINFO_HTTP_CODE); - $curlerr = curl_error($sess); + $curlerr = curl_error($sess); curl_close($sess); if ($response_code == 200) @@ -229,7 +230,7 @@ function Swekey_HttpGet($url, &$response_code) return $res; } - if (! empty($response_code)) + if (! empty($response_code)) { $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error $gSwekeyLastError ($curlerr) getting $url"); @@ -237,41 +238,41 @@ function Swekey_HttpGet($url, &$response_code) } $response_code = 408; // Request Timeout - $gSwekeyLastError = $response_code; + $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error $curlerr getting $url"); return ""; } - + // use pecl_http if available if (class_exists('HttpRequest')) { - // retry if one of the server is down + // retry if one of the server is down for ($num=1; $num <= 3; $num++ ) { $r = new HttpRequest($url); $options = array('timeout' => '3'); - + if (substr($url,0, 6) == "https:") { - $sslOptions = array(); + $sslOptions = array(); $sslOptions['verifypeer'] = true; $sslOptions['verifyhost'] = true; $capath = __FILE__; $name = strrchr($capath, '/'); if (empty($name)) // windows - $name = strrchr($capath, '\\'); - $capath = substr($capath, 0, strlen($capath) - strlen($name) + 1).'musbe-ca.crt'; - + $name = strrchr($capath, '\\'); + $capath = substr($capath, 0, strlen($capath) - strlen($name) + 1).'musbe-ca.crt'; + if (! empty($gSwekeyCA)) $sslOptions['cainfo'] = $gSwekeyCA; - - $options['ssl'] = $sslOptions; + + $options['ssl'] = $sslOptions; } $r->setOptions($options); - - // try + + // try { $reply = $r->send(); $res = $reply->getBody(); @@ -287,19 +288,19 @@ function Swekey_HttpGet($url, &$response_code) $gSwekeyLastResult = $res; return $res; - } - // catch (HttpException $e) + } + // catch (HttpException $e) // { // error_log("SWEKEY_WARNING:HttpException ".$e." getting ".$url); - // } - } - + // } + } + $response_code = 408; // Request Timeout - $gSwekeyLastError = $response_code; + $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error ".$gSwekeyLastError." getting ".$url); return ""; } - + global $http_response_header; $res = @file_get_contents($url); $response_code = substr($http_response_header[0], 9, 3); //HTTP/1.0 @@ -308,15 +309,15 @@ function Swekey_HttpGet($url, &$response_code) $gSwekeyLastResult = $res; return $res; } - + $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error ".$response_code." getting ".$url); return ""; -} +} /** * Get a Random Token from a Token Server - * The RT is a 64 vhars hexadecimal value + * The RT is a 64 vhars hexadecimal value * You should better use Swekey_GetFastRndToken() for performance * @access public */ @@ -324,26 +325,26 @@ function Swekey_GetRndToken() { global $gSwekeyRndTokenServer; return Swekey_HttpGet($gSwekeyRndTokenServer.'/FULL-RND-TOKEN', $response_code); -} +} /** * Get a Half Random Token from a Token Server - * The RT is a 64 vhars hexadecimal value - * Use this value if you want to make your own Swekey_GetFastRndToken() + * The RT is a 64 vhars hexadecimal value + * Use this value if you want to make your own Swekey_GetFastRndToken() * @access public */ function Swekey_GetHalfRndToken() { global $gSwekeyRndTokenServer; return Swekey_HttpGet($gSwekeyRndTokenServer.'/HALF-RND-TOKEN', $response_code); -} +} /** - * Get a Half Random Token - * The RT is a 64 vhars hexadecimal value - * This function get a new random token and reuse it. + * Get a Half Random Token + * The RT is a 64 vhars hexadecimal value + * This function get a new random token and reuse it. * Token are refetched from the server only once every 30 seconds. - * You should always use this function to get half random token. + * You should always use this function to get half random token. * @access public */ function Swekey_GetFastHalfRndToken() @@ -357,7 +358,7 @@ function Swekey_GetFastHalfRndToken() if (isset($_SESSION['rnd-token-date'])) if (time() - $_SESSION['rnd-token-date'] < 30) $res = $_SESSION['rnd-token']; - + // If not we try to get it from a temp file (PHP >= 5.2.1 only) if (strlen($res) != 32 && $gSwekeyTokenCacheEnabled) { @@ -369,7 +370,7 @@ function Swekey_GetFastHalfRndToken() if ($modif != false) if (time() - $modif < 30) { - $res = @file_get_contents($cachefile); + $res = @file_get_contents($cachefile); if (strlen($res) != 32) $res = ""; else @@ -378,9 +379,9 @@ function Swekey_GetFastHalfRndToken() $_SESSION['rnd-token-date'] = $modif; } } - } + } } - + // If we don't have a valid RT here we have to get it from the server if (strlen($res) != 32) { @@ -394,29 +395,29 @@ function Swekey_GetFastHalfRndToken() $file = fopen($cachefile , "x"); if ($file != FALSE) { - @fwrite($file, $res); + @fwrite($file, $res); @fclose($file); } } } - + return $res."00000000000000000000000000000000"; } /** - * Get a Random Token - * The RT is a 64 vhars hexadecimal value - * This function generates a unique random token for each call but call the + * Get a Random Token + * The RT is a 64 vhars hexadecimal value + * This function generates a unique random token for each call but call the * server only once every 30 seconds. - * You should always use this function to get random token. + * You should always use this function to get random token. * @access public */ function Swekey_GetFastRndToken() { $res = Swekey_GetFastHalfRndToken(); if (strlen($res) == 64) - return substr($res, 0, 32).strtoupper(md5("Musbe Authentication Key" + mt_rand() + date(DATE_ATOM))); - + return substr($res, 0, 32).strtoupper(md5("Musbe Authentication Key" + mt_rand() + date(DATE_ATOM))); + return ""; } @@ -435,11 +436,11 @@ function Swekey_CheckOtp($id, $rt, $otp) global $gSwekeyCheckServer; $res = Swekey_HttpGet($gSwekeyCheckServer.'/CHECK-OTP/'.$id.'/'.$rt.'/'.$otp, $response_code); return $response_code == 200 && $res == "OK"; -} +} /** * Values that are associated with a key. - * The following values can be returned by the Swekey_GetStatus() function + * The following values can be returned by the Swekey_GetStatus() function */ define ("SWEKEY_STATUS_OK",0); define ("SWEKEY_STATUS_NOT_FOUND",1); // The key does not exist in the db @@ -452,7 +453,7 @@ define ("SWEKEY_STATUS_UNKOWN",201); // We could not connect to the authentica /** * Values that are associated with a key. - * The Javascript Api can also return the following values + * The Javascript Api can also return the following values */ define ("SWEKEY_STATUS_REPLACED",100); // This key has been replaced by a backup key define ("SWEKEY_STATUS_BACKUP_KEY",101); // This key is a backup key that is not activated yet @@ -460,7 +461,7 @@ define ("SWEKEY_STATUS_NOTPLUGGED",200); // This key is not plugged in the compu /** - * Return the text corresponding to the integer status of a key + * Return the text corresponding to the integer status of a key * * @param status The status * @return The text corresponding to the status @@ -483,10 +484,10 @@ function Swekey_GetStatusStr($status) case SWEKEY_STATUS_UNKOWN : return 'Unknow Status, could not connect to the authentication server'; } return 'unknown status '.$status; -} +} /** - * If your web site requires a key to login you should check that the key + * If your web site requires a key to login you should check that the key * is still valid (has not been lost or stolen) before requiring it. * A key can be authenticated only if its status is SWEKEY_STATUS_OK * @param id The id of the swekey @@ -499,8 +500,8 @@ function Swekey_GetStatus($id) $res = Swekey_HttpGet($gSwekeyStatusServer.'/GET-STATUS/'.$id, $response_code); if ($response_code == 200) return intval($res); - + return SWEKEY_STATUS_UNKOWN; -} +} ?> diff --git a/libraries/export/codegen.php b/libraries/export/codegen.php index 7a4873960..f0326b142 100644 --- a/libraries/export/codegen.php +++ b/libraries/export/codegen.php @@ -3,6 +3,7 @@ /** * Set of functions used to build NHibernate dumps of tables * + * @package phpMyAdmin-Export-Codegen * @version $Id$ */ if (! defined('PHPMYADMIN')) { @@ -269,7 +270,7 @@ class TableProperty } return implode("\n", $lines); } - + function handleNHibernateXMLBody($db, $table, $crlf) { $lines=array(); @@ -295,7 +296,7 @@ class TableProperty $lines[]=""; return implode("\n", $lines); } - + function cgGetOption($optionName) { global $what; diff --git a/libraries/export/csv.php b/libraries/export/csv.php index b1b6b2236..5a0b08406 100644 --- a/libraries/export/csv.php +++ b/libraries/export/csv.php @@ -1,6 +1,7 @@