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


PHP PMA_Util::getMessage方法代码示例

本文整理汇总了PHP中PMA_Util::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getMessage方法的具体用法?PHP PMA_Util::getMessage怎么用?PHP PMA_Util::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Util的用法示例。


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

示例1: PMA_handleCreateOrEditIndex

/**
 * Function to handle the creation or edit of an index
 *
 * @param string    $db    current db
 * @param string    $table current table
 * @param PMA_Index $index current index
 *
 * @return void
 */
function PMA_handleCreateOrEditIndex($db, $table, $index)
{
    $error = false;
    $sql_query = PMA_getSqlQueryForIndexCreateOrEdit($db, $table, $index, $error);
    // If there is a request for SQL previewing.
    if (isset($_REQUEST['preview_sql'])) {
        PMA_previewSQL($sql_query);
    }
    if (!$error) {
        $GLOBALS['dbi']->query($sql_query);
        $message = PMA_Message::success(__('Table %1$s has been altered successfully.'));
        $message->addParam($table);
        if ($GLOBALS['is_ajax_request'] == true) {
            $response = PMA_Response::getInstance();
            $response->addJSON('message', $message);
            $response->addJSON('index_table', PMA_Index::getView($table, $db));
            $response->addJSON('sql_query', PMA_Util::getMessage(null, $sql_query));
        } else {
            include 'tbl_structure.php';
        }
        exit;
    } else {
        $response = PMA_Response::getInstance();
        $response->isSuccess(false);
        $response->addJSON('message', $error);
        exit;
    }
}
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:37,代码来源:tbl_indexes.lib.php

示例2: testShowMessageNotAjax

 /**
  * Test for getMessage
  *
  * @return void
  */
 function testShowMessageNotAjax()
 {
     global $cfg;
     $GLOBALS['is_ajax_request'] = true;
     $GLOBALS['table'] = 'tbl';
     $GLOBALS['db'] = 'db';
     $GLOBALS['sql_query'] = "SELECT * FROM tblPatient ";
     $this->expectOutputString("<div id=\"result_query\" align=\"\">\n            <div class=\"notice\">msg</div><code class=\"sql\"><span class=\"syntax\"><span class=\"inner_sql\"><a href=\"./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.0%2Fen%2Fselect.html&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" target=\"mysql_doc\"><span class=\"syntax_alpha syntax_alpha_reservedWord\">SELECT</span></a>  <span class=\"syntax_punct\">*</span> <br /><span class=\"syntax_alpha syntax_alpha_reservedWord\">FROM</span> <span class=\"syntax_alpha syntax_alpha_identifier\">tblPatient</span></span></span></code><div class=\"tools\"><form action=\"sql.php\" method=\"post\"><input type=\"hidden\" name=\"db\" value=\"db\" /><input type=\"hidden\" name=\"table\" value=\"tbl\" /><input type=\"hidden\" name=\"server\" value=\"server\" /><input type=\"hidden\" name=\"lang\" value=\"en\" /><input type=\"hidden\" name=\"token\" value=\"647a62ad301bf9025e3b13bc7caa02cb\" /><input type=\"hidden\" name=\"sql_query\" value=\"SELECT * FROM tblPatient \" /></form><script type=\"text/javascript\">\n            //<![CDATA[\n            \$('.tools form').last().after('[<a href=\"#\" title=\"Inline edit of this query\" class=\"inline_edit_sql\">Inline</a>]');\n            //]]>\n            </script> [\n            <a href=\"tbl_sql.php?db=db&amp;table=tbl&amp;sql_query=SELECT+%2A+FROM+tblPatient+&amp;show_query=1&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb#querybox\" >Edit</a>\n            ] [\n            <a href=\"import.php?db=db&amp;table=tbl&amp;sql_query=EXPLAIN+SELECT+%2A+FROM+tblPatient+&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" >Explain SQL</a>\n            ] [\n            <a href=\"import.php?db=db&amp;table=tbl&amp;sql_query=SELECT+%2A+FROM+tblPatient+&amp;show_query=1&amp;show_as_php=1&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" >Create PHP Code</a>\n            ] [\n            <a href=\"import.php?db=db&amp;table=tbl&amp;sql_query=SELECT+%2A+FROM+tblPatient+&amp;show_query=1&amp;server=server&amp;lang=en&amp;token=647a62ad301bf9025e3b13bc7caa02cb\" >Refresh</a>\n            ]</div></div>");
     echo PMA_Util::getMessage("msg");
     //$this->assertEquals("", PMA_Util::getMessage("msg"));
     $this->assertTrue(true);
 }
开发者ID:FilipeRamosFernandes,项目名称:phpmyadmin,代码行数:17,代码来源:PMA_showMessage_test_disabled.php

