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


PHP PMA_Message::getDisplay方法代码示例

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


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

示例1: testGetDisplay

 /**
  * getDisplay test
  */
 public function testGetDisplay()
 {
     $this->object->setMessage('Test Message');
     $this->assertEquals(
         '<div class="notice">Test Message</div>',
         $this->object->getDisplay()
     );
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:11,代码来源:PMA_Message_test.php

示例2: PMA_getHtmlForUserOverview

/**
 * Get HTML snippet for display user overview page
 *
 * @param string $pmaThemeImage a image source link
 * @param string $text_dir      text directory
 *
 * @return string $html_output
 */
function PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
{
    $html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usrlist.png') . __('Users overview') . "\n" . '</h2>' . "\n";
    $password_column = 'Password';
    if (PMA_Util::getServerType() == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50706) {
        $password_column = 'authentication_string';
    }
    // $sql_query is for the initial-filtered,
    // $sql_query_all is for counting the total no. of users
    $sql_query = $sql_query_all = 'SELECT *,' . " IF(`" . $password_column . "` = _latin1 '', 'N', 'Y') AS 'Password'" . ' FROM `mysql`.`user`';
    $sql_query .= isset($_REQUEST['initial']) ? PMA_rangeOfUsers($_REQUEST['initial']) : '';
    $sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
    $sql_query_all .= ' ;';
    $res = $GLOBALS['dbi']->tryQuery($sql_query, null, PMA_DatabaseInterface::QUERY_STORE);
    $res_all = $GLOBALS['dbi']->tryQuery($sql_query_all, null, PMA_DatabaseInterface::QUERY_STORE);
    if (!$res) {
        // the query failed! This may have two reasons:
        // - the user does not have enough privileges
        // - the privilege tables use a structure of an earlier version.
        // so let's try a more simple query
        $GLOBALS['dbi']->freeResult($res);
        $GLOBALS['dbi']->freeResult($res_all);
        $sql_query = 'SELECT * FROM `mysql`.`user`';
        $res = $GLOBALS['dbi']->tryQuery($sql_query, null, PMA_DatabaseInterface::QUERY_STORE);
        if (!$res) {
            $html_output .= PMA_getHtmlForViewUsersError();
            $html_output .= PMA_getAddUserHtmlFieldset();
        } else {
            // This message is hardcoded because I will replace it by
            // a automatic repair feature soon.
            $raw = 'Your privilege table structure seems to be older than' . ' this MySQL version!<br />' . 'Please run the <code>mysql_upgrade</code> command' . '(<code>mysql_fix_privilege_tables</code> on older systems)' . ' that should be included in your MySQL server distribution' . ' to solve this problem!';
            $html_output .= PMA_Message::rawError($raw)->getDisplay();
        }
        $GLOBALS['dbi']->freeResult($res);
    } else {
        $db_rights = PMA_getDbRightsForUserOverview();
        // for all initials, even non A-Z
        $array_initials = array();
        /**
         * Displays the initials
         * Also not necessary if there is less than 20 privileges
         */
        if ($GLOBALS['dbi']->numRows($res_all) > 20) {
            $html_output .= PMA_getHtmlForInitials($array_initials);
        }
        /**
         * Display the user overview
         * (if less than 50 users, display them immediately)
         */
        if (isset($_REQUEST['initial']) || isset($_REQUEST['showall']) || $GLOBALS['dbi']->numRows($res) < 50) {
            $html_output .= PMA_getUsersOverview($res, $db_rights, $pmaThemeImage, $text_dir);
        } else {
            $html_output .= PMA_getAddUserHtmlFieldset();
        }
        // end if (display overview)
        if (!$GLOBALS['is_ajax_request'] || !empty($_REQUEST['ajax_page_request'])) {
            $flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly ' . 'from MySQL\'s privilege tables. The content of these tables ' . 'may differ from the privileges the server uses, ' . 'if they have been changed manually. In this case, ' . 'you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE);
            $flushLink = '<a href="server_privileges.php' . PMA_URL_getCommon(array('flush_privileges' => 1)) . '" id="reload_privileges_anchor">';
            $flushnote->addParam($flushLink, false);
            $flushnote->addParam('</a>', false);
            $html_output .= $flushnote->getDisplay();
        }
    }
    return $html_output;
}
开发者ID:siddhantsomani,项目名称:phpmyadmin,代码行数:73,代码来源:server_privileges.lib.php

示例3: PMA_ajaxResponse

/**
 * function that generates a json output for an ajax request and ends script
 * execution
 *
 * @param PMA_Message|string $message    message string containing the
 *                                       html of the message
 * @param bool               $success    success whether the ajax request
 *                                       was successfull
 * @param array              $extra_data extra data  optional -
 *                                       any other data as part of the json request
 *
 * @return nothing
 */
function PMA_ajaxResponse($message, $success = true, $extra_data = array())
{
    $response = array();
    if ($success == true) {
        $response['success'] = true;
        if ($message instanceof PMA_Message) {
            $response['message'] = $message->getDisplay();
        } else {
            $response['message'] = $message;
        }
    } else {
        $response['success'] = false;
        if ($message instanceof PMA_Message) {
            $response['error'] = $message->getDisplay();
        } else {
            $response['error'] = $message;
        }
    }
    // If extra_data has been provided, append it to the response array
    if (!empty($extra_data) && count($extra_data) > 0) {
        $response = array_merge($response, $extra_data);
    }
    // Set the Content-Type header to JSON so that jQuery parses the
    // response correctly.
    //
    // At this point, other headers might have been sent;
    // even if $GLOBALS['is_header_sent'] is true,
    // we have to send these additional headers.
    header('Cache-Control: no-cache');
    header("Content-Type: application/json");
    echo json_encode($response);
    if (!defined('TESTSUITE')) {
        exit;
    }
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:48,代码来源:common.lib.php

示例4: PMA_getHtmlForDisplayUserOverviewPage

/**
 * Get HTML snippet for display user overview page
 *
 * @param string $link_edit         standard link to edit privileges
 * @param string $pmaThemeImage     a image source link
 * @param string $text_dir          text directory
 * @param string $conditional_class if ajaxable 'Ajax' otherwise ''
 * @param string $link_export       standard link to export privileges
 *
 * @return string $html_output
 */
function PMA_getHtmlForDisplayUserOverviewPage($link_edit, $pmaThemeImage, $text_dir, $conditional_class, $link_export)
{
    $html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usrlist.png') . __('Users overview') . "\n" . '</h2>' . "\n";
    $sql_query = 'SELECT *,' . "       IF(`Password` = _latin1 '', 'N', 'Y') AS 'Password'" . '  FROM `mysql`.`user`';
    $sql_query .= isset($_REQUEST['initial']) ? PMA_rangeOfUsers($_REQUEST['initial']) : '';
    $sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
    $res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE);
    if (!$res) {
        // the query failed! This may have two reasons:
        // - the user does not have enough privileges
        // - the privilege tables use a structure of an earlier version.
        // so let's try a more simple query
        $sql_query = 'SELECT * FROM `mysql`.`user`';
        $res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE);
        if (!$res) {
            $html_output .= PMA_Message::error(__('No Privileges'))->getDisplay();
            PMA_DBI_free_result($res);
            unset($res);
        } else {
            // This message is hardcoded because I will replace it by
            // a automatic repair feature soon.
            $raw = 'Your privilege table structure seems to be older than' . ' this MySQL version!<br />' . 'Please run the <code>mysql_upgrade</code> command' . '(<code>mysql_fix_privilege_tables</code> on older systems)' . ' that should be included in your MySQL server distribution' . ' to solve this problem!';
            $html_output .= PMA_Message::rawError($raw)->getDisplay();
        }
    } else {
        $db_rights = PMA_getDbRightsForUserOverview();
        // for all initials, even non A-Z
        $array_initials = array();
        /**
         * Displays the initials
         * Also not necassary if there is less than 20 privileges
         */
        if (PMA_DBI_num_rows($res) > 20) {
            $html_output .= PMA_getHtmlForDisplayTheInitials($array_initials, $conditional_class);
        }
        /**
         * Display the user overview
         * (if less than 50 users, display them immediately)
         */
        if (isset($_REQUEST['initial']) || isset($_REQUEST['showall']) || PMA_DBI_num_rows($res) < 50) {
            $html_output .= PMA_getUsersOverview($res, $db_rights, $link_edit, $pmaThemeImage, $text_dir, $conditional_class, $link_export);
        } else {
            $html_output .= PMA_getAddUserHtmlFieldset($conditional_class);
        }
        // end if (display overview)
        if (!$GLOBALS['is_ajax_request'] || !empty($_REQUEST['ajax_page_request'])) {
            $flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly from MySQL\'s privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE);
            $flushLink = '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;' . 'flush_privileges=1" id="reload_privileges_anchor" ' . 'class="' . $conditional_class . '">';
            $flushnote->addParam($flushLink, false);
            $flushnote->addParam('</a>', false);
            $html_output .= $flushnote->getDisplay();
        }
        return $html_output;
    }
}
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:66,代码来源:server_privileges.lib.php

