get rid of propicon
This commit is contained in:
@@ -81,7 +81,7 @@ class PMA_Config
|
||||
*/
|
||||
function checkSystem()
|
||||
{
|
||||
$this->set('PMA_VERSION', '2.10.0-dev');
|
||||
$this->set('PMA_VERSION', '2.11.0-dev');
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
2493
libraries/PMA_Sql.class.php
Normal file
2493
libraries/PMA_Sql.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,73 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
/**
|
||||
* hold PMA_Theme class
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* handles theme
|
||||
*
|
||||
* @todo add the possibility to make a theme depends on another theme and by default on orignal
|
||||
* @todo make all components optional - taking missing compnents from 'parent' theme
|
||||
* @todo make css optionaly replacing 'parent' css or extending it (by appending at the end)
|
||||
* @todo add an optional global css file - which will be used for both frames
|
||||
*
|
||||
*/
|
||||
class PMA_Theme {
|
||||
/**
|
||||
* @var string version
|
||||
* @var string theme version
|
||||
* @access protected
|
||||
*/
|
||||
var $version = '0.0.0.0';
|
||||
|
||||
/**
|
||||
* @var string name
|
||||
* @var string theme name
|
||||
* @access protected
|
||||
*/
|
||||
var $name = '';
|
||||
|
||||
/**
|
||||
* @var string id
|
||||
* @var string theme id
|
||||
* @access protected
|
||||
*/
|
||||
var $id = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var string theme path
|
||||
* @access protected
|
||||
*/
|
||||
var $path = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var string image path
|
||||
* @access protected
|
||||
*/
|
||||
var $img_path = '';
|
||||
|
||||
/**
|
||||
* @var array valid css types
|
||||
* @access protected
|
||||
*/
|
||||
var $types = array('left', 'right', 'print');
|
||||
|
||||
/**
|
||||
* @var integer last modification time for info file
|
||||
* @access protected
|
||||
*/
|
||||
var $mtime_info = 0;
|
||||
|
||||
function __wakeup()
|
||||
{
|
||||
$this->loadInfo();
|
||||
$this->checkImgPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @uses PMA_Theme::getPath()
|
||||
* @uses PMA_Theme::$mtime_info
|
||||
* @uses PMA_Theme::setVersion()
|
||||
* @uses PMA_Theme::setName()
|
||||
* @uses filemtime()
|
||||
* @uses file_exists()
|
||||
* @return boolean whether loading them info was successful or not
|
||||
*/
|
||||
function loadInfo()
|
||||
{
|
||||
if (! file_exists($this->getPath() . '/info.inc.php')) {
|
||||
@@ -78,12 +102,16 @@ class PMA_Theme {
|
||||
* or false if theme is invalid
|
||||
*
|
||||
* @static
|
||||
* @param string path to theme
|
||||
* @access public
|
||||
* @uses PMA_Theme
|
||||
* @uses PMA_Theme::setPath()
|
||||
* @uses PMA_Theme::loadInfo()
|
||||
* @uses PMA_Theme::checkImgPath()
|
||||
* @param string $folder path to theme
|
||||
* @return object PMA_Theme
|
||||
*/
|
||||
function load($folder)
|
||||
{
|
||||
|
||||
$theme = new PMA_Theme();
|
||||
|
||||
$theme->setPath($folder);
|
||||
@@ -97,6 +125,19 @@ class PMA_Theme {
|
||||
return $theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks image path for existance - if not found use img from original theme
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::getPath()
|
||||
* @uses PMA_Theme::setImgPath()
|
||||
* @uses PMA_Theme::getName()
|
||||
* @uses $GLOBALS['cfg']['ThemePath']
|
||||
* @uses $GLOBALS['PMA_errors']
|
||||
* @uses $GLOBALS['strThemeNoValidImgPath']
|
||||
* @uses is_dir()
|
||||
* @uses sprintf()
|
||||
*/
|
||||
function checkImgPath()
|
||||
{
|
||||
if (is_dir($this->getPath() . '/img/')) {
|
||||
@@ -108,16 +149,20 @@ class PMA_Theme {
|
||||
} else {
|
||||
$GLOBALS['PMA_errors'][] =
|
||||
sprintf($GLOBALS['strThemeNoValidImgPath'], $this->getName());
|
||||
/*
|
||||
trigger_error(
|
||||
sprintf($GLOBALS['strThemeNoValidImgPath'], $this->getName()),
|
||||
E_USER_WARNING);
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns path to theme
|
||||
* @uses $this->$path as return value
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$path as return value
|
||||
* @return string $path path to theme
|
||||
*/
|
||||
function getPath()
|
||||
@@ -128,6 +173,8 @@ class PMA_Theme {
|
||||
/**
|
||||
* returns layout file
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::getPath()
|
||||
* @return string layout file
|
||||
*/
|
||||
function getLayoutFile()
|
||||
@@ -137,7 +184,9 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* set path to theme
|
||||
* @uses $this->$path to set it
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$path to set it
|
||||
* @param string $path path to theme
|
||||
*/
|
||||
function setPath($path)
|
||||
@@ -147,7 +196,9 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* sets version
|
||||
* @uses $this->version
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$version
|
||||
* @param string new version
|
||||
*/
|
||||
function setVersion($version)
|
||||
@@ -157,7 +208,9 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* returns version
|
||||
* @uses $this->version
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$version
|
||||
* @return string version
|
||||
*/
|
||||
function getVersion()
|
||||
@@ -169,8 +222,9 @@ class PMA_Theme {
|
||||
* checks theme version agaisnt $version
|
||||
* returns true if theme version is equal or higher to $version
|
||||
*
|
||||
* @access public
|
||||
* @uses version_compare()
|
||||
* @uses $this->getVersion()
|
||||
* @uses PMA_Theme::getVersion()
|
||||
* @param string $version version to compare to
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -181,6 +235,10 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* sets name
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$name to set it
|
||||
* @uses trim()
|
||||
* @param string $name new name
|
||||
*/
|
||||
function setName($name)
|
||||
@@ -190,6 +248,9 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* returns name
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$name as return value
|
||||
* @return string name
|
||||
*/
|
||||
function getName()
|
||||
@@ -199,6 +260,9 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* sets id
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$id to set it
|
||||
* @param string $id new id
|
||||
*/
|
||||
function setId($id)
|
||||
@@ -208,18 +272,31 @@ class PMA_Theme {
|
||||
|
||||
/**
|
||||
* returns id
|
||||
* @return string id
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_Theme::$id as return value
|
||||
* @return string id
|
||||
*/
|
||||
function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @uses PMA_Theme::$img_path to set it
|
||||
* @param string path to images for this theme
|
||||
*/
|
||||
function setImgPath($path)
|
||||
{
|
||||
$this->img_path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @uses PMA_Theme::$img_path as retunr value
|
||||
* @return string image path for this theme
|
||||
*/
|
||||
function getImgPath()
|
||||
{
|
||||
return $this->img_path;
|
||||
@@ -228,8 +305,9 @@ class PMA_Theme {
|
||||
/**
|
||||
* load css (send to stdout, normaly the browser)
|
||||
*
|
||||
* @uses $this->getPath()
|
||||
* @uses $this->types
|
||||
* @access public
|
||||
* @uses PMA_Theme::getPath()
|
||||
* @uses PMA_Theme::$types
|
||||
* @uses PMA_SQP_buildCssData()
|
||||
* @uses file_exists()
|
||||
* @uses in_array()
|
||||
@@ -267,10 +345,11 @@ class PMA_Theme {
|
||||
/**
|
||||
* prints out the preview for this theme
|
||||
*
|
||||
* @uses $this->getName()
|
||||
* @uses $this->getVersion()
|
||||
* @uses $this->getId()
|
||||
* @uses $this->getPath()
|
||||
* @access public
|
||||
* @uses PMA_Theme::getName()
|
||||
* @uses PMA_Theme::getVersion()
|
||||
* @uses PMA_Theme::getId()
|
||||
* @uses PMA_Theme::getPath()
|
||||
* @uses $GLOBALS['strThemeNoPreviewAvailable']
|
||||
* @uses $GLOBALS['strTakeIt']
|
||||
* @uses PMA_generate_common_url()
|
||||
@@ -303,5 +382,4 @@ class PMA_Theme {
|
||||
.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -41,7 +41,7 @@ function PMA_auth() {
|
||||
<body>
|
||||
<?php if (file_exists('./config.header.inc.php')) {
|
||||
require('./config.header.inc.php');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<br /><br />
|
||||
@@ -196,8 +196,7 @@ function PMA_auth_fails()
|
||||
{
|
||||
$error = PMA_DBI_getError();
|
||||
if ($error && $GLOBALS['errno'] != 1045) {
|
||||
PMA_sendHeaderLocation('error.php?error=' . urlencode($error));
|
||||
exit;
|
||||
PMA_fatalError($error);
|
||||
} else {
|
||||
PMA_auth();
|
||||
return true;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
function PMA_auth() {
|
||||
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
|
||||
PMA_sendHeaderLocation('error.php?error=' . urlencode('You must set SignonURL!'));
|
||||
PMA_fatalError('You must set SignonURL!');
|
||||
} elseif (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
|
||||
/* Perform logout to custom URL */
|
||||
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
|
||||
@@ -53,7 +53,7 @@ function PMA_auth() {
|
||||
function PMA_auth_check()
|
||||
{
|
||||
global $PHP_AUTH_USER, $PHP_AUTH_PW;
|
||||
|
||||
|
||||
/* Session name */
|
||||
$session_name = $GLOBALS['cfg']['Server']['SignonSession'];
|
||||
|
||||
@@ -68,7 +68,7 @@ function PMA_auth_check()
|
||||
session_write_close();
|
||||
|
||||
/* Load single signon session */
|
||||
session_name($session_name);
|
||||
session_name($session_name);
|
||||
session_id($_COOKIE[$session_name]);
|
||||
session_start();
|
||||
|
||||
@@ -104,7 +104,7 @@ function PMA_auth_check()
|
||||
session_start();
|
||||
|
||||
/* Restore our token */
|
||||
if (!empty($pma_token)) {
|
||||
if (!empty($pma_token)) {
|
||||
$_SESSION[' PMA_token '] = $pma_token;
|
||||
}
|
||||
}
|
||||
@@ -154,8 +154,7 @@ function PMA_auth_fails()
|
||||
{
|
||||
$error = PMA_DBI_getError();
|
||||
if ($error && $GLOBALS['errno'] != 1045) {
|
||||
PMA_sendHeaderLocation('error.php?error=' . urlencode($error));
|
||||
exit;
|
||||
PMA_fatalError($error);
|
||||
} else {
|
||||
PMA_auth();
|
||||
return true;
|
||||
|
@@ -1,13 +1,11 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* Misc stuff and functions used by almost all the scripts.
|
||||
* Misc stuff and functions used by ALL the scripts.
|
||||
* MUST be included by every script
|
||||
*
|
||||
* Among other things, it contains the advanced authentication work.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Order of sections for common.lib.php:
|
||||
*
|
||||
* the include of libraries/defines_mysql.lib.php must be after the connection
|
||||
@@ -34,13 +32,14 @@
|
||||
* - authentication work
|
||||
* - load of the libraries/defines_mysql.lib.php library to get the MySQL
|
||||
* release number
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* For now, avoid warnings of E_STRICT mode
|
||||
* (this must be done before function definitions)
|
||||
*/
|
||||
|
||||
if (defined('E_STRICT')) {
|
||||
$old_error_reporting = error_reporting(0);
|
||||
if ($old_error_reporting & E_STRICT) {
|
||||
@@ -54,14 +53,12 @@ if (defined('E_STRICT')) {
|
||||
/**
|
||||
* Avoid object cloning errors
|
||||
*/
|
||||
|
||||
@ini_set('zend.ze1_compatibility_mode',false);
|
||||
@ini_set('zend.ze1_compatibility_mode', false);
|
||||
|
||||
/**
|
||||
* Avoid problems with magic_quotes_runtime
|
||||
*/
|
||||
|
||||
@ini_set('magic_quotes_runtime',false);
|
||||
@ini_set('magic_quotes_runtime', false);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -86,9 +83,78 @@ function PMA_securePath($path)
|
||||
return $path;
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* displays the given error message on phpMyAdmin error page in foreign language,
|
||||
* ends script execution and closes session
|
||||
*
|
||||
* @todo use detected argument separator (PMA_Config)
|
||||
* @uses $GLOBALS['session_name']
|
||||
* @uses $GLOBALS['text_dir']
|
||||
* @uses $GLOBALS['strError']
|
||||
* @uses $GLOBALS['available_languages']
|
||||
* @uses $GLOBALS['lang']
|
||||
* @uses PMA_removeCookie()
|
||||
* @uses select_lang.lib.php
|
||||
* @uses $_COOKIE
|
||||
* @uses substr()
|
||||
* @uses header()
|
||||
* @uses urlencode()
|
||||
* @param string $error_message the error message or named error message
|
||||
*/
|
||||
function PMA_fatalError($error_message, $message_args = null)
|
||||
{
|
||||
if (! isset($GLOBALS['available_languages'])) {
|
||||
$GLOBALS['cfg'] = array('DefaultLang' => 'en-iso-8859-1',
|
||||
'AllowAnywhereRecoding' => false);
|
||||
// Loads the language file
|
||||
require_once './libraries/select_lang.lib.php';
|
||||
if (isset($strError)) {
|
||||
$GLOBALS['strError'] = $strError;
|
||||
}
|
||||
if (isset($text_dir)) {
|
||||
$GLOBALS['text_dir'] = $text_dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (substr($error_message, 0, 3) === 'str') {
|
||||
if (isset($$error_message)) {
|
||||
$error_message = $$error_message;
|
||||
} elseif (isset($GLOBALS[$error_message])) {
|
||||
$error_message = $GLOBALS[$error_message];
|
||||
}
|
||||
}
|
||||
|
||||
if (is_string($message_args)) {
|
||||
$error_message = sprintf($error_message, $message_args);
|
||||
} elseif (is_array($message_args)) {
|
||||
$error_message = vsprintf($error_message, $message_args);
|
||||
}
|
||||
$error_message = strtr($error_message, array('<br />' => '[br]'));
|
||||
|
||||
// Displays the error message
|
||||
// (do not use & for parameters sent by header)
|
||||
header('Location: error.php'
|
||||
. '?lang=' . urlencode($GLOBALS['available_languages'][$GLOBALS['lang']][2])
|
||||
. '&dir=' . urlencode($GLOBALS['text_dir'])
|
||||
. '&type=' . urlencode($GLOBALS['strError'])
|
||||
. '&error=' . urlencode($error_message));
|
||||
|
||||
// on fatal errors it cannot hurt to always delete the current session
|
||||
if (isset($GLOBALS['session_name']) && isset($_COOKIE[$GLOBALS['session_name']])) {
|
||||
PMA_removeCookie($GLOBALS['session_name']);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns count of tables in given db
|
||||
*
|
||||
* @uses PMA_DBI_try_query()
|
||||
* @uses PMA_backquote()
|
||||
* @uses PMA_DBI_QUERY_STORE()
|
||||
* @uses PMA_DBI_num_rows()
|
||||
* @uses PMA_DBI_free_result()
|
||||
* @param string $db database to count tables for
|
||||
* @return integer count of tables in $db
|
||||
*/
|
||||
@@ -113,6 +179,9 @@ function PMA_getTableCount($db)
|
||||
* (renamed with PMA prefix to avoid double definition when embedded
|
||||
* in Moodle)
|
||||
*
|
||||
* @uses each()
|
||||
* @uses strlen()
|
||||
* @uses substr()
|
||||
* @param string $size
|
||||
* @return integer $size
|
||||
*/
|
||||
@@ -266,6 +335,9 @@ function PMA_array_merge_recursive()
|
||||
/**
|
||||
* calls $function vor every element in $array recursively
|
||||
*
|
||||
* @uses PMA_arrayWalkRecursive()
|
||||
* @uses is_array()
|
||||
* @uses is_string()
|
||||
* @param array $array array to walk
|
||||
* @param string $function function to call for every array element
|
||||
*/
|
||||
@@ -327,6 +399,11 @@ function PMA_checkPageValidity(&$page, $whitelist)
|
||||
* searchs in $_SERVER, $_ENV than trys getenv() and apache_getenv()
|
||||
* in this order
|
||||
*
|
||||
* @uses $_SERVER
|
||||
* @uses $_ENV
|
||||
* @uses getenv()
|
||||
* @uses function_exists()
|
||||
* @uses apache_getenv()
|
||||
* @param string $var_name variable name
|
||||
* @return string value of $var or empty string
|
||||
*/
|
||||
@@ -347,7 +424,7 @@ function PMA_getenv($var_name) {
|
||||
|
||||
/**
|
||||
* include here only libraries which contain only function definitions
|
||||
* no code im main()!
|
||||
* no code in main()!
|
||||
*/
|
||||
/**
|
||||
* Input sanitizing
|
||||
@@ -371,9 +448,13 @@ require_once './libraries/Config.class.php';
|
||||
require_once './libraries/Table.class.php';
|
||||
|
||||
|
||||
|
||||
if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
|
||||
/**
|
||||
* Java script escaping.
|
||||
*/
|
||||
require_once './libraries/js_escape.lib.php';
|
||||
|
||||
/**
|
||||
* string PMA_getIcon(string $icon)
|
||||
*
|
||||
@@ -395,6 +476,9 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Displays the maximum size for an upload
|
||||
*
|
||||
* @uses $GLOBALS['strMaximumSize']
|
||||
* @uses PMA_formatByteDown()
|
||||
* @uses sprintf()
|
||||
* @param integer the size
|
||||
*
|
||||
* @return string the message
|
||||
@@ -426,6 +510,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* Add slashes before "'" and "\" characters so a value containing them can
|
||||
* be used in a sql comparison.
|
||||
*
|
||||
* @uses str_replace()
|
||||
* @param string the string to slash
|
||||
* @param boolean whether the string will be used in a 'LIKE' clause
|
||||
* (it then requires two more escaped sequences) or not
|
||||
@@ -468,6 +553,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* database, table and field names.
|
||||
* Note: This function does not escape backslashes!
|
||||
*
|
||||
* @uses str_replace()
|
||||
* @param string the string to escape
|
||||
*
|
||||
* @return string the escaped string
|
||||
@@ -486,6 +572,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* removes slashes before "_" and "%" characters
|
||||
* Note: This function does not unescape backslashes!
|
||||
*
|
||||
* @uses str_replace()
|
||||
* @param string $name the string to escape
|
||||
* @return string the escaped string
|
||||
* @access public
|
||||
@@ -503,6 +590,8 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
*
|
||||
* checks if the sting is quoted and removes this quotes
|
||||
*
|
||||
* @uses str_replace()
|
||||
* @uses substr()
|
||||
* @param string $quoted_string string to remove quotes from
|
||||
* @param string $quote type of quote to remove
|
||||
* @return string unqoted string
|
||||
@@ -535,6 +624,11 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* format sql strings
|
||||
*
|
||||
* @todo move into PMA_Sql
|
||||
* @uses PMA_SQP_isError()
|
||||
* @uses PMA_SQP_formatHtml()
|
||||
* @uses PMA_SQP_formatNone()
|
||||
* @uses is_array()
|
||||
* @param mixed pre-parsed SQL structure
|
||||
*
|
||||
* @return string the formatted sql
|
||||
@@ -594,6 +688,17 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Displays a link to the official MySQL documentation
|
||||
*
|
||||
* @uses $cfg['MySQLManualType']
|
||||
* @uses $cfg['MySQLManualBase']
|
||||
* @uses $cfg['ReplaceHelpImg']
|
||||
* @uses $GLOBALS['mysql_4_1_doc_lang']
|
||||
* @uses $GLOBALS['mysql_5_1_doc_lang']
|
||||
* @uses $GLOBALS['mysql_5_0_doc_lang']
|
||||
* @uses $GLOBALS['strDocu']
|
||||
* @uses $GLOBALS['pmaThemeImage']
|
||||
* @uses PMA_MYSQL_INT_VERSION
|
||||
* @uses strtolower()
|
||||
* @uses str_replace()
|
||||
* @param string chapter of "HTML, one page per chapter" documentation
|
||||
* @param string contains name of page/anchor that is being linked
|
||||
* @param bool whether to use big icon (like in left frame)
|
||||
@@ -671,34 +776,71 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Displays a hint icon, on mouse over show the hint
|
||||
*
|
||||
* @uses $GLOBALS['pmaThemeImage']
|
||||
* @uses PMA_jsFormat()
|
||||
* @param string the error message
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_showHint($hint_message)
|
||||
{
|
||||
//return '<img class="lightbulb" src="' . $GLOBALS['pmaThemeImage'] . 'b_tipp.png" width="16" height="16" border="0" alt="' . $hint_message . '" title="' . $hint_message . '" align="middle" onclick="alert(\'' . PMA_jsFormat($hint_message, false) . '\');" />';
|
||||
return '<img class="lightbulb" src="' . $GLOBALS['pmaThemeImage'] . 'b_tipp.png" width="16" height="16" alt="Tip" title="Tip" onmouseover="pmaTooltip(\'' . PMA_jsFormat($hint_message, false) . '\'); return false;" onmouseout="swapTooltip(\'default\'); return false;" />';
|
||||
}
|
||||
function PMA_showHint($hint_message)
|
||||
{
|
||||
//return '<img class="lightbulb" src="' . $GLOBALS['pmaThemeImage'] . 'b_tipp.png" width="16" height="16" border="0" alt="' . $hint_message . '" title="' . $hint_message . '" align="middle" onclick="alert(\'' . PMA_jsFormat($hint_message, false) . '\');" />';
|
||||
return '<img class="lightbulb" src="' . $GLOBALS['pmaThemeImage']
|
||||
. 'b_tipp.png" width="16" height="16" alt="Tip" title="Tip" onmouseover="pmaTooltip(\''
|
||||
. PMA_jsFormat($hint_message, false) . '\'); return false;" onmouseout="swapTooltip(\'default\'); return false;" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a MySQL error message in the right frame.
|
||||
*
|
||||
* @uses footer.inc.php
|
||||
* @uses header.inc.php
|
||||
* @uses $GLOBALS['sql_query']
|
||||
* @uses $GLOBALS['strError']
|
||||
* @uses $GLOBALS['strSQLQuery']
|
||||
* @uses $GLOBALS['pmaThemeImage']
|
||||
* @uses $GLOBALS['strEdit']
|
||||
* @uses $GLOBALS['strMySQLSaid']
|
||||
* @uses $cfg['PropertiesIconic']
|
||||
* @uses PMA_backquote()
|
||||
* @uses PMA_DBI_getError()
|
||||
* @uses PMA_formatSql()
|
||||
* @uses PMA_generate_common_hidden_inputs()
|
||||
* @uses PMA_generate_common_url()
|
||||
* @uses PMA_showMySQLDocu()
|
||||
* @uses PMA_sqlAddslashes()
|
||||
* @uses PMA_SQP_isError()
|
||||
* @uses PMA_SQP_parse()
|
||||
* @uses PMA_SQP_getErrorString()
|
||||
* @uses strtolower()
|
||||
* @uses urlencode()
|
||||
* @uses str_replace()
|
||||
* @uses nl2br()
|
||||
* @uses substr()
|
||||
* @uses preg_replace()
|
||||
* @uses preg_match()
|
||||
* @uses explode()
|
||||
* @uses implode()
|
||||
* @uses is_array()
|
||||
* @uses function_exists()
|
||||
* @uses htmlspecialchars()
|
||||
* @uses trim()
|
||||
* @uses strstr()
|
||||
* @param string the error message
|
||||
* @param string the sql query that failed
|
||||
* @param boolean whether to show a "modify" link or not
|
||||
* @param string the "back" link url (full path is not required)
|
||||
* @param boolean EXIT the page?
|
||||
*
|
||||
* @global array the configuration array
|
||||
* @global string the curent table
|
||||
* @global string the current db
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_mysqlDie($error_message = '', $the_query = '',
|
||||
$is_modify_link = true, $back_url = '',
|
||||
$exit = true)
|
||||
$is_modify_link = true, $back_url = '', $exit = true)
|
||||
{
|
||||
global $cfg, $table, $db, $sql_query;
|
||||
global $table, $db;
|
||||
|
||||
/**
|
||||
* start http output, display html headers
|
||||
@@ -839,7 +981,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
unset($error_table, $error_fields, $duplicate_value);
|
||||
|
||||
echo ' <form method="post" action="import.php" style="padding: 0; margin: 0">' ."\n"
|
||||
.' <input type="hidden" name="sql_query" value="' . htmlentities($sql) . '" />' . "\n"
|
||||
.' <input type="hidden" name="sql_query" value="' . htmlspecialchars($sql) . '" />' . "\n"
|
||||
.' ' . PMA_generate_common_hidden_inputs($db, $table) . "\n"
|
||||
.' <input type="submit" name="submit" value="' . $GLOBALS['strBrowse'] . '" />' . "\n"
|
||||
.' </form>' . "\n";
|
||||
@@ -867,6 +1009,9 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* Returns a string formatted with CONVERT ... USING
|
||||
* if MySQL supports it
|
||||
*
|
||||
* @uses PMA_MYSQL_INT_VERSION
|
||||
* @uses $GLOBALS['collation_connection']
|
||||
* @uses explode()
|
||||
* @param string the string itself
|
||||
* @param string the mode: quoted or unquoted (this one by default)
|
||||
*
|
||||
@@ -894,6 +1039,19 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Send HTTP header, taking IIS limits into account (600 seems ok)
|
||||
*
|
||||
* @uses PMA_IS_IIS
|
||||
* @uses PMA_COMING_FROM_COOKIE_LOGIN
|
||||
* @uses PMA_get_arg_separator()
|
||||
* @uses SID
|
||||
* @uses strlen()
|
||||
* @uses strpos()
|
||||
* @uses header()
|
||||
* @uses session_write_close()
|
||||
* @uses headers_sent()
|
||||
* @uses function_exists()
|
||||
* @uses debug_print_backtrace()
|
||||
* @uses trigger_error()
|
||||
* @uses defined()
|
||||
* @param string $uri the header to send
|
||||
* @return boolean always true
|
||||
*/
|
||||
@@ -951,10 +1109,10 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* returns array with tables of given db with extended infomation and grouped
|
||||
*
|
||||
* @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
|
||||
* @uses $GLOBALS['cfg']['LeftFrameTableLevel']
|
||||
* @uses $GLOBALS['cfg']['ShowTooltipAliasTB']
|
||||
* @uses $GLOBALS['cfg']['NaturalOrder']
|
||||
* @uses $cfg['LeftFrameTableSeparator']
|
||||
* @uses $cfg['LeftFrameTableLevel']
|
||||
* @uses $cfg['ShowTooltipAliasTB']
|
||||
* @uses $cfg['NaturalOrder']
|
||||
* @uses PMA_backquote()
|
||||
* @uses count()
|
||||
* @uses array_merge
|
||||
@@ -1072,10 +1230,16 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* Adds backquotes on both sides of a database, table or field name.
|
||||
* and escapes backquotes inside the name with another backquote
|
||||
*
|
||||
* example:
|
||||
* <code>
|
||||
* echo PMA_backquote('owner`s db'); // `owner``s db`
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @uses PMA_backquote()
|
||||
* @uses is_array()
|
||||
* @uses strlen()
|
||||
* @uses str_replace()
|
||||
* @param mixed $a_name the database, table or field name to "backquote"
|
||||
* or array of it
|
||||
* @param boolean $do_it a flag to bypass this function (used by dump
|
||||
@@ -1100,7 +1264,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
}
|
||||
|
||||
// '0' is also empty for php :-(
|
||||
if (strlen($a_name) && $a_name != '*') {
|
||||
if (strlen($a_name) && $a_name !== '*') {
|
||||
return '`' . str_replace('`', '``', $a_name) . '`';
|
||||
} else {
|
||||
return $a_name;
|
||||
@@ -1108,60 +1272,10 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
} // end of the 'PMA_backquote()' function
|
||||
|
||||
|
||||
/**
|
||||
* Format a string so it can be a string inside JavaScript code inside an
|
||||
* eventhandler (onclick, onchange, on..., ).
|
||||
* This function is used to displays a javascript confirmation box for
|
||||
* "DROP/DELETE/ALTER" queries.
|
||||
*
|
||||
* @uses PMA_escapeJsString()
|
||||
* @uses PMA_backquote()
|
||||
* @uses is_string()
|
||||
* @uses htmlspecialchars()
|
||||
* @uses str_replace()
|
||||
* @param string $a_string the string to format
|
||||
* @param boolean $add_backquotes whether to add backquotes to the string or not
|
||||
*
|
||||
* @return string the formatted string
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_jsFormat($a_string = '', $add_backquotes = true)
|
||||
{
|
||||
if (is_string($a_string)) {
|
||||
$a_string = htmlspecialchars($a_string);
|
||||
$a_string = PMA_escapeJsString($a_string);
|
||||
/**
|
||||
* @todo what is this good for?
|
||||
*/
|
||||
$a_string = str_replace('#', '\\#', $a_string);
|
||||
}
|
||||
|
||||
return (($add_backquotes) ? PMA_backquote($a_string) : $a_string);
|
||||
} // end of the 'PMA_jsFormat()' function
|
||||
|
||||
/**
|
||||
* escapes a string to be inserted as string a JavaScript block
|
||||
* enclosed by <![CDATA[ ... ]]>
|
||||
* this requires only to escape ' with \' and end of script block
|
||||
*
|
||||
* @uses strtr()
|
||||
* @param string $string the string to be escaped
|
||||
* @return string the escaped string
|
||||
*/
|
||||
function PMA_escapeJsString($string)
|
||||
{
|
||||
return strtr($string, array(
|
||||
'\\' => '\\\\',
|
||||
'\'' => '\\\'',
|
||||
"\n" => '\n',
|
||||
"\r" => '\r',
|
||||
'</script' => '</\' + \'script'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the <CR><LF> value depending on the user OS.
|
||||
*
|
||||
* @uses PMA_USR_OS
|
||||
* @return string the <CR><LF> value to use
|
||||
*
|
||||
* @access public
|
||||
@@ -1186,8 +1300,10 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Reloads navigation if needed.
|
||||
*
|
||||
* @global mixed configuration
|
||||
* @global bool whether to reload
|
||||
* @uses $GLOBALS['reload']
|
||||
* @uses $GLOBALS['db']
|
||||
* @uses PMA_generate_common_url()
|
||||
* @global array configuration
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@@ -1220,7 +1336,7 @@ if (typeof(window.parent) != 'undefined'
|
||||
* @param string $message the message to display
|
||||
* @param string $sql_query the query to display
|
||||
* @global array the configuration array
|
||||
* @uses $GLOBALS['cfg']
|
||||
* @uses $cfg
|
||||
* @access public
|
||||
*/
|
||||
function PMA_showMessage($message, $sql_query = null)
|
||||
@@ -1566,6 +1682,8 @@ if (typeof(window.parent) != 'undefined'
|
||||
* $comma is not substracted from the length
|
||||
* with a $length of 0 no truncation occurs, number is only formated
|
||||
* to the current locale
|
||||
*
|
||||
* examples:
|
||||
* <code>
|
||||
* echo PMA_formatNumber(123456789, 6); // 123,457 k
|
||||
* echo PMA_formatNumber(-123456789, 4, 2); // -123.46 M
|
||||
@@ -1573,6 +1691,7 @@ if (typeof(window.parent) != 'undefined'
|
||||
* echo PMA_formatNumber(0.003, 3, 3); // 0.003
|
||||
* echo PMA_formatNumber(0.00003, 3, 2); // 0.03 m
|
||||
* echo PMA_formatNumber(0, 6); // 0
|
||||
*
|
||||
* </code>
|
||||
* @param double $value the value to format
|
||||
* @param integer $length the max length
|
||||
@@ -1713,21 +1832,20 @@ if (typeof(window.parent) != 'undefined'
|
||||
* returns a tab for tabbed navigation.
|
||||
* If the variables $link and $args ar left empty, an inactive tab is created
|
||||
*
|
||||
* @uses $GLOBALS['strEmpty']
|
||||
* @uses $GLOBALS['strDrop']
|
||||
* @uses $GLOBALS['active_page']
|
||||
* @uses $GLOBALS['url_query']
|
||||
* @uses $cfg['MainPageIconic']
|
||||
* @uses $GLOBALS['pmaThemeImage']
|
||||
* @uses PMA_generate_common_url()
|
||||
* @uses E_USER_NOTICE
|
||||
* @uses htmlentities()
|
||||
* @uses urlencode()
|
||||
* @uses sprintf()
|
||||
* @uses trigger_error()
|
||||
* @uses array_merge()
|
||||
* basename()
|
||||
* $GLOBALS['strEmpty']
|
||||
* $GLOBALS['strDrop']
|
||||
* $GLOBALS['active_page']
|
||||
* $GLOBALS['PHP_SELF']
|
||||
* htmlentities()
|
||||
* PMA_generate_common_url()
|
||||
* $GLOBALS['url_query']
|
||||
* urlencode()
|
||||
* $GLOBALS['cfg']['MainPageIconic']
|
||||
* $GLOBALS['pmaThemeImage']
|
||||
* sprintf()
|
||||
* trigger_error()
|
||||
* E_USER_NOTICE
|
||||
* @uses basename()
|
||||
* @param array $tab array with all options
|
||||
* @return string html code for one tab, a link if valid otherwise a span
|
||||
* @access public
|
||||
@@ -1959,6 +2077,9 @@ if (typeof(window.parent) != 'undefined'
|
||||
/**
|
||||
* Returns a given timespan value in a readable format.
|
||||
*
|
||||
* @uses $GLOBALS['timespanfmt']
|
||||
* @uses sprintf()
|
||||
* @uses floor()
|
||||
* @param int the timespan
|
||||
*
|
||||
* @return string the formatted value
|
||||
@@ -1988,6 +2109,8 @@ if (typeof(window.parent) != 'undefined'
|
||||
* Fulfills todo-item
|
||||
* http://sf.net/tracker/?func=detail&aid=544361&group_id=23067&atid=377411
|
||||
*
|
||||
* @todo add a multibyte safe function PMA_STR_split()
|
||||
* @uses strlen
|
||||
* @param string The string
|
||||
* @param string The Separator (defaults to "<br />\n")
|
||||
*
|
||||
@@ -2036,6 +2159,11 @@ if (typeof(window.parent) != 'undefined'
|
||||
* Not sure we could use a strMissingParameter message here,
|
||||
* would have to check if the error message file is always available
|
||||
*
|
||||
* @todo localize error message
|
||||
* @todo use PMA_fatalError() if $die === true?
|
||||
* @uses PMA_getenv()
|
||||
* @uses header_meta_style.inc.php
|
||||
* basename
|
||||
* @param array The names of the parameters needed by the calling
|
||||
* script.
|
||||
* @param boolean Stop the execution?
|
||||
@@ -2050,13 +2178,13 @@ if (typeof(window.parent) != 'undefined'
|
||||
*/
|
||||
function PMA_checkParameters($params, $die = true, $request = true)
|
||||
{
|
||||
global $PHP_SELF, $checked_special;
|
||||
global $checked_special;
|
||||
|
||||
if (!isset($checked_special)) {
|
||||
$checked_special = false;
|
||||
}
|
||||
|
||||
$reported_script_name = basename($PHP_SELF);
|
||||
$reported_script_name = basename(PMA_getenv('PHP_SELF'));
|
||||
$found_error = false;
|
||||
$error_message = '';
|
||||
|
||||
@@ -2066,7 +2194,10 @@ if (typeof(window.parent) != 'undefined'
|
||||
}
|
||||
|
||||
if (!isset($GLOBALS[$param])) {
|
||||
$error_message .= $reported_script_name . ': Missing parameter: ' . $param . ' <a href="./Documentation.html#faqmissingparameters" target="documentation"> (FAQ 2.8)</a><br />';
|
||||
$error_message .= $reported_script_name
|
||||
. ': Missing parameter: ' . $param
|
||||
. ' <a href="./Documentation.html#faqmissingparameters"'
|
||||
. ' target="documentation"> (FAQ 2.8)</a><br />';
|
||||
$found_error = true;
|
||||
}
|
||||
}
|
||||
@@ -2201,6 +2332,9 @@ if (typeof(window.parent) != 'undefined'
|
||||
/**
|
||||
* Generate a button or image tag
|
||||
*
|
||||
* @uses PMA_USR_BROWSER_AGENT
|
||||
* @uses $GLOBALS['pmaThemeImage']
|
||||
* @uses $GLOBALS['cfg']['PropertiesIconic']
|
||||
* @param string name of button element
|
||||
* @param string class of button element
|
||||
* @param string name of image element
|
||||
@@ -2213,30 +2347,30 @@ if (typeof(window.parent) != 'undefined'
|
||||
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text,
|
||||
$image)
|
||||
{
|
||||
global $pmaThemeImage, $propicon;
|
||||
|
||||
/* Opera has trouble with <input type="image"> */
|
||||
/* IE has trouble with <button> */
|
||||
if (PMA_USR_BROWSER_AGENT != 'IE') {
|
||||
echo '<button class="' . $button_class . '" type="submit"'
|
||||
.' name="' . $button_name . '" value="' . $text . '"'
|
||||
.' title="' . $text . '">' . "\n"
|
||||
.'<img class="icon" src="' . $pmaThemeImage . $image . '"'
|
||||
.'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . $image . '"'
|
||||
.' title="' . $text . '" alt="' . $text . '" width="16"'
|
||||
.' height="16" />'
|
||||
.($propicon == 'both' ? ' ' . $text : '') . "\n"
|
||||
.($GLOBALS['cfg']['PropertiesIconic'] === 'both' ? ' ' . $text : '') . "\n"
|
||||
.'</button>' . "\n";
|
||||
} else {
|
||||
echo '<input type="image" name="' . $image_name . '" value="'
|
||||
. $text . '" title="' . $text . '" src="' . $pmaThemeImage
|
||||
. $text . '" title="' . $text . '" src="' . $GLOBALS['pmaThemeImage']
|
||||
. $image . '" />'
|
||||
. ($propicon == 'both' ? ' ' . $text : '') . "\n";
|
||||
. ($GLOBALS['cfg']['PropertiesIconic'] == 'both' ? ' ' . $text : '') . "\n";
|
||||
}
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* Generate a pagination selector for browsing resultsets
|
||||
*
|
||||
* @uses $GLOBALS['strPageNumber']
|
||||
* @uses range()
|
||||
* @param string URL for the JavaScript
|
||||
* @param string Number of rows in the pagination set
|
||||
* @param string current page number
|
||||
@@ -2332,26 +2466,40 @@ if (typeof(window.parent) != 'undefined'
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @todo add documentation
|
||||
* replaces %u in given path with current user name
|
||||
*
|
||||
* example:
|
||||
* <code>
|
||||
* $user_dir = PMA_userDir('/var/pma_tmp/%u/'); // '/var/pma_tmp/root/'
|
||||
*
|
||||
* </code>
|
||||
* @uses $cfg['Server']['user']
|
||||
* @uses substr()
|
||||
* @uses str_replace()
|
||||
* @param string $dir with wildcard for user
|
||||
* @return string per user directory
|
||||
*/
|
||||
function PMA_userDir($dir)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
// add trailing slash
|
||||
if (substr($dir, -1) != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
return str_replace('%u', $cfg['Server']['user'], $dir);
|
||||
return str_replace('%u', $GLOBALS['cfg']['Server']['user'], $dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns html code for db link to default db page
|
||||
*
|
||||
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
|
||||
* @uses $cfg['DefaultTabDatabase']
|
||||
* @uses $GLOBALS['db']
|
||||
* @uses $GLOBALS['strJumpToDB']
|
||||
* @uses PMA_generate_common_url()
|
||||
* @uses PMA_unescape_mysql_wildcards()
|
||||
* @uses strlen()
|
||||
* @uses sprintf()
|
||||
* @uses htmlspecialchars()
|
||||
* @param string $database
|
||||
* @return string html link to default db page
|
||||
*/
|
||||
@@ -2446,7 +2594,10 @@ if (typeof(window.parent) != 'undefined'
|
||||
* Displays a lightbulb hint explaining a known external bug
|
||||
* that affects a functionality
|
||||
*
|
||||
* @uses PMA_MYSQL_INT_VERSION
|
||||
* @uses $GLOBALS['strKnownExternalBug']
|
||||
* @uses PMA_showHint()
|
||||
* @uses sprintf()
|
||||
* @param string $functionality localized message explaining the func.
|
||||
* @param string $component 'mysql' (eventually, 'php')
|
||||
* @param string $minimum_version of this component
|
||||
@@ -2786,17 +2937,8 @@ if (empty($_SESSION['PMA_Config'])) {
|
||||
/**
|
||||
* We really need this one!
|
||||
*/
|
||||
if (!function_exists('preg_replace')) {
|
||||
header('Location: error.php'
|
||||
. '?lang=' . urlencode($available_languages[$lang][2])
|
||||
. '&dir=' . urlencode($text_dir)
|
||||
. '&type=' . urlencode($strError)
|
||||
. '&error=' . urlencode(
|
||||
strtr(sprintf($strCantLoad, 'pcre'),
|
||||
array('<br />' => '[br]')))
|
||||
. '&' . SID
|
||||
);
|
||||
exit();
|
||||
if (! function_exists('preg_replace')) {
|
||||
PMA_fatalError('strCantLoad', 'pcre');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3047,7 +3189,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
}
|
||||
$GLOBALS['url_params']['server'] = $GLOBALS['server'];
|
||||
|
||||
|
||||
if (! empty($cfg['Server'])) {
|
||||
|
||||
/**
|
||||
@@ -3063,17 +3204,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
|
||||
// to allow HTTP or http
|
||||
$cfg['Server']['auth_type'] = strtolower($cfg['Server']['auth_type']);
|
||||
if (!file_exists('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php')) {
|
||||
header('Location: error.php'
|
||||
. '?lang=' . urlencode($available_languages[$lang][2])
|
||||
. '&dir=' . urlencode($text_dir)
|
||||
. '&type=' . urlencode($strError)
|
||||
. '&error=' . urlencode(
|
||||
$strInvalidAuthMethod . ' '
|
||||
. $cfg['Server']['auth_type'])
|
||||
. '&' . SID
|
||||
);
|
||||
exit();
|
||||
if (! file_exists('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php')) {
|
||||
PMA_fatalError($strInvalidAuthMethod . ' ' . $cfg['Server']['auth_type']);
|
||||
}
|
||||
/**
|
||||
* the required auth type plugin
|
||||
@@ -3198,6 +3330,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
&& strpos(' ' . $lang, 'ja-')
|
||||
&& file_exists('./libraries/kanji-encoding.lib.php')) {
|
||||
require_once './libraries/kanji-encoding.lib.php';
|
||||
/**
|
||||
* enable multibyte string support
|
||||
*/
|
||||
define('PMA_MULTIBYTE_ENCODING', 1);
|
||||
} // end if
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -56,18 +56,11 @@ if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension'
|
||||
|
||||
if ( ! PMA_DBI_checkAndLoadMysqlExtension( $alternativ_extension ) ) {
|
||||
// if alternativ fails too ...
|
||||
header( 'Location: error.php'
|
||||
. '?lang=' . urlencode( $available_languages[$lang][2] )
|
||||
. '&dir=' . urlencode( $text_dir )
|
||||
. '&type=' . urlencode( $strError )
|
||||
. '&error=' . urlencode(
|
||||
sprintf( $GLOBALS['strCantLoad'],
|
||||
$GLOBALS['cfg']['Server']['extension'] )
|
||||
.' - [a@./Documentation.html#faqmysql@documentation]'
|
||||
.$GLOBALS['strDocu'] . '[/a]' )
|
||||
. '&' . SID
|
||||
);
|
||||
exit();
|
||||
PMA_fatalError(
|
||||
sprintf($GLOBALS['strCantLoad'],
|
||||
$GLOBALS['cfg']['Server']['extension'])
|
||||
. ' - [a@./Documentation.html#faqmysql@documentation]'
|
||||
. $GLOBALS['strDocu'] . '[/a]');
|
||||
}
|
||||
|
||||
$GLOBALS['cfg']['Server']['extension'] = $alternativ_extension;
|
||||
|
@@ -793,17 +793,15 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
}
|
||||
|
||||
// 2.1.4 Do define the sorting url
|
||||
if (!$is_in_sort) {
|
||||
if (! $is_in_sort) {
|
||||
// loic1: patch #455484 ("Smart" order)
|
||||
$GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
|
||||
if ($GLOBALS['cfg']['Order'] == 'SMART') {
|
||||
$GLOBALS['cfg']['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
|
||||
$GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
|
||||
if ($GLOBALS['cfg']['Order'] === 'SMART') {
|
||||
$sort_order .= (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
|
||||
} else {
|
||||
$sort_order .= $GLOBALS['cfg']['Order'];
|
||||
}
|
||||
$sort_order .= $GLOBALS['cfg']['Order'];
|
||||
$order_img = '';
|
||||
} elseif (preg_match('@[[:space:]]ASC$@i', $sort_expression)) {
|
||||
$sort_order .= ' DESC';
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
|
||||
} elseif (preg_match('@[[:space:]]DESC$@i', $sort_expression)) {
|
||||
$sort_order .= ' ASC';
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />';
|
||||
@@ -1720,9 +1718,11 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
// displayed
|
||||
$total = '';
|
||||
$is_display = PMA_setDisplayMode($the_disp_mode, $total);
|
||||
if ($total == '') {
|
||||
unset($total);
|
||||
}
|
||||
// what was this for?
|
||||
// $total can be 0 if $cfg['MaxExactCountViews'] = 0
|
||||
//if ($total == '') {
|
||||
// unset($total);
|
||||
//}
|
||||
|
||||
// 1.2 Defines offsets for the next and previous pages
|
||||
if ($is_display['nav_bar'] == '1') {
|
||||
@@ -2015,6 +2015,27 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
|
||||
($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_tblexport.png" height="16" width="16" alt="' . $GLOBALS['strExport'] . '" />' : '') . $GLOBALS['strExport'],
|
||||
'', true, true, '') . "\n";
|
||||
}
|
||||
|
||||
// CREATE VIEW
|
||||
/**
|
||||
*
|
||||
* @todo detect privileges to create a view
|
||||
* (but see 2006-01-19 note in display_create_table.lib.php,
|
||||
* I think we cannot detect db-specific privileges reliably)
|
||||
*/
|
||||
if (PMA_MYSQL_INT_VERSION >= 50000) {
|
||||
if (!$header_shown) {
|
||||
echo $header;
|
||||
$header_shown = TRUE;
|
||||
}
|
||||
echo ' <!-- Create View -->' . "\n";
|
||||
echo ' ' . "\n";
|
||||
echo PMA_linkOrButton(
|
||||
'view_create.php' . $url_query,
|
||||
($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_views.png" height="16" width="16" alt="CREATE VIEW" />' : '') . 'CREATE VIEW',
|
||||
'', true, true, '') . "\n";
|
||||
}
|
||||
|
||||
if ($header_shown) {
|
||||
echo '</fieldset><br />';
|
||||
}
|
||||
|
@@ -36,5 +36,5 @@ if ($GLOBALS['text_dir'] == 'ltr') {
|
||||
}
|
||||
?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/print.css?<?php echo PMA_generate_common_url(); ?>" media="print" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
|
||||
|
@@ -46,7 +46,7 @@ if ($text_dir == 'ltr') {
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
|
||||
<title><?php echo $strSQLResult; ?> - phpMyAdmin <?php echo PMA_VERSION ?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&js_frame=print&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&js_frame=print&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
@@ -176,9 +176,6 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
$sql_query_disabled = TRUE;
|
||||
}
|
||||
}
|
||||
if (! empty($sql_query)) {
|
||||
$sql_query = htmlspecialchars($sql_query);
|
||||
}
|
||||
}
|
||||
} // end do query (no skip)
|
||||
} // end buffer exists
|
||||
|
64
libraries/js_escape.lib.php
Normal file
64
libraries/js_escape.lib.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* $Id: common.lib.php 9832 2007-01-09 09:50:49Z nijel $ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* Javascript escaping functions.
|
||||
*
|
||||
* @author Michal Čihař <michal@cihar.com>
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Format a string so it can be a string inside JavaScript code inside an
|
||||
* eventhandler (onclick, onchange, on..., ).
|
||||
* This function is used to displays a javascript confirmation box for
|
||||
* "DROP/DELETE/ALTER" queries.
|
||||
*
|
||||
* @uses PMA_escapeJsString()
|
||||
* @uses PMA_backquote()
|
||||
* @uses is_string()
|
||||
* @uses htmlspecialchars()
|
||||
* @uses str_replace()
|
||||
* @param string $a_string the string to format
|
||||
* @param boolean $add_backquotes whether to add backquotes to the string or not
|
||||
*
|
||||
* @return string the formatted string
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_jsFormat($a_string = '', $add_backquotes = true)
|
||||
{
|
||||
if (is_string($a_string)) {
|
||||
$a_string = htmlspecialchars($a_string);
|
||||
$a_string = PMA_escapeJsString($a_string);
|
||||
/**
|
||||
* @todo what is this good for?
|
||||
*/
|
||||
$a_string = str_replace('#', '\\#', $a_string);
|
||||
}
|
||||
|
||||
return (($add_backquotes) ? PMA_backquote($a_string) : $a_string);
|
||||
} // end of the 'PMA_jsFormat()' function
|
||||
|
||||
/**
|
||||
* escapes a string to be inserted as string a JavaScript block
|
||||
* enclosed by <![CDATA[ ... ]]>
|
||||
* this requires only to escape ' with \' and end of script block
|
||||
*
|
||||
* @uses strtr()
|
||||
* @uses preg_replace()
|
||||
* @param string $string the string to be escaped
|
||||
* @return string the escaped string
|
||||
*/
|
||||
function PMA_escapeJsString($string)
|
||||
{
|
||||
return preg_replace('@</script@i', '</\' + \'script',
|
||||
strtr($string, array(
|
||||
'\\' => '\\\\',
|
||||
'\'' => '\\\'',
|
||||
"\n" => '\n',
|
||||
"\r" => '\r')));
|
||||
}
|
||||
|
||||
?>
|
@@ -25,8 +25,15 @@ if ( $GLOBALS['cfg']['LeftDisplayLogo'] ) {
|
||||
}
|
||||
|
||||
echo '<div id="pmalogo">' . "\n"
|
||||
.'<a href="' . $GLOBALS['cfg']['LeftLogoLink'] . '" target="_blank">'
|
||||
.$logo . '</a>' . "\n"
|
||||
.'<a href="' . $GLOBALS['cfg']['LeftLogoLink'];
|
||||
switch ($GLOBALS['cfg']['LeftLogoLinkWindow']) {
|
||||
case 'new':
|
||||
echo '" target="_blank"';
|
||||
break;
|
||||
case 'main':
|
||||
echo '?' . $query_url . '" target="frame_content"';
|
||||
}
|
||||
echo '>' . $logo . '</a>' . "\n"
|
||||
.'</div>' . "\n";
|
||||
} // end of display logo
|
||||
?>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* phpMyAdmin Language Loading File
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -152,42 +152,30 @@ function PMA_langDetect(&$str, $envType)
|
||||
} // end of the 'PMA_langDetect()' function
|
||||
|
||||
/**
|
||||
* @var string path to the translations directory
|
||||
* @global string path to the translations directory
|
||||
*/
|
||||
$lang_path = './lang/';
|
||||
$GLOBALS['lang_path'] = './lang/';
|
||||
|
||||
/**
|
||||
* first check for lang dir exists
|
||||
* @global string interface language
|
||||
*/
|
||||
if (! is_dir($lang_path)) {
|
||||
// language directory not found
|
||||
trigger_error('phpMyAdmin-ERROR: path not found: '
|
||||
. $lang_path . ', check your language directory.',
|
||||
E_USER_WARNING);
|
||||
// and tell the user
|
||||
PMA_sendHeaderLocation('error.php?error='
|
||||
. urlencode( 'path to languages is invalid: ' . $lang_path));
|
||||
// stop execution
|
||||
exit;
|
||||
}
|
||||
|
||||
$GLOBALS['lang'] = 'en-iso-8859-1';
|
||||
/**
|
||||
* @var string interface language
|
||||
* @global boolean wether loading lang from cfg failed
|
||||
*/
|
||||
$GLOBALS['lang'] = '';
|
||||
$GLOBALS['lang_failed_cfg'] = false;
|
||||
/**
|
||||
* @var boolean wether loading lang from cfg failed
|
||||
* @global boolean wether loading lang from cookie failed
|
||||
*/
|
||||
$lang_failed_cfg = false;
|
||||
$GLOBALS['lang_failed_cookie'] = false;
|
||||
/**
|
||||
* @var boolean wether loading lang from cookie failed
|
||||
* @global boolean wether loading lang from user request failed
|
||||
*/
|
||||
$lang_failed_cookie = false;
|
||||
$GLOBALS['lang_failed_request'] = false;
|
||||
/**
|
||||
* @var boolean wether loading lang from user request failed
|
||||
* @global string text direction ltr or rtl
|
||||
*/
|
||||
$lang_failed_request = false;
|
||||
|
||||
$GLOBALS['text_dir'] = 'ltr';
|
||||
|
||||
/**
|
||||
* All the supported languages have to be listed in the array below.
|
||||
@@ -222,7 +210,10 @@ $lang_failed_request = false;
|
||||
* For Russian, we put 1251 first, because MSIE does not accept 866
|
||||
* and users would not see anything.
|
||||
*/
|
||||
$available_languages = array(
|
||||
/**
|
||||
* @global array supported languages
|
||||
*/
|
||||
$GLOBALS['available_languages'] = array(
|
||||
'af-iso-8859-1' => array('af|afrikaans', 'afrikaans-iso-8859-1', 'af', ''),
|
||||
'af-utf-8' => array('af|afrikaans', 'afrikaans-utf-8', 'af', ''),
|
||||
'ar-win1256' => array('ar|arabic', 'arabic-windows-1256', 'ar', 'العربية'),
|
||||
@@ -346,29 +337,43 @@ $available_languages = array(
|
||||
// Language filtering support
|
||||
if (! empty($GLOBALS['cfg']['FilterLanguages'])) {
|
||||
$new_lang = array();
|
||||
foreach ($available_languages as $key => $val) {
|
||||
foreach ($GLOBALS['available_languages'] as $key => $val) {
|
||||
if (preg_match('@' . $GLOBALS['cfg']['FilterLanguages'] . '@', $key)) {
|
||||
$new_lang[$key] = $val;
|
||||
}
|
||||
}
|
||||
if (count($new_lang) > 0) {
|
||||
$available_languages = $new_lang;
|
||||
$GLOBALS['available_languages'] = $new_lang;
|
||||
}
|
||||
unset($key, $val, $new_lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* first check for lang dir exists
|
||||
*/
|
||||
if (! is_dir($GLOBALS['lang_path'])) {
|
||||
// language directory not found
|
||||
trigger_error('phpMyAdmin-ERROR: path not found: '
|
||||
. $GLOBALS['lang_path'] . ', check your language directory.',
|
||||
E_USER_WARNING);
|
||||
// and tell the user
|
||||
PMA_fatalError('path to languages is invalid: ' . $GLOBALS['lang_path']);
|
||||
}
|
||||
|
||||
/**
|
||||
* check for language files
|
||||
*/
|
||||
foreach ($available_languages as $each_lang_key => $each_lang) {
|
||||
if (! file_exists($lang_path . $each_lang[1] . '.inc.php')) {
|
||||
unset($available_languages[$each_lang_key]);
|
||||
foreach ($GLOBALS['available_languages'] as $each_lang_key => $each_lang) {
|
||||
if (! file_exists($GLOBALS['lang_path'] . $each_lang[1] . '.inc.php')) {
|
||||
unset($GLOBALS['available_languages'][$each_lang_key]);
|
||||
}
|
||||
}
|
||||
unset($each_lang_key, $each_lang);
|
||||
|
||||
// MySQL charsets map
|
||||
$mysql_charset_map = array(
|
||||
/**
|
||||
* @global array MySQL charsets map
|
||||
*/
|
||||
$GLOBALS['mysql_charset_map'] = array(
|
||||
'big5' => 'big5',
|
||||
'cp-866' => 'cp866',
|
||||
'euc-jp' => 'ujis',
|
||||
@@ -394,49 +399,51 @@ $mysql_charset_map = array(
|
||||
'windows-1257' => 'cp1257',
|
||||
);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Do the work!
|
||||
*/
|
||||
// Checks whether charset recoding should be allowed or not
|
||||
$allow_recoding = FALSE; // Default fallback value
|
||||
if (empty($convcharset)) {
|
||||
|
||||
/**
|
||||
* @global boolean whether charset recoding should be allowed or not
|
||||
*/
|
||||
$GLOBALS['allow_recoding'] = false;
|
||||
if (empty($GLOBALS['convcharset'])) {
|
||||
if (isset($_COOKIE['pma_charset'])) {
|
||||
$convcharset = $_COOKIE['pma_charset'];
|
||||
$GLOBALS['convcharset'] = $_COOKIE['pma_charset'];
|
||||
} else {
|
||||
$convcharset = $GLOBALS['cfg']['DefaultCharset'];
|
||||
$GLOBALS['convcharset'] = $GLOBALS['cfg']['DefaultCharset'];
|
||||
}
|
||||
}
|
||||
|
||||
if (! PMA_langCheck()) {
|
||||
// fallback language
|
||||
$fall_back_lang = 'en-utf-8'; $line = __LINE__;
|
||||
$fall_back_lang = 'en-utf-8';
|
||||
$line = __LINE__;
|
||||
if (! PMA_langSet($fall_back_lang)) {
|
||||
trigger_error('phpMyAdmin-ERROR: invalid lang code: '
|
||||
. __FILE__ . '#' . $line . ', check hard coded fall back language.',
|
||||
E_USER_WARNING);
|
||||
// stop execution
|
||||
// and tell the user that his choosen language is invalid
|
||||
PMA_sendHeaderLocation('error.php?error='
|
||||
. urlencode('Could not load any language, please check your language settings and folder'));
|
||||
exit;
|
||||
PMA_fatalError('Could not load any language, please check your language settings and folder.');
|
||||
}
|
||||
}
|
||||
|
||||
// Defines the associated filename and load the translation
|
||||
$lang_file = $lang_path . $available_languages[$GLOBALS['lang']][1] . '.inc.php';
|
||||
$lang_file = $GLOBALS['lang_path'] . $GLOBALS['available_languages'][$GLOBALS['lang']][1] . '.inc.php';
|
||||
require_once $lang_file;
|
||||
|
||||
// now, that we have loaded the language strings we can send the errors
|
||||
if ($lang_failed_cfg) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, htmlspecialchars($lang_failed_cfg));
|
||||
if ($GLOBALS['lang_failed_cfg']) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strLanguageUnknown'], htmlspecialchars($GLOBALS['lang_failed_cfg']));
|
||||
}
|
||||
if ($lang_failed_cookie) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, htmlspecialchars($lang_failed_cookie));
|
||||
if ($GLOBALS['lang_failed_cookie']) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strLanguageUnknown'], htmlspecialchars($GLOBALS['lang_failed_cookie']));
|
||||
}
|
||||
if ($lang_failed_request) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, htmlspecialchars($lang_failed_request));
|
||||
if ($GLOBALS['lang_failed_request']) {
|
||||
$GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strLanguageUnknown'], htmlspecialchars($GLOBALS['lang_failed_request']));
|
||||
}
|
||||
|
||||
unset($strLanguageFileNotFound, $line, $fall_back_lang,
|
||||
$lang_failed_cfg, $lang_failed_cookie, $lang_failed_request, $strLanguageUnknown);
|
||||
$GLOBALS['lang_failed_cfg'], $GLOBALS['lang_failed_cookie'], $GLOBALS['ang_failed_request'], $GLOBALS['strLanguageUnknown']);
|
||||
?>
|
||||
|
@@ -17,18 +17,7 @@
|
||||
// verify if PHP supports session, die if it does not
|
||||
|
||||
if (!@function_exists('session_name')) {
|
||||
$cfg = array('DefaultLang' => 'en-iso-8859-1',
|
||||
'AllowAnywhereRecoding' => false);
|
||||
// Loads the language file
|
||||
require_once('./libraries/select_lang.lib.php');
|
||||
// Displays the error message
|
||||
// (do not use & for parameters sent by header)
|
||||
header('Location: error.php'
|
||||
. '?lang=' . urlencode($available_languages[$lang][2])
|
||||
. '&dir=' . urlencode($text_dir)
|
||||
. '&type=' . urlencode($strError)
|
||||
. '&error=' . urlencode(sprintf($strCantLoad, 'session')));
|
||||
exit();
|
||||
PMA_fatalError('strCantLoad', 'session');
|
||||
} elseif (ini_get('session.auto_start') == true && session_name() != 'phpMyAdmin') {
|
||||
$_SESSION = array();
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
@@ -83,13 +72,32 @@ session_cache_limiter('private');
|
||||
|
||||
$session_name = 'phpMyAdmin';
|
||||
@session_name($session_name);
|
||||
// strictly, PHP 4 since 4.4.2 would not need a verification
|
||||
if (version_compare(PHP_VERSION, '5.1.2', 'lt')
|
||||
&& isset($_COOKIE[$session_name])
|
||||
// strictly, PHP 4 since 4.4.2 would not need a verification
|
||||
if (version_compare(PHP_VERSION, '5.1.2', 'lt')
|
||||
&& isset($_COOKIE[$session_name])
|
||||
&& eregi("\r|\n", $_COOKIE[$session_name])) {
|
||||
die('attacked');
|
||||
die('attacked');
|
||||
}
|
||||
|
||||
if (! isset($_COOKIE[$session_name])) {
|
||||
// on first start of session we will check for errors
|
||||
// f.e. session dir cannot be accessed - session file not created
|
||||
ob_start();
|
||||
$old_display_errors = ini_get('display_errors');
|
||||
$old_error_reporting = error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
$r = session_start();
|
||||
ini_set('display_errors', $old_display_errors);
|
||||
error_reporting($old_error_reporting);
|
||||
unset($old_display_errors, $old_error_reporting);
|
||||
$session_error = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if ($r !== true || ! empty($session_error)) {
|
||||
PMA_fatalError('strSessionStartupErrorGeneral');
|
||||
}
|
||||
} else {
|
||||
@session_start();
|
||||
}
|
||||
@session_start();
|
||||
|
||||
/**
|
||||
* Token which is used for authenticating access queries.
|
||||
|
@@ -719,7 +719,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_SQP_analyze(&$arr)
|
||||
function PMA_SQP_analyze($arr)
|
||||
{
|
||||
if ($arr == array()) {
|
||||
return array();
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
/**
|
||||
* f i e l d u p l o a d e d f r o m a f i l e
|
||||
*
|
||||
@@ -47,6 +48,7 @@
|
||||
* @uses PMA_checkParameters()
|
||||
* @uses PMA_sqlAddslashes()
|
||||
* @uses PMA_userDir()
|
||||
* @todo there are also file uploads in the import dialog - possible we can merge this
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -63,7 +65,6 @@ require_once './libraries/common.lib.php';
|
||||
$valid_file_was_uploaded = false;
|
||||
|
||||
// Check if a multi-edit row was found
|
||||
|
||||
$me_fields_upload =
|
||||
(isset($_FILES['fields_upload_' . $key]['tmp_name']['multi_edit'][$primary_key])
|
||||
? $_FILES['fields_upload_' . $key]['tmp_name']['multi_edit'][$primary_key]
|
||||
@@ -93,16 +94,18 @@ if ($me_fields_upload != 'none') {
|
||||
// before opening it. The FAQ 1.11 explains how to create the "./tmp"
|
||||
// directory - if needed
|
||||
if ('' != ini_get('open_basedir')) {
|
||||
$tmp_subdir = (PMA_IS_WINDOWS ? '.\\tmp\\' : './tmp/');
|
||||
$tmp_subdir = (PMA_IS_WINDOWS ? 'tmp' : 'tmp');
|
||||
|
||||
if (! is_dir($tmp_subdir)) {
|
||||
// try to create the tmp directory if not exists
|
||||
if (mkdir($tmp_subdir, 0777)) {
|
||||
if (@mkdir($tmp_subdir, 0777)) {
|
||||
chmod($tmp_subdir, 0777);
|
||||
}
|
||||
}
|
||||
|
||||
if (! is_writable($tmp_subdir)) {
|
||||
// cannot create directory or access, point user to FAQ 1.11
|
||||
$message .= $GLOBALS['strFieldInsertFromFileTempDirNotExists'] . '<br />';
|
||||
// if we cannot move the file don't change blob fields
|
||||
$file_to_insert = false;
|
||||
} else {
|
||||
@@ -148,7 +151,37 @@ if ($me_fields_upload != 'none') {
|
||||
}
|
||||
|
||||
unset($file_to_insert, $file_to_insert_size, $unlink);
|
||||
}
|
||||
} elseif (isset($_FILES['fields_upload_' . $key]['error']['multi_edit'][$primary_key])) {
|
||||
// check for file upload errors
|
||||
switch ($_FILES['fields_upload_' . $key]['error']['multi_edit'][$primary_key]) {
|
||||
// cybot_tm: 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:
|
||||
case 4: //UPLOAD_ERR_NO_FILE:
|
||||
break;
|
||||
case 1: //UPLOAD_ERR_INI_SIZE:
|
||||
$message .= $GLOBALS['strUploadErrorIniSize'] . '<br />';
|
||||
break;
|
||||
case 2: //UPLOAD_ERR_FORM_SIZE:
|
||||
$message .= $GLOBALS['strUploadErrorFormSize'] . '<br />';
|
||||
break;
|
||||
case 3: //UPLOAD_ERR_PARTIAL:
|
||||
$message .= $GLOBALS['strUploadErrorPartial'] . '<br />';
|
||||
break;
|
||||
case 6: //UPLOAD_ERR_NO_TMP_DIR:
|
||||
$message .= $GLOBALS['strUploadErrorNoTempDir'] . '<br />';
|
||||
break;
|
||||
case 7: //UPLOAD_ERR_CANT_WRITE:
|
||||
$message .= $GLOBALS['strUploadErrorCantWrite'] . '<br />';
|
||||
break;
|
||||
case 8: //UPLOAD_ERR_EXTENSION:
|
||||
$message .= $GLOBALS['strUploadErrorExtension'] . '<br />';
|
||||
break;
|
||||
default:
|
||||
$message .= $GLOBALS['strUploadErrorUnknown'] . '<br />';
|
||||
} // end switch
|
||||
} // end else
|
||||
|
||||
if (false === $valid_file_was_uploaded) {
|
||||
|
||||
|
Reference in New Issue
Block a user