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


PHP Message::success方法代码示例

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


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

示例1: multiSubmitAction

 /**
  * Handles actions related to multiple tables
  *
  * @return void
  */
 public function multiSubmitAction()
 {
     $action = 'db_structure.php';
     $err_url = 'db_structure.php' . PMA_URL_getCommon(array('db' => $this->db));
     // see bug #2794840; in this case, code path is:
     // db_structure.php -> libraries/mult_submits.inc.php -> sql.php
     // -> db_structure.php and if we got an error on the multi submit,
     // we must display it here and not call again mult_submits.inc.php
     if (!isset($_POST['error']) || false === $_POST['error']) {
         include 'libraries/mult_submits.inc.php';
     }
     if (empty($_POST['message'])) {
         $_POST['message'] = Message::success();
     }
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:20,代码来源:DatabaseStructureController.php

示例2: elseif

    } elseif (!$run_parts) {
        $GLOBALS['dbi']->selectDb($db);
        $result = $GLOBALS['dbi']->tryQuery($sql_query);
        if ($result && !empty($sql_query_views)) {
            $sql_query .= ' ' . $sql_query_views . ';';
            $result = $GLOBALS['dbi']->tryQuery($sql_query_views);
            unset($sql_query_views);
        }
        if (!$result) {
            $message = Message::error($GLOBALS['dbi']->getError());
        }
    }
    if ($query_type == 'drop_tbl' || $query_type == 'empty_tbl' || $query_type == 'row_delete') {
        PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check_value);
    }
    if ($rebuild_database_list) {
        // avoid a problem with the database list navigator
        // when dropping a db from server_databases
        $GLOBALS['pma']->databases->build();
    }
} else {
    if (isset($submit_mult) && ($submit_mult == 'sync_unique_columns_central_list' || $submit_mult == 'delete_unique_columns_central_list' || $submit_mult == 'add_to_central_columns' || $submit_mult == 'remove_from_central_columns' || $submit_mult == 'make_consistent_with_central_list')) {
        if (isset($centralColsError) && $centralColsError !== true) {
            $message = $centralColsError;
        } else {
            $message = Message::success(__('Success!'));
        }
    } else {
        $message = Message::success(__('No change'));
    }
}
开发者ID:netroby,项目名称:phpmyadmin,代码行数:31,代码来源:mult_submits.inc.php

示例3: PMA_addUserAndCreateDatabase

/**
 * Prepares queries for adding users and
 * also create database and return query and message
 *
 * @param boolean $_error         whether user create or not
 * @param string  $real_sql_query SQL query for add a user
 * @param string  $sql_query      SQL query to be displayed
 * @param string  $username       username
 * @param string  $hostname       host name
 * @param string  $dbname         database name
 *
 * @return array  $sql_query, $message
 */