示例5: getMessage

 /**
  * Prepare the message and the query
  * usually the message is the result of the query executed
  *
  * @param PMA_Message|string $message   the message to display
  * @param string             $sql_query the query to display
  * @param string             $type      the type (level) of the message
  *
  * @return string
  *
  * @access  public
  */
 public static function getMessage($message, $sql_query = null, $type = 'notice')
 {
     global $cfg;
     $retval = '';
     if (null === $sql_query) {
         if (!empty($GLOBALS['display_query'])) {
             $sql_query = $GLOBALS['display_query'];
         } elseif (!empty($GLOBALS['unparsed_sql'])) {
             $sql_query = $GLOBALS['unparsed_sql'];
         } elseif (!empty($GLOBALS['sql_query'])) {
             $sql_query = $GLOBALS['sql_query'];
         } else {
             $sql_query = '';
         }
     }
     if (isset($GLOBALS['using_bookmark_message'])) {
         $retval .= $GLOBALS['using_bookmark_message']->getDisplay();
         unset($GLOBALS['using_bookmark_message']);
     }
     // In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
     // check for it's presence before using it
     $retval .= '<div class="result_query"' . (isset($GLOBALS['cell_align_left']) ? ' style="text-align: ' . $GLOBALS['cell_align_left'] . '"' : '') . '>' . "\n";
     if ($message instanceof PMA_Message) {
         if (isset($GLOBALS['special_message'])) {
             $message->addMessage($GLOBALS['special_message']);
             unset($GLOBALS['special_message']);
         }
         $retval .= $message->getDisplay();
     } else {
         $retval .= '<div class="' . $type . '">';
         $retval .= PMA_sanitize($message);
         if (isset($GLOBALS['special_message'])) {
             $retval .= PMA_sanitize($GLOBALS['special_message']);
             unset($GLOBALS['special_message']);
         }
         $retval .= '</div>';
     }
     if ($cfg['ShowSQL'] == true && !empty($sql_query) && $sql_query !== ';') {
         // Html format the query to be displayed
         // If we want to show some sql code it is easiest to create it here
         /* SQL-Parser-Analyzer */
         if (!empty($GLOBALS['show_as_php'])) {
             $new_line = '\\n"<br />' . "\n" . '&nbsp;&nbsp;&nbsp;&nbsp;. "';
             $query_base = htmlspecialchars(addslashes($sql_query));
             $query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
         } else {
             $query_base = $sql_query;
         }
         $query_too_big = false;
         $queryLength = mb_strlen($query_base);
         if ($queryLength > $cfg['MaxCharactersInDisplayedSQL']) {
             // when the query is large (for example an INSERT of binary
             // data), the parser chokes; so avoid parsing the query
             $query_too_big = true;
             $shortened_query_base = nl2br(htmlspecialchars(mb_substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
         }
         if (!empty($GLOBALS['show_as_php'])) {
             $query_base = '$sql  = "' . $query_base;
         } elseif (isset($query_base)) {
             $query_base = self::formatSql($query_base);
         }
         // Prepares links that may be displayed to edit/explain the query
         // (don't go to default pages, we must go to the page
         // where the query box is available)
         // Basic url query part
         $url_params = array();
         if (!isset($GLOBALS['db'])) {
             $GLOBALS['db'] = '';
         }
         if (mb_strlen($GLOBALS['db'])) {
             $url_params['db'] = $GLOBALS['db'];
             if (mb_strlen($GLOBALS['table'])) {
                 $url_params['table'] = $GLOBALS['table'];
                 $edit_link = 'tbl_sql.php';
             } else {
                 $edit_link = 'db_sql.php';
             }
         } else {
             $edit_link = 'server_sql.php';
         }
         // Want to have the query explained
         // but only explain a SELECT (that has not been explained)
         /* SQL-Parser-Analyzer */
         $explain_link = '';
         $is_select = preg_match('@^SELECT[[:space:]]+@i', $sql_query);
         if (!empty($cfg['SQLQuery']['Explain']) && !$query_too_big) {
             $explain_params = $url_params;
             if ($is_select) {
//.........这里部分代码省略.........
开发者ID:altesien,项目名称:FinalProject,代码行数:101,代码来源:Util.class.php

示例6: PMA_stopImport

/**
 * Stops the import on (mostly upload/file related) error
 *
 * @param PMA_Message $error_message The error message
 *
 * @return void
 * @access  public
 *
 */
function PMA_stopImport(PMA_Message $error_message)
{
    global $import_handle, $file_to_unlink;
    // Close open handles
    if ($import_handle !== false && $import_handle !== null) {
        fclose($import_handle);
    }
    // Delete temporary file
    if ($file_to_unlink != '') {
        unlink($file_to_unlink);
    }
    $msg = $error_message->getDisplay();
    $_SESSION['Import_message']['message'] = $msg;
    $response = PMA_Response::getInstance();
    $response->isSuccess(false);
    $response->addJSON('message', PMA_Message::error($msg));
    exit;
}
开发者ID:sruthikudaravalli,项目名称:QuickCabs,代码行数:27,代码来源:import.lib.php

示例7: PMA_getHtmlForSqlQueryResults

/**
 * Function to get html for the sql query results div
 *
 * @param string      $previous_update_query_html html for the previously
 *                                                executed query
 * @param string      $profiling_chart_html       html for profiling
 * @param PMA_Message $missing_unique_column_msg  message for the missing
 *                                                unique column
 * @param PMA_Message $bookmark_created_msg       message for bookmark creation
 * @param string      $table_html                 html for the table for
 *                                                displaying sql results
 * @param string      $indexes_problems_html      html for displaying errors
 *                                                in indexes
 * @param string      $bookmark_support_html      html for displaying bookmark form
 *
 * @return string $html_output
 */
function PMA_getHtmlForSqlQueryResults($previous_update_query_html, $profiling_chart_html, $missing_unique_column_msg, $bookmark_created_msg, $table_html, $indexes_problems_html, $bookmark_support_html)
{
    //begin the sqlqueryresults div here. container div
    $html_output = '<div class="sqlqueryresults ajax">';
    $html_output .= isset($previous_update_query_html) ? $previous_update_query_html : '';
    $html_output .= isset($profiling_chart_html) ? $profiling_chart_html : '';
    $html_output .= isset($missing_unique_column_msg) ? $missing_unique_column_msg->getDisplay() : '';
    $html_output .= isset($bookmark_created_msg) ? $bookmark_created_msg->getDisplay() : '';
    $html_output .= $table_html;
    $html_output .= isset($indexes_problems_html) ? $indexes_problems_html : '';
    $html_output .= isset($bookmark_support_html) ? $bookmark_support_html : '';
    $html_output .= '</div>';
    // end sqlqueryresults div
    return $html_output;
}
开发者ID:mi-squared,项目名称:openemr,代码行数:32,代码来源:sql.lib.php

示例8: testGetDisplay

 /**
  * getDisplay test
  *
  * @return void
  */
 public function testGetDisplay()
 {
     $this->object->setMessage('Test Message');
     $this->assertEquals('<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> ' . 'Test Message</div>', $this->object->getDisplay());
 }
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:10,代码来源:PMA_Message_test.php


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