Inheritance: extends Message
Exemplo n.º 1
0
 /**
  * Stores query data into session data for debugging purposes
  *
  * @param string         $query  Query text
  * @param object         $link   database link
  * @param object|boolean $result Query result
  * @param integer        $time   Time to execute query
  *
  * @return void
  */
 private function _dbgQuery($query, $link, $result, $time)
 {
     $dbgInfo = array();
     $error_message = $this->getError($link);
     if ($result == false && is_string($error_message)) {
         $dbgInfo['error'] = '<span style="color:red">' . htmlspecialchars($error_message) . '</span>';
     }
     $dbgInfo['query'] = htmlspecialchars($query);
     $dbgInfo['time'] = $time;
     // Get and slightly format backtrace
     $dbgInfo['trace'] = debug_backtrace();
     foreach ($dbgInfo['trace'] as $key => $step) {
         if (isset($step['file'])) {
             $dbgInfo['trace'][$key]['file'] = Error::relPath($step['file']);
         }
     }
     $dbgInfo['hash'] = md5($query);
     $_SESSION['debug']['queries'][] = $dbgInfo;
 }
Exemplo n.º 2
0
 /**
  * Error handler to catch fatal errors when loading configuration
  * file
  *
  *
  * PMA_Config_fatalErrorHandler
  * @return void
  */
 public static function fatalErrorHandler()
 {
     if (!isset($GLOBALS['pma_config_loading']) || !$GLOBALS['pma_config_loading']) {
         return;
     }
     $error = error_get_last();
     if ($error === null) {
         return;
     }
     PMA_fatalError(sprintf('Failed to load phpMyAdmin configuration (%s:%s): %s', Error::relPath($error['file']), $error['line'], $error['message']));
 }
Exemplo n.º 3
0
 /**
  * Get a single function argument
  *
  * if $function is one of include/require
  * the $arg is converted to a relative path
  *
  * @param string $arg      argument to process
  * @param string $function function name
  *
  * @return string
  */
 public static function getArg($arg, $function)
 {
     $retval = '';
     $include_functions = array('include', 'include_once', 'require', 'require_once');
     $connect_functions = array('mysql_connect', 'mysql_pconnect', 'mysqli_connect', 'mysqli_real_connect', 'connect', '_realConnect');
     if (in_array($function, $include_functions)) {
         $retval .= Error::relPath($arg);
     } elseif (in_array($function, $connect_functions) && getType($arg) === 'string') {
         $retval .= getType($arg) . ' ********';
     } elseif (is_scalar($arg)) {
         $retval .= getType($arg) . ' ' . htmlspecialchars(var_export($arg, true));
     } else {
         $retval .= getType($arg);
     }
     return $retval;
 }
 /**
  * display HTML header
  *
  * @param Error $error the error
  *
  * @return void
  */
 protected function dispPageStart($error = null)
 {
     Response::getInstance()->disable();
     echo '<html><head><title>';
     if ($error) {
         echo $error->getTitle();
     } else {
         echo 'phpMyAdmin error reporting page';
     }
     echo '</title></head>';
 }
 /**
  * Stores query data into session data for debugging purposes
  *
  * @param string         $query  Query text
  * @param object         $link   database link
  * @param object|boolean $result Query result
  * @param integer        $time   Time to execute query
  *
  * @return void
  */
 private function _dbgQuery($query, $link, $result, $time)
 {
     $dbgInfo = array();
     $error_message = $this->getError($link);
     if ($result == false && is_string($error_message)) {
         $dbgInfo['error'] = '<span style="color:red">' . htmlspecialchars($error_message) . '</span>';
     }
     $dbgInfo['query'] = htmlspecialchars($query);
     $dbgInfo['time'] = $time;
     // Get and slightly format backtrace, this is used
     // in the javascript console.
     // Strip call to _dbgQuery
     $dbgInfo['trace'] = Error::processBacktrace(array_slice(debug_backtrace(), 1));
     $dbgInfo['hash'] = md5($query);
     $_SESSION['debug']['queries'][] = $dbgInfo;
 }