From d7df8b818561537a3ddb1699a64f07a8a60927bc Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Fri, 8 Nov 2013 18:56:01 +0100 Subject: [PATCH 1/6] Update types in PHPDoc. --- libraries/Util.class.php | 8 ++++---- libraries/sql.lib.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 590534b42d..63bbcf0bc1 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -2606,7 +2606,7 @@ class PMA_Util * @param string $minimum_version of this component * @param string $bugref bug reference for this component * - * @return void + * @return String */ public static function getExternalBug( $functionality, $component, $minimum_version, $bugref @@ -3308,7 +3308,7 @@ class PMA_Util * * @param string $max_upload_size maximum upload size * - * @return void + * @return String */ public static function getBrowseUploadFileBlock($max_upload_size) { @@ -3338,7 +3338,7 @@ class PMA_Util * @param array $import_list array of import plugins * @param string $uploaddir upload directory * - * @return void + * @return String */ public static function getSelectUploadFileBlock($import_list, $uploaddir) { @@ -3938,7 +3938,7 @@ class PMA_Util /** * Prepare HTML code for display button. * - * @return void + * @return String */ public static function getButton() { diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index d9c57216bc..c11dec8d30 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -303,7 +303,7 @@ function PMA_getColumnNameInColumnDropSql($sql) * * @param string $db database name * @param string $table table name - * @param string $fields_meta meta fields + * @param array $fields_meta meta fields * * @return boolean whether the result set contains a unique key */ @@ -1826,7 +1826,7 @@ function PMA_getBookmarkCreatedMessage() * @param object $result result of the executed query * @param array $analyzed_sql_results analyzed sql results * - * @return type + * @return String */ function PMA_getHtmlForSqlQueryResultsTable($sql_data, $displayResultsObject, $db, $goto, $pmaThemeImage, $url_query, $disp_mode, $sql_limit_to_append, @@ -1931,7 +1931,7 @@ function PMA_getMessageIfMissingColumnIndex($table, $db, $editable, $disp_mode) * database structure page. * @param string $db current database * - * @return void + * @return string */ function PMA_getHtmlForIndexesProblems($query_type, $selected, $db) { From a7137df36111804b4278038e57db2aa7362276b4 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Fri, 8 Nov 2013 19:02:08 +0100 Subject: [PATCH 2/6] Update phpdoc. --- libraries/Util.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 63bbcf0bc1..c3bfa29ed7 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -3202,7 +3202,7 @@ class PMA_Util * string. * * @param string $string Text where to do expansion. - * @param function $escape Function to call for escaping variable values. + * @param array|string $escape Function to call for escaping variable values. * Can also be an array of: * - the escape method name * - the class that contains the method From 80210a489a4ed6046cc4eab1d12ff7bd2a41f288 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Fri, 8 Nov 2013 19:20:04 +0100 Subject: [PATCH 3/6] Update PHPDoc. --- libraries/DisplayResults.class.php | 16 ++++++++-------- libraries/Util.class.php | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index c764f0a997..59941936e7 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -170,7 +170,7 @@ class PMA_DisplayResults * * @param string $property name of the property * - * @return if property exist, value of the relavant property + * @return mixed|void if property exist, value of the relavant property */ public function __get($property) { @@ -184,7 +184,7 @@ class PMA_DisplayResults * Set values for any property of this class * * @param string $property name of the property - * @param any $value value to set + * @param mixed $value value to set * * @return void */ @@ -986,11 +986,11 @@ class PMA_DisplayResults * @param string $sort_direction sort direction * @param boolean $is_limited_display with limited operations or not * - * @return string html content + * @return string html content * - * @access private + * @access private * - * @see getTable() + * @see getTable() */ private function _getTableHeaders( &$is_display, $analyzed_sql = '', @@ -4196,11 +4196,11 @@ class PMA_DisplayResults * @param string $dir _left / _right * @param array $is_display display mode * - * @return $checkBoxes_html html content + * @return String $checkBoxes_html html content * - * @access private + * @access private * - * @see _getVerticalTable() + * @see _getVerticalTable() */ private function _getCheckBoxesForMultipleRowOperations($dir, $is_display) { diff --git a/libraries/Util.class.php b/libraries/Util.class.php index c3bfa29ed7..e4e6eb8c5a 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -596,10 +596,10 @@ class PMA_Util * * @return mixed * - * @global string the curent table - * @global string the current db + * @global string $table the curent table + * @global string $db the current db * - * @access public + * @access public */ public static function mysqlDie( $error_message = '', $the_query = '', @@ -2047,10 +2047,9 @@ class PMA_Util * * @return void * - * @global string path to current script - * @global boolean flag whether any special variable was required + * @global boolean $checked_special flag whether any special variable was required * - * @access public + * @access public */ public static function checkParameters($params, $request = true) { @@ -2092,7 +2091,7 @@ class PMA_Util * @param array $row current row * @param boolean $force_unique generate condition only on pk or unique * - * @access public + * @access public * * @return array the calculated condition and whether condition is unique */ @@ -3201,14 +3200,14 @@ class PMA_Util * Formats user string, expanding @VARIABLES@, accepting strftime format * string. * - * @param string $string Text where to do expansion. + * @param string $string Text where to do expansion. * @param array|string $escape Function to call for escaping variable values. * Can also be an array of: * - the escape method name * - the class that contains the method * - location of the class (for inclusion) - * @param array $updates Array with overrides for default parameters - * (obtained from GLOBALS). + * @param array $updates Array with overrides for default parameters + * (obtained from GLOBALS). * * @return string */ @@ -4156,7 +4155,7 @@ class PMA_Util /** * Returns information with latest version from phpmyadmin.net * - * @return JSON decoded object with the data + * @return String JSON decoded object with the data */ public static function getLatestVersion() { @@ -4337,4 +4336,5 @@ class PMA_Util } } } + ?> From 661db9ec478ee085c3a4f9cf6ef201173d8c187b Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Fri, 8 Nov 2013 19:27:31 +0100 Subject: [PATCH 4/6] Update PHPDoc. --- libraries/DisplayResults.class.php | 11 +++++----- libraries/transformations.lib.php | 32 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 59941936e7..6e6e9f2f0a 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -5960,12 +5960,12 @@ class PMA_DisplayResults * * @param string $buffer String to process * - * @return Escaped and cleaned up text suitable for html. + * @return String Escaped and cleaned up text suitable for html. * - * @access private + * @access private * - * @see _getDataCellForBlobField(), _getRowData(), - * _handleNonPrintableContents() + * @see _getDataCellForBlobField(), _getRowData(), + * _handleNonPrintableContents() */ private function _mimeDefaultFunction($buffer) { @@ -5988,7 +5988,7 @@ class PMA_DisplayResults * @param string $binary_or_blob binary' or 'blob' * @param int $hexlength optional, get substring * - * @return Displayable version of the binary string + * @return String Displayable version of the binary string * * @access private * @@ -6019,4 +6019,5 @@ class PMA_DisplayResults return $content; } } + ?> diff --git a/libraries/transformations.lib.php b/libraries/transformations.lib.php index b37b7406e7..ddf1c60aac 100644 --- a/libraries/transformations.lib.php +++ b/libraries/transformations.lib.php @@ -133,11 +133,11 @@ function PMA_getAvailableMIMEtypes() /** * Returns the description of the transformation * - * @param string $file transformation file - * @param string $html_formatted whether the description should be formatted - * as HTML + * @param string $file transformation file + * @param boolean $html_formatted whether the description should be formatted + * as HTML * - * @return the description of the transformation + * @return String the description of the transformation */ function PMA_getTransformationDescription($file, $html_formatted = true) { @@ -153,11 +153,11 @@ function PMA_getTransformationDescription($file, $html_formatted = true) /** * Gets the mimetypes for all columns of a table * - * @param string $db the name of the db to check for - * @param string $table the name of the table to check for - * @param string $strict whether to include only results having a mimetype set + * @param string $db the name of the db to check for + * @param string $table the name of the table to check for + * @param boolean $strict whether to include only results having a mimetype set * - * @access public + * @access public * * @return array [field_name][field_key] = field_value */ @@ -232,14 +232,14 @@ function PMA_getMIME($db, $table, $strict = false) /** * Set a single mimetype to a certain value. * - * @param string $db the name of the db - * @param string $table the name of the table - * @param string $key the name of the column - * @param string $mimetype the mimetype of the column - * @param string $transformation the transformation of the column - * @param string $transformation_options the transformation options of the column - * @param string $forcedelete force delete, will erase any existing - * comments for this column + * @param string $db the name of the db + * @param string $table the name of the table + * @param string $key the name of the column + * @param string $mimetype the mimetype of the column + * @param string $transformation the transformation of the column + * @param string $transformation_options the transformation options of the column + * @param boolean $forcedelete force delete, will erase any existing + * comments for this column * * @access public * From 1f09a222818a7ed7c51dee3d21b6cbb1adfa518f Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Fri, 8 Nov 2013 22:41:05 +0100 Subject: [PATCH 5/6] Fix PHPDoc. --- libraries/List.class.php | 2 +- libraries/Theme_Manager.class.php | 3 +- libraries/navigation/Navigation.class.php | 2 - .../navigation/NavigationHeader.class.php | 20 ++++----- libraries/navigation/NavigationTree.class.php | 4 +- libraries/navigation/NodeFactory.class.php | 2 +- libraries/navigation/Nodes/Node.class.php | 6 +-- .../navigation/Nodes/Node_Database.class.php | 2 +- .../Nodes/Node_DatabaseChild.class.php | 2 +- .../Nodes/Node_Function_Container.class.php | 2 - libraries/php-gettext/gettext.php | 7 ++-- .../auth/AuthenticationCookie.class.php | 4 +- libraries/plugins/auth/recaptchalib.php | 42 +++++++++++-------- libraries/sqlvalidator.lib.php | 2 +- 14 files changed, 51 insertions(+), 49 deletions(-) diff --git a/libraries/List.class.php b/libraries/List.class.php index e44edd55cc..a228983447 100644 --- a/libraries/List.class.php +++ b/libraries/List.class.php @@ -33,7 +33,7 @@ abstract class PMA_List extends ArrayObject /** * returns item only if there is only one in the list * - * @return single item + * @return PMA_List single item */ public function getSingleItem() { diff --git a/libraries/Theme_Manager.class.php b/libraries/Theme_Manager.class.php index 9a99e00e23..a33686cb72 100644 --- a/libraries/Theme_Manager.class.php +++ b/libraries/Theme_Manager.class.php @@ -61,7 +61,6 @@ class PMA_Theme_Manager * Constructor for Theme Manager class * * @access public - * @return void */ public function __construct() { @@ -114,7 +113,7 @@ class PMA_Theme_Manager * Initialise the class * * @access public - * @return void + * @return boolean|void */ public function init() { diff --git a/libraries/navigation/Navigation.class.php b/libraries/navigation/Navigation.class.php index 9821f0822e..b7827f6b1c 100644 --- a/libraries/navigation/Navigation.class.php +++ b/libraries/navigation/Navigation.class.php @@ -23,8 +23,6 @@ class PMA_Navigation { /** * Initialises the class - * - * @return void */ public function __construct() { diff --git a/libraries/navigation/NavigationHeader.class.php b/libraries/navigation/NavigationHeader.class.php index e513107242..d53567b609 100644 --- a/libraries/navigation/NavigationHeader.class.php +++ b/libraries/navigation/NavigationHeader.class.php @@ -20,7 +20,7 @@ class PMA_NavigationHeader /** * Renders the navigation * - * @return void + * @return String HTML */ public function getDisplay() { @@ -121,15 +121,15 @@ class PMA_NavigationHeader /** * Renders a single link for the top of the navigation panel * - * @param string $link The url for the link - * @param bool $showText Whether to show the text or to - * only use it for title attributes - * @param string $text The text to display and use for title attributes - * @param bool $showIcon Whether to show the icon - * @param string $icon The filename of the icon to show - * @param string $linkId Value to use for the ID attribute - * @param string $disableAjax Whether to disable ajax page loading for this link - * @param string $linkTarget The name of the target frame for the link + * @param string $link The url for the link + * @param bool $showText Whether to show the text or to + * only use it for title attributes + * @param string $text The text to display and use for title attributes + * @param bool $showIcon Whether to show the icon + * @param string $icon The filename of the icon to show + * @param string $linkId Value to use for the ID attribute + * @param boolean $disableAjax Whether to disable ajax page loading for this link + * @param string $linkTarget The name of the target frame for the link * * @return string HTML code for one link */ diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index eb259bb2d4..8714ef83ac 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -83,8 +83,6 @@ class PMA_NavigationTree /** * Initialises the class - * - * @return void */ public function __construct() { @@ -994,7 +992,7 @@ class PMA_NavigationTree /** * Makes some nodes visible based on the which node is active * - * @return nothing + * @return void */ private function _setVisibility() { diff --git a/libraries/navigation/NodeFactory.class.php b/libraries/navigation/NodeFactory.class.php index 7d8106af98..f561fb87f5 100644 --- a/libraries/navigation/NodeFactory.class.php +++ b/libraries/navigation/NodeFactory.class.php @@ -80,7 +80,7 @@ class PMA_NodeFactory * @param bool $is_group Whether this object has been created * while grouping nodes * - * @return string + * @return mixed */ public static function getInstance( $class = 'Node', diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index 5a85572400..a0f349773e 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -139,7 +139,7 @@ class Node * * @param Node $child A child node * - * @return nothing + * @return void */ public function addChild($child) { @@ -180,7 +180,7 @@ class Node * * @param string $name The name of child to be removed * - * @return nothing + * @return void */ public function removeChild($name) { @@ -430,7 +430,7 @@ class Node /** * Returns HTML for control buttons displayed infront of a node * - * @return HTML for control buttons + * @return String HTML for control buttons */ public function getHtmlForControlButtons() { diff --git a/libraries/navigation/Nodes/Node_Database.class.php b/libraries/navigation/Nodes/Node_Database.class.php index 843566d3e4..ffc95fe040 100644 --- a/libraries/navigation/Nodes/Node_Database.class.php +++ b/libraries/navigation/Nodes/Node_Database.class.php @@ -289,7 +289,7 @@ class Node_Database extends Node /** * Returns HTML for show hidden button displayed infront of database node * - * @return HTML for show hidden button + * @return String HTML for show hidden button */ public function getHtmlForControlButtons() { diff --git a/libraries/navigation/Nodes/Node_DatabaseChild.class.php b/libraries/navigation/Nodes/Node_DatabaseChild.class.php index 0734ff6781..922b23d74b 100644 --- a/libraries/navigation/Nodes/Node_DatabaseChild.class.php +++ b/libraries/navigation/Nodes/Node_DatabaseChild.class.php @@ -19,7 +19,7 @@ abstract class Node_DatabaseChild extends Node /** * Returns HTML for hide button displayed infront of the database child node * - * @return HTML for hide button + * @return String HTML for hide button */ public function getHtmlForControlButtons() { diff --git a/libraries/navigation/Nodes/Node_Function_Container.class.php b/libraries/navigation/Nodes/Node_Function_Container.class.php index 4a1f9b8a56..6a571ff1f1 100644 --- a/libraries/navigation/Nodes/Node_Function_Container.class.php +++ b/libraries/navigation/Nodes/Node_Function_Container.class.php @@ -18,8 +18,6 @@ class Node_Function_Container extends Node { /** * Initialises the class - * - * @return Node_Column_Container */ public function __construct() { diff --git a/libraries/php-gettext/gettext.php b/libraries/php-gettext/gettext.php index 5064047cbd..3d040dff3c 100644 --- a/libraries/php-gettext/gettext.php +++ b/libraries/php-gettext/gettext.php @@ -79,7 +79,7 @@ class gettext_reader { /** * Reads an array of Integers from the Stream * - * @param int count How many elements should be read + * @param int $count How many elements should be read * @return Array of Integers */ function readintarray($count) { @@ -95,8 +95,9 @@ class gettext_reader { /** * Constructor * - * @param object Reader the StreamReader object - * @param boolean enable_cache Enable or disable caching of strings (default on) + * @param object $Reader the StreamReader object + * @param boolean $enable_cache Enable or disable caching of strings (default on) + * @return void|boolean */ function gettext_reader($Reader, $enable_cache = true) { // If there isn't a StreamReader, turn on short circuit mode. diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 5f7efa2c4b..a390ef00a5 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -63,9 +63,9 @@ class AuthenticationCookie extends AuthenticationPlugin * * this function MUST exit/quit the application * - * @global string the last connection error + * @global string $conn_error the last connection error * - * @return void + * @return boolean|void */ public function auth() { diff --git a/libraries/plugins/auth/recaptchalib.php b/libraries/plugins/auth/recaptchalib.php index 32c4f4d758..daa3033568 100644 --- a/libraries/plugins/auth/recaptchalib.php +++ b/libraries/plugins/auth/recaptchalib.php @@ -41,8 +41,10 @@ define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); /** * Encodes the given data into a query string format - * @param $data - array of string elements to be encoded - * @return string - encoded request + * + * @param array $data array of string elements to be encoded + * + * @return string encoded request */ function _recaptcha_qsencode ($data) { $req = ""; @@ -58,10 +60,12 @@ function _recaptcha_qsencode ($data) { /** * Submits an HTTP POST to a reCAPTCHA server - * @param string $host - * @param string $path - * @param array $data - * @param int port + * + * @param string $host Host + * @param string $path Path + * @param array $data Data + * @param int $port Port + * * @return array response */ function _recaptcha_http_post($host, $path, $data, $port = 80) { @@ -97,18 +101,19 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting reCAPTCHA HTML widget * is embedded within the HTML form it was called from. - * @param string $pubkey A public key for reCAPTCHA - * @param string $error The error given by reCAPTCHA (optional, default is null) - * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) + * + * @param string $pubkey A public key for reCAPTCHA + * @param string $error The error given by reCAPTCHA (optional, default is null) + * @param boolean $use_ ssl Should the request be made over ssl? (optional, default is false) - * @return string - The HTML to be embedded in the user's form. + * @return string The HTML to be embedded in the user's form. */ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) { if ($pubkey == null || $pubkey == '') { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } - + if ($use_ssl) { $server = RECAPTCHA_API_SECURE_SERVER; } else { @@ -159,8 +164,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex die ("For security reasons, you must pass the remote ip to reCAPTCHA"); } - - + + //discard spam submissions if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { $recaptcha_response = new ReCaptchaResponse(); @@ -196,8 +201,11 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex * gets a URL where the user can sign up for reCAPTCHA. If your application * has a configuration page where you enter a key, you should provide a link * using this function. + * * @param string $domain The domain where the page is hosted * @param string $appname The name of your application + * + * @return String URL */ function recaptcha_get_signup_url ($domain = null, $appname = null) { return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); @@ -215,7 +223,7 @@ function _recaptcha_aes_encrypt($val,$ky) { if (! function_exists ("mcrypt_encrypt")) { die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); } - $mode=MCRYPT_MODE_CBC; + $mode=MCRYPT_MODE_CBC; $enc=MCRYPT_RIJNDAEL_128; $val=_recaptcha_aes_pad($val); return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); @@ -232,11 +240,11 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) { die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); } - + $ky = pack('H*', $privkey); $cryptmail = _recaptcha_aes_encrypt ($email, $ky); - + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); } @@ -267,7 +275,7 @@ function _recaptcha_mailhide_email_parts ($email) { function recaptcha_mailhide_html($pubkey, $privkey, $email) { $emailparts = _recaptcha_mailhide_email_parts ($email); $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); - + return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]); diff --git a/libraries/sqlvalidator.lib.php b/libraries/sqlvalidator.lib.php index 24007af30d..df59d1b7be 100644 --- a/libraries/sqlvalidator.lib.php +++ b/libraries/sqlvalidator.lib.php @@ -53,7 +53,7 @@ if ($cfg['SQLValidator']['use'] == true) { * * @return string Validator result string * - * @global array The PMA configuration array + * @global array $cfg The PMA configuration array */ function PMA_validateSQL($sql) { From ca8eb087cc4a2ab3826783bd03d6f6373de23066 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Sat, 9 Nov 2013 11:04:52 +0100 Subject: [PATCH 6/6] Revert third party modifications. --- libraries/php-gettext/gettext.php | 7 ++--- libraries/plugins/auth/recaptchalib.php | 42 ++++++++++--------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/libraries/php-gettext/gettext.php b/libraries/php-gettext/gettext.php index 3d040dff3c..5064047cbd 100644 --- a/libraries/php-gettext/gettext.php +++ b/libraries/php-gettext/gettext.php @@ -79,7 +79,7 @@ class gettext_reader { /** * Reads an array of Integers from the Stream * - * @param int $count How many elements should be read + * @param int count How many elements should be read * @return Array of Integers */ function readintarray($count) { @@ -95,9 +95,8 @@ class gettext_reader { /** * Constructor * - * @param object $Reader the StreamReader object - * @param boolean $enable_cache Enable or disable caching of strings (default on) - * @return void|boolean + * @param object Reader the StreamReader object + * @param boolean enable_cache Enable or disable caching of strings (default on) */ function gettext_reader($Reader, $enable_cache = true) { // If there isn't a StreamReader, turn on short circuit mode. diff --git a/libraries/plugins/auth/recaptchalib.php b/libraries/plugins/auth/recaptchalib.php index daa3033568..32c4f4d758 100644 --- a/libraries/plugins/auth/recaptchalib.php +++ b/libraries/plugins/auth/recaptchalib.php @@ -41,10 +41,8 @@ define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); /** * Encodes the given data into a query string format - * - * @param array $data array of string elements to be encoded - * - * @return string encoded request + * @param $data - array of string elements to be encoded + * @return string - encoded request */ function _recaptcha_qsencode ($data) { $req = ""; @@ -60,12 +58,10 @@ function _recaptcha_qsencode ($data) { /** * Submits an HTTP POST to a reCAPTCHA server - * - * @param string $host Host - * @param string $path Path - * @param array $data Data - * @param int $port Port - * + * @param string $host + * @param string $path + * @param array $data + * @param int port * @return array response */ function _recaptcha_http_post($host, $path, $data, $port = 80) { @@ -101,19 +97,18 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting reCAPTCHA HTML widget * is embedded within the HTML form it was called from. - * - * @param string $pubkey A public key for reCAPTCHA - * @param string $error The error given by reCAPTCHA (optional, default is null) - * @param boolean $use_ ssl Should the request be made over ssl? (optional, default is false) + * @param string $pubkey A public key for reCAPTCHA + * @param string $error The error given by reCAPTCHA (optional, default is null) + * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) - * @return string The HTML to be embedded in the user's form. + * @return string - The HTML to be embedded in the user's form. */ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) { if ($pubkey == null || $pubkey == '') { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } - + if ($use_ssl) { $server = RECAPTCHA_API_SECURE_SERVER; } else { @@ -164,8 +159,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex die ("For security reasons, you must pass the remote ip to reCAPTCHA"); } - - + + //discard spam submissions if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { $recaptcha_response = new ReCaptchaResponse(); @@ -201,11 +196,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex * gets a URL where the user can sign up for reCAPTCHA. If your application * has a configuration page where you enter a key, you should provide a link * using this function. - * * @param string $domain The domain where the page is hosted * @param string $appname The name of your application - * - * @return String URL */ function recaptcha_get_signup_url ($domain = null, $appname = null) { return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); @@ -223,7 +215,7 @@ function _recaptcha_aes_encrypt($val,$ky) { if (! function_exists ("mcrypt_encrypt")) { die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); } - $mode=MCRYPT_MODE_CBC; + $mode=MCRYPT_MODE_CBC; $enc=MCRYPT_RIJNDAEL_128; $val=_recaptcha_aes_pad($val); return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); @@ -240,11 +232,11 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) { die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); } - + $ky = pack('H*', $privkey); $cryptmail = _recaptcha_aes_encrypt ($email, $ky); - + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); } @@ -275,7 +267,7 @@ function _recaptcha_mailhide_email_parts ($email) { function recaptcha_mailhide_html($pubkey, $privkey, $email) { $emailparts = _recaptcha_mailhide_email_parts ($email); $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); - + return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]);