コード例 #1
0
ファイル: PMA_Navigation_test.php プロジェクト: yonh/php-mvc
 /**
  * Tests getItemUnhideDialog() method.
  *
  * @return void
  * @test
  */
 public function testGetItemUnhideDialog()
 {
     $expectedQuery = "SELECT `item_name`, `item_type`" . " FROM `pmadb`.`navigationhiding`" . " WHERE `username`='user' AND `db_name`='db' AND `table_name`=''";
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('tryQuery')->with($expectedQuery)->will($this->returnValue(true));
     $dbi->expects($this->at(1))->method('fetchArray')->will($this->returnValue(array('item_name' => 'tableName', 'item_type' => 'table')));
     $dbi->expects($this->at(2))->method('fetchArray')->will($this->returnValue(array('item_name' => 'viewName', 'item_type' => 'view')));
     $dbi->expects($this->at(3))->method('fetchArray')->will($this->returnValue(false));
     $dbi->expects($this->once())->method('freeResult');
     $GLOBALS['dbi'] = $dbi;
     $html = $this->object->getItemUnhideDialog('db');
     $this->assertContains('<td>tableName</td>', $html);
     $this->assertContains('<a href="navigation.php' . PMA_URL_getCommon() . '&unhideNavItem=true&itemType=table&itemName=tableName&dbName=db"' . ' class="unhideNavItem ajax">', $html);
 }
コード例 #2
0
 /**
  * Generates the header
  *
  * @return string The header
  */
 public function getDisplay()
 {
     $retval = '';
     if (!$this->_headerIsSent) {
         if (!$this->_isAjax && $this->_isEnabled) {
             $this->sendHttpHeaders();
             $retval .= $this->_getHtmlStart();
             $retval .= $this->_getMetaTags();
             $retval .= $this->_getLinkTags();
             $retval .= $this->getTitleTag();
             // The user preferences have been merged at this point
             // so we can conditionally add CodeMirror
             if ($GLOBALS['cfg']['CodemirrorEnable']) {
                 $this->_scripts->addFile('codemirror/lib/codemirror.js');
                 $this->_scripts->addFile('codemirror/mode/sql/sql.js');
                 $this->_scripts->addFile('codemirror/addon/runmode/runmode.js');
                 $this->_scripts->addFile('codemirror/addon/hint/show-hint.js');
                 $this->_scripts->addFile('codemirror/addon/hint/sql-hint.js');
             }
             if ($this->_userprefsOfferImport) {
                 $this->_scripts->addFile('config.js');
             }
             $retval .= $this->_scripts->getDisplay();
             $retval .= '<noscript>';
             $retval .= '<style>html{display:block}</style>';
             $retval .= '</noscript>';
             $retval .= $this->_getBodyStart();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $nav = new PMA_Navigation();
                 $retval .= $nav->getDisplay();
             }
             // Include possible custom headers
             if (file_exists(CUSTOM_HEADER_FILE)) {
                 $retval .= '<div id="pma_header">';
                 ob_start();
                 include CUSTOM_HEADER_FILE;
                 $retval .= ob_get_contents();
                 ob_end_clean();
                 $retval .= '</div>';
             }
             // offer to load user preferences from localStorage
             if ($this->_userprefsOfferImport) {
                 include_once './libraries/user_preferences.lib.php';
                 $retval .= PMA_userprefsAutoloadGetHeader();
             }
             // pass configuration for hint tooltip display
             // (to be used by PMA_tooltip() in js/functions.js)
             if (!$GLOBALS['cfg']['ShowHint']) {
                 $retval .= '<span id="no_hint" class="hide"></span>';
             }
             $retval .= $this->_getWarnings();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $retval .= $this->_menu->getDisplay();
                 $retval .= '<span id="lock_page_icon"></span>';
                 $retval .= sprintf('<a id="goto_pagetop" href="#" title="%s">%s</a>', __('Click on the bar to scroll to top of page'), PMA_Util::getImage('s_top.png'));
             }
             $retval .= $this->_console->getDisplay();
             $retval .= '<div id="page_content">';
             $retval .= $this->getMessage();
         }
         if ($this->_isEnabled && empty($_REQUEST['recent_table'])) {
             $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
         }
     }
     return $retval;
 }
コード例 #3
0
<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * The navigation panel - displays server, db and table selection tree
 *
 * @package PhpMyAdmin-Navigation
 */
// Include common functionalities
require_once './libraries/common.inc.php';
// Also initialises the collapsible tree class
require_once './libraries/navigation/Navigation.class.php';
$response = PMA_Response::getInstance();
$navigation = new PMA_Navigation();
if (!$response->isAjax()) {
    $response->addHTML(PMA_Message::error(__('Fatal error: The navigation can only be accessed via AJAX')));
    exit;
}
$cfgRelation = PMA_getRelationsParam();
if (isset($cfgRelation['navwork']) && $cfgRelation['navwork']) {
    if (isset($_REQUEST['hideNavItem'])) {
        if (!empty($_REQUEST['itemName']) && !empty($_REQUEST['itemType']) && !empty($_REQUEST['dbName'])) {
            $navigation->hideNavigationItem($_REQUEST['itemName'], $_REQUEST['itemType'], $_REQUEST['dbName'], !empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null);
        }
        exit;
    }
    if (isset($_REQUEST['unhideNavItem'])) {
        if (!empty($_REQUEST['itemName']) && !empty($_REQUEST['itemType']) && !empty($_REQUEST['dbName'])) {
            $navigation->unhideNavigationItem($_REQUEST['itemName'], $_REQUEST['itemType'], $_REQUEST['dbName'], !empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null);
        }
        exit;
コード例 #4
0
ファイル: navigation.php プロジェクト: yxwzaxns/sakura
<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * the navigation frame - displays server, db and table selection tree
 *
 * @package PhpMyAdmin-Navigation
 */
// Include common functionalities
require_once './libraries/common.inc.php';
// Also initialises the collapsible tree class
require_once './libraries/navigation/Navigation.class.php';
// Do the magic
$response = PMA_Response::getInstance();
if ($response->isAjax()) {
    $navigation = new PMA_Navigation();
    $response->addJSON('message', $navigation->getDisplay());
} else {
    $response->addHTML(PMA_Message::error(__('Fatal error: The navigation can only be accessed via AJAX')));
}