当前位置: 首页>>代码示例>>PHP>>正文


PHP libraries\Response类代码示例

本文整理汇总了PHP中PMA\libraries\Response的典型用法代码示例。如果您正苦于以下问题:PHP Response类的具体用法?PHP Response怎么用?PHP Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Response类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_printGitRevision

/**
* Prints details about the current Git commit revision
*
* @return void
*/
function PMA_printGitRevision()
{
    if (!$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
        $response = Response::getInstance();
        $response->setRequestStatus(false);
        return;
    }
    // load revision data from repo
    $GLOBALS['PMA_Config']->checkGitRevision();
    // if using a remote commit fast-forwarded, link to GitHub
    $commit_hash = substr($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'), 0, 7);
    $commit_hash = '<strong title="' . htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE')) . '">' . $commit_hash . '</strong>';
    if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTECOMMIT')) {
        $commit_hash = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/commit/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH')) . '" rel="noopener noreferrer" target="_blank">' . $commit_hash . '</a>';
    }
    $branch = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH');
    if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTEBRANCH')) {
        $branch = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/tree/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH')) . '" rel="noopener noreferrer" target="_blank">' . $branch . '</a>';
    }
    if ($branch !== false) {
        $branch = sprintf(__('%1$s from %2$s branch'), $commit_hash, $branch);
    } else {
        $branch = $commit_hash . ' (' . __('no branch') . ')';
    }
    $committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
    $author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
    PMA_printListItem(__('Git revision:') . ' ' . $branch . ',<br /> ' . sprintf(__('committed on %1$s by %2$s'), PMA\libraries\Util::localisedDate(strtotime($committer['date'])), '<a href="' . PMA_linkURL('mailto:' . htmlspecialchars($committer['email'])) . '">' . htmlspecialchars($committer['name']) . '</a>') . ($author != $committer ? ', <br />' . sprintf(__('authored on %1$s by %2$s'), PMA\libraries\Util::localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . htmlspecialchars($author['email'])) . '">' . htmlspecialchars($author['name']) . '</a>') : ''), 'li_pma_version_git', null, null, null);
}
开发者ID:nijel,项目名称:phpmyadmin,代码行数:33,代码来源:display_git_revision.lib.php

示例2: PMA_RTE_sendEditor

/**
 * Send TRI or EVN editor via ajax or by echoing.
 *
 * @param string $type      TRI or EVN
 * @param string $mode      Editor mode 'add' or 'edit'
 * @param array  $item      Data necessary to create the editor
 * @param string $title     Title of the editor
 * @param string $db        Database
 * @param string $operation Operation 'change' or ''
 *
 * @return void
 */
function PMA_RTE_sendEditor($type, $mode, $item, $title, $db, $operation = null)
{
    if ($item !== false) {
        // Show form
        if ($type == 'TRI') {
            $editor = PMA_TRI_getEditorForm($mode, $item);
        } else {
            // EVN
            $editor = PMA_EVN_getEditorForm($mode, $operation, $item);
        }
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA\libraries\Response::getInstance();
            $response->addJSON('message', $editor);
            $response->addJSON('title', $title);
        } else {
            echo "\n\n<h2>{$title}</h2>\n\n{$editor}";
            unset($_POST);
        }
        exit;
    } else {
        $message = __('Error in processing request:') . ' ';
        $message .= sprintf(PMA_RTE_getWord('not_found'), htmlspecialchars(PMA\libraries\Util::backquote($_REQUEST['item_name'])), htmlspecialchars(PMA\libraries\Util::backquote($db)));
        $message = Message::error($message);
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA\libraries\Response::getInstance();
            $response->setRequestStatus(false);
            $response->addJSON('message', $message);
            exit;
        } else {
            $message->display();
        }
    }
}
开发者ID:pjiahao,项目名称:phpmyadmin,代码行数:45,代码来源:rte_general.lib.php

示例3: PMA_RTE_handleExport

/**
 * This function is called from one of the other functions in this file
 * and it completes the handling of the export functionality.
 *
 * @param string $export_data The SQL query to create the requested item
 *
 * @return void
 */