function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, $username, $hostname, $dbname)
{
    if ($_error || !empty($real_sql_query) && !$GLOBALS['dbi']->tryQuery($real_sql_query)) {
        $_REQUEST['createdb-1'] = $_REQUEST['createdb-2'] = $_REQUEST['createdb-3'] = null;
        $message = Message::rawError($GLOBALS['dbi']->getError());
    } else {
        $message = Message::success(__('You have added a new user.'));
    }
    if (isset($_REQUEST['createdb-1'])) {
        // Create database with same name and grant all privileges
        $q = 'CREATE DATABASE IF NOT EXISTS ' . Util::backquote(Util::sqlAddSlashes($username)) . ';';
        $sql_query .= $q;
        if (!$GLOBALS['dbi']->tryQuery($q)) {
            $message = Message::rawError($GLOBALS['dbi']->getError());
        }
        /**
         * Reload the navigation
         */
        $GLOBALS['reload'] = true;
        $GLOBALS['db'] = $username;
        $q = 'GRANT ALL PRIVILEGES ON ' . Util::backquote(Util::escapeMysqlWildcards(Util::sqlAddSlashes($username))) . '.* TO \'' . Util::sqlAddSlashes($username) . '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
        $sql_query .= $q;
        if (!$GLOBALS['dbi']->tryQuery($q)) {
            $message = Message::rawError($GLOBALS['dbi']->getError());
        }
    }
    if (isset($_REQUEST['createdb-2'])) {
        // Grant all privileges on wildcard name (username\_%)
        $q = 'GRANT ALL PRIVILEGES ON ' . Util::backquote(Util::sqlAddSlashes($username) . '\\_%') . '.* TO \'' . Util::sqlAddSlashes($username) . '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
        $sql_query .= $q;
        if (!$GLOBALS['dbi']->tryQuery($q)) {
            $message = Message::rawError($GLOBALS['dbi']->getError());
        }
    }
    if (isset($_REQUEST['createdb-3'])) {
        // Grant all privileges on the specified database to the new user
        $q = 'GRANT ALL PRIVILEGES ON ' . Util::backquote(Util::sqlAddSlashes($dbname)) . '.* TO \'' . Util::sqlAddSlashes($username) . '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
        $sql_query .= $q;
        if (!$GLOBALS['dbi']->tryQuery($q)) {
            $message = Message::rawError($GLOBALS['dbi']->getError());
        }
    }
    return array($sql_query, $message);
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:57,代码来源:server_privileges.lib.php

示例4: list

            $response->addJSON('message', Message::error(__('No databases selected.')));
        } else {
            PMA_sendHeaderLocation($uri);
        }
        exit;
    }
}
// end if (ensures db exists)
/**
 * Changes database charset if requested by the user
 */
if (isset($_REQUEST['submitcollation']) && isset($_REQUEST['db_collation']) && !empty($_REQUEST['db_collation'])) {
    list($db_charset) = explode('_', $_REQUEST['db_collation']);
    $sql_query = 'ALTER DATABASE ' . PMA\libraries\Util::backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($_REQUEST['db_collation']);
    $result = $GLOBALS['dbi']->query($sql_query);
    $message = Message::success();
    unset($db_charset);
    /**
     * If we are in an Ajax request, let us stop the execution here. Necessary for
     * db charset change action on db_operations.php.  If this causes a bug on
     * other pages, we might have to move this to a different location.
     */
    if ($GLOBALS['is_ajax_request'] == true) {
        $response = PMA\libraries\Response::getInstance();
        $response->setRequestStatus($message->isSuccess());
        $response->addJSON('message', $message);
        exit;
    }
}
/**
 * Set parameters for links
开发者ID:pjiahao,项目名称:phpmyadmin,代码行数:31,代码来源:db_common.inc.php

示例5: PMA_dropMultiDatabases

/**
 * Deal with Drops multiple databases
 *
 * @return null
 */
