/** * 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); }
$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 if ($new_transformations_sql != '') { $GLOBALS['dbi']->tryQuery($new_transformations_sql); } } unset($pma_transformation_data); if (!isset($_REQUEST['ajax_dialog'])) { $message = PMA\libraries\Message::success(); include 'tbl_structure.php'; } else { $response = PMA\libraries\Response::getInstance(); $response->addJSON('message', PMA\libraries\Util::getMessage(PMA\libraries\Message::success(), $sql_query)); $response->setRequestStatus(true); } exit; } // prefill values if not already filled from former submission $view = array('operation' => 'create', 'or_replace' => '', 'algorithm' => '', 'definer' => '', 'sql_security' => '', 'name' => '', 'column_names' => '', 'as' => $sql_query, 'with' => ''); if (PMA_isValid($_REQUEST['view'], 'array')) { $view = array_merge($view, $_REQUEST['view']); } $url_params['db'] = $GLOBALS['db']; $url_params['reload'] = 1; /** * Displays the page */ $htmlString = '<!-- CREATE VIEW options -->' . '<div id="div_view_options">' . '<form method="post" action="view_create.php">' . PMA_URL_getHiddenInputs($url_params) . '<fieldset>' . '<legend>' . (isset($_REQUEST['ajax_dialog']) ? __('Details') : ($view['operation'] == 'create' ? __('Create view') : __('Edit view'))) . '</legend>' . '<table class="rte_table">';
* cleanup pmadb stuff for this db */ include_once 'libraries/relation_cleanup.lib.php'; PMA_relationsCleanupDatabase($GLOBALS['db']); // 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', '');
* Deletes users * (Changes / copies a user, part IV) */ if (isset($_REQUEST['delete']) || isset($_REQUEST['change_copy']) && $_REQUEST['mode'] < 4) { include_once 'libraries/relation_cleanup.lib.php'; $queries = PMA_getDataForDeleteUsers($queries); if (empty($_REQUEST['change_copy'])) { list($sql_query, $message) = PMA_deleteUser($queries); } } /** * Changes / copies a user, part V */ if (isset($_REQUEST['change_copy'])) { $queries = PMA_getDataForQueries($queries, $queries_for_display); $message = PMA\libraries\Message::success(); $sql_query = join("\n", $queries); } /** * Reloads the privilege tables into memory */ $message_ret = PMA_updateMessageForReload(); if (isset($message_ret)) { $message = $message_ret; unset($message_ret); } /** * If we are in an Ajax request for Create User/Edit User/Revoke User/ * Flush Privileges, show $message and exit. */ if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request']) && !isset($_REQUEST['export']) && (!isset($_REQUEST['submit_mult']) || $_REQUEST['submit_mult'] != 'export') && (!isset($_REQUEST['initial']) || $_REQUEST['initial'] === null || $_REQUEST['initial'] === '' || isset($_REQUEST['delete']) && $_REQUEST['delete'] === 'Go') && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_group_dialog']) && !isset($_REQUEST['db_specific'])) {
require_once 'libraries/replication.inc.php'; require_once 'libraries/replication_gui.lib.php'; $ServerStatusData = new ServerStatusData(); $response = Response::getInstance(); /** * 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
$columnAdd = PMA_getHTMLforAddCentralColumn($total_rows, $pos, $db); $response->addHTML($columnAdd); exit; } $table_navigation_html = PMA_getHTMLforTableNavigation($total_rows, $pos, $db); $response->addHTML($table_navigation_html); $columnAdd = PMA_getHTMLforAddCentralColumn($total_rows, $pos, $db); $response->addHTML($columnAdd); $deleteRowForm = '<form method="post" id="del_form" action="db_central_columns.php">' . PMA_URL_getHiddenInputs($db) . '<input id="del_col_name" type="hidden" name="col_name" value="">' . '<input type="hidden" name="pos" value="' . $pos . '">' . '<input type="hidden" name="delete_save" value="delete"></form>'; $response->addHTML($deleteRowForm); $table_struct = '<div id="tableslistcontainer">' . '<form name="tableslistcontainer">' . '<table id="table_columns" class="tablesorter" ' . 'style="min-width:100%" class="data">'; $response->addHTML($table_struct); $tableheader = PMA_getCentralColumnsTableHeader('column_heading', __('Click to sort.'), 2); $response->addHTML($tableheader); $result = PMA_getColumnsList($db, $pos, $max_rows); $odd_row = true; $row_num = 0; foreach ($result as $row) { $tableHtmlRow = PMA_getHTMLforCentralColumnsTableRow($row, $odd_row, $row_num, $db); $response->addHTML($tableHtmlRow); $odd_row = !$odd_row; $row_num++; } $response->addHTML('</table>'); $tablefooter = PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir); $response->addHTML($tablefooter); $response->addHTML('</form></div>'); $message = PMA\libraries\Message::success(sprintf(__('Showing rows %1$s - %2$s.'), $pos + 1, $pos + count($result))); if (isset($tmp_msg) && $tmp_msg !== true) { $message = $tmp_msg; }
// Checking if the WHERE clause has to be replaced. if (!empty($where_clause) && is_array($where_clause)) { $replaces[] = array('WHERE', 'WHERE (' . implode(') OR (', $where_clause) . ')'); } // Preparing to remove the LIMIT clause. $replaces[] = array('LIMIT', ''); // Replacing the clauses. $sql_query = SqlParser\Utils\Query::replaceClauses($parser->statements[0], $parser->list, $replaces); // Removing the aliases by finding the alias followed by a dot. $tokens = SqlParser\Lexer::getTokens($sql_query); foreach ($aliases as $alias => $table) { $tokens = SqlParser\Utils\Tokens::replaceTokens($tokens, array(array('value_str' => $alias), array('type' => SqlParser\Token::TYPE_OPERATOR, 'value_str' => '.')), array(new SqlParser\Token($table), new SqlParser\Token('.', SqlParser\Token::TYPE_OPERATOR))); } $sql_query = SqlParser\TokensList::build($tokens); } echo PMA\libraries\Util::getMessage(PMA\libraries\Message::success()); } require_once 'libraries/display_export.lib.php'; if (!isset($sql_query)) { $sql_query = ''; } if (!isset($num_tables)) { $num_tables = 0; } if (!isset($unlim_num_rows)) { $unlim_num_rows = 0; } if (!isset($multi_values)) { $multi_values = ''; } $response = Response::getInstance();
$message = PMA\libraries\Message::rawError($GLOBALS['dbi']->getError()); // avoid displaying the not-created db name in header or navi panel $GLOBALS['db'] = ''; $GLOBALS['table'] = ''; /** * If in an Ajax request, just display the message with {@link PMA\libraries\Response} */ if ($GLOBALS['is_ajax_request'] == true) { $response = PMA\libraries\Response::getInstance(); $response->setRequestStatus(false); $response->addJSON('message', $message); } else { include_once 'index.php'; } } else { $message = PMA\libraries\Message::success(__('Database %1$s has been created.')); $message->addParam($_POST['new_db']); $GLOBALS['db'] = $_POST['new_db']; /** * If in an Ajax request, build the output and send it */ if ($GLOBALS['is_ajax_request'] == true) { //Construct the html for the new database, so that it can be appended to // the list of databases on server_databases.php /** * Build the array to be passed to {@link PMA_URL_getCommon} * to generate the links * * @global array $GLOBALS['db_url_params'] * @name $db_url_params */
/** * 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); } }
/** * 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); } }
} else { // build update query $query[] = 'UPDATE ' . PMA\libraries\Util::backquote($GLOBALS['table']) . ' SET ' . implode(', ', $query_values) . ' WHERE ' . $where_clause . ($_REQUEST['clause_is_unique'] ? '' : ' LIMIT 1'); } } } // end foreach ($loop_array as $where_clause) unset($multi_edit_columns_name, $multi_edit_columns_prev, $multi_edit_funcs, $multi_edit_columns_type, $multi_edit_columns_null, $func_no_param, $multi_edit_auto_increment, $current_value_as_an_array, $key, $current_value, $loop_array, $where_clause, $using_key, $multi_edit_columns_null_prev, $insert_fail); // Builds the sql query if ($is_insert && count($value_sets) > 0) { $query = PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets); } elseif (empty($query) && !isset($_REQUEST['preview_sql']) && !$row_skipped) { // No change -> move back to the calling script // // Note: logic passes here for inline edit $message = PMA\libraries\Message::success(__('No change')); $active_page = $goto_include; include '' . PMA_securePath($goto_include); exit; } unset($multi_edit_columns, $is_insertignore); // If there is a request for SQL previewing. if (isset($_REQUEST['preview_sql'])) { PMA_previewSQL($query); } /** * Executes the sql query and get the result, then move back to the calling * page */ list($url_params, $total_affected_rows, $last_messages, $warning_messages, $error_messages, $return_to_sql_query) = PMA_executeSqlQuery($url_params, $query); if ($is_insert && (count($value_sets) > 0 || $row_skipped)) {
/** * test success method * * @return void */ public function testSuccess() { $this->object = new PMA\libraries\Message('test<&>', PMA\libraries\Message::SUCCESS); $this->assertEquals($this->object, PMA\libraries\Message::success('test<&>')); $this->assertEquals('Your SQL query has been executed successfully.', PMA\libraries\Message::success()->getString()); }
: PMA\libraries\Message::error(); } 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) ); }
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 : ''); // Work to do? // (here, do not use $_REQUEST['db] as it can be crafted) if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) { Tracker::deleteTracking($GLOBALS['db'], $_REQUEST['table']); PMA\libraries\Message::success(__('Tracking data deleted successfully.'))->display(); } elseif (isset($_REQUEST['submit_create_version'])) { PMA_createTrackingForMultipleTables($_REQUEST['selected']); PMA\libraries\Message::success(sprintf(__('Version %1$s was created for selected tables,' . ' tracking is active for them.'), htmlspecialchars($_REQUEST['version'])))->display(); } elseif (isset($_REQUEST['submit_mult'])) { if (!empty($_REQUEST['selected_tbl'])) { if ($_REQUEST['submit_mult'] == 'delete_tracking') { foreach ($_REQUEST['selected_tbl'] as $table) { Tracker::deleteTracking($GLOBALS['db'], $table); } PMA\libraries\Message::success(__('Tracking data deleted successfully.'))->display(); } elseif ($_REQUEST['submit_mult'] == 'track') { echo PMA_getHtmlForDataDefinitionAndManipulationStatements('db_tracking.php' . $url_query, 0, $GLOBALS['db'], $_REQUEST['selected_tbl']); exit; } } else { PMA\libraries\Message::notice(__('No tables selected.'))->display(); } } // Get tracked data about the database $data = Tracker::getTrackedData($_REQUEST['db'], '', '1'); // No tables present and no log exist if ($num_tables == 0 && count($data['ddlog']) == 0) { echo '<p>', __('No tables found in database.'), '</p>', "\n"; if (empty($db_is_system_schema)) { echo PMA_getHtmlForCreateTable($db);
$html_output .= PMA_executeQueryAndGetQueryResponse($analyzed_sql_results, false, $db, $table, null, $_REQUEST['sql_query'], null, null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query, null, null); } $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');
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);
&& $_REQUEST['toggle_activation'] == 'deactivate_now' ) { $html .= PMA_changeTracking('deactivate'); } // Activate tracking if (isset($_REQUEST['toggle_activation']) && $_REQUEST['toggle_activation'] == 'activate_now' ) { $html .= PMA_changeTracking('activate'); } // Export as SQL execution if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'execution') { $sql_result = PMA_exportAsSQLExecution($entries); $msg = PMA\libraries\Message::success(__('SQL statements executed.')); $html .= $msg->getDisplay(); } // Export as SQL dump if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldump') { $html .= PMA_exportAsSQLDump($entries); } /* * Schema snapshot */ if (isset($_REQUEST['snapshot'])) { $html .= PMA_getHtmlForSchemaSnapshot($url_query); } // end of snapshot report
unset($_REQUEST['do_save_data']); include_once 'libraries/create_addfield.lib.php'; list($result, $sql_query) = PMA_tryColumnCreationQuery($db, $table, $err_url); if ($result === true) { // If comments were sent, enable relation stuff include_once 'libraries/transformations.lib.php'; // Update comment table for mime types [MIME] if (isset($_REQUEST['field_mimetype']) && is_array($_REQUEST['field_mimetype']) && $cfg['BrowseMIME']) { foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) { if (isset($_REQUEST['field_name'][$fieldindex]) && mb_strlen($_REQUEST['field_name'][$fieldindex])) { PMA_setMIME($db, $table, $_REQUEST['field_name'][$fieldindex], $mimetype, $_REQUEST['field_transformation'][$fieldindex], $_REQUEST['field_transformation_options'][$fieldindex], $_REQUEST['field_input_transformation'][$fieldindex], $_REQUEST['field_input_transformation_options'][$fieldindex]); } } } // Go back to the structure sub-page $message = PMA\libraries\Message::success(__('Table %1$s has been altered successfully.')); $message->addParam($table); $response->addJSON('message', PMA\libraries\Util::getMessage($message, $sql_query, 'success')); exit; } else { $error_message_html = PMA\libraries\Util::mysqlDie('', '', false, $err_url, false); $response->addHTML($error_message_html); $response->setRequestStatus(false); exit; } } // end do alter table /** * Displays the form used to define the new field */ if ($abort == false) {
} // 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) {