示例3: getDisplay

 /**
  * Returns the menu and the breadcrumbs as a string
  *
  * @return string
  */
 public function getDisplay()
 {
     $retval = $this->_getBreadcrumbs();
     $retval .= $this->_getMenu();
     if (!empty($GLOBALS['message'])) {
         if (isset($GLOBALS['buffer_message'])) {
             $buffer_message = $GLOBALS['buffer_message'];
         }
         $retval .= PMA_Util::getMessage($GLOBALS['message']);
         unset($GLOBALS['message']);
         if (isset($buffer_message)) {
             $GLOBALS['buffer_message'] = $buffer_message;
         }
     }
     return $retval;
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:21,代码来源:Menu.class.php

示例4: PMA_getExtraDataForAjaxBehavior

/**
 * This function return the extra data array for the ajax behavior
 *
 * @param string $password  password
 * @param string $sql_query sql query
 * @param string $hostname  hostname
 * @param string $username  username
 *
 * @return array $extra_data
 */
function PMA_getExtraDataForAjaxBehavior($password, $sql_query, $hostname, $username)
{
    if (isset($GLOBALS['dbname'])) {
        //if (preg_match('/\\\\(?:_|%)/i', $dbname)) {
        if (preg_match('/(?<!\\\\)(?:_|%)/i', $GLOBALS['dbname'])) {
            $dbname_is_wildcard = true;
        } else {
            $dbname_is_wildcard = false;
        }
    }
    $user_group_count = 0;
    if ($GLOBALS['cfgRelation']['menuswork']) {
        $user_group_count = PMA_getUserGroupCount();
    }
    $extra_data = array();
    if (mb_strlen($sql_query)) {
        $extra_data['sql_query'] = PMA_Util::getMessage(null, $sql_query);
    }
    if (isset($_REQUEST['change_copy'])) {
        /**
         * generate html on the fly for the new user that was just created.
         */
        $new_user_string = '<tr>' . "\n" . '<td> <input type="checkbox" name="selected_usr[]" ' . 'id="checkbox_sel_users_"' . 'value="' . htmlspecialchars($username) . '&amp;#27;' . htmlspecialchars($hostname) . '" />' . '</td>' . "\n" . '<td><label for="checkbox_sel_users_">' . (empty($_REQUEST['username']) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($username)) . '</label></td>' . "\n" . '<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
        $new_user_string .= '<td>';
        if (!empty($password) || isset($_POST['pma_pw'])) {
            $new_user_string .= __('Yes');
        } else {
            $new_user_string .= '<span style="color: #FF0000">' . __('No') . '</span>';
        }
        $new_user_string .= '</td>' . "\n";
        $new_user_string .= '<td>' . '<code>' . join(', ', PMA_extractPrivInfo(null, true)) . '</code>' . '</td>';
        //Fill in privileges here
        // if $cfg['Servers'][$i]['users'] and $cfg['Servers'][$i]['usergroups'] are
        // enabled
        $cfgRelation = PMA_getRelationsParam();
        if (isset($cfgRelation['users']) && isset($cfgRelation['usergroups'])) {
            $new_user_string .= '<td class="usrGroup"></td>';
        }
        $new_user_string .= '<td>';
        if (isset($_POST['Grant_priv']) && $_POST['Grant_priv'] == 'Y') {
            $new_user_string .= __('Yes');
        } else {
            $new_user_string .= __('No');
        }
        $new_user_string .= '</td>';
        if ($GLOBALS['is_grantuser']) {
            $new_user_string .= '<td>' . PMA_getUserLink('edit', $username, $hostname) . '</td>' . "\n";
        }
        if (isset($cfgRelation['menuswork']) && $user_group_count > 0) {
            $new_user_string .= '<td>' . PMA_getUserGroupEditLink($username) . '</td>' . "\n";
        }
        $new_user_string .= '<td>' . PMA_getUserLink('export', $username, $hostname, '', '', isset($_GET['initial']) ? $_GET['initial'] : '') . '</td>' . "\n";
        $new_user_string .= '</tr>';
        $extra_data['new_user_string'] = $new_user_string;
        /**
         * Generate the string for this alphabet's initial, to update the user
         * pagination
         */
        $new_user_initial = mb_strtoupper(mb_substr($username, 0, 1));
        $newUserInitialString = '<a href="server_privileges.php' . PMA_URL_getCommon(array('initial' => $new_user_initial)) . '">' . $new_user_initial . '</a>';
        $extra_data['new_user_initial'] = $new_user_initial;
        $extra_data['new_user_initial_string'] = $newUserInitialString;
    }
    if (isset($_POST['update_privs'])) {
        $extra_data['db_specific_privs'] = false;
        $extra_data['db_wildcard_privs'] = false;
        if (isset($dbname_is_wildcard)) {
            $extra_data['db_specific_privs'] = !$dbname_is_wildcard;
            $extra_data['db_wildcard_privs'] = $dbname_is_wildcard;
        }
        $new_privileges = join(', ', PMA_extractPrivInfo(null, true));
        $extra_data['new_privileges'] = $new_privileges;
    }
    if (isset($_REQUEST['validate_username'])) {
        $sql_query = "SELECT * FROM `mysql`.`user` WHERE `User` = '" . $_REQUEST['username'] . "';";
        $res = $GLOBALS['dbi']->query($sql_query);
        $row = $GLOBALS['dbi']->fetchRow($res);
        if (empty($row)) {
            $extra_data['user_exists'] = false;
        } else {
            $extra_data['user_exists'] = true;
        }
    }
    return $extra_data;
}
开发者ID:siddhantsomani,项目名称:phpmyadmin,代码行数:95,代码来源:server_privileges.lib.php

示例5: 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 {
//.........这里部分代码省略.........
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:101,代码来源:rte_routines.lib.php

示例6: getTable

 /**
  * Prepare a table of results returned by a SQL query.
  *
  * @param integer &$dt_result         the link id associated to the query
  *                                    which results have to be displayed
  * @param array   &$displayParts      the parts to display
  * @param array   $analyzed_sql       the analyzed query
  * @param boolean $is_limited_display With limited operations or not
  *
  * @return  string   $table_html   Generated HTML content for resulted table
  *
  * @access  public
  *
  * @see     sql.php file
  */
 public function getTable(&$dt_result, &$displayParts, $analyzed_sql, $is_limited_display = false)
 {
     $table_html = '';
     // Following variable are needed for use in isset/empty or
     // use with array indexes/safe use in foreach
     $fields_meta = $this->__get('fields_meta');
     $showtable = $this->__get('showtable');
     $printview = $this->__get('printview');
     // why was this called here? (already called from sql.php)
     //$this->setConfigParamsForDisplayTable();
     /**
      * @todo move this to a central place
      * @todo for other future table types
      */
     $is_innodb = isset($showtable['Type']) && $showtable['Type'] == self::TABLE_TYPE_INNO_DB;
     if ($is_innodb && !isset($analyzed_sql[0]['queryflags']['union']) && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ')) {
         // "j u s t   b r o w s i n g"
         $pre_count = '~';
         $after_count = PMA_Util::showHint(PMA_sanitize(__('May be approximate. See [doc@faq3-11]FAQ 3.11[/doc].')));
     } else {
         $pre_count = '';
         $after_count = '';
     }
     // 1. ----- Prepares the work -----
     // 1.1 Gets the information about which functionalities should be
     //     displayed
     $total = '';
     $displayParts = $this->_setDisplayParts($displayParts, $total);
     // 1.2 Defines offsets for the next and previous pages
     if ($displayParts['nav_bar'] == '1') {
         list($pos_next, $pos_prev) = $this->_getOffsets();
     }
     // end if
     if (!isset($analyzed_sql[0]['order_by_clause'])) {
         $analyzed_sql[0]['order_by_clause'] = "";
     }
     // 1.3 Find the sort expression
     // we need $sort_expression and $sort_expression_nodirection
     // even if there are many table references
     list($sort_expression, $sort_expression_nodirection, $sort_direction) = $this->_getSortParams($analyzed_sql[0]['order_by_clause']);
     $number_of_columns = count($sort_expression_nodirection);
     // 1.4 Prepares display of first and last value of the sorted column
     $sorted_column_message = '';
     for ($i = 0; $i < $number_of_columns; $i++) {
         $sorted_column_message .= $this->_getSortedColumnMessage($dt_result, $sort_expression_nodirection[$i]);
     }
     // 2. ----- Prepare to display the top of the page -----
     // 2.1 Prepares a messages with position information
     if ($displayParts['nav_bar'] == '1' && isset($pos_next)) {
         $message = $this->_setMessageInformation($sorted_column_message, $analyzed_sql[0]['limit_clause'], $total, $pos_next, $pre_count, $after_count);
         $table_html .= PMA_Util::getMessage($message, $this->__get('sql_query'), 'success');
     } elseif (!isset($printview) || $printview != '1') {
         $table_html .= PMA_Util::getMessage(__('Your SQL query has been executed successfully.'), $this->__get('sql_query'), 'success');
     }
     // 2.3 Prepare the navigation bars
     if (!mb_strlen($this->__get('table'))) {
         if (isset($analyzed_sql[0]['query_type']) && $analyzed_sql[0]['query_type'] == self::QUERY_TYPE_SELECT) {
             // table does not always contain a real table name,
             // for example in MySQL 5.0.x, the query SHOW STATUS
             // returns STATUS as a table name
             $this->__set('table', $fields_meta[0]->table);
         } else {
             $this->__set('table', '');
         }
     }
     if ($displayParts['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) {
         $table_html .= $this->_getPlacedTableNavigations($pos_next, $pos_prev, self::PLACE_TOP_DIRECTION_DROPDOWN, $is_innodb);
     } elseif (!isset($printview) || $printview != '1') {
         $table_html .= "\n" . '<br /><br />' . "\n";
     }
     // 2b ----- Get field references from Database -----
     // (see the 'relation' configuration variable)
     // initialize map
     $map = array();
     // find tables
     $target = array();
     if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
         foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
             $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
         }
     }
     if (mb_strlen($this->__get('table'))) {
         // This method set the values for $map array
         $this->_setParamForLinkForeignKeyRelatedTables($map);
         // Coming from 'Distinct values' action of structure page
//.........这里部分代码省略.........
开发者ID:nkeat12,项目名称:dv,代码行数:101,代码来源:DisplayResults.class.php

示例7: __

if (isset($result)) {
    // set to success by default, because result set could be empty
    // (for example, a table rename)
    $_type = 'success';
    if (empty($_message)) {
        $_message = $result ? __('Your SQL query has been executed successfully') : __('Error');
        // $result should exist, regardless of $_message
        $_type = $result ? 'success' : 'error';
    }
    if (!empty($warning_messages)) {
        $_message = new PMA_Message();
        $_message->addMessages($warning_messages);
        $_message->isError(true);
        unset($warning_messages);
    }
    echo PMA_Util::getMessage($_message, $sql_query, $_type, $is_view = true);
    unset($_message, $_type);
}
$url_params['goto'] = 'view_operations.php';
$url_params['back'] = 'view_operations.php';
/**
 * Displays the page
 */
?>
<!-- Table operations -->
<div class="operations_half_width">
<form method="post" action="view_operations.php">
<?php 
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
?>
<input type="hidden" name="reload" value="1" />
开发者ID:mindfeederllc,项目名称:openemr,代码行数:31,代码来源:view_operations.php

示例8: PMA_sendQueryResponseForResultsReturned

/**
 * Function to display results when the executed query returns non empty results
 *
 * @param array      $result               executed query results
 * @param array      $analyzed_sql_results analysed sql results
 * @param string     $db                   current database
 * @param string     $table                current table
 * @param string     $disp_mode            display mode
 * @param string     $message              message to show
 * @param array      $sql_data             sql data
 * @param object     $displayResultsObject Instance of DisplayResults.class
 * @param string     $goto                 goto page url
 * @param string     $pmaThemeImage        uri of the theme image
 * @param string     $sql_limit_to_append  sql limit to append
 * @param int        $unlim_num_rows       unlimited number of rows
 * @param int        $num_rows             number of rows
 * @param string     $full_sql_query       full sql query
 * @param string     $disp_query           display query
 * @param string     $disp_message         display message
 * @param array      $profiling_results    profiling results
 * @param string     $query_type           query type
 * @param array|null $selectedTables       array of table names selected from
 *                                         the database structure page, for an
 *                                         action like check table, optimize
 *                                         table, analyze table or repair table
 * @param string     $sql_query            sql query
 * @param string     $complete_query       complete sql query
 *
 * @return void
 */
function PMA_sendQueryResponseForResultsReturned($result, $analyzed_sql_results, $db, $table, $disp_mode, $message, $sql_data, $displayResultsObject, $goto, $pmaThemeImage, $sql_limit_to_append, $unlim_num_rows, $num_rows, $full_sql_query, $disp_query, $disp_message, $profiling_results, $query_type, $selectedTables, $sql_query, $complete_query)
{
    // If we are retrieving the full value of a truncated field or the original
    // value of a transformed field, show it here
    if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
        PMA_sendResponseForGridEdit($result);
        // script has exited at this point
    }
    // Gets the list of fields properties
    if (isset($result) && $result) {
        $fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
    }
    // Should be initialized these parameters before parsing
    $showtable = isset($showtable) ? $showtable : null;
    $url_query = isset($url_query) ? $url_query : null;
    $response = PMA_Response::getInstance();
    $header = $response->getHeader();
    $scripts = $header->getScripts();
    // hide edit and delete links:
    // - for information_schema
    // - if the result set does not contain all the columns of a unique key
    //   (unless this is an updatable view)
    $sele_exp_cls = $analyzed_sql_results['analyzed_sql'][0]['select_expr_clause'];
    $updatableView = trim($sele_exp_cls) == '*' && PMA_Table::isUpdatableView($db, $table);
    $has_unique = PMA_resultSetContainsUniqueKey($db, $table, $fields_meta);
    $just_one_table = PMA_resultSetHasJustOneTable($fields_meta);
    $editable = ($has_unique || $updatableView) && $just_one_table;
    // Displays the results in a table
    if (empty($disp_mode)) {
        // see the "PMA_setDisplayMode()" function in
        // libraries/DisplayResults.class.php
        $disp_mode = 'urdr111101';
    }
    if (!empty($table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
        $disp_mode = 'nnnn110111';
    }
    if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
        $disp_mode = 'nnnn000000';
    }
    if (isset($_REQUEST['table_maintenance'])) {
        $scripts->addFile('makegrid.js');
        $scripts->addFile('sql.js');
        $table_maintenance_html = '';
        if (isset($message)) {
            $message = PMA_Message::success($message);
            $table_maintenance_html = PMA_Util::getMessage($message, $GLOBALS['sql_query'], 'success');
        }
        $table_maintenance_html .= PMA_getHtmlForSqlQueryResultsTable(isset($sql_data) ? $sql_data : null, $displayResultsObject, $db, $goto, $pmaThemeImage, $url_query, $disp_mode, $sql_limit_to_append, false, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
        if (empty($sql_data) || ($sql_data['valid_queries'] = 1)) {
            $response->addHTML($table_maintenance_html);
            exit;
        }
    }
    if (!isset($_REQUEST['printview']) || $_REQUEST['printview'] != '1') {
        $scripts->addFile('makegrid.js');
        $scripts->addFile('sql.js');
        unset($GLOBALS['message']);
        //we don't need to buffer the output in getMessage here.
        //set a global variable and check against it in the function
        $GLOBALS['buffer_message'] = false;
    }
    $print_view_header_html = PMA_getHtmlForPrintViewHeader($db, $full_sql_query, $num_rows);
    $previous_update_query_html = PMA_getHtmlForPreviousUpdateQuery(isset($disp_query) ? $disp_query : null, $GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data : null, isset($disp_message) ? $disp_message : null);
    $profiling_chart_html = PMA_getHtmlForProfilingChart($disp_mode, $db, isset($profiling_results) ? $profiling_results : null);
    $missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex($table, $db, $editable);
    $bookmark_created_msg = PMA_getBookmarkCreatedMessage();
    $table_html = PMA_getHtmlForSqlQueryResultsTable(isset($sql_data) ? $sql_data : null, $displayResultsObject, $db, $goto, $pmaThemeImage, $url_query, $disp_mode, $sql_limit_to_append, $editable, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
    $indexes_problems_html = PMA_getHtmlForIndexesProblems(isset($query_type) ? $query_type : null, isset($selectedTables) ? $selectedTables : null, $db);
    $cfgBookmark = PMA_Bookmark_getParams();
    if ($cfgBookmark) {
//.........这里部分代码省略.........
开发者ID:harryboulderdash,项目名称:PlayGFC,代码行数:101,代码来源:sql.lib.php

示例9: PMA_getHtmlForSchemaSnapshot

/**
 * Function to get html for schema snapshot
 *
 * @param string $url_query url query
 *
 * @return string
 */
function PMA_getHtmlForSchemaSnapshot($url_query)
{
    $html = '<h3>' . __('Structure snapshot') . '  [<a href="tbl_tracking.php' . $url_query . '">' . __('Close') . '</a>]</h3>';
    $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']);
    // Get first DROP TABLE/VIEW and CREATE TABLE/VIEW statements
    $drop_create_statements = $data['ddlog'][0]['statement'];
    if (mb_strstr($data['ddlog'][0]['statement'], 'DROP TABLE') || mb_strstr($data['ddlog'][0]['statement'], 'DROP VIEW')) {
        $drop_create_statements .= $data['ddlog'][1]['statement'];
    }
    // Print SQL code
    $html .= PMA_Util::getMessage(sprintf(__('Version %s snapshot (SQL code)'), htmlspecialchars($_REQUEST['version'])), $drop_create_statements);
    // Unserialize snapshot
    $temp = unserialize($data['schema_snapshot']);
    $columns = $temp['COLUMNS'];
    $indexes = $temp['INDEXES'];
    $html .= PMA_getHtmlForColumns($columns);
    if (count($indexes) > 0) {
        $html .= PMA_getHtmlForIndexes($indexes);
    }
    // endif
    $html .= '<br /><hr /><br />';
    return $html;
}
开发者ID:saisai,项目名称:phpmyadmin,代码行数:30,代码来源:tracking.lib.php

示例10: PMA_updateColumns

/**
 * Update the table's structure based on $_REQUEST
 *
 * @param string $db    database name
 * @param string $table table name
 *
 * @return boolean $regenerate              true if error occurred
 *
 */
function PMA_updateColumns($db, $table)
{
    $err_url = 'tbl_structure.php?' . PMA_URL_getCommon($db, $table);
    $regenerate = false;
    $field_cnt = count($_REQUEST['field_name']);
    $key_fields = array();
    $changes = array();
    for ($i = 0; $i < $field_cnt; $i++) {
        if (PMA_columnNeedsAlterTable($i)) {
            $changes[] = 'CHANGE ' . PMA_Table::generateAlter(isset($_REQUEST['field_orig'][$i]) ? $_REQUEST['field_orig'][$i] : '', $_REQUEST['field_name'][$i], $_REQUEST['field_type'][$i], $_REQUEST['field_length'][$i], $_REQUEST['field_attribute'][$i], isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '', isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : 'NOT NULL', $_REQUEST['field_default_type'][$i], $_REQUEST['field_default_value'][$i], isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false, isset($_REQUEST['field_comments'][$i]) ? $_REQUEST['field_comments'][$i] : '', $key_fields, $i, isset($_REQUEST['field_move_to'][$i]) ? $_REQUEST['field_move_to'][$i] : '');
        }
    }
    // end for
    $response = PMA_Response::getInstance();
    if (count($changes) > 0) {
        // Builds the primary keys statements and updates the table
        $key_query = '';
        /**
         * this is a little bit more complex
         *
         * @todo if someone selects A_I when altering a column we need to check:
         *  - no other column with A_I
         *  - the column has an index, if not create one
         *
         */
        // To allow replication, we first select the db to use
        // and then run queries on this db.
        if (!$GLOBALS['dbi']->selectDb($db)) {
            PMA_Util::mysqlDie($GLOBALS['dbi']->getError(), 'USE ' . PMA_Util::backquote($db) . ';', '', $err_url);
        }
        $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
        $sql_query .= implode(', ', $changes) . $key_query;
        $sql_query .= ';';
        $result = $GLOBALS['dbi']->tryQuery($sql_query);
        if ($result !== false) {
            $message = PMA_Message::success(__('Table %1$s has been altered successfully.'));
            $message->addParam($table);
            $response->addHTML(PMA_Util::getMessage($message, $sql_query, 'success'));
        } else {
            // An error happened while inserting/updating a table definition
            $response->isSuccess(false);
            $response->addJSON('message', PMA_Message::rawError(__('Query error') . ':<br />' . $GLOBALS['dbi']->getError()));
            $regenerate = true;
        }
    }
    include_once 'libraries/transformations.lib.php';
    // update field names in relation
    if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) {
        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']) && $GLOBALS['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]);
            }
        }
    }
    return $regenerate;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:73,代码来源:structure.lib.php

示例11: htmlspecialchars

">
            <td><?php 
            echo htmlspecialchars($tablename);
            ?>
</td>
            <td><?php 
            echo $my_link;
            ?>
</td>
            </tr>
            <?php 
            if ($style == 'even') {
                $style = 'odd';
            } else {
                $style = 'even';
            }
        }
    }
    ?>
    </tbody>
    </table>
    <?php 
}
// If available print out database log
if (count($data['ddlog']) > 0) {
    $log = '';
    foreach ($data['ddlog'] as $entry) {
        $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n";
    }
    echo PMA_Util::getMessage(__('Database Log'), $log);
}
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:31,代码来源:db_tracking.php

