Skip to content

Commit

Permalink
use include() instead of require() when including file conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
ruleant committed Sep 22, 2011
1 parent ff56cbf commit ac088aa
Show file tree
Hide file tree
Showing 19 changed files with 123 additions and 123 deletions.
18 changes: 9 additions & 9 deletions libraries/header.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function PMA_addRecentTable($db, $table)
/**
* Gets a core script and starts output buffering work
*/
require_once './libraries/ob.lib.php';
include_once './libraries/ob.lib.php';
PMA_outBufferPre();

// if database storage for user preferences is transient, offer to load
Expand All @@ -54,9 +54,9 @@ function PMA_addRecentTable($db, $table)
// to a seperate file. It can now be included by header.inc.php,
// querywindow.php.

require_once './libraries/header_http.inc.php';
require_once './libraries/header_meta_style.inc.php';
require_once './libraries/header_scripts.inc.php';
include_once './libraries/header_http.inc.php';
include_once './libraries/header_meta_style.inc.php';
include_once './libraries/header_scripts.inc.php';
?>
<meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
<?php /* remove vertical scroll bar bug in ie */ ?>
Expand All @@ -76,7 +76,7 @@ function PMA_addRecentTable($db, $table)

// Include possible custom headers
if (file_exists(CUSTOM_HEADER_FILE)) {
require CUSTOM_HEADER_FILE;
include CUSTOM_HEADER_FILE;
}


Expand All @@ -89,7 +89,7 @@ function PMA_addRecentTable($db, $table)

// offer to load user preferences from localStorage
if ($userprefs_offer_import) {
require_once './libraries/user_preferences.lib.php';
include_once './libraries/user_preferences.lib.php';
PMA_userprefs_autoload_header();
}

Expand Down Expand Up @@ -148,7 +148,7 @@ function PMA_addRecentTable($db, $table)
// if the table is being dropped, $_REQUEST['purge'] is set to '1'
// so do not display the table name in upper div
if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
require_once './libraries/tbl_info.inc.php';
include_once './libraries/tbl_info.inc.php';

