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


PHP PMA_ajaxResponse函数代码示例

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


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

示例1: testAjaxResponseMessageError

 function testAjaxResponseMessageError()
 {
     $message = new PMA_Message("Error Message Text", 1);
     // TODO: class for output div should be "error"
     $this->expectOutputString('{"success":false,"error":"<div class=\\"success\\">Error Message Text<\\/div>"}');
     PMA_ajaxResponse($message, false);
 }
开发者ID:bugyak,项目名称:phporadmin,代码行数:7,代码来源:PMA_ajaxResponse_test.php

示例2: PMA_printGitRevision

/**
* Prints details about the current Git commit revision
*/
function PMA_printGitRevision()
{
    if (!$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
        PMA_ajaxResponse('', false);
    }
    // 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')) . '" 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')) . '" target="_blank">' . $branch . '</a>';
    }
    if ($branch !== false) {
        $branch = sprintf(__('%1$s from %2$s branch'), $commit_hash, $branch);
    } else {
        $branch = $commit_hash . ' (' . __('no branch') . ')';
    }
    ob_start();
    $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_localisedDate(strtotime($committer['date'])), '<a href="' . PMA_linkURL('mailto:' . $committer['email']) . '">' . htmlspecialchars($committer['name']) . '</a>') . ($author != $committer ? ', <br />' . sprintf(__('authored on %1$s by %2$s'), PMA_localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . $author['email']) . '">' . htmlspecialchars($author['name']) . '</a>') : ''), 'li_pma_version_git', null, null, null);
    $item = ob_get_contents();
    ob_end_clean();
    PMA_ajaxResponse($item, true);
}
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:33,代码来源:display_git_revision.lib.php

示例3: PMA_getChangePassMessage

/**
 * Send the message as an ajax request
 *
 * @param array   $change_password_message
 * @param string  $sql_query
 *
 * @return void
 */
function PMA_getChangePassMessage($change_password_message, $sql_query = '')
{
    if ($GLOBALS['is_ajax_request'] == true) {
        /**
         * If in an Ajax request, we don't need to show the rest of the page
         */
        if ($change_password_message['error']) {
            PMA_ajaxResponse($change_password_message['msg'], false);
        } else {
            $extra_data['sql_query'] = PMA_showMessage($change_password_message['msg'], $sql_query, 'success');
            PMA_ajaxResponse($change_password_message['msg'], true, $extra_data);
        }
    }
}
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:22,代码来源:user_password.php

示例4: 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  $item_name    The name of the item that we are exporting
 * @param  string  $export_data  The SQL query to create the requested item
 */
function PMA_RTE_handleExport($item_name, $export_data)
{
    global $db;
    $item_name = htmlspecialchars(PMA_backquote($_GET['item_name']));
    if ($export_data !== false) {
        $export_data = '<textarea cols="40" rows="15" style="width: 100%;">' . htmlspecialchars(trim($export_data)) . '</textarea>';
        $title = sprintf(PMA_RTE_getWord('export'), $item_name);
        if ($GLOBALS['is_ajax_request'] == true) {
            $extra_data = array('title' => $title);
            PMA_ajaxResponse($export_data, true, $extra_data);
        } else {
            echo "<fieldset>\n" . "<legend>{$title}</legend>\n" . $export_data . "</fieldset>\n";
        }
    } else {
        $_db = htmlspecialchars(PMA_backquote($db));
        $response = __('Error in Processing Request') . ' : ' . sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
        $response = PMA_message::error($response);
        if ($GLOBALS['is_ajax_request'] == true) {
            PMA_ajaxResponse($response, false);
        } else {
            $response->display();
        }
    }
}
开发者ID:kirhgoph,项目名称:VMWare-Workstation-web-interface,代码行数:31,代码来源:rte_export.lib.php

示例5: PMA_EVN_handleEditor