function PMA_dropMultiDatabases()
{
    if (!isset($_REQUEST['selected_dbs']) && !isset($_REQUEST['query_type'])) {
        $message = Message::error(__('No databases selected.'));
    } else {
        $action = 'server_databases.php';
        $submit_mult = 'drop_db';
        $err_url = 'server_databases.php' . PMA_URL_getCommon();
        if (isset($_REQUEST['selected_dbs']) && !isset($_REQUEST['is_js_confirmed'])) {
            $selected_db = $_REQUEST['selected_dbs'];
        }
        if (isset($_REQUEST['is_js_confirmed'])) {
            $_REQUEST = array('query_type' => $submit_mult, 'selected' => $_REQUEST['selected_dbs'], 'mult_btn' => __('Yes'), 'db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
        }
        //the following variables will be used on mult_submits.inc.php
        global $query_type, $selected, $mult_btn;
        include 'libraries/mult_submits.inc.php';
        unset($action, $submit_mult, $err_url, $selected_db, $GLOBALS['db']);
        if (empty($message)) {
            if ($mult_btn == __('Yes')) {
                $number_of_databases = count($selected);
            } else {
                $number_of_databases = 0;
            }
            $message = Message::success(_ngettext('%1$d database has been dropped successfully.', '%1$d databases have been dropped successfully.', $number_of_databases));
            $message->addParam($number_of_databases);
        }
    }
    if ($GLOBALS['is_ajax_request'] && $message instanceof PMA\libraries\Message) {
        $response = PMA\libraries\Response::getInstance();
        $response->setRequestStatus($message->isSuccess());
        $response->addJSON('message', $message);
        exit;
    }
}
开发者ID:netroby,项目名称:phpmyadmin,代码行数:40,代码来源:server_databases.lib.php

示例6: PMA_getQueryResponseForResultsReturned

/**
 * Function to display results when the executed query returns non empty results
 *
 * @param object         $result               executed query results
 * @param array          $analyzed_sql_results analysed sql results
 * @param string         $db                   current database
 * @param string         $table                current table
 * @param string         $message              message to show
 * @param array          $sql_data             sql data
 * @param DisplayResults $displayResultsObject Instance of DisplayResults
 * @param string         $pmaThemeImage        uri of the theme image
 * @param int            $unlim_num_rows       unlimited number of rows
 * @param int            $num_rows             number of rows
 * @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 string html
 */
function PMA_getQueryResponseForResultsReturned($result, $analyzed_sql_results, $db, $table, $message, $sql_data, $displayResultsObject, $pmaThemeImage, $unlim_num_rows, $num_rows, $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\libraries\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)
    $updatableView = false;
    $statement = $analyzed_sql_results['statement'];
    if ($statement instanceof SqlParser\Statements\SelectStatement) {
        if (!empty($statement->expr)) {
            if ($statement->expr[0]->expr === '*') {
                $_table = new Table($table, $db);
                $updatableView = $_table->isUpdatableView();
            }
        }
    }
    $has_unique = PMA_resultSetContainsUniqueKey($db, $table, $fields_meta);
    $just_one_table = PMA_resultSetHasJustOneTable($fields_meta);
    $editable = ($has_unique || $GLOBALS['cfg']['RowActionLinksWithoutUnique'] || $updatableView) && $just_one_table;
    $displayParts = array('edit_lnk' => $displayResultsObject::UPDATE_ROW, 'del_lnk' => $displayResultsObject::DELETE_ROW, 'sort_lnk' => '1', 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '0', 'pview_lnk' => '1');
    if (!empty($table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
        $displayParts = array('edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'sort_lnk' => '1', 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1');
    }
    if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
        $displayParts = array('edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'sort_lnk' => '0', 'nav_bar' => '0', 'bkm_form' => '0', 'text_btn' => '0', 'pview_lnk' => '0');
    }
    if (isset($_REQUEST['table_maintenance'])) {
        $scripts->addFile('makegrid.js');
        $scripts->addFile('sql.js');
        $table_maintenance_html = '';
        if (isset($message)) {
            $message = Message::success($message);
            $table_maintenance_html = PMA\libraries\Util::getMessage($message, $GLOBALS['sql_query'], 'success');
        }
        $table_maintenance_html .= PMA_getHtmlForSqlQueryResultsTable($displayResultsObject, $pmaThemeImage, $url_query, $displayParts, 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;
    }
    $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($url_query, $db, isset($profiling_results) ? $profiling_results : array());
    $missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex($table, $db, $editable, $has_unique);
    $bookmark_created_msg = PMA_getBookmarkCreatedMessage();
    $table_html = PMA_getHtmlForSqlQueryResultsTable($displayResultsObject, $pmaThemeImage, $url_query, $displayParts, $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) {
        $bookmark_support_html = PMA_getHtmlForBookmark($displayParts, $cfgBookmark, $sql_query, $db, $table, isset($complete_query) ? $complete_query : $sql_query, $cfgBookmark['user']);
//.........这里部分代码省略.........
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:101,代码来源:sql.lib.php

示例7: updateColumns

 /**
  * Update the table's structure based on $_REQUEST
  *
  * @return boolean $regenerate              true if error occurred
  *
  */
 protected function updateColumns()
 {
     $err_url = 'tbl_structure.php' . PMA_URL_getCommon(array('db' => $this->db, 'table' => $this->table));
     $regenerate = false;
     $field_cnt = count($_REQUEST['field_name']);
     $changes = array();
     $adjust_privileges = array();
     for ($i = 0; $i < $field_cnt; $i++) {
         if (!$this->columnNeedsAlterTable($i)) {
             continue;
         }
         $changes[] = 'CHANGE ' . Table::generateAlter(Util_lib\get($_REQUEST, "field_orig.{$i}", ''), $_REQUEST['field_name'][$i], $_REQUEST['field_type'][$i], $_REQUEST['field_length'][$i], $_REQUEST['field_attribute'][$i], Util_lib\get($_REQUEST, "field_collation.{$i}", ''), Util_lib\get($_REQUEST, "field_null.{$i}", 'NOT NULL'), $_REQUEST['field_default_type'][$i], $_REQUEST['field_default_value'][$i], Util_lib\get($_REQUEST, "field_extra.{$i}", false), Util_lib\get($_REQUEST, "field_comments.{$i}", ''), Util_lib\get($_REQUEST, "field_virtuality.{$i}", ''), Util_lib\get($_REQUEST, "field_expression.{$i}", ''), Util_lib\get($_REQUEST, "field_move_to.{$i}", ''));
         // find the remembered sort expression
         $sorted_col = $this->table_obj->getUiProp(Table::PROP_SORTED_COLUMN);
         // if the old column name is part of the remembered sort expression
         if (mb_strpos($sorted_col, Util::backquote($_REQUEST['field_orig'][$i])) !== false) {
             // delete the whole remembered sort expression
             $this->table_obj->removeUiProp(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
     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 (!$this->dbi->selectDb($this->db)) {
             Util::mysqlDie($this->dbi->getError(), 'USE ' . Util::backquote($this->db) . ';', false, $err_url);
         }
         $sql_query = 'ALTER TABLE ' . Util::backquote($this->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 : '');
         }
         $columns_with_index = $this->dbi->getTable($this->db, $this->table)->getColumnsWithIndex(PMA_Index::PRIMARY | PMA_Index::UNIQUE | PMA_Index::INDEX | PMA_Index::SPATIAL | PMA_Index::FULLTEXT);
         $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] && !in_array($_REQUEST['field_orig'][$i], $columns_with_index)) {
                 $secondary_query = 'ALTER TABLE ' . Util::backquote($this->table) . ' CHANGE ' . Util::backquote($_REQUEST['field_orig'][$i]) . ' ' . Util::backquote($_REQUEST['field_orig'][$i]) . ' BLOB;';
                 $this->dbi->query($secondary_query);
                 $changedToBlob[$i] = true;
             } else {
                 $changedToBlob[$i] = false;
             }
         }
         // Then make the requested changes
         $result = $this->dbi->tryQuery($sql_query);
         if ($result !== false) {
             $changed_privileges = $this->adjustColumnPrivileges($adjust_privileges);
             if ($changed_privileges) {
                 $message = Message::success(__('Table %1$s has been altered successfully. Privileges ' . 'have been adjusted.'));
             } else {
                 $message = Message::success(__('Table %1$s has been altered successfully.'));
             }
             $message->addParam($this->table);
             $this->response->addHTML(Util::getMessage($message, $sql_query, 'success'));
         } else {
             // An error happened while inserting/updating a table definition
             // Save the Original Error
             $orig_error = $this->dbi->getError();
             $changes_revert = array();
             // Change back to Original Collation and data type
             for ($i = 0; $i < $field_cnt; $i++) {
                 if ($changedToBlob[$i]) {
                     $changes_revert[] = 'CHANGE ' . Table::generateAlter(Util_lib\get($_REQUEST, "field_orig.{$i}", ''), $_REQUEST['field_name'][$i], $_REQUEST['field_type_orig'][$i], $_REQUEST['field_length_orig'][$i], $_REQUEST['field_attribute_orig'][$i], Util_lib\get($_REQUEST, "field_collation_orig.{$i}", ''), Util_lib\get($_REQUEST, "field_null_orig.{$i}", 'NOT NULL'), $_REQUEST['field_default_type_orig'][$i], $_REQUEST['field_default_value_orig'][$i], Util_lib\get($_REQUEST, "field_extra_orig.{$i}", false), Util_lib\get($_REQUEST, "field_comments_orig.{$i}", ''), Util_lib\get($_REQUEST, "field_virtuality_orig.{$i}", ''), Util_lib\get($_REQUEST, "field_expression_orig.{$i}", ''), Util_lib\get($_REQUEST, "field_move_to_orig.{$i}", ''));
                 }
             }
             $revert_query = 'ALTER TABLE ' . Util::backquote($this->table) . ' ';
             $revert_query .= implode(', ', $changes_revert) . '';
             $revert_query .= ';';
             // Column reverted back to original
             $this->dbi->query($revert_query);
             $this->response->setRequestStatus(false);
             $this->response->addJSON('message', Message::rawError(__('Query error') . ':<br />' . $orig_error));
             $regenerate = true;
         }
     }
     // update field names in relation
     if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) {
//.........这里部分代码省略.........
开发者ID:Gemorroj,项目名称:phpmyadmin,代码行数:101,代码来源:TableStructureController.php

示例8: PMA_RTN_flushPrivileges

/**
 * Flush privileges and get message
 *
 * @param bool $flushPrivileges Flush privileges
 *
 * @return PMA\libraries\Message
 */
function PMA_RTN_flushPrivileges($flushPrivileges)
{
    if ($flushPrivileges) {
        // Flush the Privileges
        $flushPrivQuery = 'FLUSH PRIVILEGES;';
        $GLOBALS['dbi']->query($flushPrivQuery);
        $message = PMA\libraries\Message::success(__('Routine %1$s has been modified. Privileges have been adjusted.'));
    } else {
        $message = PMA\libraries\Message::success(__('Routine %1$s has been modified.'));
    }
    $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
    return $message;
}
开发者ID:wp-cloud,项目名称:phpmyadmin,代码行数:20,代码来源:rte_routines.lib.php

示例9: PMA_moveRepeatingGroup

/**
 * move the repeating group of columns to a new table
 *
 * @param string $repeatingColumns comma separated list of repeating group columns
 * @param string $primary_columns  comma separated list of column in primary key
 * of $table
 * @param string $newTable         name of the new table to be created
 * @param string $newColumn        name of the new column in the new table
 * @param string $table            current table
 * @param string $db               current database
 *
 * @return array
 */
function PMA_moveRepeatingGroup($repeatingColumns, $primary_columns, $newTable, $newColumn, $table, $db)
{
    $repeatingColumnsArr = (array) Util::backquote(explode(', ', $repeatingColumns));
    $primary_columns = implode(',', Util::backquote(explode(',', $primary_columns)));
    $query1 = 'CREATE TABLE ' . Util::backquote($newTable);
    $query2 = 'ALTER TABLE ' . Util::backquote($table);
    $message = Message::success(sprintf(__('Selected repeating group has been moved to the table \'%s\''), htmlspecialchars($table)));
    $first = true;
    $error = false;
    foreach ($repeatingColumnsArr as $repeatingColumn) {
        if (!$first) {
            $query1 .= ' UNION ';
        }
        $first = false;
        $query1 .= ' SELECT ' . $primary_columns . ',' . $repeatingColumn . ' as ' . Util::backquote($newColumn) . ' FROM ' . Util::backquote($table);
        $query2 .= ' DROP ' . $repeatingColumn . ',';
    }
    $query2 = trim($query2, ',');
    $queries = array($query1, $query2);
    $GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
    foreach ($queries as $query) {
        if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
            $message = Message::error(__('Error in processing!'));
            $message->addMessage('<br /><br />');
            $message->addMessage(Message::rawError($GLOBALS['dbi']->getError($GLOBALS['userlink'])));
            $error = true;
            break;
        }
    }
    return array('queryError' => $error, 'message' => $message);
}
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:44,代码来源:normalization.lib.php

示例10: PMA_createTrackingVersion

/**
 * Function to create the tracking version
 *
 * @return string HTML of the success message
 */
function PMA_createTrackingVersion()
{
    $html = '';
    $tracking_set = PMA_getTrackingSet();
    $versionCreated = Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set, $GLOBALS['dbi']->getTable($GLOBALS['db'], $GLOBALS['table'])->isView());
    if ($versionCreated) {
        $msg = Message::success(sprintf(__('Version %1$s was created, tracking for %2$s is active.'), htmlspecialchars($_REQUEST['version']), htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])));
        $html .= $msg->getDisplay();
    }
    return $html;
}
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:16,代码来源:tracking.lib.php

