本文整理汇总了PHP中PMA_Message::rawError方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Message::rawError方法的具体用法?PHP PMA_Message::rawError怎么用?PHP PMA_Message::rawError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Message
的用法示例。
在下文中一共展示了PMA_Message::rawError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_auth
//.........这里部分代码省略.........
if (top != self) {
//window.top.location.href=location;
}
//]]>
</script>
</head>
<body class="loginform">
<?php
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
}
?>
<div class="container">
<a href="http://www.phpmyadmin.net" target="_blank" class="logo"><?php
$logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';
if (@file_exists($logo_image)) {
echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />';
} else {
echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="phpMyAdmin" />';
}
?>
</a>
<h1>
<?php
echo sprintf($GLOBALS['strWelcome'], '<bdo dir="ltr" xml:lang="en">' . $page_title . '</bdo>');
?>
</h1>
<?php
// Show error message
if (!empty($conn_error)) {
PMA_Message::rawError($conn_error)->display();
}
// Displays the languages form
if (empty($GLOBALS['cfg']['Lang'])) {
require_once './libraries/display_select_lang.lib.php';
// use fieldset, don't show doc link
PMA_select_language(true, false);
}
?>
<br />
<!-- Login form -->
<form method="post" action="index.php" name="login_form"<?php
echo $autocomplete;
?>
target="_top" class="login">
<fieldset>
<legend>
<?php
echo $GLOBALS['strLogin'];
echo '<a href="./Documentation.html" target="documentation" ' . 'title="' . $GLOBALS['strPmaDocumentation'] . '">';
if ($GLOBALS['cfg']['ReplaceHelpImg']) {
echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strPmaDocumentation'] . '" />';
} else {
echo '(*)';
}
echo '</a>';
?>
</legend>
<?php
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
?>
<div class="item">
示例2: PMA_handleQueryExecuteError
/**
* Responds an error when an error happens when executing the query
*
* @param boolean $is_gotofile whether goto file or not
* @param String $error error after executing the query
* @param String $full_sql_query full sql query
*
* @return void
*/
function PMA_handleQueryExecuteError($is_gotofile, $error, $full_sql_query)
{
if ($is_gotofile) {
$message = PMA_Message::rawError($error);
$response = PMA_Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $message);
} else {
PMA_Util::mysqlDie($error, $full_sql_query, '', '');
}
exit;
}
示例3: PMA_addUserAndCreateDatabase
/**
* Prepares queries for adding users and
* also create database and return query and message
*
* @param boolean $_error whether user create or not
* @param string $real_sql_query SQL query for add a user
* @param string $sql_query SQL query to be displayed
* @param string $username username
* @param string $hostname host name
* @param string $dbname database name
*
* @return array $sql_query, $message
*/
function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, $username, $hostname, $dbname)
{
if ($_error || !empty($real_sql_query) && !$GLOBALS['dbi']->tryQuery($real_sql_query)) {
$_REQUEST['createdb-1'] = $_REQUEST['createdb-2'] = $_REQUEST['createdb-3'] = null;
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
} else {
$message = PMA_Message::success(__('You have added a new user.'));
}
if (isset($_REQUEST['createdb-1'])) {
// Create database with same name and grant all privileges
$q = 'CREATE DATABASE IF NOT EXISTS ' . PMA_Util::backquote(PMA_Util::sqlAddSlashes($username)) . ';';
$sql_query .= $q;
if (!$GLOBALS['dbi']->tryQuery($q)) {
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
}
/**
* Reload the navigation
*/
$GLOBALS['reload'] = true;
$GLOBALS['db'] = $username;
$q = 'GRANT ALL PRIVILEGES ON ' . PMA_Util::backquote(PMA_Util::escapeMysqlWildcards(PMA_Util::sqlAddSlashes($username))) . '.* TO \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!$GLOBALS['dbi']->tryQuery($q)) {
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
}
}
if (isset($_REQUEST['createdb-2'])) {
// Grant all privileges on wildcard name (username\_%)
$q = 'GRANT ALL PRIVILEGES ON ' . PMA_Util::backquote(PMA_Util::sqlAddSlashes($username) . '\\_%') . '.* TO \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!$GLOBALS['dbi']->tryQuery($q)) {
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
}
}
if (isset($_REQUEST['createdb-3'])) {
// Grant all privileges on the specified database to the new user
$q = 'GRANT ALL PRIVILEGES ON ' . PMA_Util::backquote(PMA_Util::sqlAddSlashes($dbname)) . '.* TO \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!$GLOBALS['dbi']->tryQuery($q)) {
$message = PMA_Message::rawError($GLOBALS['dbi']->getError());
}
}
return array($sql_query, $message);
}
示例4: PMA_deleteFromTrackingReportLog
/**
* Function to delete from a tracking report log
*
* @param array &$data tracked data
* @param string $which_log ddlog|dmlog
* @param string $type DDL|DML
* @param string $message success message
*
* @return string HTML for the message
*/
function PMA_deleteFromTrackingReportLog(&$data, $which_log, $type, $message)
{
$html = '';
$delete_id = $_REQUEST['delete_' . $which_log];
// Only in case of valid id
if ($delete_id == (int) $delete_id) {
unset($data[$which_log][$delete_id]);
$successfullyDeleted = PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], $type, $data[$which_log]);
if ($successfullyDeleted) {
$msg = PMA_Message::success($message);
} else {
$msg = PMA_Message::rawError(__('Query error'));
}
$html .= $msg->getDisplay();
}
return $html;
}
示例5: PMA_updateColumns
/**
* Update the table's structure based on $_REQUEST
*
* @param string $db database name
* @param string $table table name
*
* @return boolean $regenerate true if error occurred
*
*/
function PMA_updateColumns($db, $table)
{
$err_url = 'tbl_structure.php?' . PMA_URL_getCommon($db, $table);
$regenerate = false;
$field_cnt = count($_REQUEST['field_name']);
$key_fields = array();
$changes = array();
for ($i = 0; $i < $field_cnt; $i++) {
if (PMA_columnNeedsAlterTable($i)) {
$changes[] = 'CHANGE ' . PMA_Table::generateAlter(isset($_REQUEST['field_orig'][$i]) ? $_REQUEST['field_orig'][$i] : '', $_REQUEST['field_name'][$i], $_REQUEST['field_type'][$i], $_REQUEST['field_length'][$i], $_REQUEST['field_attribute'][$i], isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '', isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : 'NOT NULL', $_REQUEST['field_default_type'][$i], $_REQUEST['field_default_value'][$i], isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false, isset($_REQUEST['field_comments'][$i]) ? $_REQUEST['field_comments'][$i] : '', $key_fields, $i, isset($_REQUEST['field_move_to'][$i]) ? $_REQUEST['field_move_to'][$i] : '');
}
}
// end for
$response = PMA_Response::getInstance();
if (count($changes) > 0) {
// Builds the primary keys statements and updates the table
$key_query = '';
/**
* this is a little bit more complex
*
* @todo if someone selects A_I when altering a column we need to check:
* - no other column with A_I
* - the column has an index, if not create one
*
*/
// To allow replication, we first select the db to use
// and then run queries on this db.
if (!$GLOBALS['dbi']->selectDb($db)) {
PMA_Util::mysqlDie($GLOBALS['dbi']->getError(), 'USE ' . PMA_Util::backquote($db) . ';', '', $err_url);
}
$sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
$sql_query .= implode(', ', $changes) . $key_query;
$sql_query .= ';';
$result = $GLOBALS['dbi']->tryQuery($sql_query);
if ($result !== false) {
$message = PMA_Message::success(__('Table %1$s has been altered successfully.'));
$message->addParam($table);
$response->addHTML(PMA_Util::getMessage($message, $sql_query, 'success'));
} else {
// An error happened while inserting/updating a table definition
$response->isSuccess(false);
$response->addJSON('message', PMA_Message::rawError(__('Query error') . ':<br />' . $GLOBALS['dbi']->getError()));
$regenerate = true;
}
}
include_once 'libraries/transformations.lib.php';
// update field names in relation
if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) {
foreach ($_REQUEST['field_orig'] as $fieldindex => $fieldcontent) {
if ($_REQUEST['field_name'][$fieldindex] != $fieldcontent) {
PMA_REL_renameField($db, $table, $fieldcontent, $_REQUEST['field_name'][$fieldindex]);
}
}
}
// update mime types
if (isset($_REQUEST['field_mimetype']) && is_array($_REQUEST['field_mimetype']) && $GLOBALS['cfg']['BrowseMIME']) {
foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
if (isset($_REQUEST['field_name'][$fieldindex]) && strlen($_REQUEST['field_name'][$fieldindex])) {
PMA_setMIME($db, $table, $_REQUEST['field_name'][$fieldindex], $mimetype, $_REQUEST['field_transformation'][$fieldindex], $_REQUEST['field_transformation_options'][$fieldindex]);
}
}
}
return $regenerate;
}
示例6: array_intersect
if (!empty($_REQUEST['view']['column_names'])) {
$sql_query .= $sep . ' (' . $_REQUEST['view']['column_names'] . ')';
}
$sql_query .= $sep . ' AS ' . $_REQUEST['view']['as'];
if (isset($_REQUEST['view']['with'])) {
$options = array_intersect($_REQUEST['view']['with'], $view_with_options);
if (count($options)) {
$sql_query .= $sep . ' WITH ' . implode(' ', $options);
}
}
if (PMA_DBI_try_query($sql_query)) {
$message = PMA_Message::success();
require './' . $cfg['DefaultTabDatabase'];
exit;
} else {
$message = PMA_Message::rawError(PMA_DBI_getError());
}
}
// prefill values if not already filled from former submission
$view = array('or_replace' => '', 'algorithm' => '', 'name' => '', 'column_names' => '', 'as' => $sql_query, 'with' => array());
if (PMA_isValid($_REQUEST['view'], 'array')) {
$view = array_merge($view, $_REQUEST['view']);
}
/**
* Displays top menu links
* We use db links because a VIEW is not necessarily on a single table
*/
$num_tables = 0;
require_once './libraries/db_links.inc.php';
$url_params['db'] = $GLOBALS['db'];
$url_params['reload'] = 1;
示例7: open
/**
*
*/
function open()
{
if (!$this->_decompress) {
$this->_handle = @fopen($this->getName(), 'r');
}
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:
$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;
}
}
示例8: PMA_save_userprefs
/**
* Saves user preferences
*
* @uses $_SESSION['cache'][...]['userprefs']
* @uses $_SESSION['userconfig']
* @uses $GLOBALS['cfg']['ServerDefault']
* @uses $GLOBALS['controllink']
* @uses $GLOBALS['server']
* @uses ConfigFile::getConfigArray()
* @uses ConfigFile::getInstance()
* @uses PMA_backquote()
* @uses PMA_DBI_fetch_value
* @uses PMA_DBI_getError()
* @uses PMA_DBI_try_query()
* @uses PMA_Message::addMessage()
* @uses PMA_Message::error()
* @uses PMA_Message::rawError()
* @uses PMA_sqlAddslashes()
* @uses PMA_getRelationsParam()
* @param array $config_data
* @return true|PMA_Message
*/
function PMA_save_userprefs(array $config_array)
{
$cfgRelation = PMA_getRelationsParam();
$server = isset($GLOBALS['server']) ? $GLOBALS['server'] : $GLOBALS['cfg']['ServerDefault'];
$cache_key = 'server_' . $server;
if (!$cfgRelation['userconfigwork']) {
// no pmadb table, use session storage
$_SESSION['userconfig'] = array('db' => $config_array, 'ts' => time());
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
unset($_SESSION['cache'][$cache_key]['userprefs']);
}
return true;
}
// save configuration to pmadb
$query_table = PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['userconfig']);
$query = '
SELECT `username`
FROM ' . $query_table . '
WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\'';
$has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']);
$config_data = json_encode($config_array);
if ($has_config) {
$query = '
UPDATE ' . $query_table . '
SET `config_data` = \'' . PMA_sqlAddslashes($config_data) . '\'
WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\'';
} else {
$query = '
INSERT INTO ' . $query_table . ' (`username`, `config_data`)
VALUES (\'' . PMA_sqlAddslashes($cfgRelation['user']) . '\',
\'' . PMA_sqlAddslashes($config_data) . '\')';
}
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
unset($_SESSION['cache'][$cache_key]['userprefs']);
}
if (!PMA_DBI_try_query($query, $GLOBALS['controllink'])) {
$message = PMA_Message::error(__('Could not save configuration'));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
return $message;
}
return true;
}
示例9: testRawError
/**
* test rawError method
*
* @return void
*/
public function testRawError()
{
$this->object = new PMA_Message('', PMA_Message::ERROR);
$this->object->setMessage('test<&>');
$this->assertEquals($this->object, PMA_Message::rawError('test<&>'));
}
示例10: unset
$delete_id = $_REQUEST['delete_dmlog'];
// Only in case of valable id
if ($delete_id == (int)$delete_id) {
unset($data['dmlog'][$delete_id]);
$successfullyDeleted = PMA_Tracker::changeTrackingData(
$_REQUEST['db'], $_REQUEST['table'],
$_REQUEST['version'], 'DML', $data['dmlog']
);
if ($successfullyDeleted) {
$msg = PMA_Message::success(
__('Tracking data manipulation successfully deleted')
);
} else {
$msg = PMA_Message::rawError(__('Query error'));
}
$msg->display();
}
}
}
if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) {
echo '<h3>' . __('Tracking report')
. ' [<a href="tbl_tracking.php?' . $url_query . '">' . __('Close')
. '</a>]</h3>';
echo '<small>' . __('Tracking statements') . ' '
. htmlspecialchars($data['tracking']) . '</small><br/>';
echo '<br/>';
示例11: PMA_moveRepeatingGroup
/**
* move the repeating group of columns to a new table
*
* @param string $repeatingColumns comma separated list of repeating group columns
* @param string $primary_columns comma separated list of column in primary key
* of $table
* @param string $newTable name of the new table to be created
* @param string $newColumn name of the new column in the new table
* @param string $table current table
* @param string $db current database
*
* @return array
*/
function PMA_moveRepeatingGroup($repeatingColumns, $primary_columns, $newTable, $newColumn, $table, $db)
{
$repeatingColumnsArr = (array) PMA_Util::backquote(explode(', ', $repeatingColumns));
$primary_columns = implode(',', PMA_Util::backquote(explode(',', $primary_columns)));
$query1 = 'CREATE TABLE ' . PMA_Util::backquote($newTable);
$query2 = 'ALTER TABLE ' . PMA_Util::backquote($table);
$message = PMA_Message::success(sprintf(__('Selected repeating group has been moved to the table \'%s\''), htmlspecialchars($table)));
$first = true;
$error = false;
foreach ($repeatingColumnsArr as $repeatingColumn) {
if (!$first) {
$query1 .= ' UNION ';
}
$first = false;
$query1 .= ' SELECT ' . $primary_columns . ',' . $repeatingColumn . ' as ' . PMA_Util::backquote($newColumn) . ' FROM ' . PMA_Util::backquote($table);
$query2 .= ' DROP ' . $repeatingColumn . ',';
}
$query2 = trim($query2, ',');
$queries = array($query1, $query2);
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
foreach ($queries as $query) {
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
$message = PMA_Message::error(__('Error in processing!'));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError($GLOBALS['dbi']->getError($GLOBALS['userlink'])));
$error = true;
break;
}
}
return array('queryError' => $error, 'message' => $message);
}
示例12: saveUiPrefsToDb
/**
* Save this table's UI preferences into phpMyAdmin database.
*
* @return true|PMA_Message
*/
protected function saveUiPrefsToDb()
{
$cfgRelation = PMA_getRelationsParam();
$pma_table = PMA_Util::backquote($cfgRelation['db']) . "." . PMA_Util::backquote($cfgRelation['table_uiprefs']);
$secureDbName = PMA_Util::sqlAddSlashes($this->_db_name);
$username = $GLOBALS['cfg']['Server']['user'];
$sql_query = " REPLACE INTO " . $pma_table . " (username, db_name, table_name, prefs) VALUES ('" . $username . "', '" . $secureDbName . "', '" . PMA_Util::sqlAddSlashes($this->_name) . "', '" . PMA_Util::sqlAddSlashes(json_encode($this->uiprefs)) . "')";
$success = $this->_dbi->tryQuery($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(__('Could not save table UI preferences!'));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError($this->_dbi->getError($GLOBALS['controllink'])));
return $message;
}
// Remove some old rows in table_uiprefs if it exceeds the configured
// maximum rows
$sql_query = 'SELECT COUNT(*) FROM ' . $pma_table;
$rows_count = $this->_dbi->fetchValue($sql_query);
$max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs'];
if ($rows_count > $max_rows) {
$num_rows_to_delete = $rows_count - $max_rows;
$sql_query = ' DELETE FROM ' . $pma_table . ' ORDER BY last_update ASC' . ' LIMIT ' . $num_rows_to_delete;
$success = $this->_dbi->tryQuery($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(sprintf(__('Failed to cleanup table UI preferences (see ' . '$cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'), PMA_Util::showDocu('config', 'cfg_Servers_MaxTableUiprefs')));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError($this->_dbi->getError($GLOBALS['controllink'])));
return $message;
}
}
return true;
}
示例13: PMA_addUserAndCreateDatabase
/**
* Prepares queries for adding users and also create database and return query and message
*
* @param boolean $_error whether user create or not
* @param string $real_sql_query SQL query for add a user
* @param string $sql_query SQL query to be displayed
* @param string $username username
* @param string $hostname host name
*
* @return array $sql_query, $message
*/
function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, $username, $hostname)
{
$common_functions = PMA_CommonFunctions::getInstance();
if ($_error || !PMA_DBI_try_query($real_sql_query)) {
$_REQUEST['createdb-1'] = $_REQUEST['createdb-2'] = $_REQUEST['createdb-3'] = false;
$message = PMA_Message::rawError(PMA_DBI_getError());
} else {
$message = PMA_Message::success(__('You have added a new user.'));
}
if (isset($_REQUEST['createdb-1'])) {
// Create database with same name and grant all privileges
$q = 'CREATE DATABASE IF NOT EXISTS ' . $common_functions->backquote($common_functions->sqlAddSlashes($username)) . ';';
$sql_query .= $q;
if (!PMA_DBI_try_query($q)) {
$message = PMA_Message::rawError(PMA_DBI_getError());
}
/**
* If we are not in an Ajax request, we can't reload navigation now
*/
if ($GLOBALS['is_ajax_request'] != true) {
// this is needed in case tracking is on:
$GLOBALS['db'] = $username;
$GLOBALS['reload'] = true;
echo $common_functions->getReloadNavigationScript();
}
$q = 'GRANT ALL PRIVILEGES ON ' . $common_functions->backquote($common_functions->escapeMysqlWildcards($common_functions->sqlAddSlashes($username))) . '.* TO \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!PMA_DBI_try_query($q)) {
$message = PMA_Message::rawError(PMA_DBI_getError());
}
}
if (isset($_REQUEST['createdb-2'])) {
// Grant all privileges on wildcard name (username\_%)
$q = 'GRANT ALL PRIVILEGES ON ' . $common_functions->backquote($common_functions->sqlAddSlashes($username) . '\\_%') . '.* TO \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!PMA_DBI_try_query($q)) {
$message = PMA_Message::rawError(PMA_DBI_getError());
}
}
if (isset($_REQUEST['createdb-3'])) {
// Grant all privileges on the specified database to the new user
$q = 'GRANT ALL PRIVILEGES ON ' . $common_functions->backquote($common_functions->sqlAddSlashes($dbname)) . '.* TO \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';';
$sql_query .= $q;
if (!PMA_DBI_try_query($q)) {
$message = PMA_Message::rawError(PMA_DBI_getError());
}
}
return array($sql_query, $message);
}
示例14: PMA_auth
/**
* Displays authentication form
*
* this function MUST exit/quit the application
*
* @global string the last connection error
*
* @access public
*/
function PMA_auth()
{
global $conn_error;
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
exit;
}
/* No recall if blowfish secret is not configured as it would produce garbage */
if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) {
$default_user = $GLOBALS['PHP_AUTH_USER'];
$default_server = $GLOBALS['pma_auth_server'];
$autocomplete = '';
} else {
$default_user = '';
$default_server = '';
// skip the IE autocomplete feature.
$autocomplete = ' autocomplete="off"';
}
$cell_align = $GLOBALS['text_dir'] == 'ltr' ? 'left' : 'right';
// Defines the charset to be used
header('Content-Type: text/html; charset=utf-8');
/* HTML header; do not show here the PMA version to improve security */
$page_title = 'phpMyAdmin ';
include './libraries/header_meta_style.inc.php';
// if $page_title is set, this script uses it as the title:
include './libraries/header_scripts.inc.php';
?>
</head>
<body class="loginform">
<?php
if (file_exists(CUSTOM_HEADER_FILE)) {
include CUSTOM_HEADER_FILE;
}
?>
<div class="container">
<a href="<?php
echo PMA_linkURL('http://www.phpmyadmin.net/');
?>
" target="_blank" class="logo"><?php
$logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';
if (@file_exists($logo_image)) {
echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />';
} else {
echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="phpMyAdmin" />';
}
?>
</a>
<h1>
<?php
echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">' . $page_title . '</bdo>');
?>
</h1>
<?php
// Show error message
if (!empty($conn_error)) {
PMA_Message::rawError($conn_error)->display();
}
echo "<noscript>\n";
PMA_message::error(__("Javascript must be enabled past this point"))->display();
echo "</noscript>\n";
echo "<div class='hide js-show'>";
// Displays the languages form
if (empty($GLOBALS['cfg']['Lang'])) {
include_once './libraries/display_select_lang.lib.php';
// use fieldset, don't show doc link
PMA_select_language(true, false);
}
echo "</div>";
?>
<br />
<!-- Login form -->
<form method="post" action="index.php" name="login_form"<?php
echo $autocomplete;
?>
target="_top" class="login hide js-show">
<fieldset>
<legend>
<?php
echo __('Log in');
echo PMA_showDocu('');
?>
</legend>
<?php
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
?>
<div class="item">
//.........这里部分代码省略.........
示例15: PMA_handleRollbackRequest
/**
* Handles request for ROLLBACK.
*
* @param string $sql_query SQL query(s)
*
* @return void
*/
function PMA_handleRollbackRequest($sql_query)
{
$sql_delimiter = $_REQUEST['sql_delimiter'];
$queries = explode($sql_delimiter, $sql_query);
$error = false;
$error_msg = __('Only INSERT, UPDATE, DELETE and REPLACE ' . 'SQL queries containing transactional engine tables can be rolled back.');
foreach ($queries as $sql_query) {
if (empty($sql_query)) {
continue;
}
// Check each query for ROLLBACK support.
if (!PMA_checkIfRollbackPossible($sql_query)) {
$global_error = $GLOBALS['dbi']->getError();
if ($global_error) {
$error = $global_error;
} else {
$error = $error_msg;
}
break;
}
}
if ($error) {
unset($_REQUEST['rollback_query']);
$response = PMA_Response::getInstance();
$message = PMA_Message::rawError($error);
$response->addJSON('message', $message);
exit;
} else {
// If everything fine, START a transaction.
$GLOBALS['dbi']->query('START TRANSACTION');
}
}