/**
 * Handles editor requests for adding or editing an item
 */
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 = PMA_DBI_get_definition($db, 'EVENT', $_REQUEST['item_original_name']);
                $drop_item = "DROP EVENT " . PMA_backquote($_REQUEST['item_original_name']) . ";\n";
                $result = PMA_DBI_try_query($drop_item);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_item) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                } else {
                    $result = PMA_DBI_try_query($item_query);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), $item_query) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                        // We dropped the old item, but were unable to create the new one
                        // Try to restore the backup query
                        $result = PMA_DBI_try_query($create_item);
                        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 event.') . '<br />' . __('The backed up query was:') . "\"{$create_item}\"" . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                        }
                    } else {
                        $message = PMA_Message::success(__('Event %1$s has been modified.'));
                        $message->addParam(PMA_backquote($_REQUEST['item_name']));
                        $sql_query = $drop_item . $item_query;
                    }
                }
            } else {
                // 'Add a new item' mode
                $result = PMA_DBI_try_query($item_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), $item_query) . '<br /><br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                } else {
                    $message = PMA_Message::success(__('Event %1$s has been created.'));
                    $message->addParam(PMA_backquote($_REQUEST['item_name']));
                    $sql_query = $item_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_showMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $extra_data = array();
            if ($message->isSuccess()) {
                $columns = "`EVENT_NAME`, `EVENT_TYPE`, `STATUS`";
                $where = "EVENT_SCHEMA='" . PMA_sqlAddSlashes($db) . "' " . "AND EVENT_NAME='" . PMA_sqlAddSlashes($_REQUEST['item_name']) . "'";
                $query = "SELECT {$columns} FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE {$where};";
                $event = PMA_DBI_fetch_single_row($query);
                $extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['item_name']));
                $extra_data['new_row'] = PMA_EVN_getRowForList($event);
                $extra_data['insert'] = !empty($event);
                $response = $output;
            } else {
                $response = $message;
            }
            PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
        }
    }
    /**
     * 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();
//.........这里部分代码省略.........
开发者ID:AmberWish,项目名称:laba_web,代码行数:101,代码来源:rte_events.lib.php

示例6: PMA_mysqlDie

        $result = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, false, $err_url);
        // Changes password cookie if required
        // Duration = till the browser is closed for password (we don't want this to be saved)
        if ($cfg['Server']['auth_type'] == 'cookie') {
            $GLOBALS['PMA_Config']->setCookie('pmaPass-' . $server, PMA_blowfish_encrypt($password, $GLOBALS['cfg']['blowfish_secret']));
        }
        // end if
        // For http auth. mode, the "back" link will also enforce new
        // authentication
        if ($cfg['Server']['auth_type'] == 'http') {
            $_url_params['old_usr'] = 'relog';
        }
        $message = PMA_Message::success(__('The profile has been updated.'));
        if ($GLOBALS['is_ajax_request'] == true) {
            $extra_data['sql_query'] = PMA_showMessage($message, $sql_query, 'success');
            PMA_ajaxResponse($message, true, $extra_data);
        }
        // Displays the page
        require_once './libraries/header.inc.php';
        echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
        PMA_showMessage($message, $sql_query, 'success');
        ?>
        <a href="index.php<?php 
        echo PMA_generate_common_url($_url_params);
        ?>
" target="_parent">
            <strong><?php 
        echo __('Back');
        ?>
</strong></a>
        <?php 
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:31,代码来源:user_password.php

示例7: PMA_ajaxResponse

}
$url_query .= '&amp;goto=tbl_tracking.php&amp;back=db_tracking.php';
// Get the database structure
$sub_part = '_structure';
require './libraries/db_info.inc.php';
// Work to do?
//  (here, do not use $_REQUEST['db] as it can be crafted)
if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) {
    PMA_Tracker::deleteTracking($GLOBALS['db'], $_REQUEST['table']);
    /**
     * If in an Ajax request, generate the success message and use
     * {@link PMA_ajaxResponse()} to send the output
     */
    if ($GLOBALS['is_ajax_request'] == true) {
        $message = PMA_Message::success();
        PMA_ajaxResponse($message, true);
    }
}
// Get tracked data about the database
$data = PMA_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_information_schema)) {
        require './libraries/display_create_table.lib.php';
    }
    // Display the footer
    require './libraries/footer.inc.php';
    exit;
}
// ---------------------------------------------------------------------------
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:31,代码来源:db_tracking.php

