diff --git a/db_operations.php b/db_operations.php index 60be255715..eec625bd5f 100644 --- a/db_operations.php +++ b/db_operations.php @@ -287,7 +287,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; $test_rs = PMA_queryAsControlUser( $test_query, - null, + false, PMA_DatabaseInterface::QUERY_STORE ); diff --git a/db_structure.php b/db_structure.php index 208551597f..fb9beab9d7 100644 --- a/db_structure.php +++ b/db_structure.php @@ -100,7 +100,7 @@ if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['favorite_table'])) { $ajax_response->addJSON( 'anchor', PMA_getHtmlForFavoriteAnchor( - $db, array('TABLE_NAME' => $favorite_table), $titles + $db, $favorite_table, $titles ) ); } else { diff --git a/examples/openid.php b/examples/openid.php index a99603de4b..bc0a6bf902 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -64,7 +64,7 @@ function Show_page($contents) } /* Need to have cookie visible from parent directory */ -session_set_cookie_params(0, '/', '', 0); +session_set_cookie_params(0, '/', '', false); /* Create signon session */ $session_name = 'SignonSession'; session_name($session_name); diff --git a/examples/signon.php b/examples/signon.php index 8b2ab2e279..d55ff6dac0 100644 --- a/examples/signon.php +++ b/examples/signon.php @@ -12,7 +12,7 @@ */ /* Need to have cookie visible from parent directory */ -session_set_cookie_params(0, '/', '', 0); +session_set_cookie_params(0, '/', '', false); /* Create signon session */ $session_name = 'SignonSession'; session_name($session_name); diff --git a/import.php b/import.php index c8f7e2d92c..fd81ae0146 100644 --- a/import.php +++ b/import.php @@ -624,7 +624,7 @@ if (strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { if (isset($my_die)) { foreach ($my_die as $key => $die) { PMA_Util::mysqlDie( - $die['error'], $die['sql'], '', $err_url, $error + $die['error'], $die['sql'], false, $err_url, $error ); } } diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index c49fc410c3..f9b0be38e4 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -187,7 +187,7 @@ class Advisor /** * Splits justification to text and formula. * - * @param string $rule the rule + * @param array $rule the rule * * @return array */ @@ -204,7 +204,7 @@ class Advisor * Adds a rule to the result list * * @param string $type type of rule - * @param array $rule rule itslef + * @param array $rule rule itself * * @return void */ diff --git a/libraries/DBQbe.class.php b/libraries/DBQbe.class.php index b68ce7a629..6be893426b 100644 --- a/libraries/DBQbe.class.php +++ b/libraries/DBQbe.class.php @@ -118,7 +118,7 @@ class PMA_DbQbe * Minimum width of a column * * @access private - * @var string + * @var int */ private $_form_column_width; /** @@ -1313,7 +1313,7 @@ class PMA_DbQbe /** * Provides FROM clause for building SQL query * - * @param string $cfgRelation Relation Settings + * @param array $cfgRelation Relation Settings * * @return string FROM clause */ @@ -1362,7 +1362,7 @@ class PMA_DbQbe /** * Provides the generated SQL query * - * @param string $cfgRelation Relation Settings + * @param array $cfgRelation Relation Settings * * @return string SQL query */ @@ -1386,7 +1386,7 @@ class PMA_DbQbe /** * Provides the generated QBE form * - * @param string $cfgRelation Relation Settings + * @param array $cfgRelation Relation Settings * * @return string QBE form */ diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index b2933f608a..c126c17d5d 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -366,7 +366,7 @@ class PMA_DatabaseInterface /** * returns the beginning of the SQL statement to fetch the list of tables * - * @param string $this_databases databases to list + * @param array $this_databases databases to list * @param string $sql_where_table additional condition * * @return string the SQL statement @@ -374,7 +374,7 @@ class PMA_DatabaseInterface private function _getSqlForTablesFull($this_databases, $sql_where_table) { if (PMA_DRIZZLE) { - $engine_info = PMA_Util::cacheGet('drizzle_engines', true); + $engine_info = PMA_Util::cacheGet('drizzle_engines', null); $stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false"; if (isset($engine_info['InnoDB']) && $engine_info['InnoDB']['module_library'] == 'innobase' @@ -893,7 +893,7 @@ class PMA_DatabaseInterface $sql .= ' FROM data_dictionary.SCHEMAS s'; if ($force_stats) { - $engine_info = PMA_Util::cacheGet('drizzle_engines', true); + $engine_info = PMA_Util::cacheGet('drizzle_engines', null); $stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false"; if (isset($engine_info['InnoDB']) && $engine_info['InnoDB']['module_library'] == 'innobase' @@ -1386,26 +1386,26 @@ class PMA_DatabaseInterface return; } if (! defined('PMA_MYSQL_INT_VERSION')) { - if (PMA_Util::cacheExists('PMA_MYSQL_INT_VERSION', true)) { + if (PMA_Util::cacheExists('PMA_MYSQL_INT_VERSION', null)) { define( 'PMA_MYSQL_INT_VERSION', - PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', null) ); define( 'PMA_MYSQL_MAJOR_VERSION', - PMA_Util::cacheGet('PMA_MYSQL_MAJOR_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_MAJOR_VERSION', null) ); define( 'PMA_MYSQL_STR_VERSION', - PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION', null) ); define( 'PMA_MYSQL_VERSION_COMMENT', - PMA_Util::cacheGet('PMA_MYSQL_VERSION_COMMENT', true) + PMA_Util::cacheGet('PMA_MYSQL_VERSION_COMMENT', null) ); define( 'PMA_DRIZZLE', - PMA_Util::cacheGet('PMA_DRIZZLE', true) + PMA_Util::cacheGet('PMA_DRIZZLE', null) ); } else { $version = $this->fetchSingleRow( @@ -1437,22 +1437,22 @@ class PMA_DatabaseInterface PMA_Util::cacheSet( 'PMA_MYSQL_INT_VERSION', PMA_MYSQL_INT_VERSION, - true + null ); PMA_Util::cacheSet( 'PMA_MYSQL_MAJOR_VERSION', PMA_MYSQL_MAJOR_VERSION, - true + null ); PMA_Util::cacheSet( 'PMA_MYSQL_STR_VERSION', PMA_MYSQL_STR_VERSION, - true + null ); PMA_Util::cacheSet( 'PMA_MYSQL_VERSION_COMMENT', PMA_MYSQL_VERSION_COMMENT, - true + null ); /* Detect Drizzle - it does not support charsets */ @@ -1470,7 +1470,7 @@ class PMA_DatabaseInterface PMA_Util::cacheSet( 'PMA_DRIZZLE', PMA_DRIZZLE, - true + null ); } } @@ -1516,7 +1516,7 @@ class PMA_DatabaseInterface } // Cache plugin list for Drizzle - if (PMA_DRIZZLE && !PMA_Util::cacheExists('drizzle_engines', true)) { + if (PMA_DRIZZLE && !PMA_Util::cacheExists('drizzle_engines', null)) { $sql = "SELECT p.plugin_name, m.module_library FROM data_dictionary.plugins p JOIN data_dictionary.modules m USING (module_name) @@ -1524,7 +1524,7 @@ class PMA_DatabaseInterface AND p.plugin_name NOT IN ('FunctionEngine', 'schema') AND p.is_active = 'YES'"; $engines = $this->fetchResult($sql, 'plugin_name', null, $link); - PMA_Util::cacheSet('drizzle_engines', $engines, true); + PMA_Util::cacheSet('drizzle_engines', $engines, null); } } @@ -1686,13 +1686,13 @@ class PMA_DatabaseInterface * // $users['admin']['John Doe'] = '123' * * - * @param string|mysql_result $result query or mysql result - * @param string|integer $key field-name or offset - * used as key for array - * @param string|integer $value value-name or offset - * used as value for array - * @param resource $link mysql link - * @param mixed $options query options + * @param string|mysql_result $result query or mysql result + * @param string|integer|array $key field-name or offset + * used as key for array + * @param string|integer $value value-name or offset + * used as value for array + * @param resource $link mysql link + * @param mixed $options query options * * @return array resultrows or values indexed by $key */ @@ -2010,8 +2010,8 @@ class PMA_DatabaseInterface */ public function isSuperuser() { - if (PMA_Util::cacheExists('is_superuser', true)) { - return PMA_Util::cacheGet('is_superuser', true); + if (PMA_Util::cacheExists('is_superuser', null)) { + return PMA_Util::cacheGet('is_superuser', null); } // when connection failed we don't have a $userlink @@ -2031,12 +2031,12 @@ class PMA_DatabaseInterface self::QUERY_STORE ); } - PMA_Util::cacheSet('is_superuser', $result, true); + PMA_Util::cacheSet('is_superuser', $result, null); } else { - PMA_Util::cacheSet('is_superuser', false, true); + PMA_Util::cacheSet('is_superuser', false, null); } - return PMA_Util::cacheGet('is_superuser', true); + return PMA_Util::cacheGet('is_superuser', null); } /** diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index b1c6f24da2..b495104f77 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -990,10 +990,10 @@ class PMA_DisplayResults * * @param array &$is_display which elements to display * @param array|string $analyzed_sql the analyzed query - * @param string $sort_expression sort expression - * @param string $sort_expression_nodirection sort expression + * @param array $sort_expression sort expression + * @param array $sort_expression_nodirection sort expression * without direction - * @param string $sort_direction sort direction + * @param array $sort_direction sort direction * @param boolean $is_limited_display with limited operations * or not * @@ -1827,7 +1827,7 @@ class PMA_DisplayResults * @param integer $column_index the index of the column * @param string $unsorted_sql_query the unsorted sql query * @param integer $session_max_rows maximum rows resulted by sql - * @param array $direction the display direction + * @param string $direction the display direction * @param string $comments comment for row * @param array $sort_direction sort direction * @param boolean $directionCondition display direction horizontal @@ -2094,7 +2094,7 @@ class PMA_DisplayResults * Get sort url paramaeters - sort order and order image * * @param array $sort_direction the sort direction - * @param array $sort_order the sorting order + * @param string $sort_order the sorting order * @param integer $column_index the index of the column * @param integer $index the index of sort direction array. * @@ -3685,7 +3685,7 @@ class PMA_DisplayResults * @param array $analyzed_sql the analyzed query * @param string $transformation_plugin the name of transformation plugin * @param string $default_function the default transformation function - * @param string $transform_options the transformation parameters + * @param array $transform_options the transformation parameters * * @return string $cell the prepared cell, html content * @@ -3741,7 +3741,7 @@ class PMA_DisplayResults * primary etc) * @param string $transformation_plugin the name of transformation function * @param string $default_function the default transformation function - * @param string $transform_options the transformation parameters + * @param array $transform_options the transformation parameters * @param boolean $condition_field the column should highlighted * or not * @param boolean $is_field_truncated the condition for blob data @@ -3839,7 +3839,7 @@ class PMA_DisplayResults * @param boolean $condition_field the column should highlighted or not * @param string $transformation_plugin the name of transformation function * @param string $default_function the default transformation function - * @param string $transform_options the transformation parameters + * @param array $transform_options the transformation parameters * @param boolean $is_field_truncated the condition for blob data replacements * @param array $analyzed_sql the analyzed query * @@ -3960,7 +3960,7 @@ class PMA_DisplayResults * or not * @param string $transformation_plugin the name of transformation function * @param string $default_function the default transformation function - * @param string $transform_options the transformation parameters + * @param array $transform_options the transformation parameters * @param boolean $is_field_truncated the condition for blob data * replacements * @param array $analyzed_sql the analyzed query @@ -4907,7 +4907,7 @@ class PMA_DisplayResults $column_for_first_row = $this->_handleNonPrintableContents( $meta->type, $row[$sorted_column_index], $transformation_plugin, $transform_options, - $default_function, $meta, null + $default_function, $meta ); } else { @@ -4931,7 +4931,7 @@ class PMA_DisplayResults $column_for_last_row = $this->_handleNonPrintableContents( $meta->type, $row[$sorted_column_index], $transformation_plugin, $transform_options, - $default_function, $meta, null + $default_function, $meta ); } else { @@ -5521,7 +5521,7 @@ class PMA_DisplayResults * @param string $transformation_plugin transformation plugin. * Can also be the default function: * PMA_mimeDefaultFunction - * @param string $transform_options transformation parameters + * @param array $transform_options transformation parameters * @param string $default_function default transformation function * @param object $meta the meta-information about the field * @param array $url_params parameters that should go to the @@ -5606,7 +5606,7 @@ class PMA_DisplayResults * @param string $class css classes for the td element * @param bool $condition_field whether the column is a part of the * where clause - * @param string $analyzed_sql the analyzed query + * @param array $analyzed_sql the analyzed query * @param object $meta the meta-information about the field * @param array $map the list of relations * @param string $data data diff --git a/libraries/File.class.php b/libraries/File.class.php index a9ff862f29..5c492a6419 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -572,7 +572,7 @@ class PMA_File /** * Sets the file handle * - * @param object $handle file handle + * @param resource $handle file handle * * @return void */ @@ -630,7 +630,7 @@ class PMA_File include_once './libraries/zip_extension.lib.php'; $result = PMA_getZipContents($this->getName()); if (! empty($result['error'])) { - $this->_error_message = PMA_Message::rawError($result['error']); + $this->_error_message = (string) PMA_Message::rawError($result['error']); return false; } else { $this->content_uncompressed = $result['data']; diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 4132faa555..fe891df336 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -138,11 +138,11 @@ class PMA_Message /** * Constructor * - * @param string $string The message to be displayed - * @param integer $number A numeric representation of the type of message - * @param array $params An array of parameters to use in the message - * @param integer $sanitize A flag to indicate what to sanitize, see - * constant definitions above + * @param string $string The message to be displayed + * @param integer $number A numeric representation of the type of message + * @param array|string $params An array of parameters to use in the message + * @param integer $sanitize A flag to indicate what to sanitize, see + * constant definitions above */ public function __construct($string = '', $number = PMA_Message::NOTICE, $params = array(), $sanitize = PMA_Message::SANITIZE_NONE @@ -515,8 +515,8 @@ class PMA_Message /** * set all params at once, usually used in conjunction with string * - * @param array $params parameters to set - * @param boolean $sanitize whether to sanitize params + * @param array|string $params parameters to set + * @param boolean $sanitize whether to sanitize params * * @return void */ @@ -525,6 +525,10 @@ class PMA_Message if ($sanitize) { $params = PMA_Message::sanitize($params); } + // convert single param to array + if (! is_array($params)) { + $params = array($params); + } $this->params = $params; } diff --git a/libraries/PMA.php b/libraries/PMA.php index c7e8326030..f01b9cac78 100644 --- a/libraries/PMA.php +++ b/libraries/PMA.php @@ -20,6 +20,8 @@ require_once './libraries/List_Database.class.php'; * phpMyAdmin main Controller * * @package PhpMyAdmin + * @property resource $userlink + * @property resource $controllink */ class PMA { diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 1a3074088a..2d2fe6eed2 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -488,11 +488,12 @@ class PMA_Table } break; case 'NULL' : - //If user uncheck null checkbox and not change default value null, - //default value will be ignored. - if ($null !== false && $null != 'NULL') { + // If user uncheck null checkbox and not change default value null, + // default value will be ignored. + if ($null !== false && $null !== 'NULL') { break; } + // otherwise, fall to next case (no break; here) case 'CURRENT_TIMESTAMP' : $query .= ' DEFAULT ' . $default_type; break; diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 7a8fdf0eec..3154c3edc8 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -1307,7 +1307,7 @@ class PMA_Util */ public static function profilingSupported() { - if (!self::cacheExists('profiling_supported', true)) { + if (!self::cacheExists('profiling_supported', null)) { // 5.0.37 has profiling but for example, 5.1.20 does not // (avoid a trip to the server for MySQL before 5.0.37) // and do not set a constant as we might be switching servers @@ -1315,13 +1315,13 @@ class PMA_Util && (PMA_MYSQL_INT_VERSION >= 50037) && $GLOBALS['dbi']->fetchValue("SHOW VARIABLES LIKE 'profiling'") ) { - self::cacheSet('profiling_supported', true, true); + self::cacheSet('profiling_supported', true, null); } else { - self::cacheSet('profiling_supported', false, true); + self::cacheSet('profiling_supported', false, null); } } - return self::cacheGet('profiling_supported', true); + return self::cacheGet('profiling_supported', null); } /** @@ -2801,20 +2801,20 @@ class PMA_Util */ public static function clearUserCache() { - self::cacheUnset('is_superuser', true); + self::cacheUnset('is_superuser', null); } /** * Verifies if something is cached in the session * * @param string $var variable name - * @param int|true $server server + * @param null|int $server server * * @return boolean */ public static function cacheExists($var, $server = 0) { - if ($server === true) { + if ($server === null) { $server = $GLOBALS['server']; } return isset($_SESSION['cache']['server_' . $server][$var]); @@ -2824,13 +2824,13 @@ class PMA_Util * Gets cached information from the session * * @param string $var varibale name - * @param int|true $server server + * @param null|int $server server * * @return mixed */ public static function cacheGet($var, $server = 0) { - if ($server === true) { + if ($server === null) { $server = $GLOBALS['server']; } if (isset($_SESSION['cache']['server_' . $server][$var])) { @@ -2845,13 +2845,13 @@ class PMA_Util * * @param string $var variable name * @param mixed $val value - * @param int|true $server server + * @param null|int $server server * * @return mixed */ public static function cacheSet($var, $val = null, $server = 0) { - if ($server === true) { + if ($server === null) { $server = $GLOBALS['server']; } $_SESSION['cache']['server_' . $server][$var] = $val; @@ -2861,13 +2861,13 @@ class PMA_Util * Removes cached information from the session * * @param string $var variable name - * @param int|true $server server + * @param null|int $server server * * @return void */ public static function cacheUnset($var, $server = 0) { - if ($server === true) { + if ($server === null) { $server = $GLOBALS['server']; } unset($_SESSION['cache']['server_' . $server][$var]); @@ -4264,10 +4264,10 @@ class PMA_Util && $save ) { if (! isset($_SESSION) && ! defined('TESTSUITE')) { - ini_set('session.use_only_cookies', false); - ini_set('session.use_cookies', false); - ini_set('session.use_trans_sid', false); - ini_set('session.cache_limiter', null); + ini_set('session.use_only_cookies', '0'); + ini_set('session.use_cookies', '0'); + ini_set('session.use_trans_sid', '0'); + ini_set('session.cache_limiter', 'null'); session_start(); } $_SESSION['cache']['version_check'] = array( diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index 22c6e3bf07..fb9bf46e8a 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -34,21 +34,21 @@ $GLOBALS['is_superuser'] = $GLOBALS['dbi']->isSuperuser(); */ function PMA_analyseShowGrant() { - if (PMA_Util::cacheExists('is_create_db_priv', true)) { + if (PMA_Util::cacheExists('is_create_db_priv', null)) { $GLOBALS['is_create_db_priv'] = PMA_Util::cacheGet( - 'is_create_db_priv', true + 'is_create_db_priv', null ); $GLOBALS['is_process_priv'] = PMA_Util::cacheGet( - 'is_process_priv', true + 'is_process_priv', null ); $GLOBALS['is_reload_priv'] = PMA_Util::cacheGet( - 'is_reload_priv', true + 'is_reload_priv', null ); $GLOBALS['db_to_create'] = PMA_Util::cacheGet( - 'db_to_create', true + 'db_to_create', null ); $GLOBALS['dbs_where_create_table_allowed'] = PMA_Util::cacheGet( - 'dbs_where_create_table_allowed', true + 'dbs_where_create_table_allowed', null ); return; } @@ -152,14 +152,14 @@ function PMA_analyseShowGrant() // must also cacheUnset() them in // libraries/plugins/auth/AuthenticationCookie.class.php - PMA_Util::cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], true); - PMA_Util::cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true); - PMA_Util::cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true); - PMA_Util::cacheSet('db_to_create', $GLOBALS['db_to_create'], true); + PMA_Util::cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], null); + PMA_Util::cacheSet('is_process_priv', $GLOBALS['is_process_priv'], null); + PMA_Util::cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], null); + PMA_Util::cacheSet('db_to_create', $GLOBALS['db_to_create'], null); PMA_Util::cacheSet( 'dbs_where_create_table_allowed', $GLOBALS['dbs_where_create_table_allowed'], - true + null ); } // end function diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 37377be673..2227c1e466 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -70,7 +70,7 @@ if (version_compare(phpversion(), '5.4', 'lt')) { /** * Avoid problems with magic_quotes_runtime */ - @ini_set('magic_quotes_runtime', false); + @ini_set('magic_quotes_runtime', '0'); } /** diff --git a/libraries/config/ConfigFile.class.php b/libraries/config/ConfigFile.class.php index 0482a4e583..368aacd927 100644 --- a/libraries/config/ConfigFile.class.php +++ b/libraries/config/ConfigFile.class.php @@ -28,7 +28,7 @@ class ConfigFile /** * Stores original PMA config, not modified by user preferences - * @var PMA_Config + * @var array */ private $_baseCfg; @@ -269,7 +269,7 @@ class ConfigFile $this->_flattenArrayResult = array(); array_walk($this->_defaultCfg, array($this, '_flattenArray'), ''); $flat_cfg = $this->_flattenArrayResult; - $this->_flattenArrayResult = null; + $this->_flattenArrayResult = array(); return $flat_cfg; } @@ -287,7 +287,7 @@ class ConfigFile $this->_flattenArrayResult = array(); array_walk($cfg, array($this, '_flattenArray'), ''); $flat_cfg = $this->_flattenArrayResult; - $this->_flattenArrayResult = null; + $this->_flattenArrayResult = array(); // save values map for translating a few user preferences paths, // should be complemented by code reading from generated config @@ -519,7 +519,7 @@ class ConfigFile $this->_flattenArrayResult = array(); array_walk($_SESSION[$this->_id], array($this, '_flattenArray'), ''); $c = $this->_flattenArrayResult; - $this->_flattenArrayResult = null; + $this->_flattenArrayResult = array(); $persistKeys = array_diff( array_keys($this->_persistKeys), diff --git a/libraries/config/Validator.class.php b/libraries/config/Validator.class.php index 5a8e01e45e..890f85ba32 100644 --- a/libraries/config/Validator.class.php +++ b/libraries/config/Validator.class.php @@ -182,9 +182,9 @@ class PMA_Validator $old_track_errors = ini_get('track_errors'); $old_display_errors = ini_get('display_errors'); $old_error_reporting = error_reporting(E_ALL); - ini_set('html_errors', false); - ini_set('track_errors', true); - ini_set('display_errors', true); + ini_set('html_errors', '0'); + ini_set('track_errors', '1'); + ini_set('display_errors', '1'); set_error_handler(array("PMA_Validator", "nullErrorHandler")); ob_start(); } else { diff --git a/libraries/create_addfield.lib.php b/libraries/create_addfield.lib.php index f6f153806c..aed0251073 100644 --- a/libraries/create_addfield.lib.php +++ b/libraries/create_addfield.lib.php @@ -322,7 +322,8 @@ function PMA_tryColumnCreationQuery($db, $table, $err_url) $GLOBALS['dbi']->selectDb($db) or PMA_Util::mysqlDie( $GLOBALS['dbi']->getError(), - 'USE ' . PMA_Util::backquote($db), '', + 'USE ' . PMA_Util::backquote($db), + false, $err_url ); $sql_query = 'ALTER TABLE ' . diff --git a/libraries/dbi/DBIMysql.class.php b/libraries/dbi/DBIMysql.class.php index 1799139e79..8cc1bf9662 100644 --- a/libraries/dbi/DBIMysql.class.php +++ b/libraries/dbi/DBIMysql.class.php @@ -39,7 +39,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension /** * Helper function for connecting to the database server * - * @param array $server host/port/socket + * @param string $server host/port/socket * @param string $user mysql user name * @param string $password mysql user password * @param int $client_flags client flags of connection @@ -567,4 +567,4 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension return false; } } -?> \ No newline at end of file +?> diff --git a/libraries/display_export.inc.php b/libraries/display_export.inc.php index 39b07d38d2..eccf2e29b6 100644 --- a/libraries/display_export.inc.php +++ b/libraries/display_export.inc.php @@ -22,7 +22,7 @@ require_once './libraries/display_export.lib.php'; /* Scan for plugins */ $export_list = PMA_getPlugins( - "export", + 'export', 'libraries/plugins/export/', array( 'export_type' => $export_type, diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index 0a7d44f793..ce1aa0ccb6 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -254,7 +254,7 @@ function PMA_getHtmlForExportOptionsSelection($export_type, $multi_values) /** * Prints Html For Export Options Format * - * @param String $export_list Export List + * @param array $export_list Export List * * @return string */ @@ -679,13 +679,13 @@ function PMA_getHtmlForExportOptionsOutput($export_type) /** * Prints Html For Export Options * - * @param String $export_type Selected Export Type - * @param String $db Selected DB - * @param String $table Selected Table - * @param String $multi_values Export selection - * @param String $num_tables number of tables - * @param String $export_list Export List - * @param String $unlim_num_rows Number of Rows + * @param string $export_type Selected Export Type + * @param string $db Selected DB + * @param string $table Selected Table + * @param string $multi_values Export selection + * @param string $num_tables number of tables + * @param array $export_list Export List + * @param string $unlim_num_rows Number of Rows * * @return string */ diff --git a/libraries/error_report.lib.php b/libraries/error_report.lib.php index fd35956f3f..80a216eff8 100644 --- a/libraries/error_report.lib.php +++ b/libraries/error_report.lib.php @@ -43,25 +43,26 @@ function PMA_getReportData($pretty_print = true) return ''; } $exception = $_REQUEST['exception']; - $exception["stack"] = PMA_translateStacktrace($exception["stack"]); - List($uri, $script_name) = PMA_sanitizeUrl($exception["url"]); - $exception["uri"] = $uri; - unset($exception["url"]); + $exception['stack'] = PMA_translateStacktrace($exception['stack']); + list($uri, $script_name) = PMA_sanitizeUrl($exception['url']); + $exception['uri'] = $uri; + unset($exception['url']); $report = array( - "exception" => $exception, - "script_name" => $script_name, - "pma_version" => PMA_VERSION, - "browser_name" => PMA_USR_BROWSER_AGENT, - "browser_version" => PMA_USR_BROWSER_VER, - "user_os" => PMA_USR_OS, - "server_software" => $_SERVER['SERVER_SOFTWARE'], - "user_agent_string" => $_SERVER['HTTP_USER_AGENT'], - "locale" => $_COOKIE['pma_lang'], - "configuration_storage" => - empty($GLOBALS['cfg']['Servers'][1]['pmadb']) ? "disabled" : - "enabled", - "php_version" => phpversion(), - "microhistory" => $_REQUEST['microhistory'], + 'exception' => $exception, + 'script_name' => $script_name, + 'pma_version' => PMA_VERSION, + 'browser_name' => PMA_USR_BROWSER_AGENT, + 'browser_version' => PMA_USR_BROWSER_VER, + 'user_os' => PMA_USR_OS, + 'server_software' => $_SERVER['SERVER_SOFTWARE'], + 'user_agent_string' => $_SERVER['HTTP_USER_AGENT'], + 'locale' => $_COOKIE['pma_lang'], + 'configuration_storage' => + empty($GLOBALS['cfg']['Servers'][1]['pmadb']) + ? 'disabled' + : 'enabled', + 'php_version' => phpversion(), + 'microhistory' => $_REQUEST['microhistory'], ); if (! empty($_REQUEST['description'])) { @@ -95,27 +96,27 @@ function PMA_getReportData($pretty_print = true) function PMA_sanitizeUrl($url) { $components = parse_url($url); - if (isset($components["fragment"]) - && preg_match("", $components["fragment"], $matches) + if (isset($components['fragment']) + && preg_match('', $components['fragment'], $matches) ) { - $uri = str_replace($matches[0], "", $components["fragment"]); - $url = "http://dummy_host/" . $uri; + $uri = str_replace($matches[0], '', $components['fragment']); + $url = 'http://dummy_host/' . $uri; $components = parse_url($url); } // get script name - preg_match("<([a-zA-Z\-_\d]*\.php)$>", $components["path"], $matches); + preg_match('<([a-zA-Z\-_\d]*\.php)$>', $components['path'], $matches); $script_name = $matches[1]; // remove deployment specific details to make uri more generic - parse_str($components["query"], $query_array); - unset($query_array["db"]); - unset($query_array["table"]); - unset($query_array["token"]); - unset($query_array["server"]); + parse_str($components['query'], $query_array); + unset($query_array['db']); + unset($query_array['table']); + unset($query_array['token']); + unset($query_array['server']); $query = http_build_query($query_array); - $uri = $script_name . "?" . $query; + $uri = $script_name . '?' . $query; return array($uri, $script_name); } @@ -130,8 +131,8 @@ function PMA_sendErrorReport($report) { $data_string = json_encode($report); if (ini_get('allow_url_fopen')) { - $context = array("http" => - array( + $context = array( + 'http' => array( 'method' => 'POST', 'content' => $data_string, 'header' => "Content-Type: multipart/form-data\r\n", @@ -152,7 +153,7 @@ function PMA_sendErrorReport($report) $curl_handle = curl_init(SUBMISSION_URL); $curl_handle = PMA_Util::configureCurl($curl_handle); - curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data_string); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); diff --git a/libraries/export.lib.php b/libraries/export.lib.php index 3a3e52395a..77016a046d 100644 --- a/libraries/export.lib.php +++ b/libraries/export.lib.php @@ -454,10 +454,10 @@ function PMA_getHtmlForDisplayedExportHeader($export_type, $db, $table) * @param string $crlf end of line character(s) * @param string $err_url the URL in case of error * @param string $export_type the export type - * @param string $do_relation whether to export relation info - * @param string $do_comments whether to add comments - * @param string $do_mime whether to add MIME info - * @param string $do_dates whether to add dates + * @param bool $do_relation whether to export relation info + * @param bool $do_comments whether to add comments + * @param bool $do_mime whether to add MIME info + * @param bool $do_dates whether to add dates * * @return void */ @@ -494,10 +494,10 @@ function PMA_exportServer( * @param string $crlf end of line character(s) * @param string $err_url the URL in case of error * @param string $export_type the export type - * @param string $do_relation whether to export relation info - * @param string $do_comments whether to add comments - * @param string $do_mime whether to add MIME info - * @param string $do_dates whether to add dates + * @param bool $do_relation whether to export relation info + * @param bool $do_comments whether to add comments + * @param bool $do_mime whether to add MIME info + * @param bool $do_dates whether to add dates * * @return void */ @@ -639,10 +639,10 @@ function PMA_exportDatabase( * @param string $crlf end of line character(s) * @param string $err_url the URL in case of error * @param string $export_type the export type - * @param string $do_relation whether to export relation info - * @param string $do_comments whether to add comments - * @param string $do_mime whether to add MIME info - * @param string $do_dates whether to add dates + * @param bool $do_relation whether to export relation info + * @param bool $do_comments whether to add comments + * @param bool $do_mime whether to add MIME info + * @param bool $do_dates whether to add dates * @param string $allrows whether "dump all rows" was ticked * @param string $limit_to upper limit * @param string $limit_from starting limit diff --git a/libraries/gis/GIS_Geometry.class.php b/libraries/gis/GIS_Geometry.class.php index b457db53cd..4e265975c5 100644 --- a/libraries/gis/GIS_Geometry.class.php +++ b/libraries/gis/GIS_Geometry.class.php @@ -189,9 +189,9 @@ abstract class PMA_GIS_Geometry /** * Extracts points, scales and returns them as an array. * - * @param string $point_set string of comma sperated points - * @param array $scale_data data related to scaling - * @param boolean $linear if true, as a 1D array, else as a 2D array + * @param string $point_set string of comma sperated points + * @param null|array $scale_data data related to scaling + * @param boolean $linear if true, as a 1D array, else as a 2D array * * @return array scaled points * @access protected @@ -210,7 +210,7 @@ abstract class PMA_GIS_Geometry if (isset($cordinates[0]) && trim($cordinates[0]) != '' && isset($cordinates[1]) && trim($cordinates[1]) != '' ) { - if ($scale_data != null) { + if ($scale_data !== null) { $x = ($cordinates[0] - $scale_data['x']) * $scale_data['scale']; $y = $scale_data['height'] - ($cordinates[1] - $scale_data['y']) * $scale_data['scale']; diff --git a/libraries/gis/GIS_Geometrycollection.class.php b/libraries/gis/GIS_Geometrycollection.class.php index 09b04ed404..ff57e5e5a6 100644 --- a/libraries/gis/GIS_Geometrycollection.class.php +++ b/libraries/gis/GIS_Geometrycollection.class.php @@ -100,11 +100,11 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS GEOMETRYCOLLECTION object - * @param string $label label for the GIS GEOMETRYCOLLECTION object - * @param string $color color for the GIS GEOMETRYCOLLECTION object - * @param array $scale_data array containing data related to scaling - * @param object $image image object + * @param string $spatial GIS GEOMETRYCOLLECTION object + * @param string $label label for the GIS GEOMETRYCOLLECTION object + * @param string $color color for the GIS GEOMETRYCOLLECTION object + * @param array $scale_data array containing data related to scaling + * @param resource $image image object * * @return resource the modified image object * @access public diff --git a/libraries/gis/GIS_Linestring.class.php b/libraries/gis/GIS_Linestring.class.php index 2874de0636..0298a8b9a7 100644 --- a/libraries/gis/GIS_Linestring.class.php +++ b/libraries/gis/GIS_Linestring.class.php @@ -63,11 +63,11 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS LINESTRING object - * @param string $label Label for the GIS LINESTRING object - * @param string $line_color Color for the GIS LINESTRING object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS LINESTRING object + * @param string $label Label for the GIS LINESTRING object + * @param string $line_color Color for the GIS LINESTRING object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return resource the modified image object * @access public diff --git a/libraries/gis/GIS_Multilinestring.class.php b/libraries/gis/GIS_Multilinestring.class.php index 1a74e2aa96..6f604c0b19 100644 --- a/libraries/gis/GIS_Multilinestring.class.php +++ b/libraries/gis/GIS_Multilinestring.class.php @@ -72,11 +72,11 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS MULTILINESTRING object - * @param string $label Label for the GIS MULTILINESTRING object - * @param string $line_color Color for the GIS MULTILINESTRING object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS MULTILINESTRING object + * @param string $label Label for the GIS MULTILINESTRING object + * @param string $line_color Color for the GIS MULTILINESTRING object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return object the modified image object * @access public diff --git a/libraries/gis/GIS_Multipoint.class.php b/libraries/gis/GIS_Multipoint.class.php index 515780deb5..d3882a6b1f 100644 --- a/libraries/gis/GIS_Multipoint.class.php +++ b/libraries/gis/GIS_Multipoint.class.php @@ -63,11 +63,11 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS MULTIPOINT object - * @param string $label Label for the GIS MULTIPOINT object - * @param string $point_color Color for the GIS MULTIPOINT object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS MULTIPOINT object + * @param string $label Label for the GIS MULTIPOINT object + * @param string $point_color Color for the GIS MULTIPOINT object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return object the modified image object * @access public diff --git a/libraries/gis/GIS_Multipolygon.class.php b/libraries/gis/GIS_Multipolygon.class.php index 275ca3e463..369d01a13b 100644 --- a/libraries/gis/GIS_Multipolygon.class.php +++ b/libraries/gis/GIS_Multipolygon.class.php @@ -80,11 +80,11 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS MULTIPOLYGON object - * @param string $label Label for the GIS MULTIPOLYGON object - * @param string $fill_color Color for the GIS MULTIPOLYGON object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS MULTIPOLYGON object + * @param string $label Label for the GIS MULTIPOLYGON object + * @param string $fill_color Color for the GIS MULTIPOLYGON object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return object the modified image object * @access public diff --git a/libraries/gis/GIS_Point.class.php b/libraries/gis/GIS_Point.class.php index 35fff43621..bcd8517bde 100644 --- a/libraries/gis/GIS_Point.class.php +++ b/libraries/gis/GIS_Point.class.php @@ -63,11 +63,11 @@ class PMA_GIS_Point extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS POINT object - * @param string $label Label for the GIS POINT object - * @param string $point_color Color for the GIS POINT object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS POINT object + * @param string $label Label for the GIS POINT object + * @param string $point_color Color for the GIS POINT object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return object the modified image object * @access public diff --git a/libraries/gis/GIS_Polygon.class.php b/libraries/gis/GIS_Polygon.class.php index ed944f4a0d..51521da618 100644 --- a/libraries/gis/GIS_Polygon.class.php +++ b/libraries/gis/GIS_Polygon.class.php @@ -72,11 +72,11 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry /** * Adds to the PNG image object, the data related to a row in the GIS dataset. * - * @param string $spatial GIS POLYGON object - * @param string $label Label for the GIS POLYGON object - * @param string $fill_color Color for the GIS POLYGON object - * @param array $scale_data Array containing data related to scaling - * @param object $image Image object + * @param string $spatial GIS POLYGON object + * @param string $label Label for the GIS POLYGON object + * @param string $fill_color Color for the GIS POLYGON object + * @param array $scale_data Array containing data related to scaling + * @param resource $image Image object * * @return object the modified image object * @access public diff --git a/libraries/gis/GIS_Visualization.class.php b/libraries/gis/GIS_Visualization.class.php index 20fd75f881..f86f451c22 100644 --- a/libraries/gis/GIS_Visualization.class.php +++ b/libraries/gis/GIS_Visualization.class.php @@ -173,7 +173,7 @@ class PMA_GIS_Visualization $output .= ''; $scale_data = $this->_scaleDataSet($this->_data); - $output .= $this->_prepareDataSet($this->_data, $scale_data, 'svg', ''); + $output .= $this->_prepareDataSet($this->_data, $scale_data, 'svg'); $output .= ''; $output .= ''; @@ -305,7 +305,7 @@ class PMA_GIS_Visualization . 'map.addLayers([layerMapnik,layerCycleMap,layerNone]);' . 'var vectorLayer = new OpenLayers.Layer.Vector("Data");' . 'var bound;'; - $output .= $this->_prepareDataSet($this->_data, $scale_data, 'ol', ''); + $output .= $this->_prepareDataSet($this->_data, $scale_data, 'ol'); $output .= 'map.addLayer(vectorLayer);' . 'map.zoomToExtent(bound);' @@ -441,16 +441,16 @@ class PMA_GIS_Visualization /** * Prepares and return the dataset as needed by the visualization. * - * @param array $data Raw data - * @param array $scale_data Data related to scaling - * @param string $format Format of the visulaization - * @param object $results Image object in the case of png - * TCPDF object in the case of pdf + * @param array $data Raw data + * @param array $scale_data Data related to scaling + * @param string $format Format of the visulaization + * @param null|object $results Image object in the case of png + * TCPDF object in the case of pdf * * @return mixed the formatted array of data * @access private */ - private function _prepareDataSet($data, $scale_data, $format, $results) + private function _prepareDataSet($data, $scale_data, $format, $results = null) { $color_number = 0; diff --git a/libraries/mysql_charsets.inc.php b/libraries/mysql_charsets.inc.php index ea3aa2989b..b42af4970d 100644 --- a/libraries/mysql_charsets.inc.php +++ b/libraries/mysql_charsets.inc.php @@ -13,7 +13,7 @@ if (! defined('PHPMYADMIN')) { * */ -if (! PMA_Util::cacheExists('mysql_charsets', true)) { +if (! PMA_Util::cacheExists('mysql_charsets', null)) { global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available, $mysql_default_collations, $mysql_collations_flat; @@ -88,47 +88,47 @@ if (! PMA_Util::cacheExists('mysql_charsets', true)) { unset($key, $value); PMA_Util::cacheSet( - 'mysql_charsets', $GLOBALS['mysql_charsets'], true + 'mysql_charsets', $GLOBALS['mysql_charsets'], null ); PMA_Util::cacheSet( - 'mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], true + 'mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], null ); PMA_Util::cacheSet( - 'mysql_charsets_available', $GLOBALS['mysql_charsets_available'], true + 'mysql_charsets_available', $GLOBALS['mysql_charsets_available'], null ); PMA_Util::cacheSet( - 'mysql_collations', $GLOBALS['mysql_collations'], true + 'mysql_collations', $GLOBALS['mysql_collations'], null ); PMA_Util::cacheSet( - 'mysql_default_collations', $GLOBALS['mysql_default_collations'], true + 'mysql_default_collations', $GLOBALS['mysql_default_collations'], null ); PMA_Util::cacheSet( - 'mysql_collations_flat', $GLOBALS['mysql_collations_flat'], true + 'mysql_collations_flat', $GLOBALS['mysql_collations_flat'], null ); PMA_Util::cacheSet( - 'mysql_collations_available', $GLOBALS['mysql_collations_available'], true + 'mysql_collations_available', $GLOBALS['mysql_collations_available'], null ); } else { $GLOBALS['mysql_charsets'] = PMA_Util::cacheGet( - 'mysql_charsets', true + 'mysql_charsets', null ); $GLOBALS['mysql_charsets_descriptions'] = PMA_Util::cacheGet( - 'mysql_charsets_descriptions', true + 'mysql_charsets_descriptions', null ); $GLOBALS['mysql_charsets_available'] = PMA_Util::cacheGet( - 'mysql_charsets_available', true + 'mysql_charsets_available', null ); $GLOBALS['mysql_collations'] = PMA_Util::cacheGet( - 'mysql_collations', true + 'mysql_collations', null ); $GLOBALS['mysql_default_collations'] = PMA_Util::cacheGet( - 'mysql_default_collations', true + 'mysql_default_collations', null ); $GLOBALS['mysql_collations_flat'] = PMA_Util::cacheGet( - 'mysql_collations_flat', true + 'mysql_collations_flat', null ); $GLOBALS['mysql_collations_available'] = PMA_Util::cacheGet( - 'mysql_collations_available', true + 'mysql_collations_available', null ); } diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index fb4cec139e..87610a6fc4 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -13,8 +13,8 @@ if (! defined('PHPMYADMIN')) { * Generate charset dropdown box * * @param int $type Type - * @param null $name Element name - * @param null $id Element id + * @param null|string $name Element name + * @param null|string $id Element id * @param null|string $default Default value * @param bool $label Label * @param int $indent Indent diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 25698e2174..619d5ff9d4 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -15,7 +15,7 @@ * @param mixed $plugin_param parameter to plugin by which they can * decide whether they can work * - * @return object|null new plugin instance + * @return object new plugin instance */ function PMA_getPlugin( $plugin_type, @@ -34,7 +34,8 @@ function PMA_getPlugin( return new $class_name; } - return null; + // by default, return SQL plugin + return PMA_getPlugin($plugin_type, 'sql', $plugins_dir, $plugin_param); } /** diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 6855261d98..553331530e 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -466,11 +466,11 @@ class AuthenticationCookie extends AuthenticationPlugin $last_access_time = time() - $GLOBALS['cfg']['LoginCookieValidity']; if ($_SESSION['last_access_time'] < $last_access_time ) { - PMA_Util::cacheUnset('is_create_db_priv', true); - PMA_Util::cacheUnset('is_process_priv', true); - PMA_Util::cacheUnset('is_reload_priv', true); - PMA_Util::cacheUnset('db_to_create', true); - PMA_Util::cacheUnset('dbs_where_create_table_allowed', true); + PMA_Util::cacheUnset('is_create_db_priv', null); + PMA_Util::cacheUnset('is_process_priv', null); + PMA_Util::cacheUnset('is_reload_priv', null); + PMA_Util::cacheUnset('db_to_create', null); + PMA_Util::cacheUnset('dbs_where_create_table_allowed', null); $GLOBALS['no_activity'] = true; $this->authFails(); if (! defined('TESTSUITE')) { diff --git a/libraries/schema/Export_Relation_Schema.class.php b/libraries/schema/Export_Relation_Schema.class.php index ebc4db5127..5e8dabab2f 100644 --- a/libraries/schema/Export_Relation_Schema.class.php +++ b/libraries/schema/Export_Relation_Schema.class.php @@ -29,6 +29,7 @@ class PMA_Export_Relation_Schema public $orientation; public $paper; public $pageNumber; + public $exportType; /** * Set Page Number diff --git a/libraries/session.inc.php b/libraries/session.inc.php index 182af93fb3..c9818c4355 100644 --- a/libraries/session.inc.php +++ b/libraries/session.inc.php @@ -25,7 +25,7 @@ if (!@function_exists('session_name')) { // disable starting of sessions before all settings are done // does not work, besides how it is written in php manual -//ini_set('session.auto_start', 0); +//ini_set('session.auto_start', '0'); // session cookie settings session_set_cookie_params( @@ -34,7 +34,7 @@ session_set_cookie_params( ); // cookies are safer (use @ini_set() in case this function is disabled) -@ini_set('session.use_cookies', true); +@ini_set('session.use_cookies', '1'); // optionally set session_save_path $path = $GLOBALS['PMA_Config']->get('SessionSavePath'); @@ -43,9 +43,9 @@ if (!empty($path)) { } // but not all user allow cookies -@ini_set('session.use_only_cookies', false); +@ini_set('session.use_only_cookies', '0'); // do not force transparent session ids, see bug #3398788 -//@ini_set('session.use_trans_sid', true); +//@ini_set('session.use_trans_sid', '1'); @ini_set( 'url_rewriter.tags', 'a=href,frame=src,input=src,form=fakeentry,fieldset=' @@ -53,14 +53,14 @@ if (!empty($path)) { //ini_set('arg_separator.output', '&'); // delete session/cookies when browser is closed -@ini_set('session.cookie_lifetime', 0); +@ini_set('session.cookie_lifetime', '0'); -// warn but dont work with bug -@ini_set('session.bug_compat_42', false); -@ini_set('session.bug_compat_warn', true); +// warn but don't work with bug +@ini_set('session.bug_compat_42', '0'); +@ini_set('session.bug_compat_warn', '1'); // use more secure session ids -@ini_set('session.hash_function', 1); +@ini_set('session.hash_function', '1'); // some pages (e.g. stylesheet) may be cached on clients, but not in shared // proxy servers diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index 588abadb49..121707be38 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -308,7 +308,7 @@ function PMA_getColumnNameInColumnDropSql($sql) * * @param array $fields_meta meta fields * - * @return boolean whether the result set has columns from just one table + * @return boolean whether the result set has columns from just one table */ function PMA_resultSetHasJustOneTable($fields_meta) { @@ -322,7 +322,7 @@ function PMA_resultSetHasJustOneTable($fields_meta) break; } } - return $just_one_table; + return $just_one_table; } /** @@ -2075,7 +2075,7 @@ function PMA_sendQueryResponseForResultsReturned($result, $justBrowsing, $has_unique = PMA_resultSetContainsUniqueKey( $db, $table, $fields_meta ); - + $just_one_table = PMA_resultSetHasJustOneTable($fields_meta); $editable = ($has_unique || $updatableView) && $just_one_table; @@ -2256,29 +2256,29 @@ function PMA_sendQueryResponse($num_rows, $unlim_num_rows, $is_affected, /** * Function to execute the query and send the response * - * @param array $analyzed_sql_results analysed sql results - * @param bool $is_gotofile whether goto file or not - * @param string $db current database - * @param string $table current table - * @param bool $find_real_end whether to find real end or not - * @param string $sql_query_for_bookmark the sql query to be stored as bookmark - * @param array $extra_data extra data - * @param bool $is_affected whether affected or not - * @param string $message_to_show message to show - * @param string $disp_mode display mode - * @param string $message message - * @param array $sql_data sql data - * @param string $goto goto page url - * @param string $pmaThemeImage uri of the PMA theme image - * @param string $disp_query display query - * @param string $disp_message display message - * @param string $query_type query type - * @param string $sql_query sql query - * @param bool $selected whether check table, optimize table, - * analyze table or repair table has been - * selected with respect to the selected - * tables from the database structure page - * @param string $complete_query complete query + * @param array $analyzed_sql_results analysed sql results + * @param bool $is_gotofile whether goto file or not + * @param string $db current database + * @param string $table current table + * @param bool|null $find_real_end whether to find real end or not + * @param string $sql_query_for_bookmark the sql query to be stored as bookmark + * @param array|null $extra_data extra data + * @param bool $is_affected whether affected or not + * @param string $message_to_show message to show + * @param string $disp_mode display mode + * @param string $message message + * @param array|null $sql_data sql data + * @param string $goto goto page url + * @param string $pmaThemeImage uri of the PMA theme image + * @param string $disp_query display query + * @param string $disp_message display message + * @param string $query_type query type + * @param string $sql_query sql query + * @param bool|null $selected whether check table, optimize table, + * analyze table or repair table has been + * selected with respect to the selected + * tables from the database structure page + * @param string $complete_query complete query * * @return void */ diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index db5777184f..27ddcc384c 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -264,7 +264,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, * @param string $text_dir url for text directory * @param string $overhead_check overhead check * @param boolean $db_is_system_schema whether database is information schema or not - * @param string $hidden_fields hidden fields + * @param array $hidden_fields hidden fields * * @return string $html_output */ @@ -479,7 +479,7 @@ function PMA_getHtmlForStructureTableRow( } //Favorite table anchor. $html_output .= '' - . PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles) + . PMA_getHtmlForFavoriteAnchor($db, $current_table['TABLE_NAME'], $titles) . ''; $html_output .= '' . $browse_table . ''; @@ -2729,23 +2729,23 @@ function PMA_checkFavoriteTable($db, $current_table) * * @param string $db current database * @param string $current_table current table - * @param string $titles titles + * @param array $titles titles * * @return $html_output */ function PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles) { $html_output = ' $db, 'ajax_request' => true, - 'favorite_table' => $current_table['TABLE_NAME'], - (($already_favorite?'remove':'add') . '_favorite') => true + 'favorite_table' => $current_table, + (($already_favorite ? 'remove' : 'add') . '_favorite') => true ); $fav_url = 'db_structure.php' . PMA_URL_getCommon($fav_params); $html_output .= '" '; @@ -2753,7 +2753,7 @@ function PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles) . '" title="' . ($already_favorite ? __("Remove from Favorites") : __("Add to Favorites")) . '" data-favtargets="' - . md5($db . "." . $current_table['TABLE_NAME']) + . md5($db . "." . $current_table) . '" >' . (!$already_favorite ? $titles['NoFavorite'] : $titles['Favorite']) . ''; diff --git a/libraries/url_generating.lib.php b/libraries/url_generating.lib.php index ab78d83689..03972b6f03 100644 --- a/libraries/url_generating.lib.php +++ b/libraries/url_generating.lib.php @@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) { /** * Generates text with hidden inputs. * - * @param string $db optional database name + * @param string|array $db optional database name * (can also be an array of parameters) * @param string $table optional table name * @param int $indent indenting level diff --git a/test/libraries/common/PMA_cache_test.php b/test/libraries/common/PMA_cache_test.php index 21f4d9c08a..24723fe104 100644 --- a/test/libraries/common/PMA_cache_test.php +++ b/test/libraries/common/PMA_cache_test.php @@ -50,12 +50,12 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase public function testCacheExists() { $GLOBALS['server'] = 'server'; - PMA_Util::cacheSet('test_data', 5, true); - PMA_Util::cacheSet('test_data_2', 5, true); + PMA_Util::cacheSet('test_data', 5, null); + PMA_Util::cacheSet('test_data_2', 5, null); - $this->assertTrue(PMA_Util::cacheExists('test_data', true)); + $this->assertTrue(PMA_Util::cacheExists('test_data', null)); $this->assertTrue(PMA_Util::cacheExists('test_data_2', 'server')); - $this->assertFalse(PMA_Util::cacheExists('fake_data_2', true)); + $this->assertFalse(PMA_Util::cacheExists('fake_data_2', null)); } /** @@ -66,12 +66,12 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase public function testCacheGet() { $GLOBALS['server'] = 'server'; - PMA_Util::cacheSet('test_data', 5, true); - PMA_Util::cacheSet('test_data_2', 5, true); + PMA_Util::cacheSet('test_data', 5, null); + PMA_Util::cacheSet('test_data_2', 5, null); - $this->assertNotNull(PMA_Util::cacheGet('test_data', true)); + $this->assertNotNull(PMA_Util::cacheGet('test_data', null)); $this->assertNotNull(PMA_Util::cacheGet('test_data_2', 'server')); - $this->assertNull(PMA_Util::cacheGet('fake_data_2', true)); + $this->assertNull(PMA_Util::cacheGet('fake_data_2', null)); } /** @@ -82,11 +82,11 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase public function testCacheSetGet() { $GLOBALS['server'] = 'server'; - PMA_Util::cacheSet('test_data', 25, true); + PMA_Util::cacheSet('test_data', 25, null); - PMA_Util::cacheSet('test_data', 5, true); + PMA_Util::cacheSet('test_data', 5, null); $this->assertEquals(5, $_SESSION['cache']['server_server']['test_data']); - PMA_Util::cacheSet('test_data_3', 3, true); + PMA_Util::cacheSet('test_data_3', 3, null); $this->assertEquals(3, $_SESSION['cache']['server_server']['test_data_3']); } @@ -98,12 +98,12 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase public function testCacheUnSet() { $GLOBALS['server'] = 'server'; - PMA_Util::cacheSet('test_data', 25, true); - PMA_Util::cacheSet('test_data_2', 25, true); + PMA_Util::cacheSet('test_data', 25, null); + PMA_Util::cacheSet('test_data_2', 25, null); - PMA_Util::cacheUnset('test_data', true); + PMA_Util::cacheUnset('test_data', null); $this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']); - PMA_Util::cacheUnset('test_data_2', true); + PMA_Util::cacheUnset('test_data_2', null); $this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']); } @@ -115,7 +115,7 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase public function testClearUserCache() { $GLOBALS['server'] = 'server'; - PMA_Util::cacheSet('is_superuser', 'yes', true); + PMA_Util::cacheSet('is_superuser', 'yes', null); $this->assertEquals('yes', $_SESSION['cache']['server_server']['is_superuser']); PMA_Util::clearUserCache();