Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRouslan Placella <rouslan@placella.com>2012-05-24 00:25:48 +0400
committerRouslan Placella <rouslan@placella.com>2012-06-11 17:06:02 +0400
commit4a740376c89755698ae5fac3746eb57ba07142ae (patch)
treeb33aa2a42117a87d24f145080d3f9a8887a0e21e
parent97449dae42a11cfa7f4571aaadeab3fefc30acf7 (diff)
Dropped header.inc.php in favor of the PMA_Header class
-rw-r--r--chk_rel.php2
-rw-r--r--db_create.php4
-rw-r--r--db_events.php7
-rw-r--r--db_export.php3
-rw-r--r--db_import.php3
-rw-r--r--db_operations.php3
-rw-r--r--db_routines.php7
-rw-r--r--db_search.php9
-rw-r--r--db_sql.php7
-rw-r--r--db_structure.php7
-rw-r--r--db_tracking.php3
-rw-r--r--db_triggers.php6
-rw-r--r--export.php7
-rw-r--r--import.php2
-rw-r--r--libraries/PDF.class.php2
-rw-r--r--libraries/auth/config.auth.lib.php2
-rw-r--r--libraries/common.inc.php41
-rw-r--r--libraries/common.lib.php2
-rw-r--r--libraries/core.lib.php2
-rw-r--r--libraries/db_common.inc.php5
-rw-r--r--libraries/display_tbl.lib.php2
-rw-r--r--libraries/header.inc.php137
-rw-r--r--libraries/header_printview.inc.php2
-rw-r--r--libraries/header_scripts.inc.php2
-rw-r--r--libraries/insert_edit.lib.php4
-rw-r--r--libraries/mult_submits.inc.php1
-rw-r--r--libraries/schema/Export_Relation_Schema.class.php2
-rw-r--r--libraries/server_common.inc.php4
-rw-r--r--libraries/tbl_common.inc.php2
-rw-r--r--main.php2
-rw-r--r--prefs_forms.php5
-rw-r--r--prefs_manage.php7
-rw-r--r--querywindow.php20
-rw-r--r--server_databases.php4
-rw-r--r--server_export.php6
-rw-r--r--server_import.php3
-rw-r--r--server_plugins.php7
-rw-r--r--server_privileges.php5
-rw-r--r--server_replication.php6
-rw-r--r--server_sql.php6
-rw-r--r--server_status.php26
-rw-r--r--server_synchronize.php3
-rw-r--r--server_variables.php3
-rw-r--r--sql.php41
-rw-r--r--tbl_addfield.php2
-rw-r--r--tbl_alter.php2
-rw-r--r--tbl_change.php12
-rw-r--r--tbl_chart.php11
-rw-r--r--tbl_create.php3
-rw-r--r--tbl_export.php3
-rw-r--r--tbl_gis_visualization.php13
-rw-r--r--tbl_import.php3
-rw-r--r--tbl_indexes.php3
-rw-r--r--tbl_printview.php4
-rw-r--r--tbl_relation.php3
-rw-r--r--tbl_replace.php14
-rw-r--r--tbl_select.php13
-rw-r--r--tbl_sql.php6
-rw-r--r--tbl_structure.php6
-rw-r--r--tbl_zoom_select.php29
-rw-r--r--transformation_overview.php3
-rw-r--r--transformation_wrapper.php6
-rw-r--r--user_password.php11
63 files changed, 210 insertions, 361 deletions
diff --git a/chk_rel.php b/chk_rel.php
index 3e8a0269bb..ccf62af5f7 100644
--- a/chk_rel.php
+++ b/chk_rel.php
@@ -10,7 +10,7 @@
* Gets some core libraries
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
/**
diff --git a/db_create.php b/db_create.php
index 0dff8e4553..c0618b1ca8 100644
--- a/db_create.php
+++ b/db_create.php
@@ -9,7 +9,6 @@
* Gets some core libraries
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'functions.js';
require_once 'libraries/mysql_charsets.lib.php';
if (! PMA_DRIZZLE) {
@@ -67,8 +66,6 @@ if (! $result) {
if ($GLOBALS['is_ajax_request'] == true) {
PMA_ajaxResponse($message, false);
}
-
- include_once 'libraries/header.inc.php';
include_once 'main.php';
} else {
$message = PMA_Message::success(__('Database %1$s has been created.'));
@@ -145,7 +142,6 @@ if (! $result) {
PMA_ajaxResponse($message, true, $extra_data);
}
- include_once 'libraries/header.inc.php';
include_once '' . $cfg['DefaultTabDatabase'];
}
?>
diff --git a/db_events.php b/db_events.php
index 84deaade94..af1d0a2926 100644
--- a/db_events.php
+++ b/db_events.php
@@ -15,9 +15,10 @@ require_once 'libraries/common.lib.php';
/**
* Include JavaScript libraries
*/
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'rte/common.js';
-$GLOBALS['js_include'][] = 'rte/events.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('rte/common.js');
+$scripts->addFile('rte/events.js');
/**
* Include all other files
diff --git a/db_export.php b/db_export.php
index 732b88b217..ae937f6d1c 100644
--- a/db_export.php
+++ b/db_export.php
@@ -11,7 +11,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'export.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('export.js');
// $sub_part is also used in db_info.inc.php to see if we are coming from
// db_export.php, in which case we don't obey $cfg['MaxTableList']
diff --git a/db_import.php b/db_import.php
index 146e331e9c..e804657928 100644
--- a/db_import.php
+++ b/db_import.php
@@ -10,7 +10,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'import.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('import.js');
/**
* Gets tables informations and displays top links
diff --git a/db_operations.php b/db_operations.php
index 5a04bde59c..8771d11d6c 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -19,7 +19,8 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.lib.php';
// add a javascript file for jQuery functions to handle Ajax actions
-$GLOBALS['js_include'][] = 'db_operations.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('db_operations.js');
/**
* Sets globals from $_REQUEST (we're using GET on ajax, POST otherwise)
diff --git a/db_routines.php b/db_routines.php
index 0dd2e66c44..b9d9cdc1b1 100644
--- a/db_routines.php
+++ b/db_routines.php
@@ -16,9 +16,10 @@ require_once 'libraries/mysql_charsets.lib.php';
/**
* Include JavaScript libraries
*/
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'rte/common.js';
-$GLOBALS['js_include'][] = 'rte/routines.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('rte/common.js');
+$scripts->addFile('rte/routines.js');
/**
* Include all other files
diff --git a/db_search.php b/db_search.php
index 17571a7cd7..4faa1ace6f 100644
--- a/db_search.php
+++ b/db_search.php
@@ -13,10 +13,11 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'db_search.js';
-$GLOBALS['js_include'][] = 'sql.js';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('db_search.js');
+$scripts->addFile('sql.js');
+$scripts->addFile('makegrid.js');
+$scripts->addFile('jquery/timepicker.js');
/**
* Gets some core libraries and send headers
diff --git a/db_sql.php b/db_sql.php
index c4b5c84111..2fdeb0a8c6 100644
--- a/db_sql.php
+++ b/db_sql.php
@@ -13,9 +13,10 @@ require_once 'libraries/common.inc.php';
/**
* Runs common work
*/
-$GLOBALS['js_include'][] = 'functions.js';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'sql.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('functions.js');
+$scripts->addFile('makegrid.js');
+$scripts->addFile('sql.js');
require 'libraries/db_common.inc.php';
require_once 'libraries/sql_query_form.lib.php';
diff --git a/db_structure.php b/db_structure.php
index 302e036850..d337c24e7d 100644
--- a/db_structure.php
+++ b/db_structure.php
@@ -10,9 +10,10 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'db_structure.js';
-$GLOBALS['js_include'][] = 'tbl_change.js';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('db_structure.js');
+$scripts->addFile('tbl_change.js');
+$scripts->addFile('jquery/timepicker.js');
/**
* Sets globals from $_POST
diff --git a/db_tracking.php b/db_tracking.php
index e151977baf..5573f56203 100644
--- a/db_tracking.php
+++ b/db_tracking.php
@@ -10,7 +10,8 @@
require_once 'libraries/common.inc.php';
//Get some js files needed for Ajax requests
-$GLOBALS['js_include'][] = 'db_structure.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('db_structure.js');
/**
* If we are not in an Ajax request, then do the common work and show the links etc.
diff --git a/db_triggers.php b/db_triggers.php
index d94ea90d69..80db582947 100644
--- a/db_triggers.php
+++ b/db_triggers.php
@@ -10,13 +10,13 @@
* Include required files
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/common.lib.php';
/**
* Include JavaScript libraries
*/
-$GLOBALS['js_include'][] = 'rte/common.js';
-$GLOBALS['js_include'][] = 'rte/triggers.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('rte/common.js');
+$scripts->addFile('rte/triggers.js');
/**
* Include all other files
diff --git a/export.php b/export.php
index 5b49a3145f..20432ab750 100644
--- a/export.php
+++ b/export.php
@@ -88,7 +88,6 @@ if ($_REQUEST['output_format'] == 'astext') {
// Does export require to be into file?
if (isset($export_list[$type]['force_file']) && ! $asfile) {
$message = PMA_Message::error(__('Selected export type has to be saved in file!'));
- include_once 'libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
include 'server_export.php';
@@ -369,7 +368,6 @@ if ($save_on_server) {
}
}
if (isset($message)) {
- include_once 'libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
include 'server_export.php';
@@ -403,14 +401,13 @@ if (! $save_on_server) {
$num_tables = count($tables);
if ($num_tables == 0) {
$message = PMA_Message::error(__('No tables found in database.'));
- include_once 'libraries/header.inc.php';
$active_page = 'db_export.php';
include 'db_export.php';
exit();
}
}
$backup_cfgServer = $cfg['Server'];
- include_once 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
$cfg['Server'] = $backup_cfgServer;
unset($backup_cfgServer);
echo "\n" . '<div style="text-align: ' . $cell_align_left . '">' . "\n";
@@ -720,7 +717,6 @@ do {
// End of fake loop
if ($save_on_server && isset($message)) {
- include_once 'libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
include 'server_export.php';
@@ -788,7 +784,6 @@ if (! empty($asfile)) {
);
}
- include_once 'libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
include_once 'server_export.php';
diff --git a/import.php b/import.php
index 1c93cc119f..f801c9bbde 100644
--- a/import.php
+++ b/import.php
@@ -83,7 +83,7 @@ if (! empty($sql_query)) {
// upload limit has been reached, let's assume the second possibility.
;
if ($_POST == array() && $_GET == array()) {
- include_once 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
$message = PMA_Message::error(__('You probably tried to upload too large file. Please refer to %sdocumentation%s for ways to workaround this limit.'));
$message->addParam('[a@./Documentation.html#faq1_16@_blank]');
$message->addParam('[/a]');
diff --git a/libraries/PDF.class.php b/libraries/PDF.class.php
index 99ea2035a9..6a2597cdd6 100644
--- a/libraries/PDF.class.php
+++ b/libraries/PDF.class.php
@@ -85,7 +85,7 @@ class PMA_PDF extends TCPDF
*/
function Error($error_message = '')
{
- include './libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
PMA_Message::error(__('Error while creating PDF:') . ' ' . $error_message)->display();
include './libraries/footer.inc.php';
}
diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php
index fbe39e7c8b..461a2862ef 100644
--- a/libraries/auth/config.auth.lib.php
+++ b/libraries/auth/config.auth.lib.php
@@ -93,7 +93,7 @@ function PMA_auth_fails()
<td>
<?php
- $GLOBALS['is_header_sent'] = true;
+ PMA_Header::getInstance()->isHeaderSent = true;
if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
trigger_error(__('Access denied'), E_USER_NOTICE);
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index 6054355c06..df979aebe7 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -149,6 +149,10 @@ if (!defined('PMA_MINIMUM_COMMON')) {
/******************************************************************************/
/* start procedural code label_start_procedural */
+if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
+ PMA_fatalError(__("GLOBALS overwrite attempt"));
+}
+
/**
* protect against possible exploits - there is no need to have so much variables
*/
@@ -558,34 +562,6 @@ if (PMA_isValid($_REQUEST['sql_query'])) {
//$_REQUEST['server']; // checked later in this file
//$_REQUEST['lang']; // checked by LABEL_loading_language_file
-
-/**
- * holds name of JavaScript files to be included in HTML header
- * @global array $js_include
- */
-$GLOBALS['js_include'] = array();
-$GLOBALS['js_include'][] = 'jquery/jquery-1.6.2.js';
-$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.sprintf.js';
-$GLOBALS['js_include'][] = 'update-location.js';
-
-/**
- * holds an array of javascript code snippets to be included in the HTML header
- * Can be used with PMA_addJSCode() to pass on js variables to the browser.
- * @global array $js_script
- */
-$GLOBALS['js_script'] = array();
-
-/**
- * Add common jQuery functions script here if necessary.
- */
-
-/**
- * JavaScript events that will be registered
- * @global array $js_events
- */
-$GLOBALS['js_events'] = array();
-
/**
* footnotes to be displayed ot the page bottom
* @global array $footnotes
@@ -600,6 +576,15 @@ $GLOBALS['footnotes'] = array();
*/
require './libraries/select_lang.lib.php';
+// Defines the cell alignment values depending on text direction
+if ($GLOBALS['text_dir'] == 'ltr') {
+ $GLOBALS['cell_align_left'] = 'left';
+ $GLOBALS['cell_align_right'] = 'right';
+} else {
+ $GLOBALS['cell_align_left'] = 'right';
+ $GLOBALS['cell_align_right'] = 'left';
+}
+
/**
* check for errors occurred while loading configuration
* this check is done here after loading language files to present errors in locale
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 1d890ffd47..01d971493b 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -598,7 +598,7 @@ function PMA_mysqlDie(
/**
* start http output, display html headers
*/
- include_once './libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
$error_msg = '';
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index ffcde8c867..1a1c3ea4e6 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -783,7 +783,7 @@ function PMA_includeJS($url, $ie_conditional = false)
*/
function PMA_addJSCode($str)
{
- $GLOBALS['js_script'][] = $str;
+ PMA_Header::getInstance()->getScripts()->addCode($str);
}
/**
diff --git a/libraries/db_common.inc.php b/libraries/db_common.inc.php
index 296685cdb4..d8c40cb390 100644
--- a/libraries/db_common.inc.php
+++ b/libraries/db_common.inc.php
@@ -76,7 +76,10 @@ if (isset($submitcollation) && !empty($db_collation)) {
};
}
-require_once './libraries/header.inc.php';
+/**
+ * Displays headers
+ */
+PMA_Header::getInstance()->display();
/**
* Set parameters for links
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php
index 8287dbe335..dc8a41200f 100644
--- a/libraries/display_tbl.lib.php
+++ b/libraries/display_tbl.lib.php
@@ -1061,7 +1061,7 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
} elseif ((($GLOBALS['cfg']['RowActionLinks'] == 'left')
|| ($GLOBALS['cfg']['RowActionLinks'] == 'both'))
&& (($is_display['edit_lnk'] == 'nn') && ($is_display['del_lnk'] == 'nn'))
- && (! isset($GLOBALS['is_header_sent']) || ! $GLOBALS['is_header_sent'])
+ && ! PMA_Header::getInstance()->headerIsSent
) {
// ... elseif no button, displays empty columns if required
// (unless coming from Browse mode print view)
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
deleted file mode 100644
index f1602eda97..0000000000
--- a/libraries/header.inc.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- *
- * @package PhpMyAdmin
- */
-if (! defined('PHPMYADMIN')) {
- exit;
-}
-
-require_once './libraries/RecentTable.class.php';
-require_once 'libraries/Menu.class.php';
-
-
-/**
- * Add recently used table and reload the navigation.
- *
- * @param string $db Database name where the table is located.
- * @param string $table The table name
- *
- * @return void
- */
-function PMA_addRecentTable($db, $table)
-{
- $retval = '';
- if (strlen($table) && $GLOBALS['cfg']['LeftRecentTable'] > 0) {
- $tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
- if ($tmp_result === true) {
- $retval = '<span class="hide" id="update_recent_tables"></span>';
- } else {
- $error = $tmp_result;
- $retval = $error->getDisplay();
- }
- }
- return $retval;
-}
-
-/**
- * This is not an Ajax request so we need to generate all this output.
- */
-if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
-
- if (empty($GLOBALS['is_header_sent'])) {
-
- /**
- * Gets a core script and starts output buffering work
- */
- include_once './libraries/ob.lib.php';
- PMA_outBufferPre();
-
- // if database storage for user preferences is transient, offer to load
- // exported settings from localStorage (detection will be done in JavaScript)
- $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
- && ! isset($_SESSION['userprefs_autoload']);
- if ($userprefs_offer_import) {
- $GLOBALS['js_include'][] = 'config.js';
- }
-
- // For re-usability, moved http-headers and stylesheets
- // to a seperate file. It can now be included by header.inc.php,
- // querywindow.php.
-
- include_once './libraries/header_http.inc.php';
- include_once './libraries/header_meta_style.inc.php';
- include_once './libraries/header_scripts.inc.php';
-
- /* remove vertical scroll bar bug in ie */ ?>
- <!--[if IE 6]>
- <style type="text/css">
- /* <![CDATA[ */
- html {
- overflow-y: scroll;
- }
- /* ]]> */
- </style>
- <![endif]-->
- </head>
-
- <body>
- <?php
-
- // Include possible custom headers
- if (file_exists(CUSTOM_HEADER_FILE)) {
- include CUSTOM_HEADER_FILE;
- }
-
-
- // message of "Cookies required" displayed for auth_type http or config
- // note: here, the decoration won't work because without cookies,
- // our standard CSS is not operational
- if (empty($_COOKIE)) {
- PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
- }
-
- echo "<noscript>\n";
- PMA_message::error(__("Javascript must be enabled past this point"))->display();
- echo "</noscript>\n";
-
- // offer to load user preferences from localStorage
- if ($userprefs_offer_import) {
- include_once './libraries/user_preferences.lib.php';
- echo PMA_userprefsAutoloadGetHeader();
- }
-
- // add recently used table and reload the navigation
- echo PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
-
- if (! defined('PMA_DISPLAY_HEADING')) {
- define('PMA_DISPLAY_HEADING', 1);
- }
-
- // pass configuration for hint tooltip display
- // (to be used by PMA_createqTip in js/functions.js)
- if (! $GLOBALS['cfg']['ShowHint']) {
- echo '<span id="no_hint" class="hide"></span>';
- }
-
- /**
- * Display heading if needed. Design can be set in css file.
- */
- if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
- PMA_Menu::getInstance()->display();
- }
- }
-
- /**
- * Sets a variable to remember headers have been sent
- */
- $GLOBALS['is_header_sent'] = true;
- //end if (!$GLOBALS['is_ajax_request'])
-} else {
- if (empty($GLOBALS['is_header_sent'])) {
- include_once './libraries/header_http.inc.php';
- $GLOBALS['is_header_sent'] = true;
- }
-}
-?>
diff --git a/libraries/header_printview.inc.php b/libraries/header_printview.inc.php
index 47188ad472..723d38763a 100644
--- a/libraries/header_printview.inc.php
+++ b/libraries/header_printview.inc.php
@@ -52,5 +52,5 @@ require_once './libraries/header_scripts.inc.php';
/**
* Sets a variable to remember headers have been sent
*/
-$is_header_sent = true;
+PMA_Header::getInstance()->isHeaderSent = true;
?>
diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php
index 3ea96d37e6..06be58def5 100644
--- a/libraries/header_scripts.inc.php
+++ b/libraries/header_scripts.inc.php
@@ -32,7 +32,7 @@ if (! isset($page_title)) {
// here, the function does not exist with this configuration:
// $cfg['ServerDefault'] = 0;
$is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
-
+$GLOBALS['js_include'][] = 'jquery/jquery-1.6.2.js';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
if ($GLOBALS['cfg']['CodemirrorEnable']) {
diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php
index 1a9678bf6e..5b6fe7064d 100644
--- a/libraries/insert_edit.lib.php
+++ b/libraries/insert_edit.lib.php
@@ -1551,8 +1551,8 @@ function PMA_isInsertRow()
&& $_REQUEST['insert_rows'] != $GLOBALS['cfg']['InsertRows']
) {
$GLOBALS['cfg']['InsertRows'] = $_REQUEST['insert_rows'];
- $GLOBALS['js_include'][] = 'tbl_change.js';
- include_once 'libraries/header.inc.php';
+ $scripts = PMA_Header::getInstance()->getScripts();
+ $scripts->addFile('tbl_change.js');
include 'tbl_change.php';
exit;
}
diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php
index 476e5c4f20..5b7dd44ea8 100644
--- a/libraries/mult_submits.inc.php
+++ b/libraries/mult_submits.inc.php
@@ -142,7 +142,6 @@ if (! empty($submit_mult)
if (!empty($submit_mult) && !empty($what)) {
unset($message);
- include_once './libraries/header.inc.php';
if (strlen($table)) {
include './libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
diff --git a/libraries/schema/Export_Relation_Schema.class.php b/libraries/schema/Export_Relation_Schema.class.php
index e4ccef1b25..1933b88424 100644
--- a/libraries/schema/Export_Relation_Schema.class.php
+++ b/libraries/schema/Export_Relation_Schema.class.php
@@ -226,7 +226,7 @@ class PMA_Export_Relation_Schema
{
global $db;
- include_once './libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
if (!empty($error_message)) {
$error_message = htmlspecialchars($error_message);
diff --git a/libraries/server_common.inc.php b/libraries/server_common.inc.php
index 84298bf854..50e2143d1a 100644
--- a/libraries/server_common.inc.php
+++ b/libraries/server_common.inc.php
@@ -28,9 +28,9 @@ $url_query = PMA_generate_common_url($db);
$err_url = 'main.php' . $url_query;
/**
- * Displays the headers
+ * Displays headers
*/
-require_once './libraries/header.inc.php';
+PMA_Header::getInstance()->display();
/**
* @global boolean Checks for superuser privileges
diff --git a/libraries/tbl_common.inc.php b/libraries/tbl_common.inc.php
index d903dc9125..398050a164 100644
--- a/libraries/tbl_common.inc.php
+++ b/libraries/tbl_common.inc.php
@@ -48,7 +48,7 @@ require_once './libraries/db_table_exists.lib.php';
/**
* Displays headers
*/
-require_once './libraries/header.inc.php';
+PMA_Header::getInstance()->display();
if (PMA_Tracker::isActive()
&& PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])
diff --git a/main.php b/main.php
index 202eb86627..ff9cc6f855 100644
--- a/main.php
+++ b/main.php
@@ -26,7 +26,7 @@ if ($GLOBALS['PMA_Config']->isGitRevision()) {
$GLOBALS['db'] = '';
$GLOBALS['table'] = '';
$show_query = '1';
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
// Any message to display?
if (! empty($message)) {
diff --git a/prefs_forms.php b/prefs_forms.php
index 6ae7adf6d8..6871afccf9 100644
--- a/prefs_forms.php
+++ b/prefs_forms.php
@@ -69,8 +69,9 @@ if ($form_display->process(false) && !$form_display->hasErrors()) {
}
// display forms
-$GLOBALS['js_include'][] = 'config.js';
-require 'libraries/header.inc.php';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('config.js');
+PMA_Header::getInstance()->display();
require 'libraries/user_preferences.inc.php';
if ($error) {
$error->display();
diff --git a/prefs_manage.php b/prefs_manage.php
index cdbeeeed07..096ca5dee3 100644
--- a/prefs_manage.php
+++ b/prefs_manage.php
@@ -109,7 +109,7 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
}
if (!$all_ok) {
// mimic original form and post json in a hidden field
- include 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
include 'libraries/user_preferences.inc.php';
$msg = PMA_Message::error(__('Configuration contains incorrect data for some fields.'));
$msg->display();
@@ -216,8 +216,9 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
exit;
}
-$GLOBALS['js_include'][] = 'config.js';
-require 'libraries/header.inc.php';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('config.js');
+PMA_Header::getInstance()->display();
require 'libraries/user_preferences.inc.php';
if ($error) {
if (!$error instanceof PMA_Message) {
diff --git a/querywindow.php b/querywindow.php
index 200a106fc8..cde4b889d0 100644
--- a/querywindow.php
+++ b/querywindow.php
@@ -118,27 +118,19 @@ $sql_query = '';
/**
* prepare JavaScript functionality
*/
-$js_include[] = 'common.js';
-$js_include[] = 'querywindow.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('common.js');
+$scripts->addFile('querywindow.js');
if (PMA_isValid($_REQUEST['auto_commit'], 'identical', 'true')) {
- $js_events[] = array(
- 'event' => 'load',
- 'function' => 'PMA_queryAutoCommit',
- );
+ $scripts->addEvent('load','PMA_queryAutoCommit');
}
if (PMA_isValid($_REQUEST['init'])) {
- $js_events[] = array(
- 'event' => 'load',
- 'function' => 'PMA_querywindowResize',
- );
+ $scripts->addEvent('load','PMA_querywindowResize');
}
// always set focus to the textarea
if ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full') {
- $js_events[] = array(
- 'event' => 'load',
- 'function' => 'PMA_querywindowSetFocus',
- );
+ $scripts->addEvent('load','PMA_querywindowSetFocus');
}
/**
diff --git a/server_databases.php b/server_databases.php
index 143e1f1c39..9fb4974041 100644
--- a/server_databases.php
+++ b/server_databases.php
@@ -10,8 +10,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'server_databases.js';
-$GLOBALS['js_include'][] = 'functions.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_databases.js');
require 'libraries/server_common.inc.php';
if (! PMA_DRIZZLE) {
diff --git a/server_export.php b/server_export.php
index 3f5d50b7cf..5dc8f7f023 100644
--- a/server_export.php
+++ b/server_export.php
@@ -9,9 +9,11 @@
* Does the common work
*/
require_once 'libraries/common.inc.php';
-require 'libraries/server_common.inc.php';
-$GLOBALS['js_include'][] = 'export.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('export.js');
+
+require 'libraries/server_common.inc.php';
$export_page_title = __('View dump (schema) of databases') . "\n";
$checkall_url = 'server_export.php?'
diff --git a/server_import.php b/server_import.php
index ef6200d468..3ba59c8c36 100644
--- a/server_import.php
+++ b/server_import.php
@@ -10,7 +10,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'import.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('import.js');
/**
* Does the common work
diff --git a/server_plugins.php b/server_plugins.php
index 04d638fa67..09f3004fbe 100644
--- a/server_plugins.php
+++ b/server_plugins.php
@@ -13,9 +13,10 @@ require_once 'libraries/common.inc.php';
/**
* JS includes
*/
-$GLOBALS['js_include'][] = 'jquery/jquery.cookie.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
-$GLOBALS['js_include'][] = 'server_plugins.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('jquery/jquery.cookie.js');
+$scripts->addFile('jquery/jquery.tablesorter.js');
+$scripts->addFile('server_plugins.js');
/**
* Does the common work
diff --git a/server_privileges.php b/server_privileges.php
index 5606079f60..a73dc6c0de 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -13,8 +13,8 @@ require_once 'libraries/common.inc.php';
/**
* Does the common work
*/
-$GLOBALS['js_include'][] = 'server_privileges.js';
-$GLOBALS['js_include'][] = 'functions.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_privileges.js');
$_add_user_error = false;
@@ -175,7 +175,6 @@ if (isset($dbname)) {
* Checks if the user is allowed to do what he tries to...
*/
if (! $is_superuser) {
- include 'libraries/header.inc.php';
echo '<h2>' . "\n"
. PMA_getIcon('b_usrlist.png')
. __('Privileges') . "\n"
diff --git a/server_replication.php b/server_replication.php
index 7f10eeed72..13447f8e74 100644
--- a/server_replication.php
+++ b/server_replication.php
@@ -13,8 +13,9 @@ require_once 'libraries/common.inc.php';
/**
* Does the common work
*/
-$GLOBALS['js_include'][] = 'server_privileges.js';
-$GLOBALS['js_include'][] = 'replication.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_privileges.js');
+$scripts->addFile('replication.js');
require 'libraries/server_common.inc.php';
require 'libraries/replication.inc.php';
@@ -25,7 +26,6 @@ require_once 'libraries/server_synchronize.lib.php';
* Checks if the user is allowed to do what he tries to...
*/
if (! $is_superuser) {
- include 'libraries/header.inc.php';
echo '<h2>' . "\n"
. PMA_getIcon('s_replication.png')
. __('Replication') . "\n"
diff --git a/server_sql.php b/server_sql.php
index 82924a22f0..e750054e06 100644
--- a/server_sql.php
+++ b/server_sql.php
@@ -13,9 +13,9 @@ require_once 'libraries/common.inc.php';
/**
* Does the common work
*/
-$GLOBALS['js_include'][] = 'functions.js';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'sql.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('makegrid.js');
+$scripts->addFile('sql.js');
require_once 'libraries/server_common.inc.php';
require_once 'libraries/sql_query_form.lib.php';
diff --git a/server_status.php b/server_status.php
index 75b7695d10..5618acea57 100644
--- a/server_status.php
+++ b/server_status.php
@@ -7,12 +7,12 @@
* @package PhpMyAdmin
*/
+require_once 'libraries/common.inc.php';
+
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
- $GLOBALS['is_header_sent'] = true;
+ PMA_Header::getInstance()->isHeaderSent = true;
}
-require_once 'libraries/common.inc.php';
-
/**
* Ajax request
*/
@@ -430,22 +430,24 @@ if (PMA_DRIZZLE) {
* JS Includes
*/
-$GLOBALS['js_include'][] = 'server_status.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_status.js');
-$GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.cookie.js'; // For tab persistence
+$scripts->addFile('jquery/jquery.tablesorter.js');
+$scripts->addFile('jquery/jquery.cookie.js'); // For tab persistence
// Charting
-$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
+$scripts->addFile('highcharts/highcharts.js');
/* Files required for chart exporting */
-$GLOBALS['js_include'][] = 'highcharts/exporting.js';
+$scripts->addFile('highcharts/exporting.js');
/* < IE 9 doesn't support canvas natively */
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
- $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
+ $scripts->addFile('canvg/flashcanvas.js');
}
-$GLOBALS['js_include'][] = 'canvg/canvg.js';
+
+$scripts->addFile('canvg/canvg.js');
// for profiling chart
-$GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.pieRenderer.js';
+$scripts->addFile('jqplot/jquery.jqplot.js');
+$scripts->addFile('jqplot/plugins/jqplot.pieRenderer.js');
/**
* flush status variables if requested
diff --git a/server_synchronize.php b/server_synchronize.php
index e7aba3ad43..11ede98a81 100644
--- a/server_synchronize.php
+++ b/server_synchronize.php
@@ -14,7 +14,8 @@ require_once 'libraries/common.inc.php';
/**
* Does the common work
*/
-$GLOBALS['js_include'][] = 'server_synchronize.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_synchronize.js');
require_once 'libraries/server_common.inc.php';
/**
diff --git a/server_variables.php b/server_variables.php
index ab023a97e6..1ff766e6c3 100644
--- a/server_variables.php
+++ b/server_variables.php
@@ -7,7 +7,8 @@
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'server_variables.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('server_variables.js');
PMA_addJSVar('pma_token', $_SESSION[' PMA_token ']);
PMA_addJSVar('url_query', str_replace('&amp;', '&', PMA_generate_common_url($db)));
diff --git a/sql.php b/sql.php
index 2dcbc77726..b918c8af27 100644
--- a/sql.php
+++ b/sql.php
@@ -11,15 +11,17 @@
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/Table.class.php';
+require_once 'libraries/Header.class.php';
require_once 'libraries/check_user_privileges.lib.php';
require_once 'libraries/bookmark.lib.php';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'tbl_change.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('tbl_change.js');
// the next one needed because sql.php may do a "goto" to tbl_structure.php
-$GLOBALS['js_include'][] = 'tbl_structure.js';
-$GLOBALS['js_include'][] = 'indexes.js';
-$GLOBALS['js_include'][] = 'gis_data_editor.js';
+$scripts->addFile('tbl_structure.js');
+$scripts->addFile('indexes.js');
+$scripts->addFile('gis_data_editor.js');
/**
* Sets globals from $_POST
@@ -55,12 +57,14 @@ if (isset($_REQUEST['printview'])) {
}
if (isset($_SESSION['profiling'])) {
+ $scripts = PMA_Header::getInstance()->getScripts();
/* < IE 9 doesn't support canvas natively */
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
- $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
+ $scripts->addFile('canvg/flashcanvas.js');
}
- $GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js';
- $GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.pieRenderer.js';
+ $scripts->addFile('jqplot/jquery.jqplot.js');
+ $scripts->addFile('jqplot/plugins/jqplot.pieRenderer.js');
+ $scripts->addFile('canvg/canvg.js');
}
/**
@@ -283,7 +287,7 @@ if (! defined('PMA_CHK_DROP')
&& $is_drop_database
&& ! $is_superuser
) {
- include_once 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
PMA_mysqlDie(__('"DROP DATABASE" statements are disabled.'), '', '', $err_url);
} // end if
@@ -379,7 +383,7 @@ if (! $cfg['Confirm']
if ($do_confirm) {
$stripped_sql_query = $sql_query;
- include_once 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
if ($is_drop_database) {
echo '<h1 class="error">' . __(
'You are about to DESTROY a complete database!'
@@ -844,9 +848,6 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$goto = 'main.php';
}
// Loads to target script
- if ($goto != 'main.php') {
- include_once 'libraries/header.inc.php';
- }
$active_page = $goto;
include '' . $goto;
} else {
@@ -870,9 +871,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
}
if (isset($_REQUEST['ajax_request']) && isset($_REQUEST['table_maintenance'])) {
- $GLOBALS['js_include'][] = 'functions.js';
- $GLOBALS['js_include'][] = 'makegrid.js';
- $GLOBALS['js_include'][] = 'sql.js';
+ $scripts = PMA_Header::getInstance()->getScripts();
+ $scripts->addFile('makegrid.js');
+ $scripts->addFile('sql.js');
// Gets the list of fields properties
if (isset($result) && $result) {
@@ -936,9 +937,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
echo "</p>";
} else {
- $GLOBALS['js_include'][] = 'functions.js';
- $GLOBALS['js_include'][] = 'makegrid.js';
- $GLOBALS['js_include'][] = 'sql.js';
+ $scripts = PMA_Header::getInstance()->getScripts();
+ $scripts->addFile('makegrid.js');
+ $scripts->addFile('sql.js');
unset($message);
@@ -954,7 +955,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
include 'libraries/server_common.inc.php';
}
} else {
- include_once 'libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
//we don't need to buffer the output in PMA_getMessage here.
//set a global variable and check against it in the function
$GLOBALS['buffer_message'] = false;
diff --git a/tbl_addfield.php b/tbl_addfield.php
index 4d24a49469..959fd91055 100644
--- a/tbl_addfield.php
+++ b/tbl_addfield.php
@@ -10,7 +10,7 @@
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
// Check parameters
PMA_checkParameters(array('db', 'table'));
diff --git a/tbl_alter.php b/tbl_alter.php
index 053ea71f95..4da743c6cc 100644
--- a/tbl_alter.php
+++ b/tbl_alter.php
@@ -14,8 +14,6 @@
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/header.inc.php';
-
if (isset($_REQUEST['field'])) {
$GLOBALS['field'] = $_REQUEST['field'];
}
diff --git a/tbl_change.php b/tbl_change.php
index 59addef9ad..00bfc241ba 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -12,7 +12,6 @@
* Gets the variables sent or posted to this script and displays the header
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/common.lib.php';
/**
* Ensures db and table are valid, else moves to the "parent" script
@@ -110,15 +109,16 @@ if ($GLOBALS['cfg']['ShowPropertyComments']) {
/**
* used in ./libraries/header.inc.php to load JavaScript library file
*/
-$GLOBALS['js_include'][] = 'functions.js';
-$GLOBALS['js_include'][] = 'tbl_change.js';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'gis_data_editor.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('functions.js');
+$scripts->addFile('tbl_change.js');
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('gis_data_editor.js');
/**
* HTTP and HTML headers
*/
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
/**
* Displays the query submitted and its result
diff --git a/tbl_chart.php b/tbl_chart.php
index 8a6d059c09..368e4a2ba2 100644
--- a/tbl_chart.php
+++ b/tbl_chart.php
@@ -11,15 +11,16 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'tbl_chart.js';
-$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('tbl_chart.js');
+$scripts->addFile('highcharts/highcharts.js');
/* Files required for chart exporting */
-$GLOBALS['js_include'][] = 'highcharts/exporting.js';
+$scripts->addFile('highcharts/exporting.js');
/* < IE 9 doesn't support canvas natively */
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
- $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
+ $scripts->addFile('canvg/flashcanvas.js');
}
-$GLOBALS['js_include'][] = 'canvg/canvg.js';
+$scripts->addFile('canvg/canvg.js');
/**
* Runs common work
diff --git a/tbl_create.php b/tbl_create.php
index 10580095f3..ed3369848d 100644
--- a/tbl_create.php
+++ b/tbl_create.php
@@ -11,7 +11,8 @@ require_once 'libraries/common.inc.php';
$action = 'tbl_create.php';
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
+
$titles = PMA_buildActionTitles();
// Check parameters
diff --git a/tbl_export.php b/tbl_export.php
index 57e2364e6d..d25bd5d0e2 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -10,7 +10,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'export.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('export.js');
/**
* Gets tables informations and displays top links
diff --git a/tbl_gis_visualization.php b/tbl_gis_visualization.php
index 7060737ea1..6c11359680 100644
--- a/tbl_gis_visualization.php
+++ b/tbl_gis_visualization.php
@@ -8,12 +8,13 @@
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'openlayers/OpenLayers.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.svg.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.mousewheel.js';
-$GLOBALS['js_include'][] = 'jquery/jquery.event.drag-2.0.js';
-$GLOBALS['js_include'][] = 'tbl_gis_visualization.js';
-$GLOBALS['js_include'][] = 'OpenStreetMap.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('openlayers/OpenLayers.js');
+$scripts->addFile('jquery/jquery.svg.js');
+$scripts->addFile('jquery/jquery.mousewheel.js');
+$scripts->addFile('jquery/jquery.event.drag-2.0.js');
+$scripts->addFile('tbl_gis_visualization.js');
+$scripts->addFile('OpenStreetMap.js');
// Allows for resending headers even after sending some data
ob_start();
diff --git a/tbl_import.php b/tbl_import.php
index abe6f10a1c..31fa9fcae5 100644
--- a/tbl_import.php
+++ b/tbl_import.php
@@ -10,7 +10,8 @@
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'import.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('import.js');
/**
* Gets tables informations and displays top links
diff --git a/tbl_indexes.php b/tbl_indexes.php
index af268a61ae..08f474cbc2 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -129,7 +129,8 @@ if (isset($_REQUEST['do_save_data'])) {
*/
// Displays headers (if needed)
-$GLOBALS['js_include'][] = 'indexes.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('indexes.js');
require_once 'libraries/tbl_info.inc.php';
if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
diff --git a/tbl_printview.php b/tbl_printview.php
index 78d5876154..77bcd2b6eb 100644
--- a/tbl_printview.php
+++ b/tbl_printview.php
@@ -61,9 +61,7 @@ if (isset($selected_tbl) && is_array($selected_tbl)) {
$multi_tables = (count($the_tables) > 1);
if ($multi_tables) {
- if (empty($GLOBALS['is_header_sent'])) {
- include_once 'libraries/header.inc.php';
- }
+ PMA_Header::getInstance()->display();
$tbl_list = '';
foreach ($the_tables as $key => $table) {
$tbl_list .= (empty($tbl_list) ? '' : ', ')
diff --git a/tbl_relation.php b/tbl_relation.php
index 06df554797..657001b767 100644
--- a/tbl_relation.php
+++ b/tbl_relation.php
@@ -17,7 +17,8 @@
* Gets some core libraries
*/
require_once 'libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'tbl_relation.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('tbl_relation.js');
require_once 'libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_sql.php';
diff --git a/tbl_replace.php b/tbl_replace.php
index 8fc95e0182..04753f2a03 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -31,9 +31,10 @@ PMA_DBI_select_db($GLOBALS['db']);
*/
$goto_include = false;
-$GLOBALS['js_include'][] = 'makegrid.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('makegrid.js');
// Needed for generation of Inline Edit anchors
-$GLOBALS['js_include'][] = 'sql.js';
+$scripts->addFile('sql.js');
// check whether insert row moode, if so include tbl_change.php
PMA_isInsertRow();
@@ -264,9 +265,6 @@ if ($is_insert && count($value_sets) > 0) {
// Note: logic passes here for inline edit
$message = PMA_Message::success(__('No change'));
$active_page = $goto_include;
- if (! $GLOBALS['is_ajax_request'] == true) {
- include_once 'libraries/header.inc.php';
- }
include '' . PMA_securePath($goto_include);
exit;
}
@@ -433,7 +431,7 @@ if (isset($return_to_sql_query)) {
$GLOBALS['sql_query'] = $return_to_sql_query;
}
-$GLOBALS['js_include'][] = 'tbl_change.js';
+$scripts->addFile('tbl_change.js');
$active_page = $goto_include;
@@ -447,10 +445,6 @@ if (isset($_REQUEST['after_insert']) && 'new_insert' == $_REQUEST['after_insert'
}
/**
- * Load header.
- */
-require_once 'libraries/header.inc.php';
-/**
* Load target page.
*/
require '' . PMA_securePath($goto_include);
diff --git a/tbl_select.php b/tbl_select.php
index fd86203715..3323d0b8e9 100644
--- a/tbl_select.php
+++ b/tbl_select.php
@@ -16,12 +16,13 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.lib.php';
require_once 'libraries/tbl_select.lib.php';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'sql.js';
-$GLOBALS['js_include'][] = 'tbl_select.js';
-$GLOBALS['js_include'][] = 'tbl_change.js';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'gis_data_editor.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('makegrid.js');
+$scripts->addFile('sql.js');
+$scripts->addFile('tbl_select.js');
+$scripts->addFile('tbl_change.js');
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('gis_data_editor.js');
$post_params = array(
'ajax_request',
diff --git a/tbl_sql.php b/tbl_sql.php
index 3420a051af..e2841a4cbb 100644
--- a/tbl_sql.php
+++ b/tbl_sql.php
@@ -13,9 +13,9 @@ require_once 'libraries/common.inc.php';
/**
* Runs common work
*/
-$GLOBALS['js_include'][] = 'functions.js';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'sql.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('makegrid.js');
+$scripts->addFile('sql.js');
require 'libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
diff --git a/tbl_structure.php b/tbl_structure.php
index 013cab4bc5..9068c18622 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -12,8 +12,9 @@
require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.lib.php';
-$GLOBALS['js_include'][] = 'tbl_structure.js';
-$GLOBALS['js_include'][] = 'indexes.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('tbl_structure.js');
+$scripts->addFile('indexes.js');
/**
* handle multiple field commands if required
@@ -69,7 +70,6 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) {
// handle confirmation of deleting multiple fields/columns
$action = 'tbl_structure.php';
include 'libraries/mult_submits.inc.php';
- //require_once 'libraries/header.inc.php';
if (empty($message)) {
$message = PMA_Message::success();
diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php
index f2ddbc7ed8..0f553b8364 100644
--- a/tbl_zoom_select.php
+++ b/tbl_zoom_select.php
@@ -17,24 +17,23 @@ require_once './libraries/tbl_select.lib.php';
require_once './libraries/relation.lib.php';
require_once './libraries/tbl_info.inc.php';
-$GLOBALS['js_include'][] = 'makegrid.js';
-$GLOBALS['js_include'][] = 'sql.js';
-$GLOBALS['js_include'][] = 'functions.js';
-$GLOBALS['js_include'][] = 'date.js';
+$scripts = PMA_Header::getInstance()->getScripts();
+$scripts->addFile('makegrid.js');
+$scripts->addFile('sql.js');
+$scripts->addFile('date.js');
/* < IE 9 doesn't support canvas natively */
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
- $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
+ $scripts->addFile('canvg/flashcanvas.js');
}
-
-$GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.canvasTextRenderer.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.dateAxisRenderer.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.highlighter.js';
-$GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.cursor.js';
-$GLOBALS['js_include'][] = 'canvg/canvg.js';
-$GLOBALS['js_include'][] = 'jquery/timepicker.js';
-$GLOBALS['js_include'][] = 'tbl_zoom_plot_jqplot.js';
+$scripts->addFile('jqplot/jquery.jqplot.js');
+$scripts->addFile('jqplot/plugins/jqplot.canvasTextRenderer.js');
+$scripts->addFile('jqplot/plugins/jqplot.canvasAxisLabelRenderer.js');
+$scripts->addFile('jqplot/plugins/jqplot.dateAxisRenderer.js');
+$scripts->addFile('jqplot/plugins/jqplot.highlighter.js');
+$scripts->addFile('jqplot/plugins/jqplot.cursor.js');
+$scripts->addFile('canvg/canvg.js');
+$scripts->addFile('jquery/timepicker.js');
+$scripts->addFile('tbl_zoom_plot_jqplot.js');
/**
* Sets globals from $_POST
diff --git a/transformation_overview.php b/transformation_overview.php
index ae80a506e8..c2076c515b 100644
--- a/transformation_overview.php
+++ b/transformation_overview.php
@@ -15,9 +15,10 @@ define('PMA_DISPLAY_HEADING', 0);
* Gets some core libraries and displays a top message if required
*/
require_once './libraries/common.inc.php';
-require_once './libraries/header.inc.php';
require_once './libraries/transformations.lib.php';
+PMA_Header::getInstance()->display();
+
$types = PMA_getAvailableMIMEtypes();
?>
diff --git a/transformation_wrapper.php b/transformation_wrapper.php
index 722ef2b2d6..317ff3875b 100644
--- a/transformation_wrapper.php
+++ b/transformation_wrapper.php
@@ -84,11 +84,9 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
}
}
-// For re-usability, moved http-headers and stylesheets
-// to a seperate file. It can now be included by libraries/header.inc.php,
-// querywindow.php.
+// Only output the http headers
+PMA_Header::getInstance()->sendHttpHeaders();
-require_once './libraries/header_http.inc.php';
// [MIME]
if (isset($ct) && !empty($ct)) {
$mime_type = $ct;
diff --git a/user_password.php b/user_password.php
index 8a9937eb00..d28550bb93 100644
--- a/user_password.php
+++ b/user_password.php
@@ -12,7 +12,9 @@
*/
require_once './libraries/common.inc.php';
-$GLOBALS['js_include'][] = 'server_privileges.js';
+$header = PMA_Header::getInstance();
+$scripts = $header->getScripts();
+$scripts->addFile('server_privileges.js');
/**
* Displays an error message and exits if the user isn't allowed to use this
@@ -22,7 +24,7 @@ if (! $cfg['ShowChgPassword']) {
$cfg['ShowChgPassword'] = PMA_DBI_select_db('mysql');
}
if ($cfg['Server']['auth_type'] == 'config' || ! $cfg['ShowChgPassword']) {
- include_once './libraries/header.inc.php';
+ $header->display();
PMA_Message::error(__('You don\'t have sufficient privileges to be here right now!'))->display();
include './libraries/footer.inc.php';
} // end if
@@ -50,8 +52,7 @@ if (isset($_REQUEST['nopass'])) {
* If the "change password" form hasn't been submitted or the values submitted
* aren't valid -> displays the form
*/
-// Loads the headers
-require_once './libraries/header.inc.php';
+$header->display();
// Displays an error message if required
if (isset($message)) {
@@ -203,7 +204,7 @@ function PMA_changePassAuthType($_url_params, $password)
*/
function PMA_changePassDisplayPage($message, $sql_query, $_url_params)
{
- include_once './libraries/header.inc.php';
+ PMA_Header::getInstance()->display();
echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
echo PMA_getMessage($message, $sql_query, 'success');
echo '<a href="index.php'.PMA_generate_common_url($_url_params).' target="_parent">'. "\n"