示例8: str_replace

        // avoid a redirect loop when last record was deleted
        if (0 == $num_rows && 'sql.php' == $cfg['DefaultTabTable']) {
            $goto = str_replace('sql.php', 'tbl_structure.php', $goto);
        }
        PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));
    }
    // end else
    exit;
} else {
    //If we are retrieving the full value of a truncated field or the original
    // value of a transformed field, show it here and exit
    if ($GLOBALS['inline_edit'] == true && $GLOBALS['cfg']['AjaxEnable']) {
        $row = PMA_DBI_fetch_row($result);
        $extra_data = array();
        $extra_data['value'] = $row[0];
        PMA_ajaxResponse(NULL, true, $extra_data);
    }
    // Displays the headers
    if (isset($show_query)) {
        unset($show_query);
    }
    if (isset($printview) && $printview == '1') {
        require_once './libraries/header_printview.inc.php';
    } else {
        $GLOBALS['js_include'][] = 'functions.js';
        $GLOBALS['js_include'][] = 'sql.js';
        unset($message);
        if (!$GLOBALS['is_ajax_request'] || !$GLOBALS['cfg']['AjaxEnable']) {
            if (strlen($table)) {
                require './libraries/tbl_common.php';
                $url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
开发者ID:bugyak,项目名称:phporadmin,代码行数:31,代码来源:sql.php

示例9: PMA_mysqlDie


//.........这里部分代码省略.........
    }
    if (!$the_query && !empty($GLOBALS['sql_query'])) {
        $the_query = $GLOBALS['sql_query'];
    }
    // --- Added to solve bug #641765
    if (!function_exists('PMA_SQP_isError') || PMA_SQP_isError()) {
        $formatted_sql = htmlspecialchars($the_query);
    } elseif (empty($the_query) || trim($the_query) == '') {
        $formatted_sql = '';
    } else {
        if (strlen($the_query) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
            $formatted_sql = htmlspecialchars(substr($the_query, 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])) . '[...]';
        } else {
            $formatted_sql = PMA_formatSql(PMA_SQP_parse($the_query), $the_query);
        }
    }
    // ---
    $error_msg_output .= "\n" . '<!-- PMA-SQL-ERROR -->' . "\n";
    $error_msg_output .= '    <div class="error"><h1>' . __('Error') . '</h1>' . "\n";
    // if the config password is wrong, or the MySQL server does not
    // respond, do not show the query that would reveal the
    // username/password
    if (!empty($the_query) && !strstr($the_query, 'connect')) {
        // --- Added to solve bug #641765
        if (function_exists('PMA_SQP_isError') && PMA_SQP_isError()) {
            $error_msg_output .= PMA_SQP_getErrorString() . "\n";
            $error_msg_output .= '<br />' . "\n";
        }
        // ---
        // modified to show the help on sql errors
        $error_msg_output .= '    <p><strong>' . __('SQL query') . ':</strong>' . "\n";
        if (strstr(strtolower($formatted_sql), 'select')) {
            // please show me help to the error on select
            $error_msg_output .= PMA_showMySQLDocu('SQL-Syntax', 'SELECT');
        }
        if ($is_modify_link) {
            $_url_params = array('sql_query' => $the_query, 'show_query' => 1);
            if (strlen($table)) {
                $_url_params['db'] = $db;
                $_url_params['table'] = $table;
                $doedit_goto = '<a href="tbl_sql.php' . PMA_generate_common_url($_url_params) . '">';
            } elseif (strlen($db)) {
                $_url_params['db'] = $db;
                $doedit_goto = '<a href="db_sql.php' . PMA_generate_common_url($_url_params) . '">';
            } else {
                $doedit_goto = '<a href="server_sql.php' . PMA_generate_common_url($_url_params) . '">';
            }
            $error_msg_output .= $doedit_goto . PMA_getIcon('b_edit.png', __('Edit')) . '</a>';
        }
        // end if
        $error_msg_output .= '    </p>' . "\n" . '    <p>' . "\n" . '        ' . $formatted_sql . "\n" . '    </p>' . "\n";
    }
    // end if
    if (!empty($error_message)) {
        $error_message = preg_replace("@((\r\n)|(\r)|(\n)){3,}@", "\n\n", $error_message);
    }
    // modified to show the help on error-returns
    // (now error-messages-server)
    $error_msg_output .= '<p>' . "\n" . '    <strong>' . __('MySQL said: ') . '</strong>' . PMA_showMySQLDocu('Error-messages-server', 'Error-messages-server') . "\n" . '</p>' . "\n";
    // The error message will be displayed within a CODE segment.
    // To preserve original formatting, but allow wordwrapping,
    // we do a couple of replacements
    // Replace all non-single blanks with their HTML-counterpart
    $error_message = str_replace('  ', '&nbsp;&nbsp;', $error_message);
    // Replace TAB-characters with their HTML-counterpart
    $error_message = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $error_message);
    // Replace linebreaks
    $error_message = nl2br($error_message);
    $error_msg_output .= '<code>' . "\n" . $error_message . "\n" . '</code><br />' . "\n";
    $error_msg_output .= '</div>';
    $_SESSION['Import_message']['message'] = $error_msg_output;
    if ($exit) {
        /**
         * If in an Ajax request
         * - avoid displaying a Back link
         * - use PMA_ajaxResponse() to transmit the message and exit
         */
        if ($GLOBALS['is_ajax_request'] == true) {
            PMA_ajaxResponse($error_msg_output, false);
        }
        if (!empty($back_url)) {
            if (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_output .= '<fieldset class="tblFooters">';
            $error_msg_output .= '[ <a href="' . $back_url . '">' . __('Back') . '</a> ]';
            $error_msg_output .= '</fieldset>' . "\n\n";
        }
        echo $error_msg_output;
        /**
         * display footer and exit
         */
        include './libraries/footer.inc.php';
    } else {
        echo $error_msg_output;
    }
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:101,代码来源:common.lib.php

示例10: exit

        }
    }

    if (PMA_DBI_try_query($sql_query)) {
        if ($GLOBALS['is_ajax_request'] != true) {
            $message = PMA_Message::success();
            include './' . $cfg['DefaultTabDatabase'];
            exit();
        } else {
            PMA_ajaxResponse(PMA_showMessage(PMA_Message::success(), $sql_query), 1);
        }
    } else {
        if ($GLOBALS['is_ajax_request'] != true) {
            $message = PMA_Message::rawError(PMA_DBI_getError());
        } else {
            PMA_ajaxResponse(PMA_Message::error("<i>$sql_query</i><br /><br />" . PMA_DBI_getError()), 0);
        }
    }
}