示例11: dropDatabasesAction

 /**
  * Handles dropping multiple databases
  *
  * @return void
  */
 public function dropDatabasesAction()
 {
     if (!isset($_REQUEST['selected_dbs'])) {
         $message = Message::error(__('No databases selected.'));
     } else {
         $action = 'server_databases.php';
         $err_url = $action . PMA_URL_getCommon();
         $GLOBALS['submit_mult'] = 'drop_db';
         $GLOBALS['mult_btn'] = __('Yes');
         include 'libraries/mult_submits.inc.php';
         if (empty($message)) {
             // no error message
             $number_of_databases = count($selected);
             $message = Message::success(_ngettext('%1$d database has been dropped successfully.', '%1$d databases have been dropped successfully.', $number_of_databases));
             $message->addParam($number_of_databases);
         }
     }
     if ($message instanceof Message) {
         $this->response->setRequestStatus($message->isSuccess());
         $this->response->addJSON('message', $message);
     }
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:27,代码来源:ServerDatabasesController.php

示例12: indexAction

 /**
  * Index action
  *
  * @return void
  */
 public function indexAction()
 {
     // Add/Remove favorite tables using Ajax request.
     if ($GLOBALS['is_ajax_request'] && !empty($_REQUEST['favorite_table'])) {
         $this->addRemoveFavoriteTablesAction();
         return;
     }
     $this->response->getHeader()->getScripts()->addFiles(array('db_structure.js', 'tbl_change.js', 'jquery/jquery-ui-timepicker-addon.js'));
     // Drops/deletes/etc. multiple tables if required
     if (!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']) || isset($_POST['mult_btn'])) {
         $action = 'db_structure.php';
         $err_url = 'db_structure.php' . PMA_URL_getCommon(array('db' => $this->db));
         // see bug #2794840; in this case, code path is:
         // db_structure.php -> libraries/mult_submits.inc.php -> sql.php
         // -> db_structure.php and if we got an error on the multi submit,
         // we must display it here and not call again mult_submits.inc.php
         if (!isset($_POST['error']) || false === $_POST['error']) {
             include 'libraries/mult_submits.inc.php';
         }
         if (empty($_POST['message'])) {
             $_POST['message'] = Message::success();
         }
     }
     $this->_url_query .= '&amp;goto=db_structure.php';
     // Gets the database structure
     $sub_part = '_structure';
     list($tables, $num_tables, $total_num_tables, , $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos) = Util::getDbInfo($GLOBALS['db'], isset($sub_part) ? $sub_part : '');
     $this->_tables = $tables;
     // updating $tables seems enough for #11376, but updating other
     // variables too in case they may cause some other problem.
     $this->_num_tables = $num_tables;
     $this->_pos = $pos;
     $this->_db_is_system_schema = $db_is_system_schema;
     $this->_total_num_tables = $total_num_tables;
     $this->_is_show_stats = $is_show_stats;
     // If there is an Ajax request for real row count of a table.
     if ($GLOBALS['is_ajax_request'] && isset($_REQUEST['real_row_count']) && $_REQUEST['real_row_count'] == true) {
         $this->handleRealRowCountRequestAction();
         return;
     }
     include_once 'libraries/replication.inc.php';
     PageSettings::showGroup('DbStructure');
     $db_collation = PMA_getDbCollation($this->db);
     $titles = Util::buildActionTitles();
     // 1. No tables
     if ($this->_num_tables == 0) {
         $this->response->addHTML(Message::notice(__('No tables found in database.')));
         if (empty($db_is_system_schema)) {
             $this->response->addHTML(PMA_getHtmlForCreateTable($this->db));
         }
         return;
     }
     // else
     // 2. Shows table information
     /**
      * Displays the tables list
      */
     $this->response->addHTML('<div id="tableslistcontainer">');
     $_url_params = array('pos' => $this->_pos, 'db' => $this->db);
     // Add the sort options if they exists
     if (isset($_REQUEST['sort'])) {
         $_url_params['sort'] = $_REQUEST['sort'];
     }
     if (isset($_REQUEST['sort_order'])) {
         $_url_params['sort_order'] = $_REQUEST['sort_order'];
     }
     $this->response->addHTML(Util::getListNavigator($this->_total_num_tables, $this->_pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']));
     // table form
     $this->response->addHTML(Template::get('database/structure/table_header')->render(array('db' => $this->db, 'db_is_system_schema' => $this->_db_is_system_schema, 'replication' => $GLOBALS['replication_info']['slave']['status'])));
     $i = $sum_entries = 0;
     $overhead_check = '';
     $create_time_all = '';
     $update_time_all = '';
     $check_time_all = '';
     $num_columns = $GLOBALS['cfg']['PropertiesNumColumns'] > 1 ? ceil($this->_num_tables / $GLOBALS['cfg']['PropertiesNumColumns']) + 1 : 0;
     $row_count = 0;
     $sum_size = (double) 0;
     $overhead_size = (double) 0;
     $hidden_fields = array();
     $odd_row = true;
     $overall_approx_rows = false;
     // Instance of RecentFavoriteTable class.
     $fav_instance = RecentFavoriteTable::getInstance('favorite');
     foreach ($this->_tables as $keyname => $current_table) {
         // Get valid statistics whatever is the table type
         $drop_query = '';
         $drop_message = '';
         $overhead = '';
         $table_is_view = false;
         $table_encoded = urlencode($current_table['TABLE_NAME']);
         // Sets parameters for links
         $tbl_url_query = $this->_url_query . '&amp;table=' . $table_encoded;
         // do not list the previous table's size info for a view
         list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view, $sum_size) = $this->getStuffForEngineTypeTable($current_table, $sum_size, $overhead_size);
         $curTable = $this->dbi->getTable($this->db, $current_table['TABLE_NAME']);
//.........这里部分代码省略.........
开发者ID:sergiorocha1004,项目名称:phpmyadmin,代码行数:101,代码来源:DatabaseStructureController.php

示例13: PMA_handleControlRequest

/**
 * handle control requests
 *
 * @return NULL
 */
function PMA_handleControlRequest()
{
    if (isset($_REQUEST['sr_take_action'])) {
        $refresh = false;
        $result = false;
        $messageSuccess = null;
        $messageError = null;
        if (isset($_REQUEST['slave_changemaster'])) {
            $result = PMA_handleRequestForSlaveChangeMaster();
        } elseif (isset($_REQUEST['sr_slave_server_control'])) {
            $result = PMA_handleRequestForSlaveServerControl();
            $refresh = true;
            switch ($_REQUEST['sr_slave_action']) {
                case 'start':
                    $messageSuccess = __('Replication started successfully.');
                    $messageError = __('Error starting replication.');
                    break;
                case 'stop':
                    $messageSuccess = __('Replication stopped successfully.');
                    $messageError = __('Error stopping replication.');
                    break;
                case 'reset':
                    $messageSuccess = __('Replication resetting successfully.');
                    $messageError = __('Error resetting replication.');
                    break;
                default:
                    $messageSuccess = __('Success.');
                    $messageError = __('Error.');
                    break;
            }
        } elseif (isset($_REQUEST['sr_slave_skip_error'])) {
            $result = PMA_handleRequestForSlaveSkipError();
        }
        if ($refresh) {
            $response = PMA\libraries\Response::getInstance();
            if ($response->isAjax()) {
                $response->setRequestStatus($result);
                $response->addJSON('message', $result ? Message::success($messageSuccess) : Message::error($messageError));
            } else {
                PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . 'server_replication.php' . PMA_URL_getCommon($GLOBALS['url_params'], 'text'));
            }
        }
        unset($refresh);
    }
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:50,代码来源:replication_gui.lib.php

示例14: _setMessageInformation

 /**
  * Set the content that needs to be shown in message
  *
  * @param string  $sorted_column_message the message for sorted column
  * @param array   $analyzed_sql_results  the analyzed query
  * @param integer $total                 the total number of rows returned by
  *                                       the SQL query without any
  *                                       programmatically appended LIMIT clause
  * @param integer $pos_next              the offset for next page
  * @param string  $pre_count             the string renders before row count
  * @param string  $after_count           the string renders after row count
  *
  * @return Message $message an object of Message
  *
  * @access  private
  *
  * @see     getTable()
  */
 private function _setMessageInformation($sorted_column_message, $analyzed_sql_results, $total, $pos_next, $pre_count, $after_count)
 {
     $unlim_num_rows = $this->__get('unlim_num_rows');
     // To use in isset()
     if (!empty($analyzed_sql_results['statement']->limit)) {
         $first_shown_rec = $analyzed_sql_results['statement']->limit->offset;
         $row_count = $analyzed_sql_results['statement']->limit->rowCount;
         if ($row_count < $total) {
             $last_shown_rec = $first_shown_rec + $row_count - 1;
         } else {
             $last_shown_rec = $first_shown_rec + $total - 1;
         }
     } elseif ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS || $pos_next > $total) {
         $first_shown_rec = $_SESSION['tmpval']['pos'];
         $last_shown_rec = $total - 1;
     } else {
         $first_shown_rec = $_SESSION['tmpval']['pos'];
         $last_shown_rec = $pos_next - 1;
     }
     $table = new Table($this->__get('table'), $this->__get('db'));
     if ($table->isView() && $total == $GLOBALS['cfg']['MaxExactCountViews']) {
         $message = Message::notice(__('This view has at least this number of rows. ' . 'Please refer to %sdocumentation%s.'));
         $message->addParam('[doc@cfg_MaxExactCount]');
         $message->addParam('[/doc]');
         $message_view_warning = Util::showHint($message);
     } else {
         $message_view_warning = false;
     }
     $message = Message::success(__('Showing rows %1s - %2s'));
     $message->addParam($first_shown_rec);
     if ($message_view_warning !== false) {
         $message->addParam('... ' . $message_view_warning, false);
     } else {
         $message->addParam($last_shown_rec);
     }
     $message->addMessage('(');
     if ($message_view_warning === false) {
         if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
             $message_total = Message::notice($pre_count . __('%1$d total, %2$d in query'));
             $message_total->addParam($total);
             $message_total->addParam($unlim_num_rows);
         } else {
             $message_total = Message::notice($pre_count . __('%d total'));
             $message_total->addParam($total);
         }
         if (!empty($after_count)) {
             $message_total->addMessage($after_count);
         }
         $message->addMessage($message_total, '');
         $message->addMessage(', ', '');
     }
     $message_qt = Message::notice(__('Query took %01.4f seconds.') . ')');
     $message_qt->addParam($this->__get('querytime'));
     $message->addMessage($message_qt, '');
     if (!is_null($sorted_column_message)) {
         $message->addMessage($sorted_column_message, '');
     }
     return $message;
 }
开发者ID:rugbyprof,项目名称:phpmyadmin,代码行数:77,代码来源:DisplayResults.php

示例15: getMessageForInsertedRows

 /**
  * get Message for number of inserted rows
  *
  * shorthand for getting a customized message
  *
  * @param integer $rows Number of rows
  *
  * @return Message
  * @static
  */
 public static function getMessageForInsertedRows($rows)
 {
     $message = Message::success(_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows));
     $message->addParam($rows);
     return $message;
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:16,代码来源:Message.php


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