/**
  * Loads common scripts
  *
  * @return void
  */
 private function _addDefaultScripts()
 {
     // Localised strings
     $params = array('lang' => $GLOBALS['lang']);
     if (isset($GLOBALS['db'])) {
         $params['db'] = $GLOBALS['db'];
     }
     $this->_scripts->addFile('jquery/jquery-1.11.1.min.js');
     $this->_scripts->addFile('whitelist.php' . PMA_URL_getCommon($params), false, true);
     $this->_scripts->addFile('sprintf.js');
     $this->_scripts->addFile('ajax.js');
     $this->_scripts->addFile('keyhandler.js');
     $this->_scripts->addFile('jquery/jquery-ui-1.11.2.min.js');
     $this->_scripts->addFile('jquery/jquery.cookie.js');
     $this->_scripts->addFile('jquery/jquery.mousewheel.js');
     $this->_scripts->addFile('jquery/jquery.event.drag-2.2.js');
     $this->_scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
     $this->_scripts->addFile('jquery/jquery.ba-hashchange-1.3.js');
     $this->_scripts->addFile('jquery/jquery.debounce-1.0.5.js');
     $this->_scripts->addFile('menu-resizer.js');
     // Cross-framing protection
     if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) {
         $this->_scripts->addFile('cross_framing_protection.js');
     }
     $this->_scripts->addFile('rte.js');
     if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') {
         $this->_scripts->addFile('tracekit/tracekit.js');
         $this->_scripts->addFile('error_report.js');
     }
     // Here would not be a good place to add CodeMirror because
     // the user preferences have not been merged at this point
     $this->_scripts->addFile('messages.php' . PMA_URL_getCommon($params));
     // Append the theme id to this url to invalidate
     // the cache on a theme change. Though this might be
     // unavailable for fatal errors.
     if (isset($_SESSION['PMA_Theme'])) {
         $theme_id = urlencode($_SESSION['PMA_Theme']->getId());
     } else {
         $theme_id = 'default';
     }
     $this->_scripts->addFile('get_image.js.php?theme=' . $theme_id);
     $this->_scripts->addFile('doclinks.js');
     $this->_scripts->addFile('functions.js');
     $this->_scripts->addFile('navigation.js');
     $this->_scripts->addFile('indexes.js');
     $this->_scripts->addFile('common.js');
     $this->_scripts->addCode($this->getJsParamsCode());
 }
 /**
  * Renders the footer
  *
  * @return string
  */
 public function getDisplay()
 {
     $retval = '';
     $this->_setHistory();
     if ($this->_isEnabled) {
         if (!$this->_isAjax) {
             $retval .= "</div>";
         }
         if (!$this->_isAjax && !$this->_isMinimal) {
             if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && empty($GLOBALS['checked_special']) && !$this->_isAjax) {
                 $url = $this->getSelfUrl('unencoded');
                 $header = PMA_Response::getInstance()->getHeader();
                 $scripts = $header->getScripts()->getFiles();
                 $menuHash = $header->getMenu()->getHash();
                 // prime the client-side cache
                 $this->_scripts->addCode(sprintf('AJAX.cache.primer = {' . ' url: "%s",' . ' scripts: %s,' . ' menuHash: "%s"' . '};', PMA_escapeJsString($url), json_encode($scripts), PMA_escapeJsString($menuHash)));
             }
             if (PMA_getenv('SCRIPT_NAME') && !$this->_isAjax) {
                 $url = $this->getSelfUrl();
                 $retval .= $this->_getSelfLink($url);
             }
             $this->_scripts->addCode('var debugSQLInfo = ' . $this->getDebugMessage() . ';');
             $retval .= $this->getErrorMessages();
             $retval .= $this->_scripts->getDisplay();
             if ($GLOBALS['cfg']['DBG']['demo']) {
                 $retval .= '<div id="pma_demo">';
                 $retval .= $this->_getDemoMessage();
                 $retval .= '</div>';
             }
             // Include possible custom footers
             if (file_exists(CUSTOM_FOOTER_FILE)) {
                 $retval .= '<div id="pma_footer">';
                 ob_start();
                 include CUSTOM_FOOTER_FILE;
                 $retval .= ob_get_contents();
                 ob_end_clean();
                 $retval .= '</div>';
             }
         }
         if (!$this->_isAjax) {
             $retval .= "</body></html>";
         }
     }
     return $retval;
 }
示例#3
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 ($GLOBALS['cfg']['LintEnable']) {
                     $this->_scripts->addFile('codemirror/addon/lint/lint.js');
                     $this->_scripts->addFile('codemirror/addon/lint/sql-lint.js');
                 }
             }
             $this->_scripts->addCode('ConsoleEnterExecutes=' . ($GLOBALS['cfg']['ConsoleEnterExecutes'] ? 'true' : 'false'));
             $this->_scripts->addFiles($this->_console->getScripts());
             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="page_nav_icons">';
                 $retval .= '<span id="lock_page_icon"></span>';
                 $retval .= '<span id="page_settings_icon">' . PMA_Util::getImage('s_cog.png', __('Page-related settings')) . '</span>';
                 $retval .= sprintf('<a id="goto_pagetop" href="#">%s</a>', PMA_Util::getImage('s_top.png', __('Click on the bar to scroll to top of page')));
                 $retval .= '</span>';
             }
             $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;
 }