From 40b3ce9fd191d00159c601b986f92291a4bfccb5 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 4 Oct 2007 09:22:50 +0000 Subject: [PATCH] use array to define included JavaScript libraries --- db_create.php | 2 +- export.php | 10 ++-- import.php | 2 +- libraries/common.inc.php | 5 ++ libraries/db_common.inc.php | 2 +- libraries/header.inc.php | 91 ++++++++++++---------------------- libraries/mult_submits.inc.php | 2 +- libraries/tbl_links.inc.php | 2 +- server_databases.php | 2 +- server_export.php | 2 +- server_privileges.php | 3 +- server_sql.php | 2 +- sql.php | 4 +- tbl_addfield.php | 2 +- tbl_alter.php | 2 +- tbl_change.php | 4 +- tbl_create.php | 2 +- tbl_indexes.php | 5 +- tbl_move_copy.php | 2 +- tbl_replace.php | 25 +++------- tbl_row_action.php | 9 +--- user_password.php | 2 +- 22 files changed, 74 insertions(+), 108 deletions(-) diff --git a/db_create.php b/db_create.php index a69064316..3606a673a 100644 --- a/db_create.php +++ b/db_create.php @@ -9,7 +9,7 @@ * Gets some core libraries */ require_once './libraries/common.inc.php'; -$js_to_run = 'functions.js'; +$GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/mysql_charsets.lib.php'; PMA_checkParameters(array('db')); diff --git a/export.php b/export.php index ab84554d9..e179139d9 100644 --- a/export.php +++ b/export.php @@ -60,7 +60,7 @@ if (empty($_REQUEST['asfile'])) { if (isset($export_list[$type]['force_file']) && ! $asfile) { $message = $strExportMustBeFile; $GLOBALS['show_error_header'] = true; - $js_to_run = 'functions.js'; + $GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; if ($export_type == 'server') { $active_page = 'server_export.php'; @@ -315,7 +315,7 @@ if ($save_on_server) { } } if (isset($message)) { - $js_to_run = 'functions.js'; + $GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; if ($export_type == 'server') { $active_page = 'server_export.php'; @@ -362,7 +362,7 @@ if (!$save_on_server) { $num_tables = count($tables); if ($num_tables == 0) { $message = $strNoTablesFound; - $js_to_run = 'functions.js'; + $GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; $active_page = 'db_export.php'; require './db_export.php'; @@ -553,7 +553,7 @@ if (!PMA_exportFooter()) { // End of fake loop if ($save_on_server && isset($message)) { - $js_to_run = 'functions.js'; + $GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; if ($export_type == 'server') { $active_page = 'server_export.php'; @@ -610,7 +610,7 @@ if (!empty($asfile)) { $message = sprintf($strDumpSaved, htmlspecialchars($save_filename)); } - $js_to_run = 'functions.js'; + $GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; if ($export_type == 'server') { $active_page = 'server_export.php'; diff --git a/import.php b/import.php index 6559b17cf..1bc2e28f6 100644 --- a/import.php +++ b/import.php @@ -10,7 +10,7 @@ * Get the variables sent or posted to this script and a core script */ require_once './libraries/common.inc.php'; -$js_to_run = 'functions.js'; +$GLOBALS['js_include'][] = 'functions.js'; // default values $GLOBALS['reload'] = false; diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 92e879d69..2010f7b46 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -441,6 +441,11 @@ $_REQUEST['js_frame'] = PMA_ifSetOr($_REQUEST['js_frame'], ''); //$_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(); /******************************************************************************/ /* parsing configuration file LABEL_parsing_config_file */ diff --git a/libraries/db_common.inc.php b/libraries/db_common.inc.php index 805bac559..418a799cd 100644 --- a/libraries/db_common.inc.php +++ b/libraries/db_common.inc.php @@ -55,7 +55,7 @@ if (isset($submitcollation) && !empty($db_collation)) { unset($db_charset, $db_collation); } -$js_to_run = 'functions.js'; +$GLOBALS['js_include'][] = 'functions.js'; require_once './libraries/header.inc.php'; /** diff --git a/libraries/header.inc.php b/libraries/header.inc.php index 4f12f244d..9fe886c20 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -59,79 +59,54 @@ if (empty($GLOBALS['is_header_sent'])) { // Updates the title of the frameset if possible (ns4 does not allow this) if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown' && typeof(parent.document.title) == 'string') { - parent.document.title = ''; + parent.document.title = ''; } + // js form validation stuff - var errorMsg0 = ''; - var errorMsg1 = ''; + var errorMsg0 = ''; + var errorMsg1 = ''; var noDropDbMsg = ''; - var confirmMsg = ''; - var confirmMsgDropDB = ''; - // ]]> - - + ? PMA_escapeJsString($GLOBALS['strNoDropDatabases']) : ''; ?>'; + var confirmMsg = ''; + var confirmMsgDropDB = ''; - // js form validation stuff - var jsHostEmpty = ''; - var jsUserEmpty = ''; - var jsPasswordEmpty = ''; - var jsPasswordNotSame = ''; - // ]]> - - - - // js form validation stuff - var jsHostEmpty = ''; - var jsUserEmpty = ''; - var jsPasswordEmpty = ''; - var jsPasswordNotSame = ''; - // ]]> - - - - // js index validation stuff - var errorMsg0 = ''; - var errorMsg1 = ''; - // ]]> - - - - // ]]> - - - - // ]]> - + var errorMsg0 = ''; + var errorMsg1 = ''; + // js form validation stuff + var jsHostEmpty = ''; + var jsUserEmpty = ''; + var jsPasswordEmpty = ''; + var jsPasswordNotSame = ''; + + // ]]> + + + ' . "\n"; + } // Reloads the navigation frame via JavaScript if required PMA_reloadNavigation(); ?> -