// prefill values if not already filled from former submission
$view = array(
    'or_replace' => '',
    'algorithm' => '',
    'name' => '',
    'column_names' => '',
    'as' => $sql_query,
    'with' => array(),
);

if (PMA_isValid($_REQUEST['view'], 'array')) {
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:view_create.php

示例11: PMA_exitNavigationFrame

 * finish and cleanup navigation.php script execution, only to be used in navigation.php
 *
 * @access private
 */
function PMA_exitNavigationFrame()
{
    echo '</body></html>';
    exit;
}
require_once './libraries/common.lib.php';
require_once './libraries/RecentTable.class.php';
/**
 * Check if it is an ajax request to reload the recent tables list.
 */
if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) {
    PMA_ajaxResponse('', true, array('options' => PMA_RecentTable::getInstance()->getHtmlSelectOption()));
}
// keep the offset of the db list in session before closing it
if (!isset($_SESSION['tmp_user_values']['navi_limit_offset'])) {
    $_SESSION['tmp_user_values']['navi_limit_offset'] = 0;
}
if (!isset($_SESSION['tmp_user_values']['table_limit_offset']) || $_SESSION['tmp_user_values']['table_limit_offset_db'] != $db) {
    $_SESSION['tmp_user_values']['table_limit_offset'] = 0;
    $_SESSION['tmp_user_values']['table_limit_offset_db'] = $db;
}
if (isset($_REQUEST['pos'])) {
    if (isset($_REQUEST['tpos'])) {
        $_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
    } else {
        $_SESSION['tmp_user_values']['navi_limit_offset'] = (int) $_REQUEST['pos'];
    }
开发者ID:htom78,项目名称:project,代码行数:31,代码来源:navigation.php

示例12: PMA_generate_common_url

 * DB search optimisation
 *
 * @package PhpMyAdmin
 */
require_once 'libraries/common.inc.php';
require_once 'libraries/common.lib.php';
$db = $_GET['db'];
$table_term = $_GET['table'];
$common_url_query = PMA_generate_common_url($GLOBALS['db']);
$tables_full = PMA_getTableList($db);
$tables_response = array();
foreach ($tables_full as $key => $table) {
    if (strpos($key, $table_term) !== false) {
        $link = '<li class="ajax_table"><a class="tableicon" title="' . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table['Name']) . '&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '" >';
        $attr = array('id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name']));
        if (PMA_Table::isView($table_db, $table['Name'])) {
            $link .= PMA_getImage('s_views.png', htmlspecialchars($link_title), $attr);
        } else {
            $link .= PMA_getImage('b_browse.png', htmlspecialchars($link_title), $attr);
        }
        $link .= '</a>';
        // link for the table name itself
        $href = $GLOBALS['cfg']['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table['Name']) . '&amp;pos=0';
        $link .= '<a href="' . $href . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment'] . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')') . '" id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
        $link .= '</li>' . "\n";
        $table['line'] = $link;
        $tables_response[] = $table;
    }
}
PMA_ajaxResponse('', true, array('tables' => $tables_response));
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:30,代码来源:db_tables_search.php