function PMA_RTE_handleExport($export_data)
{
    global $db;
    $item_name = htmlspecialchars(PMA\libraries\Util::backquote($_GET['item_name']));
    if ($export_data !== false) {
        $export_data = htmlspecialchars(trim($export_data));
        $title = sprintf(PMA_RTE_getWord('export'), $item_name);
        if ($GLOBALS['is_ajax_request'] == true) {
            $response = PMA\libraries\Response::getInstance();
            $response->addJSON('message', $export_data);
            $response->addJSON('title', $title);
            exit;
        } else {
            $export_data = '<textarea cols="40" rows="15" style="width: 100%;">' . $export_data . '</textarea>';
            echo "<fieldset>\n" . "<legend>{$title}</legend>\n" . $export_data . "</fieldset>\n";
        }
    } else {
        $_db = htmlspecialchars(PMA\libraries\Util::backquote($db));
        $message = __('Error in processing request:') . ' ' . sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
        $response = Message::error($message);
        if ($GLOBALS['is_ajax_request'] == true) {
            $response = PMA\libraries\Response::getInstance();
            $response->setRequestStatus(false);
            $response->addJSON('message', $message);
            exit;
        } else {
            $response->display();
        }
    }
}
开发者ID:netroby,项目名称:phpmyadmin,代码行数:38,代码来源:rte_export.lib.php

