use array to define included JavaScript libraries
This commit is contained in:
@@ -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'));
|
||||
|
10
export.php
10
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';
|
||||
|
@@ -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;
|
||||
|
@@ -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 */
|
||||
|
@@ -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';
|
||||
|
||||
/**
|
||||
|
@@ -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 = '<?php echo PMA_sanitize(str_replace('\'', '\\\'', $title)); ?>';
|
||||
parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString($title)); ?>';
|
||||
}
|
||||
|
||||
<?php
|
||||
// Add some javascript instructions if required
|
||||
if (isset($js_to_run) && $js_to_run == 'functions.js') {
|
||||
echo "\n";
|
||||
if (in_array('functions.js', $GLOBALS['js_include'])) {
|
||||
PMA_jsFormat()
|
||||
?>
|
||||
// js form validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
var errorMsg0 = '<?php echo PMA_escapeJsString($GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo PMA_escapeJsString($GLOBALS['strNotNumber']); ?>';
|
||||
var noDropDbMsg = '<?php echo (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase'])
|
||||
? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''; ?>';
|
||||
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
|
||||
var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="./js/functions.js" type="text/javascript"></script>
|
||||
? PMA_escapeJsString($GLOBALS['strNoDropDatabases']) : ''; ?>';
|
||||
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? PMA_escapeJsString($GLOBALS['strDoYouReally']) : ''); ?>';
|
||||
var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? PMA_escapeJsString($GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
|
||||
<?php
|
||||
} elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="./js/user_password.js" type="text/javascript"></script>
|
||||
<?php
|
||||
} elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="./js/server_privileges.js" type="text/javascript"></script>
|
||||
<script src="./js/functions.js" type="text/javascript"></script>
|
||||
<?php
|
||||
} elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
|
||||
echo "\n";
|
||||
} elseif (in_array('indexes.js', $GLOBALS['js_include'])) {
|
||||
?>
|
||||
// js index validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="./js/indexes.js" type="text/javascript"></script>
|
||||
<?php
|
||||
} elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="./js/tbl_change.js" type="text/javascript"></script>
|
||||
<?php
|
||||
} else {
|
||||
echo "\n";
|
||||
?>
|
||||
// ]]>
|
||||
</script>
|
||||
var errorMsg0 = '<?php echo PMA_escapeJsString($GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo PMA_escapeJsString($GLOBALS['strNotNumber']); ?>';
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
if (in_array('user_password.js', $GLOBALS['js_include'])
|
||||
|| in_array('server_privileges.js', $GLOBALS['js_include'])) {
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo PMA_escapeJsString($GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo PMA_escapeJsString($GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo PMA_escapeJsString($GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo PMA_escapeJsString($GLOBALS['strPasswordNotSame']); ?>';
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$GLOBALS['js_include'][] = 'tooltip.js';
|
||||
foreach ($GLOBALS['js_include'] as $js_script_file) {
|
||||
echo '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
|
||||
}
|
||||
|
||||
// Reloads the navigation frame via JavaScript if required
|
||||
PMA_reloadNavigation();
|
||||
?>
|
||||
<script src="./js/tooltip.js" type="text/javascript"></script>
|
||||
<meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
|
||||
<?php /* remove vertical scroll bar bug in ie */ ?>
|
||||
<!--[if IE 6]>
|
||||
|
@@ -115,7 +115,7 @@ if (! empty($submit_mult)
|
||||
* Displays the confirmation form if required
|
||||
*/
|
||||
if (!empty($submit_mult) && !empty($what)) {
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
unset($message);
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
|
@@ -37,7 +37,7 @@ $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
|
||||
/**
|
||||
* Displays headers
|
||||
*/
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
/**
|
||||
|
@@ -11,7 +11,7 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require './libraries/server_common.inc.php';
|
||||
|
||||
/**
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
|
||||
/**
|
||||
* Displays the links
|
||||
|
@@ -13,7 +13,8 @@ require_once './libraries/common.inc.php';
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
$js_to_run = 'server_privileges.js';
|
||||
$GLOBALS['js_include'][] = 'server_privileges.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require './libraries/server_common.inc.php';
|
||||
|
||||
|
||||
|
@@ -13,7 +13,7 @@ require_once './libraries/common.inc.php';
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require_once './libraries/server_common.inc.php';
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
|
4
sql.php
4
sql.php
@@ -517,7 +517,7 @@ if ($num_rows < 1 || $is_affected) {
|
||||
// Loads to target script
|
||||
if (strpos($goto, 'db_') === 0
|
||||
|| strpos($goto, 'tbl_') === 0) {
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
}
|
||||
if ($goto != 'main.php') {
|
||||
require_once './libraries/header.inc.php';
|
||||
@@ -543,7 +543,7 @@ else {
|
||||
if (isset($printview) && $printview == '1') {
|
||||
require_once './libraries/header_printview.inc.php';
|
||||
} else {
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
unset($message);
|
||||
if (strlen($table)) {
|
||||
require './libraries/tbl_common.php';
|
||||
|
@@ -11,7 +11,7 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/Table.class.php';
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
// Check parameters
|
||||
|
@@ -11,7 +11,7 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/Table.class.php';
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
// Check parameters
|
||||
|
@@ -111,7 +111,7 @@ if ($GLOBALS['cfg']['ShowPropertyComments']) {
|
||||
/**
|
||||
* used in ./libraries/header.inc.php to load JavaScript library file
|
||||
*/
|
||||
$js_to_run = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
|
||||
/**
|
||||
* HTTP and HTML headers
|
||||
@@ -610,7 +610,7 @@ foreach ($rows as $row_id => $vrow) {
|
||||
// The value column (depends on type)
|
||||
// ----------------
|
||||
|
||||
$foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
|
||||
$foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
|
||||
echo ' <td>' . "\n";
|
||||
if ($foreignData['foreign_link'] == true) {
|
||||
echo $backup_field . "\n";
|
||||
|
@@ -41,7 +41,7 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/Table.class.php';
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
|
@@ -51,9 +51,8 @@ if (!defined('PMA_IDX_INCLUDED')) {
|
||||
}
|
||||
|
||||
// Displays headers (if needed)
|
||||
$js_to_run = isset($index) && isset($do_save_data)
|
||||
? 'functions.js'
|
||||
: 'indexes.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'indexes.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
} // end if
|
||||
|
||||
|
@@ -34,7 +34,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$message = (isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames);
|
||||
} else {
|
||||
PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$message = (isset($submit_move) ? $strMoveTableOK : $strCopyTableOK);
|
||||
$message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
|
||||
$reload = 1;
|
||||
|
@@ -66,7 +66,7 @@ $goto_include = false;
|
||||
|
||||
if (isset($_REQUEST['insert_rows']) && is_numeric($_REQUEST['insert_rows']) && $_REQUEST['insert_rows'] != $cfg['InsertRows']) {
|
||||
$cfg['InsertRows'] = $_REQUEST['insert_rows'];
|
||||
$js_to_run = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
require './tbl_change.php';
|
||||
exit;
|
||||
@@ -280,7 +280,7 @@ if ($is_insert && count($value_sets) > 0) {
|
||||
} else {
|
||||
// No change -> move back to the calling script
|
||||
$message .= $GLOBALS['strNoModification'];
|
||||
$js_to_run = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$active_page = $goto_include;
|
||||
require_once './libraries/header.inc.php';
|
||||
require './' . PMA_securePath($goto_include);
|
||||
@@ -307,7 +307,7 @@ foreach ($query as $single_query) {
|
||||
} else {
|
||||
$result = PMA_DBI_query($single_query);
|
||||
}
|
||||
|
||||
|
||||
if (! $result) {
|
||||
$message .= PMA_DBI_getError();
|
||||
} else {
|
||||
@@ -329,10 +329,10 @@ foreach ($query as $single_query) {
|
||||
} // end if
|
||||
|
||||
foreach (PMA_DBI_get_warnings() as $warning) {
|
||||
$warning_message .= $warning['Level'] . ': #' . $warning['Code']
|
||||
$warning_message .= $warning['Level'] . ': #' . $warning['Code']
|
||||
. ' ' . $warning['Message'] . '[br]';
|
||||
}
|
||||
|
||||
|
||||
unset($result);
|
||||
}
|
||||
unset($single_query, $query);
|
||||
@@ -355,18 +355,9 @@ if (isset($return_to_sql_query)) {
|
||||
$GLOBALS['sql_query'] = $return_to_sql_query;
|
||||
}
|
||||
|
||||
// if user asked to "Insert another new row", we need tbl_change.js
|
||||
// otherwise the calendar icon does not work
|
||||
if ($goto_include == 'tbl_change.php') {
|
||||
/**
|
||||
* @todo if we really need to run many different js at header time,
|
||||
* $js_to_run would become an array and header.inc.php would iterate
|
||||
* thru it, instead of the bunch of if/elseif it does now
|
||||
*/
|
||||
$js_to_run = 'tbl_change.js';
|
||||
} else {
|
||||
$js_to_run = 'functions.js';
|
||||
}
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
|
||||
$active_page = $goto_include;
|
||||
require_once './libraries/header.inc.php';
|
||||
require './' . PMA_securePath($goto_include);
|
||||
|
@@ -70,13 +70,8 @@ switch($submit_mult) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($submit_mult == 'row_edit') {
|
||||
$js_to_run = 'tbl_change.js';
|
||||
}
|
||||
|
||||
if ($submit_mult == 'row_delete' || $submit_mult == 'row_export') {
|
||||
$js_to_run = 'functions.js';
|
||||
}
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
|
@@ -88,7 +88,7 @@ if (isset($nopass)) {
|
||||
* aren't valid -> displays the form
|
||||
*/
|
||||
// Loads the headers
|
||||
$js_to_run = 'user_password.js';
|
||||
$GLOBALS['js_include'][] = 'user_password.js';
|
||||
require_once './libraries/header.inc.php';
|
||||
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
|
||||
|
||||
|
Reference in New Issue
Block a user