Permalink
Browse files

Dropped header.inc.php in favor of the PMA_Header class

  • Loading branch information...
1 parent 97449da commit 4a740376c89755698ae5fac3746eb57ba07142ae @roccivic roccivic committed May 23, 2012
Showing with 210 additions and 361 deletions.
  1. +1 −1 chk_rel.php
  2. +0 −4 db_create.php
  3. +4 −3 db_events.php
  4. +2 −1 db_export.php
  5. +2 −1 db_import.php
  6. +2 −1 db_operations.php
  7. +4 −3 db_routines.php
  8. +5 −4 db_search.php
  9. +4 −3 db_sql.php
  10. +4 −3 db_structure.php
  11. +2 −1 db_tracking.php
  12. +3 −3 db_triggers.php
  13. +1 −6 export.php
  14. +1 −1 import.php
  15. +1 −1 libraries/PDF.class.php
  16. +1 −1 libraries/auth/config.auth.lib.php
  17. +13 −28 libraries/common.inc.php
  18. +1 −1 libraries/common.lib.php
  19. +1 −1 libraries/core.lib.php
  20. +4 −1 libraries/db_common.inc.php
  21. +1 −1 libraries/display_tbl.lib.php
  22. +0 −137 libraries/header.inc.php
  23. +1 −1 libraries/header_printview.inc.php
  24. +1 −1 libraries/header_scripts.inc.php
  25. +2 −2 libraries/insert_edit.lib.php
  26. +0 −1 libraries/mult_submits.inc.php
  27. +1 −1 libraries/schema/Export_Relation_Schema.class.php
  28. +2 −2 libraries/server_common.inc.php
  29. +1 −1 libraries/tbl_common.inc.php
  30. +1 −1 main.php
  31. +3 −2 prefs_forms.php
  32. +4 −3 prefs_manage.php
  33. +6 −14 querywindow.php
  34. +2 −2 server_databases.php
  35. +4 −2 server_export.php
  36. +2 −1 server_import.php
  37. +4 −3 server_plugins.php
  38. +2 −3 server_privileges.php
  39. +3 −3 server_replication.php
  40. +3 −3 server_sql.php
  41. +14 −12 server_status.php
  42. +2 −1 server_synchronize.php
  43. +2 −1 server_variables.php
  44. +21 −20 sql.php
  45. +1 −1 tbl_addfield.php
  46. +0 −2 tbl_alter.php
  47. +6 −6 tbl_change.php
  48. +6 −5 tbl_chart.php
  49. +2 −1 tbl_create.php
  50. +2 −1 tbl_export.php
  51. +7 −6 tbl_gis_visualization.php
  52. +2 −1 tbl_import.php
  53. +2 −1 tbl_indexes.php
  54. +1 −3 tbl_printview.php
  55. +2 −1 tbl_relation.php
  56. +4 −10 tbl_replace.php
  57. +7 −6 tbl_select.php
  58. +3 −3 tbl_sql.php
  59. +3 −3 tbl_structure.php
  60. +14 −15 tbl_zoom_select.php
  61. +2 −1 transformation_overview.php
  62. +2 −4 transformation_wrapper.php
  63. +6 −5 user_password.php
View
@@ -10,7 +10,7 @@
* Gets some core libraries
*/
require_once 'libraries/common.inc.php';
-require_once 'libraries/header.inc.php';
+PMA_Header::getInstance()->display();
/**
View
@@ -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 ($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 @@
PMA_ajaxResponse($message, true, $extra_data);
}
- include_once 'libraries/header.inc.php';
include_once '' . $cfg['DefaultTabDatabase'];
}
?>
View
@@ -15,9 +15,10 @@
/**
* 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
View
@@ -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']
View
@@ -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
View
@@ -19,7 +19,8 @@
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)
View
@@ -16,9 +16,10 @@
/**
* 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
View
@@ -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
View
@@ -13,9 +13,10 @@
/**
* 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';
View
@@ -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
View
@@ -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.
View
@@ -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
View
@@ -88,7 +88,6 @@
// 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 @@ function PMA_exportOutputHandler($line)
}
}
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 @@ function PMA_exportOutputHandler($line)
$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 @@ function PMA_exportOutputHandler($line)
// 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 @@ function PMA_exportOutputHandler($line)
);
}
- include_once 'libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
include_once 'server_export.php';
View
@@ -83,7 +83,7 @@
// 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]');
View
@@ -85,7 +85,7 @@ function _putpages()
*/
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';
}
@@ -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);
View
@@ -149,6 +149,10 @@
/******************************************************************************/
/* 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 @@
//$_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 @@
*/
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
View
@@ -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 = '';
View
@@ -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);
}
/**
@@ -76,7 +76,10 @@
};
}
-require_once './libraries/header.inc.php';
+/**
+ * Displays headers
+ */
+PMA_Header::getInstance()->display();
/**
* Set parameters for links
@@ -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)
Oops, something went wrong.

0 comments on commit 4a74037

Please sign in to comment.