示例12: PMA_getRelationsParam

$cfgRelation = PMA_getRelationsParam();
/**
 * Check if comments were updated
 * (must be done before displaying the menu tabs)
 */
if (isset($_REQUEST['comment'])) {
    PMA_setDbComment($GLOBALS['db'], $_REQUEST['comment']);
}
require 'libraries/db_common.inc.php';
$url_query .= '&amp;goto=db_operations.php';
// Gets the database structure
$sub_part = '_structure';
require 'libraries/db_info.inc.php';
echo "\n";
if (isset($message)) {
    echo PMA_Util::getMessage($message, $sql_query);
    unset($message);
}
$_REQUEST['db_collation'] = PMA_getDbCollation($GLOBALS['db']);
$is_information_schema = $GLOBALS['dbi']->isSystemSchema($GLOBALS['db']);
$response->addHTML('<div id="boxContainer" data-box-width="300">');
if (!$is_information_schema) {
    if ($cfgRelation['commwork']) {
        /**
         * database comment
         */
        $response->addHTML(PMA_getHtmlForDatabaseComment($GLOBALS['db']));
    }
    $response->addHTML('<div class="operations_half_width">');
    ob_start();
    include 'libraries/display_create_table.lib.php';
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:31,代码来源:db_operations.php

示例13: PMA_updateColumns

/**
 * Update the table's structure based on $_REQUEST
 *
 * @param string $db    database name
 * @param string $table table name
 *
 * @return boolean $regenerate              true if error occurred
 *
 */
function PMA_updateColumns($db, $table)
{
    $err_url = 'tbl_structure.php' . PMA_URL_getCommon(array('db' => $db, 'table' => $table));
    $regenerate = false;
    $field_cnt = count($_REQUEST['field_name']);
    $changes = array();
    $pmatable = new PMA_Table($table, $db);
    $adjust_privileges = array();
    for ($i = 0; $i < $field_cnt; $i++) {
        if (PMA_columnNeedsAlterTable($i)) {
            $changes[] = 'CHANGE ' . PMA_Table::generateAlter(isset($_REQUEST['field_orig'][$i]) ? $_REQUEST['field_orig'][$i] : '', $_REQUEST['field_name'][$i], $_REQUEST['field_type'][$i], $_REQUEST['field_length'][$i], $_REQUEST['field_attribute'][$i], isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '', isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : 'NOT NULL', $_REQUEST['field_default_type'][$i], $_REQUEST['field_default_value'][$i], isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false, isset($_REQUEST['field_comments'][$i]) ? $_REQUEST['field_comments'][$i] : '', isset($_REQUEST['field_virtuality'][$i]) ? $_REQUEST['field_virtuality'][$i] : '', isset($_REQUEST['field_expression'][$i]) ? $_REQUEST['field_expression'][$i] : '', isset($_REQUEST['field_move_to'][$i]) ? $_REQUEST['field_move_to'][$i] : '');
            // find the remembered sort expression
            $sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
            // if the old column name is part of the remembered sort expression
            if (mb_strpos($sorted_col, PMA_Util::backquote($_REQUEST['field_orig'][$i])) !== false) {
                // delete the whole remembered sort expression
                $pmatable->removeUiProp(PMA_Table::PROP_SORTED_COLUMN);
            }
            if (isset($_REQUEST['field_adjust_privileges'][$i]) && !empty($_REQUEST['field_adjust_privileges'][$i]) && $_REQUEST['field_orig'][$i] != $_REQUEST['field_name'][$i]) {
                $adjust_privileges[$_REQUEST['field_orig'][$i]] = $_REQUEST['field_name'][$i];
            }
        }
    }
    // end for
    $response = PMA_Response::getInstance();
    if (count($changes) > 0 || isset($_REQUEST['preview_sql'])) {
        // Builds the primary keys statements and updates the table
        $key_query = '';
        /**
         * this is a little bit more complex
         *
         * @todo if someone selects A_I when altering a column we need to check:
         *  - no other column with A_I
         *  - the column has an index, if not create one
         *
         */
        // To allow replication, we first select the db to use
        // and then run queries on this db.
        if (!$GLOBALS['dbi']->selectDb($db)) {
            PMA_Util::mysqlDie($GLOBALS['dbi']->getError(), 'USE ' . PMA_Util::backquote($db) . ';', false, $err_url);
        }
        $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
        $sql_query .= implode(', ', $changes) . $key_query;
        $sql_query .= ';';
        // If there is a request for SQL previewing.
        if (isset($_REQUEST['preview_sql'])) {
            PMA_previewSQL(count($changes) > 0 ? $sql_query : '');
        }
        $changedToBlob = array();
        // While changing the Column Collation
        // First change to BLOB
        for ($i = 0; $i < $field_cnt; $i++) {
            if (isset($_REQUEST['field_collation'][$i]) && isset($_REQUEST['field_collation_orig'][$i]) && $_REQUEST['field_collation'][$i] !== $_REQUEST['field_collation_orig'][$i]) {
                $secondary_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' CHANGE ' . PMA_Util::backquote($_REQUEST['field_orig'][$i]) . ' ' . PMA_Util::backquote($_REQUEST['field_orig'][$i]) . ' BLOB;';
                $GLOBALS['dbi']->query($secondary_query);
                $changedToBlob[$i] = true;
            } else {
                $changedToBlob[$i] = false;
            }
        }
        // Then make the requested changes
        $result = $GLOBALS['dbi']->tryQuery($sql_query);
        if ($result !== false) {
            $changed_privileges = PMA_adjustColumnPrivileges($db, $table, $adjust_privileges);
            if ($changed_privileges) {
                $message = PMA_Message::success(__('Table %1$s has been altered successfully. Privileges ' . 'have been adjusted.'));
            } else {
                $message = PMA_Message::success(__('Table %1$s has been altered successfully.'));
            }
            $message->addParam($table);
            $response->addHTML(PMA_Util::getMessage($message, $sql_query, 'success'));
        } else {
            // An error happened while inserting/updating a table definition
            // Save the Original Error
            $orig_error = $GLOBALS['dbi']->getError();
            $changes_revert = array();
            // Change back to Orignal Collation and data type
            for ($i = 0; $i < $field_cnt; $i++) {
                if ($changedToBlob[$i]) {
                    $changes_revert[] = 'CHANGE ' . PMA_Table::generateAlter(isset($_REQUEST['field_orig'][$i]) ? $_REQUEST['field_orig'][$i] : '', $_REQUEST['field_name'][$i], $_REQUEST['field_type_orig'][$i], $_REQUEST['field_length_orig'][$i], $_REQUEST['field_attribute_orig'][$i], isset($_REQUEST['field_collation_orig'][$i]) ? $_REQUEST['field_collation_orig'][$i] : '', isset($_REQUEST['field_null_orig'][$i]) ? $_REQUEST['field_null_orig'][$i] : 'NOT NULL', $_REQUEST['field_default_type_orig'][$i], $_REQUEST['field_default_value_orig'][$i], isset($_REQUEST['field_extra_orig'][$i]) ? $_REQUEST['field_extra_orig'][$i] : false, isset($_REQUEST['field_comments_orig'][$i]) ? $_REQUEST['field_comments_orig'][$i] : '', isset($_REQUEST['field_move_to_orig'][$i]) ? $_REQUEST['field_move_to_orig'][$i] : '');
                }
            }
            $revert_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
            $revert_query .= implode(', ', $changes_revert) . '';
            $revert_query .= ';';
            // Column reverted back to original
            $GLOBALS['dbi']->query($revert_query);
            $response->isSuccess(false);
            $response->addJSON('message', PMA_Message::rawError(__('Query error') . ':<br />' . $orig_error));
            $regenerate = true;
        }
//.........这里部分代码省略.........
开发者ID:scriptpazar,项目名称:phpmyadmin,代码行数:101,代码来源:structure.lib.php

示例14: PMA_handleUpdatesForForeignKeys

/**
 * Function to handle foreign key updates
 *
 * @param array  $destination_foreign_db     destination foreign database
 * @param array  $multi_edit_columns_name    multi edit column names
 * @param array  $destination_foreign_table  destination foreign table
 * @param array  $destination_foreign_column destination foreign column
 * @param array  $options_array              options array
 * @param string $table                      current table
 * @param array  $existrel_foreign           db, table, column
 *
 * @return string
 */
function PMA_handleUpdatesForForeignKeys($destination_foreign_db, $multi_edit_columns_name, $destination_foreign_table, $destination_foreign_column, $options_array, $table, $existrel_foreign)
{
    $html_output = '';
    $preview_sql_data = '';
    $display_query = '';
    $seen_error = false;
    $preview_sql = isset($_REQUEST['preview_sql']) ? true : false;
    foreach ($destination_foreign_db as $master_field_md5 => $foreign_db) {
        list($html, $sql_data) = PMA_handleUpdateForForeignKey($multi_edit_columns_name, $master_field_md5, $destination_foreign_table, $destination_foreign_column, $options_array, $existrel_foreign, $table, $seen_error, $display_query, $foreign_db, $preview_sql);
        $html_output .= $html;
        $preview_sql_data .= $sql_data;
    }
    // end foreach
    // If there is a request for SQL previewing.
    if ($preview_sql) {
        PMA_previewSQL($preview_sql_data);
    }
    if (!empty($display_query) && !$seen_error) {
        $GLOBALS['display_query'] = $display_query;
        $html_output = PMA_Util::getMessage(__('Your SQL query has been executed successfully.'), null, 'success');
    }
    return $html_output;
}
开发者ID:1290800466,项目名称:yiyuanduobao,代码行数:36,代码来源:tbl_relation.lib.php

示例15: PMA_changePassDisplayPage

/**
 * Display the page
 *
 * @param string $message     Message
 * @param string $sql_query   SQL query
 * @param array  $_url_params URL parameters
 *
 * @return void
 */
function PMA_changePassDisplayPage($message, $sql_query, $_url_params)
{
    echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
    echo PMA_Util::getMessage($message, $sql_query, 'success');
    echo '<a href="index.php' . PMA_URL_getCommon($_url_params) . ' target="_parent">' . "\n" . '<strong>' . __('Back') . '</strong></a>';
    exit;
}
开发者ID:skduncan,项目名称:pizza-order,代码行数:16,代码来源:user_password.php


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