echo $separator;
printf($item,
Expand Down Expand Up @@ -179,7 +179,7 @@ function PMA_addRecentTable($db, $table)
/**
* Settings for relations stuff
*/
require_once './libraries/relation.lib.php';
include_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();

// Get additional information about tables for tooltip is done
Expand Down Expand Up @@ -208,7 +208,7 @@ function PMA_addRecentTable($db, $table)
} //end if (!$GLOBALS['is_ajax_request'])
else {
if (empty($GLOBALS['is_header_sent'])) {
require_once './libraries/header_http.inc.php';
include_once './libraries/header_http.inc.php';
$GLOBALS['is_header_sent'] = true;
}
}
Expand Down
28 changes: 14 additions & 14 deletions libraries/mult_submits.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
} elseif (isset($selected_tbl) && !empty($selected_tbl)) {
// coming from database structure view - do something with selected tables
if ($submit_mult == 'print') {
require './tbl_printview.php';
include './tbl_printview.php';
} else {
$selected = $selected_tbl;
switch ($submit_mult) {
Expand All @@ -47,7 +47,7 @@
break;
case 'export':
unset($submit_mult);
require 'db_export.php';
include 'db_export.php';
exit;
break;
} // end switch
Expand Down Expand Up @@ -102,7 +102,7 @@
$mult_btn = __('Yes');
break;
case 'change':
require './tbl_alter.php';
include './tbl_alter.php';
break;
case 'browse':
// this should already be handled by tbl_structure.php
Expand All @@ -121,18 +121,18 @@
if (!empty($submit_mult) && !empty($what)) {
unset($message);

require_once './libraries/header.inc.php';
include_once './libraries/header.inc.php';
if (strlen($table)) {
require './libraries/tbl_common.php';
include './libraries/tbl_common.php';
$url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
require './libraries/tbl_info.inc.php';
require_once './libraries/tbl_links.inc.php';
include './libraries/tbl_info.inc.php';
include_once './libraries/tbl_links.inc.php';
} elseif (strlen($db)) {
require './libraries/db_common.inc.php';
require './libraries/db_info.inc.php';
include './libraries/db_common.inc.php';
include './libraries/db_info.inc.php';
} else {
require_once './libraries/server_common.inc.php';
require_once './libraries/server_links.inc.php';
include_once './libraries/server_common.inc.php';
include_once './libraries/server_links.inc.php';
}

// Builds the query
Expand Down Expand Up @@ -288,7 +288,7 @@
</fieldset>
<?php
}
require './libraries/footer.inc.php';
include './libraries/footer.inc.php';

} // end if

Expand All @@ -299,7 +299,7 @@
elseif ($mult_btn == __('Yes')) {

if ($query_type == 'drop_db' || $query_type == 'drop_tbl' || $query_type == 'drop_fld') {
require_once './libraries/relation_cleanup.lib.php';
include_once './libraries/relation_cleanup.lib.php';
}

$sql_query = '';
Expand Down Expand Up @@ -465,7 +465,7 @@
}

if ($use_sql) {
require './sql.php';
include './sql.php';
} elseif (!$run_parts) {
PMA_DBI_select_db($db);
$result = PMA_DBI_try_query($sql_query);
Expand Down
10 changes: 5 additions & 5 deletions libraries/rte/rte_main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
* Displays the header and tabs
*/
if (! empty($table) && in_array($table, PMA_DBI_get_tables($db))) {
require_once './libraries/tbl_common.php';
require_once './libraries/tbl_links.inc.php';
include_once './libraries/tbl_common.php';
include_once './libraries/tbl_links.inc.php';
} else {
$table = '';
require_once './libraries/db_common.inc.php';
require_once './libraries/db_info.inc.php';
include_once './libraries/db_common.inc.php';
include_once './libraries/db_info.inc.php';
}
} else {
/**
Expand Down Expand Up @@ -92,7 +92,7 @@
* Display the footer, if necessary
*/
if ($GLOBALS['is_ajax_request'] != true) {
require './libraries/footer.inc.php';
include './libraries/footer.inc.php';
}

?>
8 changes: 4 additions & 4 deletions libraries/string.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
*/
if (@function_exists('mb_strlen')) {
mb_internal_encoding('utf-8');
require './libraries/string_mb.lib.php';
include './libraries/string_mb.lib.php';
} else {
require './libraries/string_native.lib.php';
include './libraries/string_native.lib.php';
}

/**
* Load ctype handler.
*/
if (@extension_loaded('ctype')) {
require './libraries/string_type_ctype.lib.php';
include './libraries/string_type_ctype.lib.php';
} else {
require './libraries/string_type_native.lib.php';
include './libraries/string_type_native.lib.php';
}

/**
Expand Down
12 changes: 6 additions & 6 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
// when $server > 0, a server has been chosen so we can display
// all MySQL-related information
if ($server > 0) {
require './libraries/server_common.inc.php';
require './libraries/StorageEngine.class.php';
require './libraries/server_links.inc.php';
include './libraries/server_common.inc.php';
include './libraries/StorageEngine.class.php';
include './libraries/server_links.inc.php';

// Use the verbose name of the server instead of the hostname
// if a value is set
Expand Down Expand Up @@ -71,7 +71,7 @@
if (! $cfg['LeftDisplayServers']
&& (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
echo '<li id="li_select_server">';
require_once './libraries/select_server.lib.php';
include_once './libraries/select_server.lib.php';
PMA_select_server(true, true);
echo '</li>';
}
Expand All @@ -80,7 +80,7 @@
* Displays the mysql server related links
*/
if ($server > 0 && !PMA_DRIZZLE) {
require_once './libraries/check_user_privileges.lib.php';
include_once './libraries/check_user_privileges.lib.php';

// Logout for advanced authentication
if ($cfg['Server']['auth_type'] != 'config') {
Expand Down Expand Up @@ -119,7 +119,7 @@
// Displays language selection combo
if (empty($cfg['Lang'])) {
echo '<li id="li_select_lang">';
require_once './libraries/display_select_lang.lib.php';
include_once './libraries/display_select_lang.lib.php';
PMA_select_language();
echo '</li>';
}
Expand Down
10 changes: 5 additions & 5 deletions schema_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@
if (! $cfgRelation['relwork']) {
echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n"
. PMA_showDocu('relation') . "\n";
require_once './libraries/footer.inc.php';
include_once './libraries/footer.inc.php';
}

if (! $cfgRelation['displaywork']) {
echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
. PMA_showDocu('table_info') . "\n";
require_once './libraries/footer.inc.php';
include_once './libraries/footer.inc.php';
}

if (! isset($cfgRelation['table_coords'])) {
echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
. PMA_showDocu('table_coords') . "\n";
require_once './libraries/footer.inc.php';
include_once './libraries/footer.inc.php';
}
if (! isset($cfgRelation['pdf_pages'])) {
echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
. PMA_showDocu('pdf_pages') . "\n";
require_once './libraries/footer.inc.php';
include_once './libraries/footer.inc.php';
}

if ($cfgRelation['pdfwork']) {
Expand All @@ -64,7 +64,7 @@
* so, user can interact with it and perform export of relations schema
*/

require_once './libraries/schema/User_Schema.class.php';
include_once './libraries/schema/User_Schema.class.php';
$user_schema = new PMA_User_Schema();

/**
Expand Down
8 changes: 4 additions & 4 deletions server_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

case 'cpu':
if (!$sysinfo) {
require_once 'libraries/sysinfo.lib.php';
include_once 'libraries/sysinfo.lib.php';
$sysinfo = getSysInfo();
}
if (!$cpuload) {
Expand All @@ -151,7 +151,7 @@

case 'memory':
if (!$sysinfo) {
require_once 'libraries/sysinfo.lib.php';
include_once 'libraries/sysinfo.lib.php';
$sysinfo = getSysInfo();
}
if (!$memory) {
Expand Down Expand Up @@ -404,8 +404,8 @@
$server_master_status = false;
$server_slave_status = false;
} else {
require './libraries/replication.inc.php';
require_once './libraries/replication_gui.lib.php';
include './libraries/replication.inc.php';
include_once './libraries/replication_gui.lib.php';
}

/**
Expand Down
Loading

0 comments on commit ac088aa

Please sign in to comment.