示例4: __construct

 /**
  * No-arg constructor
  */
 public function __construct()
 {
     if (!empty($GLOBALS['cfg']['CodemirrorEnable'])) {
         $response = Response::getInstance();
         $scripts = $response->getHeader()->getScripts();
         $scripts->addFile('codemirror/lib/codemirror.js');
         $scripts->addFile('codemirror/mode/sql/sql.js');
         $scripts->addFile('codemirror/addon/runmode/runmode.js');
         $scripts->addFile('function.js');
     }
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:14,代码来源:Text_Plain_Sql.php

示例5: __construct

 /**
  * No-arg constructor
  */
 public function __construct()
 {
     if (!empty($GLOBALS['cfg']['CodemirrorEnable'])) {
         $response = PMA\libraries\Response::getInstance();
         $scripts = $response->getHeader()->getScripts();
         $scripts->addFile('codemirror/lib/codemirror.js');
         $scripts->addFile('codemirror/mode/javascript/javascript.js');
         $scripts->addFile('codemirror/addon/runmode/runmode.js');
         $scripts->addFile('transformations/json.js');
     }
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:14,代码来源:Text_Plain_Json.php

示例6: indexAction

 /**
  * Index action
  *
  * @return void
  */
 public function indexAction()
 {
     include_once 'libraries/check_user_privileges.lib.php';
     $response = Response::getInstance();
     if (isset($_REQUEST['drop_selected_dbs']) && $response->isAjax() && ($GLOBALS['is_superuser'] || $GLOBALS['cfg']['AllowUserDropDatabase'])) {
         $this->dropDatabasesAction();
         return;
     }
     include_once 'libraries/replication.inc.php';
     if (!empty($_POST['new_db']) && $response->isAjax()) {
         $this->createDatabaseAction();
         return;
     }
     include_once 'libraries/server_common.inc.php';
     $header = $this->response->getHeader();
     $scripts = $header->getScripts();
     $scripts->addFile('server_databases.js');
     $this->_setSortDetails();
     $this->_dbstats = empty($_REQUEST['dbstats']) ? false : true;
     $this->_pos = empty($_REQUEST['pos']) ? 0 : (int) $_REQUEST['pos'];
     /**
      * Displays the sub-page heading
      */
     $header_type = $this->_dbstats ? "database_statistics" : "databases";
     $this->response->addHTML(PMA_getHtmlForSubPageHeader($header_type));
     /**
      * Displays For Create database.
      */
     $html = '';
     if ($GLOBALS['cfg']['ShowCreateDb']) {
         $html .= Template::get('server/databases/create')->render();
     }
     $html .= Template::get('filter')->render(array('filterValue' => ''));
     /**
      * Gets the databases list
      */
     if ($GLOBALS['server'] > 0) {
         $this->_databases = $this->dbi->getDatabasesFull(null, $this->_dbstats, null, $this->_sort_by, $this->_sort_order, $this->_pos, true);
         $this->_database_count = count($GLOBALS['dblist']->databases);
     } else {
         $this->_database_count = 0;
     }
     /**
      * Displays the page
      */
     if ($this->_database_count > 0 && !empty($this->_databases)) {
         $html .= $this->_getHtmlForDatabases($replication_types);
     } else {
         $html .= __('No databases');
     }
     $this->response->addHTML($html);
 }
开发者ID:nijel,项目名称:phpmyadmin,代码行数:57,代码来源:ServerDatabasesController.php

示例7: authForm

 /**
  * Displays authentication form
  *
  * @return boolean
  */
 public function authForm()
 {
     /* Perform logout to custom URL */
     if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
         PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
         if (!defined('TESTSUITE')) {
             exit;
         } else {
             return false;
         }
     }
     if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {
         if (empty($GLOBALS['cfg']['Server']['verbose'])) {
             $server_message = $GLOBALS['cfg']['Server']['host'];
         } else {
             $server_message = $GLOBALS['cfg']['Server']['verbose'];
         }
         $realm_message = 'phpMyAdmin ' . $server_message;
     } else {
         $realm_message = $GLOBALS['cfg']['Server']['auth_http_realm'];
     }
     $response = Response::getInstance();
     // remove non US-ASCII to respect RFC2616
     $realm_message = preg_replace('/[^\\x20-\\x7e]/i', '', $realm_message);
     $response->header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
     $response->header('HTTP/1.0 401 Unauthorized');
     if (php_sapi_name() !== 'cgi-fcgi') {
         $response->header('status: 401 Unauthorized');
     }
     /* HTML header */
     $footer = $response->getFooter();
     $footer->setMinimal();
     $header = $response->getHeader();
     $header->setTitle(__('Access denied!'));
     $header->disableMenuAndConsole();
     $header->setBodyId('loginform');
     $response->addHTML('<h1>');
     $response->addHTML(sprintf(__('Welcome to %s'), ' phpMyAdmin'));
     $response->addHTML('</h1>');
     $response->addHTML('<h3>');
     $response->addHTML(Message::error(__('Wrong username/password. Access denied.')));
     $response->addHTML('</h3>');
     if (@file_exists(CUSTOM_FOOTER_FILE)) {
         include CUSTOM_FOOTER_FILE;
     }
     if (!defined('TESTSUITE')) {
         exit;
     } else {
         return false;
     }
 }
开发者ID:poush,项目名称:phpmyadmin,代码行数:56,代码来源:AuthenticationHttp.php

示例8: getDisplay

 /**
  * Renders the navigation tree, or part of it
  *
  * @return string The navigation tree
  */
 public function getDisplay()
 {
     /* Init */
     $retval = '';
     if (!Response::getInstance()->isAjax()) {
         $header = new NavigationHeader();
         $retval = $header->getDisplay();
     }
     $tree = new NavigationTree();
     if (!Response::getInstance()->isAjax() || !empty($_REQUEST['full']) || !empty($_REQUEST['reload'])) {
         if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree']) {
             // provide database tree in navigation
             $navRender = $tree->renderState();
         } else {
             // provide legacy pre-4.0 navigation
             $navRender = $tree->renderDbSelect();
         }
     } else {
         $navRender = $tree->renderPath();
     }
     if (!$navRender) {
         $retval .= Message::error(__('An error has occurred while loading the navigation display'))->getDisplay();
     } else {
         $retval .= $navRender;
     }
     if (!Response::getInstance()->isAjax()) {
         // closes the tags that were opened by the navigation header
         $retval .= '</div>';
         // pma_navigation_tree
         $retval .= '<div id="pma_navi_settings_container">';
         if (!defined('PMA_DISABLE_NAVI_SETTINGS')) {
             $retval .= PageSettings::getNaviSettings();
         }
         $retval .= '</div>';
         //pma_navi_settings_container
         $retval .= '</div>';
         // pma_navigation_content
         $retval .= $this->_getDropHandler();
         $retval .= '</div>';
         // pma_navigation
     }
     return $retval;
 }
