本文整理汇总了PHP中PMA_RTN_getRowForList函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_RTN_getRowForList函数的具体用法?PHP PMA_RTN_getRowForList怎么用?PHP PMA_RTN_getRowForList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_RTN_getRowForList函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_RTN_handleEditor
/**
* Handles editor requests for adding or editing an item
*
* @return Does not return
*/
function PMA_RTN_handleEditor()
{
global $_GET, $_POST, $_REQUEST, $GLOBALS, $db, $errors;
if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
/**
* Handle a request to create/edit a routine
*/
$sql_query = '';
$routine_query = PMA_RTN_getQueryFromRequest();
if (!count($errors)) {
// set by PMA_RTN_getQueryFromRequest()
// Execute the created query
if (!empty($_REQUEST['editor_process_edit'])) {
if (!in_array($_REQUEST['item_original_type'], array('PROCEDURE', 'FUNCTION'))) {
$errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_original_type']));
} else {
// Backup the old routine, in case something goes wrong
$create_routine = PMA_DBI_get_definition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']);
$drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n";
$result = PMA_DBI_try_query($drop_routine);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_routine)) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$result = PMA_DBI_try_query($routine_query);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
// We dropped the old routine, but were unable to create the new one
// Try to restore the backup query
$result = PMA_DBI_try_query($create_routine);
if (!$result) {
// OMG, this is really bad! We dropped the query,
// failed to create a new one
// and now even the backup query does not execute!
// This should not happen, but we better handle
// this just in case.
$errors[] = __('Sorry, we failed to restore the dropped routine.') . '<br />' . __('The backed up query was:') . "\"" . htmlspecialchars($create_routine) . "\"" . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
}
} else {
$message = PMA_Message::success(__('Routine %1$s has been modified.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $drop_routine . $routine_query;
}
}
}
} else {
// 'Add a new routine' mode
$result = PMA_DBI_try_query($routine_query);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('<b>One or more errors have occured while processing your request:</b>'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " . "AND ROUTINE_NAME='" . PMA_Util::sqlAddSlashes($_REQUEST['item_name']) . "'" . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($_REQUEST['item_type']) . "'";
$routine = PMA_DBI_fetch_single_row("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE {$where};");
$response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, 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['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
//.........这里部分代码省略.........
示例2: PMA_RTN_handleRequestCreateOrEdit
/**
* Handle request to create or edit a routine
*
* @param array $errors Errors
* @param string $db DB name
*
* @return array
*/
function PMA_RTN_handleRequestCreateOrEdit($errors, $db)
{
if (empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit'])) {
return $errors;
}
$sql_query = '';
$routine_query = PMA_RTN_getQueryFromRequest();
if (!count($errors)) {
// set by PMA_RTN_getQueryFromRequest()
// Execute the created query
if (!empty($_REQUEST['editor_process_edit'])) {
$isProcOrFunc = in_array($_REQUEST['item_original_type'], array('PROCEDURE', 'FUNCTION'));
if (!$isProcOrFunc) {
$errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_original_type']));
} else {
// Backup the old routine, in case something goes wrong
$create_routine = $GLOBALS['dbi']->getDefinition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']);
$privilegesBackup = PMA_RTN_backupPrivileges();
$drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA\libraries\Util::backquote($_REQUEST['item_original_name']) . ";\n";
$result = $GLOBALS['dbi']->tryQuery($drop_routine);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_routine)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
list($newErrors, $message) = PMA_RTN_createRoutine($routine_query, $create_routine, $privilegesBackup);
if (empty($newErrors)) {
$sql_query = $drop_routine . $routine_query;
} else {
$errors = array_merge($errors, $newErrors);
}
unset($newErrors);
if (null === $message) {
unset($message);
}
}
}
} else {
// 'Add a new routine' mode
$result = $GLOBALS['dbi']->tryQuery($routine_query);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
$message = PMA\libraries\Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA\libraries\Message::error(__('One or more errors have occurred while' . ' processing your request:'));
$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']) {
return $errors;
}
$response = PMA\libraries\Response::getInstance();
if (!$message->isSuccess()) {
$response->setRequestStatus(false);
$response->addJSON('message', $output);
exit;
}
$routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
$routine = $routines[0];
$response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
exit;
}
示例3: PMA_RTN_handleEditor
//.........这里部分代码省略.........
}
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $drop_routine . $routine_query;
}
}
}
} else {
// 'Add a new routine' mode
$result = $GLOBALS['dbi']->tryQuery($routine_query);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
$routine = $routines[0];
$response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, if necessary
*/
// FIXME: this must be simpler than that
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
$title = PMA_RTE_getWord('add');
$routine = PMA_RTN_getDataFromRequest();
示例4: PMA_RTE_getList
/**
* Creates a list of items containing the relevant
* information and some action links.
*
* @param string $type One of ['routine'|'trigger'|'event']
* @param array $items An array of items
*
* @return string HTML code of the list of items
*/
function PMA_RTE_getList($type, $items)
{
global $table;
/**
* Conditional classes switch the list on or off
*/
$class1 = 'hide';
$class2 = '';
if (!$items) {
$class1 = '';
$class2 = ' hide';
}
/**
* Generate output
*/
$retval = "<!-- LIST OF " . PMA_RTE_getWord('docu') . " START -->\n";
$retval .= "<fieldset>\n";
$retval .= " <legend>\n";
$retval .= " " . PMA_RTE_getWord('title') . "\n";
$retval .= " " . PMA_showMySQLDocu('SQL-Syntax', PMA_RTE_getWord('docu')) . "\n";
$retval .= " </legend>\n";
$retval .= " <div class='{$class1}' id='nothing2display'>\n";
$retval .= " " . PMA_RTE_getWord('nothing') . "\n";
$retval .= " </div>\n";
$retval .= " <table class='data{$class2}'>\n";
$retval .= " <!-- TABLE HEADERS -->\n";
$retval .= " <tr>\n";
switch ($type) {
case 'routine':
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th colspan='4'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " <th>" . __('Returns') . "</th>\n";
break;
case 'trigger':
$retval .= " <th>" . __('Name') . "</th>\n";
if (empty($table)) {
$retval .= " <th>" . __('Table') . "</th>\n";
}
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Time') . "</th>\n";
$retval .= " <th>" . __('Event') . "</th>\n";
break;
case 'event':
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th>" . __('Status') . "</th>\n";
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
break;
default:
break;
}
$retval .= " </tr>\n";
$retval .= " <!-- TABLE DATA -->\n";
$ct = 0;
foreach ($items as $item) {
$rowclass = $ct % 2 == 0 ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request']) {
$rowclass .= ' ajaxInsert hide';
}
// Get each row from the correct function
switch ($type) {
case 'routine':
$retval .= PMA_RTN_getRowForList($item, $rowclass);
break;
case 'trigger':
$retval .= PMA_TRI_getRowForList($item, $rowclass);
break;
case 'event':
$retval .= PMA_EVN_getRowForList($item, $rowclass);
break;
default:
break;
}
$ct++;
}
$retval .= " </table>\n";
$retval .= "</fieldset>\n";
$retval .= "<!-- LIST OF " . PMA_RTE_getWord('docu') . " END -->\n";
return $retval;
}
示例5: PMA_RTE_getList
//.........这里部分代码省略.........
default:
break;
}
$retval .= '">';
$retval .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
$retval .= "<fieldset>\n";
$retval .= " <legend>\n";
$retval .= " " . PMA_RTE_getWord('title') . "\n";
$retval .= " " . PMA_Util::showMySQLDocu(PMA_RTE_getWord('docu')) . "\n";
$retval .= " </legend>\n";
$retval .= " <div class='{$class1}' id='nothing2display'>\n";
$retval .= " " . PMA_RTE_getWord('nothing') . "\n";
$retval .= " </div>\n";
$retval .= " <table class='data{$class2}'>\n";
$retval .= " <!-- TABLE HEADERS -->\n";
$retval .= " <tr>\n";
// th cells with a colspan need corresponding td cells, according to W3C
switch ($type) {
case 'routine':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th colspan='4'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " <th>" . __('Returns') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 7; $i++) {
$retval .= " <td></td>\n";
}
break;
case 'trigger':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
if (empty($table)) {
$retval .= " <th>" . __('Table') . "</th>\n";
}
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Time') . "</th>\n";
$retval .= " <th>" . __('Event') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
$retval .= " <td></td>\n";
}
break;
case 'event':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th>" . __('Status') . "</th>\n";
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 6; $i++) {
$retval .= " <td></td>\n";
}
break;
default:
break;
}
$retval .= " </tr>\n";
$retval .= " <!-- TABLE DATA -->\n";
$count = 0;
foreach ($items as $item) {
$rowclass = $count % 2 == 0 ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
$rowclass .= ' ajaxInsert hide';
}
// Get each row from the correct function
switch ($type) {
case 'routine':
$retval .= PMA_RTN_getRowForList($item, $rowclass);
break;
case 'trigger':
$retval .= PMA_TRI_getRowForList($item, $rowclass);
break;
case 'event':
$retval .= PMA_EVN_getRowForList($item, $rowclass);
break;
default:
break;
}
$count++;
}
$retval .= " </table>\n";
if (count($items)) {
$retval .= '<div class="withSelected">';
$retval .= PMA_Util::getWithSelected($GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], 'rteListForm');
$retval .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_export.png', 'export');
$retval .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop');
$retval .= '</div>';
}
$retval .= "</fieldset>\n";
$retval .= "</form>\n";
$retval .= "<!-- LIST OF " . PMA_RTE_getWord('docu') . " END -->\n";
return $retval;
}
示例6: PMA_RTE_getList
/**
* Creates a list of items containing the relevant
* information and some action links.
*
* @param string $type One of ['routine'|'trigger'|'event']
* @param array $items An array of items
*
* @return string HTML code of the list of items
*/
function PMA_RTE_getList($type, $items)
{
global $table;
/**
* Conditional classes switch the list on or off
*/
$class1 = 'hide';
$class2 = '';
if (!$items) {
$class1 = '';
$class2 = ' hide';
}
/**
* Generate output
*/
$retval = "<!-- LIST OF " . PMA_RTE_getWord('docu') . " START -->\n";
$retval .= "<fieldset>\n";
$retval .= " <legend>\n";
$retval .= " " . PMA_RTE_getWord('title') . "\n";
$retval .= " " . PMA_Util::showMySQLDocu(PMA_RTE_getWord('docu')) . "\n";
$retval .= " </legend>\n";
$retval .= " <div class='{$class1}' id='nothing2display'>\n";
$retval .= " " . PMA_RTE_getWord('nothing') . "\n";
$retval .= " </div>\n";
$retval .= " <table class='data{$class2}'>\n";
$retval .= " <!-- TABLE HEADERS -->\n";
$retval .= " <tr>\n";
// th cells with a colspan need corresponding td cells, according to W3C
switch ($type) {
case 'routine':
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th colspan='4'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " <th>" . __('Returns') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 7; $i++) {
$retval .= " <td></td>\n";
}
break;
case 'trigger':
$retval .= " <th>" . __('Name') . "</th>\n";
if (empty($table)) {
$retval .= " <th>" . __('Table') . "</th>\n";
}
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Time') . "</th>\n";
$retval .= " <th>" . __('Event') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
$retval .= " <td></td>\n";
}
break;
case 'event':
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th>" . __('Status') . "</th>\n";
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 6; $i++) {
$retval .= " <td></td>\n";
}
break;
default:
break;
}
$retval .= " </tr>\n";
$retval .= " <!-- TABLE DATA -->\n";
$count = 0;
foreach ($items as $item) {
$rowclass = $count % 2 == 0 ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
$rowclass .= ' ajaxInsert hide';
}
// Get each row from the correct function
switch ($type) {
case 'routine':
$retval .= PMA_RTN_getRowForList($item, $rowclass);
break;
case 'trigger':
$retval .= PMA_TRI_getRowForList($item, $rowclass);
break;
case 'event':
$retval .= PMA_EVN_getRowForList($item, $rowclass);
break;
default:
//.........这里部分代码省略.........
示例7: PMA_RTN_handleEditor
/**
* Handles editor requests for adding or editing an item
*
* @return void
*/
function PMA_RTN_handleEditor()
{
global $_GET, $_POST, $_REQUEST, $GLOBALS, $db, $errors;
if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
/**
* Handle a request to create/edit a routine
*/
$sql_query = '';
$routine_query = PMA_RTN_getQueryFromRequest();
if (!count($errors)) {
// set by PMA_RTN_getQueryFromRequest()
// Execute the created query
if (!empty($_REQUEST['editor_process_edit'])) {
$isProcOrFunc = in_array($_REQUEST['item_original_type'], array('PROCEDURE', 'FUNCTION'));
if (!$isProcOrFunc) {
$errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_original_type']));
} else {
// Backup the old routine, in case something goes wrong
$create_routine = $GLOBALS['dbi']->getDefinition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']);
$privilegesBackup = PMA_RTN_backupPrivileges();
$drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n";
$result = $GLOBALS['dbi']->tryQuery($drop_routine);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_routine)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
list($newErrors, $message) = PMA_RTN_createRoutine($routine_query, $create_routine, $privilegesBackup);
if (empty($newErrors)) {
$sql_query = $drop_routine . $sql_query;
} else {
$errors = array_merge($errors, $newErrors);
}
unset($newErrors);
if (null === $message) {
unset($message);
}
}
}
} else {
// 'Add a new routine' mode
$result = $GLOBALS['dbi']->tryQuery($routine_query);
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
$routine = $routines[0];
$response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, if necessary
*/
// FIXME: this must be simpler than that
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
//.........这里部分代码省略.........