From c81e9ed85e01215e464d94446773bcd5e6699194 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 23 Feb 2009 19:40:40 +0000 Subject: [PATCH] Constant PATH rewritten, some parts rewritten to use INCLUDE_READABLE() --- inc/autopurge.php | 2 +- inc/config.php | 2 +- inc/db/lib-mysql3.php | 4 ++-- inc/extensions/ext-sql_patches.php | 2 +- inc/functions.php | 14 +++++++------- inc/load_cache.php | 2 +- inc/modules/admin.php | 6 +++--- inc/modules/admin/overview-inc.php | 2 +- inc/modules/admin/what-theme_import.php | 2 +- inc/modules/guest/what-wernis_portal.php | 2 +- inc/modules/member/what-themes.php | 2 +- inc/pool-update.php | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/inc/autopurge.php b/inc/autopurge.php index 75bddcd86b..8f2e72a208 100644 --- a/inc/autopurge.php +++ b/inc/autopurge.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Load all includes -$INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/autopurge/", "purge-"); +$INC_POOL = GET_DIR_AS_ARRAY(constant('PATH')."inc/autopurge/", "purge-"); // Run the filter RUN_FILTER('load_includes', $INC_POOL); diff --git a/inc/config.php b/inc/config.php index 5e6307bbd6..4cfa57bbbf 100644 --- a/inc/config.php +++ b/inc/config.php @@ -162,7 +162,7 @@ define('SSL_COOKIES', false); define('ENABLE_BACKLINK', true); // Connect to the MySQL database... -require(PATH."inc/mysql-connect.php"); +require(constant('PATH')."inc/mysql-connect.php"); // ?> diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 8d0ee5f467..b1850f4efa 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -79,7 +79,7 @@ Query string:
// // Debugging stuff... // - $fp = @fopen(PATH."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!"); + $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!"); if (!isset($OK)) { // Write first entry fwrite($fp, "Module=".$GLOBALS['module']."\n"); @@ -256,7 +256,7 @@ function SQL_QUERY_ESC ($qstring, $data, $file, $line, $run=true, $strip=true) { // // Debugging // - //* DEBUG: */ $fp = fopen(PATH."inc/cache/escape_debug.log", 'a') or mxchange_die("Cannot write debug.log!"); + //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or mxchange_die("Cannot write debug.log!"); //* DEBUG: */ fwrite($fp, $file."(".$line."): ".str_replace("\r", "", str_replace("\n", " ", $eval))."\n"); //* DEBUG: */ fclose($fp); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 3cc2446bf5..d849e757e3 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -310,7 +310,7 @@ case "update": // Update an extension case "0.2.4": // SQL queries for v0.2.4 $auto_type = "png"; // PNG image is the default - if ((FILE_READABLE(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) { + if ((INCLUDE_READABLE("theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) { // Switch to JPEG format $auto_type = "jpg"; } diff --git a/inc/functions.php b/inc/functions.php index 38612873b2..c5db673515 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -712,7 +712,7 @@ function GET_LANGUAGE() { $ret = $cacheArray['language']; } elseif (!empty($lang)) { // Check if main language file does exist - if (FILE_READABLE(PATH."inc/language/".$lang.".php")) { + if (FILE_READABLE(constant('PATH')."inc/language/".$lang.".php")) { // Okay found, so let's update cookies SET_LANGUAGE($lang); } @@ -1227,7 +1227,7 @@ function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") { if (!defined('_MAX')) define('_MAX', 15235); // Build server string - $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(PATH."inc/databases.php"); + $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(constant('PATH')."inc/databases.php"); // Build key string $keys = SITE_KEY.":".DATE_KEY; @@ -2033,7 +2033,7 @@ function generateHash ($plainText, $salt = "") { // When the salt is empty build a new one, else use the first x configured characters as the salt if (empty($salt)) { // Build server string - $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(PATH."inc/databases.php"); + $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(constant('PATH')."inc/databases.php"); // Build key string $keys = constant('SITE_KEY').":".constant('DATE_KEY').":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", bigintval(getConfig('patch_ctime'))).":".getConfig('master_salt'); @@ -2400,7 +2400,7 @@ function DEBUG_LOG ($file, $line, $message, $force=true) { // Is debug mode enabled? if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force === true)) { // Log this message away - $fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!"); + $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!"); fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($file)."|".$line."|".strip_tags($message)."\n"); fclose($fp); } // END - if @@ -2457,7 +2457,7 @@ function RESET_ADD_INCLUDES () { } // END - if // Get more daily reset scripts - $INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/reset/", "reset_"); + $INC_POOL = GET_DIR_AS_ARRAY(constant('PATH')."inc/reset/", "reset_"); // Update database if (!defined('DEBUG_RESET')) UPDATE_CONFIG("last_update", time()); @@ -2468,7 +2468,7 @@ function RESET_ADD_INCLUDES () { // Has it changed? if (getConfig('last_week') != $currWeek) { // Include weekly reset scripts - $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY(PATH."inc/weekly/", "weekly_")); + $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY(constant('PATH')."inc/weekly/", "weekly_")); // Update config if (!defined('DEBUG_WEEKLY')) UPDATE_CONFIG("last_week", $currWeek); @@ -2480,7 +2480,7 @@ function RESET_ADD_INCLUDES () { // Has it changed? if (getConfig('last_month') != $currMonth) { // Include monthly reset scripts - $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY(PATH."inc/monthly/", "monthly_")); + $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY(constant('PATH')."inc/monthly/", "monthly_")); // Update config if (!defined('DEBUG_MONTHLY')) UPDATE_CONFIG("last_month", $currMonth); diff --git a/inc/load_cache.php b/inc/load_cache.php index 4e849ba440..cc441d5d8b 100644 --- a/inc/load_cache.php +++ b/inc/load_cache.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Load more cache includes -$INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/loader/", "load_cache-"); +$INC_POOL = GET_DIR_AS_ARRAY(constant('PATH')."inc/loader/", "load_cache-"); // Run the filter RUN_FILTER('load_includes', $INC_POOL); diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 5700828f82..2127e9f67b 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -68,7 +68,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { switch ($ret) { case "done": - admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); + admin_WriteData(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); if (!constant('_FATAL')) { // Registering is done LOAD_URL("modules.php?module=admin&action=login®ister=done"); @@ -96,7 +96,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { // Admin still not registered? if (!isBooleanConstantAndTrue('admin_registered')) { // Write to config that registration is done - admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); + admin_WriteData(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); // Load URL for login LOAD_URL("modules.php?module=admin&action=login"); @@ -347,7 +347,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { if (!isConfigEntrySet('admin_menu')) setConfigEntry('admin_menu', "OLD"); // Check for version and switch between old menu system and new "intelligent menu system" - if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (FILE_READABLE(PATH."inc/modules/admin/lasys-inc.php"))) { + if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (INCLUDE_READABLE("inc/modules/admin/lasys-inc.php"))) { // Default area is the entrance, of course $area = "entrance"; diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 2ffdeee1f7..85d37c9740 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -49,7 +49,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) { $JOBS_DONE = true; // Open the extension directory - $handle = opendir(PATH."inc/extensions/") or mxchange_die("Cannot read extension directory!"); + $handle = opendir(constant('PATH')."inc/extensions/") or mxchange_die("Cannot read extension directory!"); while ($file = readdir($handle)) { // Is this file an extension? if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) { diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php index 045e925e2b..df118063b9 100644 --- a/inc/modules/admin/what-theme_import.php +++ b/inc/modules/admin/what-theme_import.php @@ -90,7 +90,7 @@ $THEMES = array( ); // Read directory "themes" -$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!"); +$handle = opendir(constant('PATH')."theme/") or mxchange_die("Cannot read themes dir!"); while ($dir = readdir($handle)) { // Construct absolute theme.php file name $INC = sprintf("theme/%s/theme.php", $dir); diff --git a/inc/modules/guest/what-wernis_portal.php b/inc/modules/guest/what-wernis_portal.php index 3d801a5e8c..c60a8f3f8e 100644 --- a/inc/modules/guest/what-wernis_portal.php +++ b/inc/modules/guest/what-wernis_portal.php @@ -49,7 +49,7 @@ ADD_DESCR("guest", __FILE__); OUTPUT_HTML("
"); $rdf = new fase4_rdf(); $rdf->use_dynamic_display(false); -$rdf->set_CacheDir(PATH."inc/cache/"); +$rdf->set_CacheDir(constant('PATH')."inc/cache/"); $rdf->set_salt(md5(SITE_KEY)); $rdf->set_max_item(10); $rdf->set_Options( diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index 990f2bedce..cf10a10eab 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -71,7 +71,7 @@ $THEMES = array( ); // Read directory "themes" -$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!"); +$handle = opendir(constant('PATH')."theme/") or mxchange_die("Cannot read themes dir!"); while ($entry = readdir($handle)) { // Construct absolute theme.php file name $INC = sprintf("theme/%s/theme.php", $entry); diff --git a/inc/pool-update.php b/inc/pool-update.php index 32256682f5..93e986148a 100644 --- a/inc/pool-update.php +++ b/inc/pool-update.php @@ -47,7 +47,7 @@ if (defined('__DAILY_RESET')) { $GLOBALS['pool_cnt'] = 0; // Load more cache includes -$INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/pool/", "pool-"); +$INC_POOL = GET_DIR_AS_ARRAY(constant('PATH')."inc/pool/", "pool-"); // Run the filter RUN_FILTER('load_includes', $INC_POOL); -- 2.39.5