开发者ID:poush,项目名称:phpmyadmin,代码行数:48,代码来源:Navigation.php

示例9: PMA_parseAnalyze

/**
 * Calls the parser on a query
 *
 * @param string $sql_query the query to parse
 * @param string $db        the current database
 *
 * @return array
 *
 * @access  public
 */
function PMA_parseAnalyze($sql_query, $db)
{
    // @todo: move to returned results (also in all the calling chain)
    $GLOBALS['unparsed_sql'] = $sql_query;
    // Get details about the SQL query.
    $analyzed_sql_results = SqlParser\Utils\Query::getAll($sql_query);
    extract($analyzed_sql_results);
    $table = '';
    // If the targeted table (and database) are different than the ones that is
    // currently browsed, edit `$db` and `$table` to match them so other elements
    // (page headers, links, navigation panel) can be updated properly.
    if (!empty($analyzed_sql_results['select_tables'])) {
        // Previous table and database name is stored to check if it changed.
        $prev_db = $db;
        if (count($analyzed_sql_results['select_tables']) > 1) {
            /**
             * @todo if there are more than one table name in the Select:
             * - do not extract the first table name
             * - do not show a table name in the page header
             * - do not display the sub-pages links)
             */
            $table = '';
        } else {
            $table = $analyzed_sql_results['select_tables'][0][0];
            if (!empty($analyzed_sql_results['select_tables'][0][1])) {
                $db = $analyzed_sql_results['select_tables'][0][1];
            }
        }
        // There is no point checking if a reload is required if we already decided
        // to reload. Also, no reload is required for AJAX requests.
        $response = Response::getInstance();
        if (empty($reload) && !$response->isAjax()) {
            // NOTE: Database names are case-insensitive.
            $reload = strcasecmp($db, $prev_db) != 0;
        }
        // Updating the array.
        $analyzed_sql_results['reload'] = $reload;
    }
    return array($analyzed_sql_results, $db, $table);
}
开发者ID:nijel,项目名称:phpmyadmin,代码行数:50,代码来源:parse_analyze.lib.php

示例10: PMA_moveOrCopyTable

/**
 * Move or copy a table
 *
 * @param string $db    current database name
 * @param string $table current table name
 *
 * @return void
 */
function PMA_moveOrCopyTable($db, $table)
{
    /**
     * Selects the database to work with
     */
    $GLOBALS['dbi']->selectDb($db);
    /**
     * $_REQUEST['target_db'] could be empty in case we came from an input field
     * (when there are many databases, no drop-down)
     */
    if (empty($_REQUEST['target_db'])) {
        $_REQUEST['target_db'] = $db;
    }
    /**
     * A target table name has been sent to this script -> do the work
     */
    if (PMA_isValid($_REQUEST['new_name'])) {
        if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
            if (isset($_REQUEST['submit_move'])) {
                $message = Message::error(__('Can\'t move table to same one!'));
            } else {
                $message = Message::error(__('Can\'t copy table to same one!'));
            }
        } else {
            Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'], $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
            if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) {
                if (isset($_REQUEST['submit_move'])) {
                    PMA_AdjustPrivileges_renameOrMoveTable($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name']);
                } else {
                    PMA_AdjustPrivileges_copyTable($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name']);
                }
                if (isset($_REQUEST['submit_move'])) {
                    $message = Message::success(__('Table %s has been moved to %s. Privileges have been ' . 'adjusted.'));
                } else {
                    $message = Message::success(__('Table %s has been copied to %s. Privileges have been ' . 'adjusted.'));
                }
            } else {
                if (isset($_REQUEST['submit_move'])) {
                    $message = Message::success(__('Table %s has been moved to %s.'));
                } else {
                    $message = Message::success(__('Table %s has been copied to %s.'));
                }
            }
            $old = PMA\libraries\Util::backquote($db) . '.' . PMA\libraries\Util::backquote($table);
            $message->addParam($old);
            $new = PMA\libraries\Util::backquote($_REQUEST['target_db']) . '.' . PMA\libraries\Util::backquote($_REQUEST['new_name']);
            $message->addParam($new);
            /* Check: Work on new table or on old table? */
            if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
            }
        }
    } else {
        /**
         * No new name for the table!
         */
        $message = Message::error(__('The table name is empty!'));
    }
    if ($GLOBALS['is_ajax_request'] == true) {
        $response = PMA\libraries\Response::getInstance();
        $response->addJSON('message', $message);
        if ($message->isSuccess()) {
            $response->addJSON('db', $GLOBALS['db']);
        } else {
            $response->setRequestStatus(false);
        }
        exit;
    }
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:76,代码来源:operations.lib.php