示例13: PMA_ajaxResponse

        $display_query = $sql_query;
        $sql_query = '';
        // read table info on this newly created table, in case
        // the next page is Structure
        $reread_info = true;
        require './libraries/tbl_info.inc.php';
        // do not switch to sql.php - as there is no row to be displayed on a new table
        if ($cfg['DefaultTabTable'] === 'sql.php') {
            require './tbl_structure.php';
        } else {
            require './' . $cfg['DefaultTabTable'];
        }
        exit;
    } else {
        if ($GLOBALS['is_ajax_request'] == true) {
            PMA_ajaxResponse(PMA_DBI_getError(), false);
        } else {
            PMA_mysqlDie('', '', '', $err_url, false);
            // An error happened while inserting/updating a table definition.
            // to prevent total loss of that data, we embed the form once again.
            // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php
            $num_fields = $_REQUEST['orig_num_fields'];
            $regenerate = true;
        }
    }
}
// end do create table
/**
 * Displays the form used to define the structure of the table
 */
// This div is used to show the content(eg: create table form with more columns) fetched with AJAX subsequently.
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:31,代码来源:tbl_create.php

示例14: PMA_TRI_handleEditor

/**
 * Handles editor requests for adding or editing an item
 */
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 = PMA_DBI_try_query($drop_item);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_item)) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                } else {
                    $result = PMA_DBI_try_query($item_query);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                        // We dropped the old item, but were unable to create the new one
                        // Try to restore the backup query
                        $result = PMA_DBI_try_query($create_item);
                        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 trigger.') . '<br />' . __('The backed up query was:') . "\"" . htmlspecialchars($create_item) . "\"" . '<br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                        }
                    } else {
                        $message = PMA_Message::success(__('Trigger %1$s has been modified.'));
                        $message->addParam(PMA_backquote($_REQUEST['item_name']));
                        $sql_query = $drop_item . $item_query;
                    }
                }
            } else {
                // 'Add a new item' mode
                $result = PMA_DBI_try_query($item_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br /><br />' . __('MySQL said: ') . PMA_DBI_getError(null);
                } else {
                    $message = PMA_Message::success(__('Trigger %1$s has been created.'));
                    $message->addParam(PMA_backquote($_REQUEST['item_name']));
                    $sql_query = $item_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_showMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $extra_data = array();
            if ($message->isSuccess()) {
                $items = PMA_DBI_get_triggers($db, $table, '');
                $trigger = false;
                foreach ($items as $value) {
                    if ($value['name'] == $_REQUEST['item_name']) {
                        $trigger = $value;
                    }
                }
                $extra_data['insert'] = false;
                if (empty($table) || $trigger !== false && $table == $trigger['table']) {
                    $extra_data['insert'] = true;
                    $extra_data['new_row'] = PMA_TRI_getRowForList($trigger);
                    $extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['item_name']));
                }
                $response = $output;
            } else {
                $response = $message;
            }
            PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
        }
    }
    /**
     * 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'];
                    }
//.........这里部分代码省略.........
开发者ID:ping199143,项目名称:1ydb,代码行数:101,代码来源:rte_triggers.lib.php

示例15: foreach

            foreach ($_REQUEST['field_orig'] as $fieldindex => $fieldcontent) {
                if ($_REQUEST['field_name'][$fieldindex] != $fieldcontent) {
                    PMA_REL_renameField($db, $table, $fieldcontent, $_REQUEST['field_name'][$fieldindex]);
                }
            }
        }
        // update mime types
        if (isset($_REQUEST['field_mimetype']) && is_array($_REQUEST['field_mimetype']) && $cfg['BrowseMIME']) {
            foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
                if (isset($_REQUEST['field_name'][$fieldindex]) && strlen($_REQUEST['field_name'][$fieldindex])) {
                    PMA_setMIME($db, $table, $_REQUEST['field_name'][$fieldindex], $mimetype, $_REQUEST['field_transformation'][$fieldindex], $_REQUEST['field_transformation_options'][$fieldindex]);
                }
            }
        }
        if ($GLOBALS['is_ajax_request'] == true) {
            PMA_ajaxResponse($message, $message->isSuccess());
        }
        $active_page = 'tbl_structure.php';
        require './tbl_structure.php';
    } else {
        PMA_mysqlDie('', '', '', $err_url, false);
        // An error happened while inserting/updating a table definition.
        // to prevent total loss of that data, we embed the form once again.
        // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php
        if (isset($_REQUEST['orig_field'])) {
            $_REQUEST['field'] = $_REQUEST['orig_field'];
        }
        $regenerate = true;
    }
}
/**
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:31,代码来源:tbl_alter.php


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