diff --git a/libraries/Error.class.php b/libraries/Error.class.php index e972f67412..31d4550ab6 100644 --- a/libraries/Error.class.php +++ b/libraries/Error.class.php @@ -93,10 +93,10 @@ class PMA_Error extends PMA_Message /** * Constructor * - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline + * @param integer $errno error number + * @param string $errstr error message + * @param string $errfile file + * @param integer $errline line */ public function __construct($errno, $errstr, $errfile, $errline) { @@ -116,7 +116,9 @@ class PMA_Error extends PMA_Message /** * sets PMA_Error::$_backtrace * - * @param array $backtrace + * @param array $backtrace backtrace + * + * @return nothing */ public function setBacktrace($backtrace) { @@ -126,7 +128,9 @@ class PMA_Error extends PMA_Message /** * sets PMA_Error::$_line * - * @param integer $line + * @param integer $line the line + * + * @return nothing */ public function setLine($line) { @@ -136,7 +140,9 @@ class PMA_Error extends PMA_Message /** * sets PMA_Error::$_file * - * @param string $file + * @param string $file the file + * + * @return nothing */ public function setFile($file) { @@ -147,8 +153,7 @@ class PMA_Error extends PMA_Message /** * returns unique PMA_Error::$_hash, if not exists it will be created * - * @param string $file - * @return string PMA_Error::$_hash + * @return string PMA_Error::$_hash */ public function getHash() { @@ -243,6 +248,7 @@ class PMA_Error extends PMA_Message /** * Display HTML backtrace * + * @return nothing */ public function displayBacktrace() { @@ -274,6 +280,8 @@ class PMA_Error extends PMA_Message * * @param string $arg * @param string $function + * + * @return nothing */ protected function displayArg($arg, $function) { @@ -296,6 +304,7 @@ class PMA_Error extends PMA_Message /** * Displays the error in HTML * + * @return nothing */ public function display() { @@ -333,9 +342,10 @@ class PMA_Error extends PMA_Message * prevent path disclusore in error message, * and make users feel save to submit error reports * - * @static - * @param string $dest path to be shorten + * @param string $dest path to be shorten + * * @return string shortened path + * @static */ static function relPath($dest) { diff --git a/libraries/Error_Handler.class.php b/libraries/Error_Handler.class.php index b6b9bf0d80..0a647f1f3b 100644 --- a/libraries/Error_Handler.class.php +++ b/libraries/Error_Handler.class.php @@ -92,10 +92,12 @@ class PMA_Error_Handler * Do not use the context parameter as we want to avoid storing the * complete $GLOBALS inside $_SESSION['errors'] * - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline + * @param integer $errno error number + * @param string $errstr error string + * @param string $errfile error file + * @param integer $errline error line + * + * @return nothing */ public function handleError($errno, $errstr, $errfile, $errline) { @@ -106,37 +108,39 @@ class PMA_Error_Handler $this->_errors[$error->getHash()] = $error; switch ($error->getNumber()) { - case E_USER_NOTICE: - case E_USER_WARNING: - case E_STRICT: - case E_DEPRECATED: - case E_NOTICE: - case E_WARNING: - case E_CORE_WARNING: - case E_COMPILE_WARNING: - case E_USER_ERROR: - case E_RECOVERABLE_ERROR: - // just collect the error - // display is called from outside - break; - case E_ERROR: - case E_PARSE: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - default: - // FATAL error, dislay it and exit - $this->_dispFatalError($error); - exit; - break; + case E_USER_NOTICE: + case E_USER_WARNING: + case E_STRICT: + case E_DEPRECATED: + case E_NOTICE: + case E_WARNING: + case E_CORE_WARNING: + case E_COMPILE_WARNING: + case E_USER_ERROR: + case E_RECOVERABLE_ERROR: + // just collect the error + // display is called from outside + break; + case E_ERROR: + case E_PARSE: + case E_CORE_ERROR: + case E_COMPILE_ERROR: + default: + // FATAL error, dislay it and exit + $this->_dispFatalError($error); + exit; + break; } } /** * log error to configured log facility * - * @todo finish! - * @param PMA_Error $error + * @param PMA_Error $error the error + * * @return bool + * + * @todo finish! */ protected function _logError($error) { @@ -146,10 +150,12 @@ class PMA_Error_Handler /** * trigger a custom error * - * @param string $errorInfo - * @param integer $errorNumber + * @param string $errorInfo error message + * @param integer $errorNumber error number * @param string $file * @param integer $line + * + * @return nothing */ public function triggerError($errorInfo, $errorNumber = null, $file = null, $line = null) { @@ -160,7 +166,9 @@ class PMA_Error_Handler /** * display fatal error and exit * - * @param PMA_Error $error + * @param PMA_Error $error the error + * + * @return nothing */ protected function _dispFatalError($error) { @@ -175,6 +183,7 @@ class PMA_Error_Handler /** * display the whole error page with all errors * + * @return nothing */ public function dispErrorPage() { @@ -188,6 +197,7 @@ class PMA_Error_Handler /** * display user errors not displayed * + * @return nothing */ public function dispUserErrors() { @@ -201,7 +211,9 @@ class PMA_Error_Handler /** * display HTML header * - * @param PMA_error $error + * @param PMA_error $error the error + * + * @return nothing */ protected function _dispPageStart($error = null) { @@ -217,6 +229,7 @@ class PMA_Error_Handler /** * display HTML footer * + * @return nothing */ protected function _dispPageEnd() { @@ -226,6 +239,7 @@ class PMA_Error_Handler /** * display all errors regardless already displayed or user errors * + * @return nothing */ public function dispAllErrors() { @@ -237,6 +251,7 @@ class PMA_Error_Handler /** * display errors not displayed * + * @return nothing */ public function dispErrors() { @@ -258,6 +273,7 @@ class PMA_Error_Handler /** * look in session for saved errors * + * @return nothing */ protected function _checkSavedErrors() { diff --git a/libraries/File.class.php b/libraries/File.class.php index 11a1a04167..70dbda2e8c 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -72,8 +72,9 @@ class PMA_File /** * constructor * - * @access public - * @param string $name file name + * @param string $name file name + * + * @access public */ function __construct($name = false) { @@ -123,9 +124,10 @@ class PMA_File * checks or sets the temp flag for this file * file objects with temp flags are deleted with object destruction * - * @access public - * @param boolean sets the temp flag + * @param boolean $is_temp sets the temp flag + * * @return boolean PMA_File::$_is_temp + * @access public */ function isTemp($is_temp = null) { @@ -139,8 +141,10 @@ class PMA_File /** * accessor * + * @param string $name file name + * + * @return nothing * @access public - * @param string $name file name */ function setName($name) { @@ -148,8 +152,10 @@ class PMA_File } /** - * @access public + * * @return string binary file content + * + * @access public */ function getContent($as_binary = true, $offset = 0, $length = null) { @@ -203,9 +209,11 @@ class PMA_File } /** - * @access public - * @param string name of file uploaded + * + * @param string $name name of file uploaded + * * @return boolean success + * @access public */ function setUploadedFile($name) { @@ -221,10 +229,11 @@ class PMA_File } /** - * @access public - * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $key the md5 hash of the column name + * @param string $rownumber + * * @return boolean success + * @access public */ function setUploadedFromTblChangeRequest($key, $rownumber) { @@ -235,34 +244,34 @@ class PMA_File // check for file upload errors switch ($file['error']) { - // we do not use the PHP constants here cause not all constants - // are defined in all versions of PHP - but the correct constants names - // are given as comment - case 0: //UPLOAD_ERR_OK: - return $this->setUploadedFile($file['tmp_name']); - break; - case 4: //UPLOAD_ERR_NO_FILE: - break; - case 1: //UPLOAD_ERR_INI_SIZE: - $this->_error_message = __('The uploaded file exceeds the upload_max_filesize directive in php.ini.'); - break; - case 2: //UPLOAD_ERR_FORM_SIZE: - $this->_error_message = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'); - break; - case 3: //UPLOAD_ERR_PARTIAL: - $this->_error_message = __('The uploaded file was only partially uploaded.'); - break; - case 6: //UPLOAD_ERR_NO_TMP_DIR: - $this->_error_message = __('Missing a temporary folder.'); - break; - case 7: //UPLOAD_ERR_CANT_WRITE: - $this->_error_message = __('Failed to write file to disk.'); - break; - case 8: //UPLOAD_ERR_EXTENSION: - $this->_error_message = __('File upload stopped by extension.'); - break; - default: - $this->_error_message = __('Unknown error in file upload.'); + // we do not use the PHP constants here cause not all constants + // are defined in all versions of PHP - but the correct constants names + // are given as comment + case 0: //UPLOAD_ERR_OK: + return $this->setUploadedFile($file['tmp_name']); + break; + case 4: //UPLOAD_ERR_NO_FILE: + break; + case 1: //UPLOAD_ERR_INI_SIZE: + $this->_error_message = __('The uploaded file exceeds the upload_max_filesize directive in php.ini.'); + break; + case 2: //UPLOAD_ERR_FORM_SIZE: + $this->_error_message = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'); + break; + case 3: //UPLOAD_ERR_PARTIAL: + $this->_error_message = __('The uploaded file was only partially uploaded.'); + break; + case 6: //UPLOAD_ERR_NO_TMP_DIR: + $this->_error_message = __('Missing a temporary folder.'); + break; + case 7: //UPLOAD_ERR_CANT_WRITE: + $this->_error_message = __('Failed to write file to disk.'); + break; + case 8: //UPLOAD_ERR_EXTENSION: + $this->_error_message = __('File upload stopped by extension.'); + break; + default: + $this->_error_message = __('Unknown error in file upload.'); } // end switch return false; @@ -287,12 +296,13 @@ class PMA_File * $file['error'] = [value] * * + * @param array $file the array + * @param string $rownumber + * @param string $key + * + * @return array * @access public * @static - * @param array $file the array - * @param string $rownumber - * @param string $key - * @return array */ function fetchUploadedFromTblChangeRequestMultiple($file, $rownumber, $key) { @@ -310,15 +320,17 @@ class PMA_File /** * sets the name if the file to the one selected in the tbl_change form * - * @access public - * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $key the md5 hash of the column name + * @param string $rownumber + * * @return boolean success + * @access public */ function setSelectedFromTblChangeRequest($key, $rownumber = null) { if (! empty($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]) - && is_string($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key])) { + && is_string($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]) + ) { // ... whether with multiple rows ... return $this->setLocalSelectedFile($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]); } else { @@ -348,10 +360,11 @@ class PMA_File * checks the superglobals provided if the tbl_change form is submitted * and uses the submitted/selected file * - * @access public - * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $key the md5 hash of the column name + * @param string $rownumber + * * @return boolean success + * @access public */ function checkTblChangeForm($key, $rownumber) { @@ -371,9 +384,10 @@ class PMA_File /** * - * @access public - * @param string $name + * @param string $name + * * @return boolean success + * @access public */ function setLocalSelectedFile($name) { @@ -528,47 +542,47 @@ class PMA_File } switch ($this->getCompression()) { - case false: - return false; - case 'application/bzip2': - if ($GLOBALS['cfg']['BZipDump'] && @function_exists('bzopen')) { - $this->_handle = @bzopen($this->getName(), 'r'); - } else { - $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); - return false; - } - break; - case 'application/gzip': - if ($GLOBALS['cfg']['GZipDump'] && @function_exists('gzopen')) { - $this->_handle = @gzopen($this->getName(), 'r'); - } else { - $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); - return false; - } - break; - case 'application/zip': - if ($GLOBALS['cfg']['ZipDump'] && @function_exists('zip_open')) { - include_once './libraries/zip_extension.lib.php'; - $result = PMA_getZipContents($this->getName()); - if (! empty($result['error'])) { - $this->_error_message = PMA_Message::rawError($result['error']); - return false; - } else { - $this->content_uncompressed = $result['data']; - } - unset($result); - } else { - $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); - return false; - } - break; - case 'none': - $this->_handle = @fopen($this->getName(), 'r'); - break; - default: + case false: + return false; + case 'application/bzip2': + if ($GLOBALS['cfg']['BZipDump'] && @function_exists('bzopen')) { + $this->_handle = @bzopen($this->getName(), 'r'); + } else { $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); return false; - break; + } + break; + case 'application/gzip': + if ($GLOBALS['cfg']['GZipDump'] && @function_exists('gzopen')) { + $this->_handle = @gzopen($this->getName(), 'r'); + } else { + $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); + return false; + } + break; + case 'application/zip': + if ($GLOBALS['cfg']['ZipDump'] && @function_exists('zip_open')) { + include_once './libraries/zip_extension.lib.php'; + $result = PMA_getZipContents($this->getName()); + if (! empty($result['error'])) { + $this->_error_message = PMA_Message::rawError($result['error']); + return false; + } else { + $this->content_uncompressed = $result['data']; + } + unset($result); + } else { + $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); + return false; + } + break; + case 'none': + $this->_handle = @fopen($this->getName(), 'r'); + break; + default: + $this->_error_message = sprintf(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'), $this->getCompression()); + return false; + break; } return true; @@ -601,6 +615,7 @@ class PMA_File * advances the file pointer in the file handle by $length bytes/chars * * @param integer $length numbers of chars/bytes to skip + * * @return boolean * @todo this function is unused */ @@ -615,9 +630,11 @@ class PMA_File /** * http://bugs.php.net/bug.php?id=29532 * bzip reads a maximum of 8192 bytes on windows systems - * @todo this function is unused + * * @param int $max_size + * * @return bool|string + * @todo this function is unused */ function getNextChunk($max_size = null) { @@ -630,41 +647,41 @@ class PMA_File // $result = $this->handler->getNextChunk($size); $result = ''; switch ($this->getCompression()) { - case 'application/bzip2': - $result = ''; - while (strlen($result) < $size - 8192 && ! feof($this->getHandle())) { - $result .= bzread($this->getHandle(), $size); - } - break; - case 'application/gzip': - $result = gzread($this->getHandle(), $size); - break; - case 'application/zip': - /* - * if getNextChunk() is used some day, - * replace this code by code similar to the one - * in open() - * - include_once './libraries/unzip.lib.php'; - $import_handle = new SimpleUnzip(); - $import_handle->ReadFile($this->getName()); - if ($import_handle->Count() == 0) { - $this->_error_message = __('No files found inside ZIP archive!'); - return false; - } elseif ($import_handle->GetError(0) != 0) { - $this->_error_message = __('Error in ZIP archive:') - . ' ' . $import_handle->GetErrorMsg(0); - return false; - } else { - $result = $import_handle->GetData(0); - } - */ - break; - case 'none': - $result = fread($this->getHandle(), $size); - break; - default: + case 'application/bzip2': + $result = ''; + while (strlen($result) < $size - 8192 && ! feof($this->getHandle())) { + $result .= bzread($this->getHandle(), $size); + } + break; + case 'application/gzip': + $result = gzread($this->getHandle(), $size); + break; + case 'application/zip': + /* + * if getNextChunk() is used some day, + * replace this code by code similar to the one + * in open() + * + include_once './libraries/unzip.lib.php'; + $import_handle = new SimpleUnzip(); + $import_handle->ReadFile($this->getName()); + if ($import_handle->Count() == 0) { + $this->_error_message = __('No files found inside ZIP archive!'); return false; + } elseif ($import_handle->GetError(0) != 0) { + $this->_error_message = __('Error in ZIP archive:') + . ' ' . $import_handle->GetErrorMsg(0); + return false; + } else { + $result = $import_handle->GetData(0); + } + */ + break; + case 'none': + $result = fread($this->getHandle(), $size); + break; + default: + return false; } if ($GLOBALS['charset_conversion']) { diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index c296f71122..c152385430 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -35,9 +35,11 @@ $pos = $_SESSION['tmp_user_values']['table_limit_offset']; /** * fills given tooltip arrays * - * @param array $tooltip_truename tooltip data - * @param array $tooltip_aliasname tooltip data - * @param array $table tabledata + * @param array &$tooltip_truename tooltip data + * @param array &$tooltip_aliasname tooltip data + * @param array $table tabledata + * + * @return nothing */ function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table) { @@ -62,7 +64,8 @@ function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table) } if ($GLOBALS['cfg']['ShowTooltipAliasTB'] - && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') { + && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested' + ) { $tooltip_truename[$table['Name']] = $table['Comment']; $tooltip_aliasname[$table['Name']] = $table['Name']; } else { @@ -137,13 +140,15 @@ if (true === $cfg['SkipLockedTables']) { if (isset($sot_cache)) { $db_info_result = PMA_DBI_query( 'SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', - null, PMA_DBI_QUERY_STORE); + null, PMA_DBI_QUERY_STORE + ); if ($db_info_result && PMA_DBI_num_rows($db_info_result) > 0) { while ($tmp = PMA_DBI_fetch_row($db_info_result)) { if (! isset($sot_cache[$tmp[0]])) { $sts_result = PMA_DBI_query( 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) - . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0], true) . '\';'); + . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0], true) . '\';' + ); $sts_tmp = PMA_DBI_fetch_assoc($sts_result); PMA_DBI_free_result($sts_result); unset($sts_result); @@ -152,8 +157,9 @@ if (true === $cfg['SkipLockedTables']) { $sts_tmp['Type'] =& $sts_tmp['Engine']; } - if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] - && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) { + if (! empty($tbl_group) && $cfg['ShowTooltipAliasTB'] + && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment']) + ) { continue; } diff --git a/libraries/db_structure.lib.php b/libraries/db_structure.lib.php index c70b6bf88f..5a93187289 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -31,9 +31,9 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false .'