示例11: showOutput

 /**
  * Output Dia Document for download
  *
  * @param string $fileName name of the dia document
  *
  * @return void
  * @access public
  * @see    XMLWriter::flush()
  */
 public function showOutput($fileName)
 {
     if (ob_get_clean()) {
         ob_end_clean();
     }
     $output = $this->flush();
     PMA\libraries\Response::getInstance()->disable();
     PMA_downloadHeader($fileName, 'application/x-dia-diagram', mb_strlen($output));
     print $output;
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:19,代码来源:Dia.php

示例12: _getDeleteLink

 /**
  * Prepares a Delete link
  *
  * @param string $del_url delete url
  * @param string $del_str text for the delete link
  * @param string $js_conf text for the JS confirmation
  * @param string $class   css classes for the td element
  *
  * @return string  the generated HTML
  *
  * @access  private
  *
  * @see     _getTableBody(), _getCheckboxAndLinks()
  */
 private function _getDeleteLink($del_url, $del_str, $js_conf, $class)
 {
     $ret = '';
     if (empty($del_url)) {
         return $ret;
     }
     $ret .= '<td class="';
     if (!empty($class)) {
         $ret .= $class . ' ';
     }
     $ajax = Response::getInstance()->isAjax() ? ' ajax' : '';
     $ret .= 'center print_ignore" ' . ' >' . Util::linkOrButton($del_url, $del_str, array('class' => 'delete_row requireConfirm' . $ajax), false) . '<div class="hide">' . $js_conf . '</div>' . '</td>';
     return $ret;
 }
开发者ID:rugbyprof,项目名称:phpmyadmin,代码行数:28,代码来源:DisplayResults.php

示例13: isset

<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Database structure manipulation
 *
 * @package PhpMyAdmin
 */
namespace PMA;

use PMA\libraries\controllers\database\DatabaseStructureController;
use PMA\libraries\Response;
use PMA\libraries\Util;
require_once 'libraries/common.inc.php';
require_once 'libraries/db_common.inc.php';
list($tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos) = Util::getDbInfo($GLOBALS['db'], isset($sub_part) ? $sub_part : '');
$container = libraries\di\Container::getDefaultContainer();
$container->factory('PMA\\libraries\\controllers\\database\\DatabaseStructureController');
$container->alias('DatabaseStructureController', 'PMA\\libraries\\controllers\\database\\DatabaseStructureController');
$container->set('PMA\\libraries\\Response', Response::getInstance());
$container->alias('response', 'PMA\\libraries\\Response');
global $db, $pos, $db_is_system_schema, $total_num_tables, $tables, $num_tables;
/* Define dependencies for the concerned controller */
$dependency_definitions = array('db' => $db, 'url_query' => &$GLOBALS['url_query'], 'pos' => $pos, 'db_is_system_schema' => $db_is_system_schema, 'num_tables' => $num_tables, 'total_num_tables' => $total_num_tables, 'tables' => $tables);
/** @var DatabaseStructureController $controller */
$controller = $container->get('DatabaseStructureController', $dependency_definitions);
$controller->indexAction();
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:27,代码来源:db_structure.php

示例14: PMA_addBookmark

/**
 * Function to add a bookmark
 *
 * @param String $pmaAbsoluteUri absolute URI
 * @param String $goto           goto page URL
 *
 * @return void
 */
function PMA_addBookmark($pmaAbsoluteUri, $goto)
{
    $result = PMA_Bookmark_save($_POST['bkm_fields'], isset($_POST['bkm_all_users']) && $_POST['bkm_all_users'] == 'true' ? true : false);
    $response = Response::getInstance();
    if ($response->isAjax()) {
        if ($result) {
            $msg = Message::success(__('Bookmark %s has been created.'));
            $msg->addParam($_POST['bkm_fields']['bkm_label']);
            $response->addJSON('message', $msg);
        } else {
            $msg = PMA\libraries\message::error(__('Bookmark not created!'));
            $response->setRequestStatus(false);
            $response->addJSON('message', $msg);
        }
        exit;
    } else {
        // go back to sql.php to redisplay query; do not use &amp; in this case:
        /**
         * @todo In which scenario does this happen?
         */
        PMA_sendHeaderLocation($pmaAbsoluteUri . $goto . '&label=' . $_POST['bkm_fields']['bkm_label']);
    }
}
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:31,代码来源:sql.lib.php

示例15: mysqlDie


//.........这里部分代码省略.........
                // please show me help to the error on select
                $error_msg .= self::showMySQLDocu('SELECT');
            }

            if ($is_modify_link) {
                $_url_params = array(
                    'sql_query' => $sql_query,
                    'show_query' => 1,
                );
                if (strlen($table) > 0) {
                    $_url_params['db'] = $db;
                    $_url_params['table'] = $table;
                    $doedit_goto = '<a href="tbl_sql.php'
                        . URL::getCommon($_url_params) . '">';
                } elseif (strlen($db) > 0) {
                    $_url_params['db'] = $db;
                    $doedit_goto = '<a href="db_sql.php'
                        . URL::getCommon($_url_params) . '">';
                } else {
                    $doedit_goto = '<a href="server_sql.php'
                        . URL::getCommon($_url_params) . '">';
                }

                $error_msg .= $doedit_goto
                   . self::getIcon('b_edit.png', __('Edit'))
                   . '</a>';
            }

            $error_msg .= '    </p>' . "\n"
                . '<p>' . "\n"
                . $formatted_sql . "\n"
                . '</p>' . "\n";
        }

        // Display server's error.
        if (!empty($server_msg)) {
            $server_msg = preg_replace(
                "@((\015\012)|(\015)|(\012)){3,}@",
                "\n\n",
                $server_msg
            );

            // Adds a link to MySQL documentation.
            $error_msg .= '<p>' . "\n"
                . '    <strong>' . __('MySQL said: ') . '</strong>'
                . self::showMySQLDocu('Error-messages-server')
                . "\n"
                . '</p>' . "\n";

            // The error message will be displayed within a CODE segment.
            // To preserve original formatting, but allow word-wrapping,
            // a couple of replacements are done.
            // All non-single blanks and  TAB-characters are replaced with their
            // HTML-counterpart
            $server_msg = str_replace(
                array('  ', "\t"),
                array('&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'),
                $server_msg
            );

            // Replace line breaks
            $server_msg = nl2br($server_msg);

            $error_msg .= '<code>' . $server_msg . '</code><br/>';
        }

        $error_msg .= '</div>';
        $_SESSION['Import_message']['message'] = $error_msg;

        if (!$exit) {
            return $error_msg;
        }

        /**
         * If this is an AJAX request, there is no "Back" link and
         * `Response()` is used to send the response.
         */
        $response = Response::getInstance();
        if ($response->isAjax()) {
            $response->setRequestStatus(false);
            $response->addJSON('message', $error_msg);
            exit;
        }

        if (!empty($back_url)) {
            if (mb_strstr($back_url, '?')) {
                $back_url .= '&amp;no_history=true';
            } else {
                $back_url .= '?no_history=true';
            }

            $_SESSION['Import_message']['go_back_url'] = $back_url;

            $error_msg .= '<fieldset class="tblFooters">'
                . '[ <a href="' . $back_url . '">' . __('Back') . '</a> ]'
                . '</fieldset>' . "\n\n";
        }

        exit($error_msg);
    }
开发者ID:nijel,项目名称:phpmyadmin,代码行数:101,代码来源:Util.php


注:本文中的PMA\libraries\Response类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。