); exit; } /** * Checks if the user is using "Change Login Information / Copy User" dialog * only to update the password */ if (isset($_REQUEST['change_copy']) && $username == $_REQUEST['old_username'] && $hostname == $_REQUEST['old_hostname'] ) { $response->addHTML( PMA\libraries\Message::error( __( "Username and hostname didn't change. " . "If you only want to change the password, " . "'Change password' tab should be used." ) )->getDisplay() ); $response->setRequestStatus(false); exit; } /** * Changes / copies a user, part I */ list($queries, $password) = PMA_getDataForChangeOrCopyUser(); /** * Adds a user
} $response = PMA\libraries\Response::getInstance(); $response->addJSON('ajax_reload', $ajax_reload); $response->addHTML($html_output); exit; } else { if ($result) { // Save a Bookmark with more than one queries (if Bookmark label given). if (!empty($_POST['bkm_label']) && !empty($import_text)) { $cfgBookmark = PMA_Bookmark_getParams(); PMA_storeTheQueryAsBookmark($db, $cfgBookmark['user'], $_REQUEST['sql_query'], $_POST['bkm_label'], isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null); } $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(true); $response->addJSON('message', PMA\libraries\Message::success($msg)); $response->addJSON('sql_query', PMA\libraries\Util::getMessage($msg, $sql_query, 'success')); } else { if ($result == false) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(false); $response->addJSON('message', PMA\libraries\Message::error($msg)); } else { $active_page = $goto; include '' . $goto; } } } // If there is request for ROLLBACK in the end. if (isset($_REQUEST['rollback_query'])) { $GLOBALS['dbi']->query('ROLLBACK'); }
require_once 'libraries/common.inc.php'; require_once 'libraries/server_users.lib.php'; require_once 'libraries/server_user_groups.lib.php'; PMA_getRelationsParam(); if (!$GLOBALS['cfgRelation']['menuswork']) { exit; } $response = PMA\libraries\Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_user_groups.js'); /** * Only allowed to superuser */ if (!$GLOBALS['is_superuser']) { $response->addHTML(PMA\libraries\Message::error(__('No Privileges'))->getDisplay()); exit; } $response->addHTML('<div>'); $response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_user_groups.php')); /** * Delete user group */ if (!empty($_REQUEST['deleteUserGroup'])) { PMA_deleteUserGroup($_REQUEST['userGroup']); } /** * Add a new user group */ if (!empty($_REQUEST['addUserGroupSubmit'])) { PMA_editUserGroup($_REQUEST['userGroup'], true);
if (empty($sql_query)) { $_message = PMA\libraries\Message::success(__('No change')); } else { $_message = $result ? PMA\libraries\Message::success() : PMA\libraries\Message::error(); } if (isset($GLOBALS['ajax_request']) && $GLOBALS['ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus($_message->isSuccess()); $response->addJSON('message', $_message); if (!empty($sql_query)) { $response->addJSON('sql_query', PMA\libraries\Util::getMessage(null, $sql_query)); } exit; } } else { $_message = $result ? PMA\libraries\Message::success($_message) : PMA\libraries\Message::error($_message); } if (!empty($warning_messages)) { $_message = new PMA\libraries\Message(); $_message->addMessages($warning_messages); $_message->isError(true); if (isset($GLOBALS['ajax_request']) && $GLOBALS['ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(false); $response->addJSON('message', $_message); if (!empty($sql_query)) { $response->addJSON('sql_query', PMA\libraries\Util::getMessage(null, $sql_query)); } exit; } unset($warning_messages);
if (in_array($_REQUEST['view']['with'], $view_with_options)) { $sql_query .= $sep . ' WITH ' . $_REQUEST['view']['with'] . ' CHECK OPTION'; } } if (!$GLOBALS['dbi']->tryQuery($sql_query)) { if (! isset($_REQUEST['ajax_dialog'])) { $message = PMA\libraries\Message::rawError($GLOBALS['dbi']->getError()); return; } $response->addJSON( 'message', PMA\libraries\Message::error( "<i>" . htmlspecialchars($sql_query) . "</i><br /><br />" . $GLOBALS['dbi']->getError() ) ); $response->setRequestStatus(false); exit; } // If different column names defined for VIEW $view_columns = array(); if (isset($_REQUEST['view']['column_names'])) { $view_columns = explode(',', $_REQUEST['view']['column_names']); } $column_map = $GLOBALS['dbi']->getColumnMapFromSql( $_REQUEST['view']['as'], $view_columns );
/** * Generate the message * * @return array error value and message */ function PMA_setChangePasswordMsg() { $error = false; $message = PMA\libraries\Message::success(__('The profile has been updated.')); if ($_REQUEST['nopass'] != '1') { if (empty($_REQUEST['pma_pw']) || empty($_REQUEST['pma_pw2'])) { $message = PMA\libraries\Message::error(__('The password is empty!')); $error = true; } elseif ($_REQUEST['pma_pw'] != $_REQUEST['pma_pw2']) { $message = PMA\libraries\Message::error(__('The passwords aren\'t the same!')); $error = true; } elseif (strlen($_REQUEST['pma_pw']) > 256) { $message = PMA_Message::error(__('Password is too long!')); $error = true; } } return array('error' => $error, 'msg' => $message); }
/* Message to show to the user */ if ($success) { if (isset($_REQUEST['automatic']) && $_REQUEST['automatic'] === "true" || $GLOBALS['cfg']['SendErrorReports'] == 'always') { $msg = __('An error has been detected and an error report has been ' . 'automatically submitted based on your settings.'); } else { $msg = __('Thank you for submitting this report.'); } } else { $msg = __('An error has been detected and an error report has been ' . 'generated but failed to be sent.') . ' ' . __('If you experience any ' . 'problems please submit a bug report manually.'); } $msg .= ' ' . __('You may want to refresh the page.'); /* Create message object */ if ($success) { $msg = PMA\libraries\Message::notice($msg); } else { $msg = PMA\libraries\Message::error($msg); } /* Add message to response */ if ($response->isAjax()) { if ($_REQUEST['exception_type'] == 'js') { $response->addJSON('message', $msg); } else { $response->addJSON('_errSubmitMsg', $msg); } } elseif ($_REQUEST['exception_type'] == 'php') { $jsCode = 'PMA_ajaxShowMessage("<div class=\\"error\\">' . $msg . '</div>", false);'; $response->getFooter()->getScripts()->addCode($jsCode); } if ($_REQUEST['exception_type'] == 'php') { // clear previous errors & save new ones. $GLOBALS['error_handler']->savePreviousErrors();
/** * testing add messages method * * @return void */ public function testAddMessages() { $messages = array(); $messages[] = "Test1"; $messages[] = new PMA\libraries\Message("PMA_Test2", PMA\libraries\Message::ERROR); $messages[] = "Test3"; $this->object->addMessages($messages, ''); $this->assertEquals(array(PMA\libraries\Message::rawNotice('Test1'), PMA\libraries\Message::error("PMA_Test2"), PMA\libraries\Message::rawNotice('Test3')), $this->object->getAddedMessages()); }
require_once 'libraries/replication.inc.php'; require_once 'libraries/replication_gui.lib.php'; /** * Does the common work */ $response = PMA\libraries\Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_privileges.js'); $scripts->addFile('replication.js'); /** * Checks if the user is allowed to do what he tries to... */ if (!$is_superuser) { $html = PMA_getHtmlForSubPageHeader('replication'); $html .= PMA\libraries\Message::error(__('No Privileges'))->getDisplay(); $response->addHTML($html); exit; } // change $GLOBALS['url_params'] with $_REQUEST['url_params'] // only if it is an array if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) { $GLOBALS['url_params'] = $_REQUEST['url_params']; } /** * Handling control requests */ PMA_handleControlRequest(); /** * start output */
/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * The navigation panel - displays server, db and table selection tree * * @package PhpMyAdmin-Navigation */ // Include common functionalities use PMA\libraries\config\PageSettings; use PMA\libraries\navigation\Navigation; require_once './libraries/common.inc.php'; // Also initialises the collapsible tree class $response = PMA\libraries\Response::getInstance(); $navigation = new Navigation(); if (!$response->isAjax()) { $response->addHTML(PMA\libraries\Message::error(__('Fatal error: The navigation can only be accessed via AJAX'))); exit; } if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) { $response->addJSON('message', PageSettings::getNaviSettings()); exit; } $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { if (isset($_REQUEST['hideNavItem'])) { if (!empty($_REQUEST['itemName']) && !empty($_REQUEST['itemType']) && !empty($_REQUEST['dbName'])) { $navigation->hideNavigationItem($_REQUEST['itemName'], $_REQUEST['itemType'], $_REQUEST['dbName'], !empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null); } exit; } if (isset($_REQUEST['unhideNavItem'])) {
$header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('export.js'); // $sub_part is used in PMA\libraries\Util::getDbInfo() to see if we are coming from // db_export.php, in which case we don't obey $cfg['MaxTableList'] $sub_part = '_export'; require_once 'libraries/db_common.inc.php'; $url_query .= '&goto=db_export.php'; list($tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : ''); /** * Displays the form */ $export_page_title = __('View dump (schema) of database'); // exit if no tables in db found if ($num_tables < 1) { PMA\libraries\Message::error(__('No tables found in database.'))->display(); exit; } // end if $multi_values = '<div class="export_table_list_container">'; if (isset($_GET['structure_or_data_forced'])) { $force_val = htmlspecialchars($_GET['structure_or_data_forced']); } else { $force_val = 0; } $multi_values .= '<input type="hidden" name="structure_or_data_forced" value="' . $force_val . '">'; $multi_values .= '<table class="export_table_select">' . '<thead><tr><th></th>' . '<th>' . __('Tables') . '</th>' . '<th class="export_structure">' . __('Structure') . '</th>' . '<th class="export_data">' . __('Data') . '</th>' . '</tr><tr>' . '<td></td>' . '<td class="export_table_name all">' . __('Select all') . '</td>' . '<td class="export_structure all">' . '<input type="checkbox" id="table_structure_all" /></td>' . '<td class="export_data all"><input type="checkbox" id="table_data_all" />' . '</td>' . '</tr></thead>' . '<tbody>'; $multi_values .= "\n"; // when called by libraries/mult_submits.inc.php if (!empty($_POST['selected_tbl']) && empty($table_select)) { $table_select = $_POST['selected_tbl'];
} if ($response->isAjax()) { $response->setRequestStatus($_message->isSuccess()); $response->addJSON('message', $_message); if (!empty($sql_query)) { $response->addJSON( 'sql_query', PMA\libraries\Util::getMessage(null, $sql_query) ); } exit; } } else { $_message = $result ? PMA\libraries\Message::success($_message) : PMA\libraries\Message::error($_message); } if (! empty($warning_messages)) { $_message = new PMA\libraries\Message; $_message->addMessagesString($warning_messages); $_message->isError(true); if ($response->isAjax()) { $response->setRequestStatus(false); $response->addJSON('message', $_message); if (!empty($sql_query)) { $response->addJSON( 'sql_query', PMA\libraries\Util::getMessage(null, $sql_query) ); } exit;
/** * Kills a selected process * on ajax request */ if ($response->isAjax() && !empty($_REQUEST['kill'])) { $kill = intval($_REQUEST['kill']); $query = $GLOBALS['dbi']->getKillQuery($kill); if ($GLOBALS['dbi']->tryQuery($query)) { $message = PMA\libraries\Message::success( __('Thread %s was successfully killed.') ); $response->setRequestStatus(true); } else { $message = PMA\libraries\Message::error( __( 'phpMyAdmin was unable to kill thread %s.' . ' It probably has already been closed.' ) ); $response->setRequestStatus(false); } $message->addParam($kill); $response->addJSON('message', $message); } elseif ($response->isAjax() && !empty($_REQUEST['refresh'])) { // Only sends the process list table $response->addHTML(PMA_getHtmlForServerProcessList()); } else { // Load the full page $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_status_processes.js'); $response->addHTML('<div>');
} // end if if ($reread_info) { // to avoid showing the old value (for example the AUTO_INCREMENT) after // a change, clear the cache $GLOBALS['dbi']->clearTableCache(); $page_checksum = $checksum = $delay_key_write = 0; include 'libraries/tbl_info.inc.php'; } unset($reread_info); if (isset($result) && empty($message_to_show)) { // set to success by default, because result set could be empty // (for example, a table rename) $_type = 'success'; if (empty($_message)) { $_message = $result ? PMA\libraries\Message::success(__('Your SQL query has been executed successfully.')) : PMA\libraries\Message::error(__('Error')); // $result should exist, regardless of $_message $_type = $result ? 'success' : 'error'; if (isset($GLOBALS['ajax_request']) && $GLOBALS['ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus($_message->isSuccess()); $response->addJSON('message', $_message); $response->addJSON('sql_query', PMA\libraries\Util::getMessage(null, $sql_query)); exit; } } if (!empty($warning_messages)) { $_message = new PMA\libraries\Message(); $_message->addMessages($warning_messages); $_message->isError(true); if ($GLOBALS['ajax_request'] == true) {
// if someday the RENAME DATABASE reappears, do not DROP $local_query = 'DROP DATABASE ' . PMA\libraries\Util::backquote($GLOBALS['db']) . ';'; $sql_query .= "\n" . $local_query; $GLOBALS['dbi']->query($local_query); $message = PMA\libraries\Message::success(__('Database %1$s has been renamed to %2$s.')); $message->addParam($GLOBALS['db']); $message->addParam($_REQUEST['newname']); } elseif (!$_error) { if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) { PMA_AdjustPrivileges_copyDB($GLOBALS['db'], $_REQUEST['newname']); } $message = PMA\libraries\Message::success(__('Database %1$s has been copied to %2$s.')); $message->addParam($GLOBALS['db']); $message->addParam($_REQUEST['newname']); } else { $message = PMA\libraries\Message::error(); } $reload = true; /* Change database to be used */ if (!$_error && $move) { $GLOBALS['db'] = $_REQUEST['newname']; } elseif (!$_error) { if (isset($_REQUEST['switch_to_new']) && $_REQUEST['switch_to_new'] == 'true') { $GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', 'true'); $GLOBALS['db'] = $_REQUEST['newname']; } else { $GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', ''); } } } /**
/** * Handles editor requests for adding or editing an item * * @return void */ function PMA_TRI_handleEditor() { global $_REQUEST, $_POST, $errors, $db, $table; if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) { $sql_query = ''; $item_query = PMA_TRI_getQueryFromRequest(); if (!count($errors)) { // set by PMA_RTN_getQueryFromRequest() // Execute the created query if (!empty($_REQUEST['editor_process_edit'])) { // Backup the old trigger, in case something goes wrong $trigger = PMA_TRI_getDataFromName($_REQUEST['item_original_name']); $create_item = $trigger['create']; $drop_item = $trigger['drop'] . ';'; $result = $GLOBALS['dbi']->tryQuery($drop_item); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_item)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); } else { $result = $GLOBALS['dbi']->tryQuery($item_query); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); // We dropped the old item, but were unable to create the // new one. Try to restore the backup query. $result = $GLOBALS['dbi']->tryQuery($create_item); $errors = checkResult($result, __('Sorry, we failed to restore the dropped trigger.'), $create_item, $errors); } else { $message = PMA\libraries\Message::success(__('Trigger %1$s has been modified.')); $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name'])); $sql_query = $drop_item . $item_query; } } } else { // 'Add a new item' mode $result = $GLOBALS['dbi']->tryQuery($item_query); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); } else { $message = PMA\libraries\Message::success(__('Trigger %1$s has been created.')); $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name'])); $sql_query = $item_query; } } } if (count($errors)) { $message = PMA\libraries\Message::error('<b>' . __('One or more errors have occurred while processing your request:') . '</b>'); $message->addHtml('<ul>'); foreach ($errors as $string) { $message->addHtml('<li>' . $string . '</li>'); } $message->addHtml('</ul>'); } $output = PMA\libraries\Util::getMessage($message, $sql_query); if ($GLOBALS['is_ajax_request']) { $response = PMA\libraries\Response::getInstance(); if ($message->isSuccess()) { $items = $GLOBALS['dbi']->getTriggers($db, $table, ''); $trigger = false; foreach ($items as $value) { if ($value['name'] == $_REQUEST['item_name']) { $trigger = $value; } } $insert = false; if (empty($table) || $trigger !== false && $table == $trigger['table']) { $insert = true; $response->addJSON('new_row', PMA_TRI_getRowForList($trigger)); $response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name']))); } $response->addJSON('insert', $insert); $response->addJSON('message', $output); } else { $response->addJSON('message', $message); $response->setRequestStatus(false); } exit; } } /** * Display a form used to add/edit a trigger, if necessary */ if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']))) { // Get the data for the form (if any) if (!empty($_REQUEST['add_item'])) { $title = PMA_RTE_getWord('add'); $item = PMA_TRI_getDataFromRequest(); $mode = 'add'; } else { if (!empty($_REQUEST['edit_item'])) { $title = __("Edit trigger"); if (!empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) { $item = PMA_TRI_getDataFromName($_REQUEST['item_name']); if ($item !== false) { $item['item_original_name'] = $item['item_name']; } } else { $item = PMA_TRI_getDataFromRequest(); } $mode = 'edit'; } } PMA_RTE_sendEditor('TRI', $mode, $item, $title, $db); } }
*/ list($username, $hostname, $dbname, $tablename, $routinename, $db_and_table, $dbname_is_wildcard) = PMA_getDataForDBInfo(); /** * Checks if the user is allowed to do what he tries to... */ if (!$GLOBALS['is_superuser'] && !$GLOBALS['is_grantuser'] && !$GLOBALS['is_createuser']) { $response->addHTML(PMA_getHtmlForSubPageHeader('privileges', '', false)); $response->addHTML(PMA\libraries\Message::error(__('No Privileges'))->getDisplay()); exit; } /** * Checks if the user is using "Change Login Information / Copy User" dialog * only to update the password */ if (isset($_REQUEST['change_copy']) && $username == $_REQUEST['old_username'] && $hostname == $_REQUEST['old_hostname']) { $response->addHTML(PMA\libraries\Message::error(__('Username and hostname didn\'t change.'))->getDisplay()); $response->setRequestStatus(false); exit; } /** * Changes / copies a user, part I */ list($queries, $password) = PMA_getDataForChangeOrCopyUser(); /** * Adds a user * (Changes / copies a user, part II) */ list($ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error) = PMA_addUser(isset($dbname) ? $dbname : null, isset($username) ? $username : null, isset($hostname) ? $hostname : null, isset($password) ? $password : null, $cfgRelation['menuswork']); //update the old variables if (isset($ret_queries)) { $queries = $ret_queries;
* Send headers depending on whether the user chose to download a dump file * or not */ if ($asfile) { // Download // (avoid rewriting data containing HTML with anchors and forms; // this was reported to happen under Plesk) @ini_set('url_rewriter.tags', ''); $filename = PMA_sanitizeFilename($filename); PMA_downloadHeader($filename, $mime_type); } else { // HTML if ($export_type == 'database') { $num_tables = count($tables); if ($num_tables == 0) { $message = PMA\libraries\Message::error(__('No tables found in database.')); $active_page = 'db_export.php'; include 'db_export.php'; exit; } } list($html, $back_button) = PMA_getHtmlForDisplayedExportHeader($export_type, $db, $table); echo $html; unset($html); } // end download } // Fake loop just to allow skip of remain of this code by break, I'd really // need exceptions here :-) do { // Re - initialize
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'])) { if (in_array($_REQUEST['view']['with'], $view_with_options)) { $sql_query .= $sep . ' WITH ' . $_REQUEST['view']['with'] . ' CHECK OPTION'; } } if (!$GLOBALS['dbi']->tryQuery($sql_query)) { if (!isset($_REQUEST['ajax_dialog'])) { $message = PMA\libraries\Message::rawError($GLOBALS['dbi']->getError()); return; } $response = PMA\libraries\Response::getInstance(); $response->addJSON('message', PMA\libraries\Message::error("<i>" . htmlspecialchars($sql_query) . "</i><br /><br />" . $GLOBALS['dbi']->getError())); $response->setRequestStatus(false); exit; } // If different column names defined for VIEW $view_columns = array(); if (isset($_REQUEST['view']['column_names'])) { $view_columns = explode(',', $_REQUEST['view']['column_names']); } $column_map = $GLOBALS['dbi']->getColumnMapFromSql($_REQUEST['view']['as'], $view_columns); $systemDb = $GLOBALS['dbi']->getSystemDatabase(); $pma_transformation_data = $systemDb->getExistingTransformationData($GLOBALS['db']); if ($pma_transformation_data !== false) { // SQL for store new transformation details of VIEW $new_transformations_sql = $systemDb->getNewTransformationDataSql($pma_transformation_data, $column_map, $_REQUEST['view']['name'], $GLOBALS['db']); // Store new transformations
/** * Handles editor requests for adding or editing an item * * @return void */ function PMA_EVN_handleEditor() { global $_REQUEST, $_POST, $errors, $db; if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) { $sql_query = ''; $item_query = PMA_EVN_getQueryFromRequest(); if (!count($errors)) { // set by PMA_RTN_getQueryFromRequest() // Execute the created query if (!empty($_REQUEST['editor_process_edit'])) { // Backup the old trigger, in case something goes wrong $create_item = $GLOBALS['dbi']->getDefinition($db, 'EVENT', $_REQUEST['item_original_name']); $drop_item = "DROP EVENT " . PMA\libraries\Util::backquote($_REQUEST['item_original_name']) . ";\n"; $result = $GLOBALS['dbi']->tryQuery($drop_item); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_item)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); } else { $result = $GLOBALS['dbi']->tryQuery($item_query); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); // We dropped the old item, but were unable to create // the new one. Try to restore the backup query $result = $GLOBALS['dbi']->tryQuery($create_item); $errors = checkResult($result, __('Sorry, we failed to restore the dropped event.'), $create_item, $errors); } else { $message = PMA\libraries\Message::success(__('Event %1$s has been modified.')); $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name'])); $sql_query = $drop_item . $item_query; } } } else { // 'Add a new item' mode $result = $GLOBALS['dbi']->tryQuery($item_query); if (!$result) { $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); } else { $message = PMA\libraries\Message::success(__('Event %1$s has been created.')); $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name'])); $sql_query = $item_query; } } } if (count($errors)) { $message = PMA\libraries\Message::error('<b>' . __('One or more errors have occurred while processing your request:') . '</b>'); $message->addString('<ul>'); foreach ($errors as $string) { $message->addString('<li>' . $string . '</li>'); } $message->addString('</ul>'); } $output = PMA\libraries\Util::getMessage($message, $sql_query); if ($GLOBALS['is_ajax_request']) { $response = PMA\libraries\Response::getInstance(); if ($message->isSuccess()) { $events = $GLOBALS['dbi']->getEvents($db, $_REQUEST['item_name']); $event = $events[0]; $response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name']))); $response->addJSON('new_row', PMA_EVN_getRowForList($event)); $response->addJSON('insert', !empty($event)); $response->addJSON('message', $output); } else { $response->setRequestStatus(false); $response->addJSON('message', $message); } exit; } } /** * Display a form used to add/edit a trigger, if necessary */ if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['item_changetype']))) { // FIXME: this must be simpler than that $operation = ''; if (!empty($_REQUEST['item_changetype'])) { $operation = 'change'; } // Get the data for the form (if any) if (!empty($_REQUEST['add_item'])) { $title = PMA_RTE_getWord('add'); $item = PMA_EVN_getDataFromRequest(); $mode = 'add'; } else { if (!empty($_REQUEST['edit_item'])) { $title = __("Edit event"); if (!empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit']) && empty($_REQUEST['item_changetype'])) { $item = PMA_EVN_getDataFromName($_REQUEST['item_name']); if ($item !== false) { $item['item_original_name'] = $item['item_name']; } } else { $item = PMA_EVN_getDataFromRequest(); } $mode = 'edit'; } } PMA_RTE_sendEditor('EVN', $mode, $item, $title, $db, $operation); } }
$currentSearchId = $savedSearch->getId(); } /** * A query has been submitted -> (maybe) execute it */ $message_to_display = false; if (isset($_REQUEST['submit_sql']) && !empty($sql_query)) { if (!preg_match('@^SELECT@i', $sql_query)) { $message_to_display = true; } else { $goto = 'db_sql.php'; PMA_executeQueryAndSendQueryResponse(null, false, $_REQUEST['db'], null, false, null, null, null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query, null, null); } } $sub_part = '_qbe'; require 'libraries/db_common.inc.php'; $url_query .= '&goto=db_qbe.php'; $url_params['goto'] = 'db_qbe.php'; list($tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos) = PMA\libraries\Util::getDbInfo($db, isset($sub_part) ? $sub_part : ''); if ($message_to_display) { PMA\libraries\Message::error(__('You have to choose at least one column to display!'))->display(); } unset($message_to_display); // create new qbe search instance $db_qbe = new PMA\libraries\DbQbe($GLOBALS['db'], $savedSearchList, $savedSearch); $url = 'db_designer.php' . URL::getCommon(array_merge($url_params, array('query' => 1))); $response->addHTML(PMA\libraries\Message::notice(sprintf(__('Switch to %svisual builder%s'), '<a href="' . $url . '">', '</a>'))); /** * Displays the Query by example form */ $response->addHTML($db_qbe->getSelectionForm());
// AJAX requests can't be cached! PMA_noCacheHeader(); // $_GET["message"] is used for asking for an import message if (isset($_GET["message"]) && $_GET["message"]) { header('Content-type: text/html'); // wait 0.3 sec before we check for $_SESSION variable, // which is set inside import.php usleep(300000); $maximumTime = ini_get('max_execution_time'); $timestamp = time(); // wait until message is available while ($_SESSION['Import_message']['message'] == null) { // close session before sleeping session_write_close(); // sleep usleep(250000); // 0.25 sec // reopen session session_start(); if (time() - $timestamp > $maximumTime) { $_SESSION['Import_message']['message'] = PMA\libraries\Message::error(__('Could not load the progress of the import.'))->getDisplay(); break; } } echo $_SESSION['Import_message']['message']; echo '<fieldset class="tblFooters">', "\n"; echo ' [ <a href="', $_SESSION['Import_message']['go_back_url'] . '">', __('Back'), '</a> ]', "\n"; echo '</fieldset>', "\n"; } else { PMA_importAjaxStatus($_GET["id"]); }
PMA_getRelationsParam(); if (! $GLOBALS['cfgRelation']['menuswork']) { exit; } $response = Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_user_groups.js'); /** * Only allowed to superuser */ if (! $GLOBALS['is_superuser']) { $response->addHTML( PMA\libraries\Message::error(__('No Privileges')) ->getDisplay() ); exit; } $response->addHTML('<div>'); $response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_user_groups.php')); /** * Delete user group */ if (! empty($_REQUEST['deleteUserGroup'])) { PMA_deleteUserGroup($_REQUEST['userGroup']); }
*/ // Include common functionalities use PMA\libraries\Response; use PMA\libraries\config\PageSettings; use PMA\libraries\navigation\Navigation; require_once './libraries/common.inc.php'; // Also initialises the collapsible tree class $response = Response::getInstance(); $navigation = new Navigation(); if (! $response->isAjax()) { $response->addHTML( PMA\libraries\Message::error( __('Fatal error: The navigation can only be accessed via AJAX') ) ); exit; } if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) { $response->addJSON('message', PageSettings::getNaviSettings()); exit(); } $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { if (isset($_REQUEST['hideNavItem'])) { if (! empty($_REQUEST['itemName']) && ! empty($_REQUEST['itemType'])