From 4ef4c88fc481335dc0631b223111c15a84cccb51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 10 Sep 2008 09:42:13 +0000 Subject: [PATCH] Surfbar admin stats added (dummy), FILE_READABLE() added --- .gitattributes | 1 + inc/extensions.php | 15 +++--- inc/extensions/ext-sql_patches.php | 15 +++--- inc/extensions/ext-surfbar.php | 6 +-- inc/functions.php | 59 +++++++++++------------- inc/install-inc.php | 6 +-- inc/language.php | 6 +-- inc/libs/cache_functions.php | 49 ++++++++------------ inc/libs/output_functions.php | 6 +-- inc/libs/sponsor_functions.php | 2 +- inc/load_extensions.php | 14 +++--- inc/modules/admin.php | 2 +- inc/modules/admin/action- | 2 +- inc/modules/admin/action-admins.php | 3 +- inc/modules/admin/action-bank.php | 2 +- inc/modules/admin/action-country.php | 2 +- inc/modules/admin/action-doubler.php | 2 +- inc/modules/admin/action-email.php | 2 +- inc/modules/admin/action-holiday.php | 2 +- inc/modules/admin/action-login.php | 2 +- inc/modules/admin/action-menu.php | 8 ++-- inc/modules/admin/action-misc.php | 8 ++-- inc/modules/admin/action-mods.php | 8 ++-- inc/modules/admin/action-newsletter.php | 8 ++-- inc/modules/admin/action-payouts.php | 8 ++-- inc/modules/admin/action-primera.php | 2 +- inc/modules/admin/action-rallye.php | 8 ++-- inc/modules/admin/action-repair.php | 8 ++-- inc/modules/admin/action-setup.php | 2 +- inc/modules/admin/action-sponsor.php | 4 +- inc/modules/admin/action-stats.php | 8 ++-- inc/modules/admin/action-surfbar.php | 2 +- inc/modules/admin/action-task.php | 8 ++-- inc/modules/admin/action-theme.php | 8 ++-- inc/modules/admin/action-transfer.php | 8 ++-- inc/modules/admin/action-user.php | 8 ++-- inc/modules/admin/action-wernis.php | 8 ++-- inc/modules/admin/admin-inc.php | 6 +-- inc/modules/admin/what-edit_sponsor.php | 4 +- inc/modules/admin/what-extensions.php | 2 +- inc/modules/admin/what-logs.php | 2 +- inc/modules/admin/what-surfbar_stats.php | 44 ++++++++++++++++++ inc/modules/admin/what-theme_check.php | 2 +- inc/modules/admin/what-theme_import.php | 12 +++-- inc/modules/admin/what-usage.php | 6 +-- inc/modules/guest/action- | 8 ++-- inc/modules/guest/action-admin.php | 15 +++--- inc/modules/guest/action-main.php | 12 ++--- inc/modules/guest/action-members.php | 8 ++-- inc/modules/guest/action-sponsor.php | 5 +- inc/modules/index.php | 31 +++++-------- inc/modules/login.php | 2 +- inc/modules/member/action- | 2 +- inc/modules/member/action-account.php | 8 ++-- inc/modules/member/action-bank.php | 8 ++-- inc/modules/member/action-extras.php | 8 ++-- inc/modules/member/action-logout.php | 8 ++-- inc/modules/member/action-main.php | 8 ++-- inc/modules/member/action-order.php | 8 ++-- inc/modules/member/action-rals.php | 8 ++-- inc/modules/member/action-stats.php | 8 ++-- inc/modules/member/action-surfbar.php | 2 +- inc/modules/member/what-reflinks.php | 4 +- inc/modules/member/what-themes.php | 11 +++-- inc/modules/sponsor.php | 4 +- inc/modules/sponsor/.php | 4 +- inc/modules/sponsor/account.php | 4 +- inc/modules/sponsor/settings.php | 4 +- inc/modules/sponsor/welcome.php | 4 +- inc/mysql-manager.php | 16 +++---- inc/stylesheet.php | 2 +- inc/theme-manager.php | 8 ++-- modules.php | 4 +- 73 files changed, 291 insertions(+), 313 deletions(-) create mode 100644 inc/modules/admin/what-surfbar_stats.php diff --git a/.gitattributes b/.gitattributes index 0c0dfd6c4c..f6de7bda74 100644 --- a/.gitattributes +++ b/.gitattributes @@ -369,6 +369,7 @@ inc/modules/admin/what-send_bonus.php -text inc/modules/admin/what-send_newsletter.php -text inc/modules/admin/what-stats_mods.php -text inc/modules/admin/what-sub_points.php -text +inc/modules/admin/what-surfbar_stats.php -text inc/modules/admin/what-theme_check.php -text inc/modules/admin/what-theme_edit.php -text inc/modules/admin/what-theme_import.php -text diff --git a/inc/extensions.php b/inc/extensions.php index 17dbf7d6d4..1250799913 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -55,7 +55,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name); // Does this extension exists? - if (file_exists($file) && is_readable($file)) + if (FILE_READABLE($file)) { // Extension was found so we can load it in registration mode require($file); @@ -98,7 +98,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $EXT_UPDATE_DEPENDS); // Check for required file - if (file_exists($file) && is_readable($file)) + if (FILE_READABLE($file)) { // File exists so let's load it $VER_BACKUP = $EXT_VERSION; @@ -254,7 +254,10 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { // Load extension in detected mode //* DEBUG: */ echo __FUNCTION__.":ext_name[{$id}]={$ext_name}
\n"; $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name); - if (file_exists($file) && is_readable($file)) require($file); + if (FILE_READABLE($file)) { + // Load the include + require($file); + } //* DEBUG: */ echo __FUNCTION__.":SQLs::count=".count($SQLs)."
\n"; if ((is_array($SQLs) && (sizeof($SQLs) > 0))) { @@ -316,7 +319,7 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin = false, $ignore_cache = false) // Extension's file name will also be checked $file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name); - if ((!file_exists($file)) && (!is_readable($file))) return false; + if (!FILE_READABLE($file)) return false; //* DEBUG: */ echo "*".$ext_name."(".count($cacheArray).")
"; // Not active is the default @@ -362,9 +365,7 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin = false, $ignore_cache = false) ( $active == "Y" ) && ( - file_exists($inc) - ) && ( - is_readable($inc) + FILE_READABLE($inc) ) ); } diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index b332e0d9b9..958fc7a7de 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -289,8 +289,7 @@ PRIMARY KEY(id) case "0.2.4": // SQL queries for v0.2.4 $auto_type = "png"; // PNG image is the default - if ((file_exists(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) - { + if ((FILE_READABLE(PATH."theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) { // Switch to JPEG format $auto_type = "jpg"; } @@ -588,19 +587,21 @@ default: // Do stuff when extension is loaded require_once(PATH."inc/extensions/ext-cache.php"); if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); - } - } + } // END - if + } // END - if // Test again if ((!empty($_CONFIG['file_hash'])) && (!empty($_CONFIG['master_salt'])) && (!empty($_CONFIG['pass_scramble']))) { // File hash fas generated so we can also file the secret file... hopefully. - if ((file_exists(PATH."inc/.secret/.".$_CONFIG['file_hash'])) && (is_readable(PATH."inc/.secret/.".$_CONFIG['file_hash']))) { - $_CONFIG['secret_key'] = implode("", file(PATH."inc/.secret/.".$_CONFIG['file_hash'])); + $hashFile = sprintf("%sinc/.secret/.%s", PATH, $_CONFIG['file_hash']); + if (FILE_READABLE($hashFile)) { + // Read file + $_CONFIG['secret_key'] = implode("", file($hashFile)); } else { // Cannot read secret file! mxchange_die("Cannot read secret file!"); } - } + } // END - if // Transfer words/numbers to constants define('POINTS' , $dummy['points_word']); diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 1ffc7492eb..4550e539ac 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -58,7 +58,6 @@ case "register": // Do stuff when installtion is running (modules.php?module=adm `last_salt` VARCHAR( 255 ) NOT NULL DEFAULT '', `reward` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '0.00000', `costs` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '0.00000', -`payment_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', `views_total` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', `status` ENUM('PENDING','CONFIRMED', 'LOCKED') NOT NULL DEFAULT 'CONFIRMED', `registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -128,11 +127,12 @@ INDEX (`userid`,`url_id`) $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_stats','URL-Statistiken','Y','Y',3)"; // Admin menus - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','','Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar',NULL,'Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','add_surfbar_url','URL hinzufügen','Fügen Sie URLs z.B. von Werbenetzwerken hinzu, oder Ihre eigenen Projekte. Vorsicht! Ihnen muss es auch gestattet sein, URLs aus dem Werbenetzwerk in die Surfbar einzufügen.',1)"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',2)"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',3)"; $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar ändern, wie Festvergütung, prozentuale Ref-Vergütung und vieles mehr.',4)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','surfbar_stats','Statistiken','Detailierte Statistiken zu einer ausgewählten URL anzeigen.',5)"; // Load CSS? $EXT_CSS = "Y"; @@ -145,7 +145,7 @@ case "remove": // Do stuff when removing extension $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`"; $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`"; $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 4"; - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 5"; + $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 6"; break; case "activate": // Do stuff when admin activates this extension diff --git a/inc/functions.php b/inc/functions.php index 0bfa73075c..bfe60aa6e7 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -272,20 +272,20 @@ function LOAD_TEMPLATE($template, $return=false, $content="") { ); // Probe for it... - if (file_exists($file2)) $file = $file2; + if (FILE_READABLE($file2)) $file = $file2; // Remove variable from memory unset($file2); } // Does the special template exists? - if ((!file_exists($file)) || (!is_readable($file))) { + if (!FILE_READABLE($file)) { // Reset to default template $file = $BASE.$template.".tpl"; - } + } // END - if // Now does the final template exists? - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { // The local file does exists so we load it. :) $tmpl_file = implode("", file($file)); @@ -646,7 +646,7 @@ function GET_LANGUAGE() { // Check GET variable and cookie if (!empty($lang)) { // Check if main language file does exist - if (file_exists(PATH."inc/language/".$lang.".php")) { + if (FILE_READABLE(PATH."inc/language/".$lang.".php")) { // Okay found, so let's update cookies SET_LANGUAGE($lang); } @@ -853,13 +853,13 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") { } // Does the special template exists? - if ((!@file_exists($file)) || (!is_readable($file))) { + if (!FILE_READABLE($file)) { // Reset to default template $file = $BASE.$template.".tpl"; } // END - if // Now does the final template exists? - if ((@file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { // The local file does exists so we load it. :) $tmpl_file = @implode("", @file($file)); $tmpl_file = addslashes($tmpl_file); @@ -1248,42 +1248,34 @@ function bigintval($num, $castValue = true) { // Insert the code in $img_code into jpeg or PNG image function GENERATE_IMAGE($img_code, $header=true) { global $_CONFIG; - if ((strlen($img_code) > 6) || (empty($img_code)) || ($_CONFIG['code_length'] == 0)) - { + + if ((strlen($img_code) > 6) || (empty($img_code)) || ($_CONFIG['code_length'] == 0)) { // Stop execution of function here because of over-sized code length return; - } - elseif (!$header) - { + } elseif (!$header) { // Return in an HTML code code return "\n"; } - switch ($_CONFIG['img_type']) - { - case "jpg": - // Loads JPEG image - $img = sprintf("%s/theme/%s/images/code_bg.jpg", PATH, GET_CURR_THEME()); - if ((file_exists($img)) && (is_readable($img))) { + // Load image + $img = sprintf("%s/theme/%s/images/code_bg.%s", PATH, GET_CURR_THEME(), $_CONFIG['img_type']); + if (FILE_READABLE($img)) { + // Switch image type + switch ($_CONFIG['img_type']) + { + case "jpg": // Okay, load image and hide all errors $image = @imagecreatefromjpeg($img); - } else { - // Exit function here - return; - } - break; + break; - case "png": - // Loads PNG image - $img = sprintf("%s/theme/%s/images/code_bg.png", PATH, GET_CURR_THEME()); - if ((file_exists($img)) && (is_readable($img))) { + case "png": // Okay, load image and hide all errors $image = @imagecreatefrompng($img); - } else { - // Exit function here - return; + break; } - break; + } else { + // Exit function here + return; } // Generate text color (red/green/blue; 0 = dark, 255 = bright) @@ -2434,6 +2426,11 @@ function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) { // Return the value return $ret; } +// Check if given FQFN is a readable file +function FILE_READABLE($fqfn) { + // Check all... + return ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))); +} // ////////////////////////////////////////////////// // // diff --git a/inc/install-inc.php b/inc/install-inc.php index 5f9fede1c2..58b56350cd 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -48,7 +48,7 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) $next = -1; $sneak++; - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { $search = "CFG: ".$comment; $tmp = $file.".tmp"; $fp = @fopen($file, 'r') or OUTPUT_HTML("READ: ".$file."
"); @@ -342,12 +342,12 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT $db = SQL_SELECT_DB($mysql['dbase'], $link, __FILE__, __LINE__); if ($db) { // Automatically run install.sql - if ((file_exists($_POST['spath']."install/tables.sql")) && (file_exists($_POST['spath']."install/menu-".GET_LANGUAGE().".sql"))) { + if ((FILE_READABLE($_POST['spath']."install/tables.sql")) && (FILE_READABLE($_POST['spath']."install/menu-".GET_LANGUAGE().".sql"))) { // Both exists so import them foreach (array("tables.sql", "menu-".GET_LANGUAGE().".sql") as $dump) { // Should be save here because file_exists() is there but we check it again. :) $file = secureString($_POST['spath']) . "install/" . $dump; - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { // Load the file $sql = implode("", file($file)); diff --git a/inc/language.php b/inc/language.php index cd18027783..93da8d9ca9 100644 --- a/inc/language.php +++ b/inc/language.php @@ -43,12 +43,12 @@ if (empty($mx_lang)) $mx_lang = DEFAULT_LANG; // Look for file $file = sprintf("%sinc/language/%s.php", PATH, $mx_lang); -if ((!file_exists($file)) || (!is_readable($file))) { +if (!FILE_READABLE($file)) { // Switch to default (DO NOT CHANGE!!!) set_session("mx_lang", "de"); $mx_lang = "de"; - $file = sprintf("%sinc/language/%s.php", PATH, $mx_lang); -} + $file = sprintf("%sinc/language/%s.php", PATH, "de"); +} // END - if // Load language file require($file); diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 711dc59554..1a7a5f14e5 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -57,16 +57,15 @@ class mxchange_cache $this->cache_path=$path; // Check if path exists - if ((file_exists($path)) && (is_dir($path)) && (!$tested)) - { + if ((is_dir($path)) && (!$tested)) { // Check if we can create a file inside the path @touch($path."dummy.tmp", 'w'); - if (file_exists($path."dummy.tmp")) { + if (FILE_READABLE($path."dummy.tmp")) { // Yes, we can do. So let's remove it @unlink($path."dummy.tmp"); // Is there a .htaccess file? - if (file_exists($path.".htaccess")) { + if (FILE_READABLE($path.".htaccess")) { // Update database that we have tested it UPDATE_CONFIG("cache_tested", 1); @@ -89,8 +88,7 @@ class mxchange_cache return "failed"; } - function cache_file($file, $ignore_ctime=false) - { + function cache_file($file, $ignore_ctime=false) { global $INC; // Construct FQFN (full qualified file name) $inc = $this->cache_path.$file.".cache"; @@ -99,14 +97,11 @@ class mxchange_cache $this->cache_inc = $inc; // Check if file exists - $status = (file_exists($inc) && (is_readable($inc)) && (is_writeable($inc))); - if ($status) - { + $status = (FILE_READABLE($inc) && (is_writeable($inc))); + if ($status) { // Yes, it does. So let's get it's last changed date/time $ctime = filectime($inc); - } - else - { + } else { // No, it doesn't. Zero date/time $ctime = "0"; } @@ -115,21 +110,20 @@ class mxchange_cache $this->cache_ctime = $ctime; // Is the cache file outdated? - if (((time() - $ctime) >= $this->update_interval) && (!$ignore_ctime)) - { + if (((time() - $ctime) >= $this->update_interval) && (!$ignore_ctime)) { // Ok, we need an update! $status = false; } + + // Return status return $status; } - function cache_init($array) - { + function cache_init($array) { // This will destory an existing cache file! - if ($this->ret == "done") - { + if ($this->ret == "done") { // Create file - if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); + if (FILE_READABLE($this->cache_inc)) @chmod($this->cache_inc, 0666); $fp = @fopen($this->cache_inc, 'w') or mxchange_die("Cannot write to cache ".$this->cache_inc." !"); // Begin of cache file @@ -137,9 +131,7 @@ class mxchange_cache // Remember file pointer $this->cache_pointer = $fp; - } - else - { + } else { // Cannot create file ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); } @@ -182,7 +174,7 @@ class mxchange_cache @fclose($this->cache_pointer); // Set rights - if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); + if (FILE_READABLE($this->cache_inc)) @chmod($this->cache_inc, 0666); // Remove pointer unset($this->cache_pointer); @@ -196,8 +188,7 @@ class mxchange_cache function cache_load() { - if ((file_exists($this->cache_inc)) && (is_readable($this->cache_inc))) - { + if (FILE_READABLE($this->cache_inc)) { // Prepare temporary array $data = array(); @@ -223,11 +214,11 @@ class mxchange_cache function cache_destroy() { - if (file_exists($this->cache_inc)) + if (FILE_READABLE($this->cache_inc)) { // Remove cache file from system @unlink($this->cache_inc); - if (!file_exists($this->cache_inc)) + if (!FILE_READABLE($this->cache_inc)) { // Close cache automatically (we don't need it anymore!) $this->cache_close(); @@ -248,7 +239,7 @@ class mxchange_cache function cache_remove($search, $data, $array) { global $ARRAY; - if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) + if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) { // Load cache into dummy array $dummy = $this->cache_load(); @@ -303,7 +294,7 @@ class mxchange_cache function cache_replace($search, $replace, $search_key, $array) { global $ARRAY; - if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) + if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) { // Load cache into dummy array $dummy = $this->cache_load(); diff --git a/inc/libs/output_functions.php b/inc/libs/output_functions.php index fb245f9b70..45f0eb4069 100644 --- a/inc/libs/output_functions.php +++ b/inc/libs/output_functions.php @@ -113,20 +113,20 @@ function get_template ($template, $return=false, $content="") $file2 = sprintf("%s%s%s_%s.tpl", $BASE, $MODE, $template, SQL_ESCAPE($_GET['what'])); // Probe for it... - if ((file_exists($file2)) && (is_readable($file2))) $file = $file2; + if (FILE_READABLE($file2)) $file = $file2; // Remove variable from memory unset($file2); } // END - if // Does the special template exists? - if ((!file_exists($file)) || (!is_readable($file))) { + if (!FILE_READABLE($file)) { // Reset to default template $file = sprintf("%stemplates/%s/html/%s.tpl", PATH, GET_LANGUAGE(), $template); } // END - if // Now does the final template exists? - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { // The local file does exists so we load it. :) $tmpl_file = implode("", file($file)); $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 019eac79ff..7ee98e3118 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -423,7 +423,7 @@ function GENERATE_SPONSOR_CONTENT($what) global $HTTP_POST_VARS, $_GET, $CONFIG; $OUT = ""; $FILE = sprintf("%sinc/modules/sponsor/%s.php", PATH, $what); - if ((file_exists($FILE)) && (is_readable($FILE))) { + if (FILE_READABLE($FILE)) { // Every sponsor action will output nothing directly. It will be written into $OUT! require_once($FILE); } else { diff --git a/inc/load_extensions.php b/inc/load_extensions.php index 9ed4eb42fa..1b5d401cbc 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -46,7 +46,7 @@ $ADD = ""; if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return; // Load default sql_patches extension if present -if (file_exists(PATH."inc/extensions/ext-sql_patches.php") && is_readable(PATH."inc/extensions/ext-sql_patches.php")) { +if (FILE_READABLE(PATH."inc/extensions/ext-sql_patches.php")) { // Load it... $EXT_LOAD_MODE = ""; require_once(PATH."inc/extensions/ext-sql_patches.php"); @@ -98,7 +98,7 @@ if ($cacheMode == "load") { // Load Language file if ($EXT_DUMMY['ext_lang'][$k] == "Y") { $INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE()); - if (file_exists($INC)) require_once($INC); + if (FILE_READABLE($INC)) require_once($INC); } // END - if // Load CSS file @@ -198,14 +198,14 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == $file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name); // Does the extension file exists? - if (file_exists($file1) && is_readable($file1)) { + if (FILE_READABLE($file1)) { // If there's no language file specified we don't need to load one... ;-) if (!empty($lang)) { // Create language file $file2 = sprintf("%sinc/language/%s_%s.php", PATH, $lang, GET_LANGUAGE()); } - if (file_exists($file3) && is_readable($file3)) { + if (FILE_READABLE($file3)) { // Special functions file $funcs = "Y"; require_once($file3); @@ -215,7 +215,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == } // Do we need a language file? - if (($file1 != $file2) && (file_exists($file2)) && (is_readable($file2))) { + if (($file1 != $file2) && (FILE_READABLE($file2))) { // Load language file $lang = "Y"; include($file2); @@ -235,7 +235,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == if ($css == "Y") { $CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $name); - if (file_exists($CSS_FILE)) { + if (FILE_READABLE($CSS_FILE)) { // CSS file for extension was found (use only relative path for now!) $EXT_CSS_FILES[] = $name.".css"; } else { @@ -261,7 +261,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == // Remember this value for later usage $cacheArray['active_extensions'][$name] = $EXT_ALWAYS_ACTIVE; } - } elseif (!file_exists($file1)) { + } elseif (!FILE_READABLE($file1)) { // Deleted extension file so we mark it for removal from DB $DEL[] = $name; } diff --git a/inc/modules/admin.php b/inc/modules/admin.php index a117d14b89..285e82eabb 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -359,7 +359,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { if (empty($_CONFIG['admin_menu'])) $_CONFIG['admin_menu'] = "OLD"; // Check for version and switch between old menu system and new "intelligent menu system" - if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (file_exists(PATH."inc/modules/admin/la_sys-inc.php"))) { + if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (FILE_READABLE(PATH."inc/modules/admin/la_sys-inc.php"))) { // Default area is the entrance, of course $area = "entrance"; diff --git a/inc/modules/admin/action- b/inc/modules/admin/action- index 4f657c6940..75268e3a1b 100644 --- a/inc/modules/admin/action- +++ b/inc/modules/admin/action- @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-admins.php b/inc/modules/admin/action-admins.php index 9e4c6b28ee..95c4b724b2 100644 --- a/inc/modules/admin/action-admins.php +++ b/inc/modules/admin/action-admins.php @@ -42,11 +42,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-bank.php b/inc/modules/admin/action-bank.php index 16ca06e121..7d20e4039b 100644 --- a/inc/modules/admin/action-bank.php +++ b/inc/modules/admin/action-bank.php @@ -43,7 +43,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-country.php b/inc/modules/admin/action-country.php index 7a1950c4d8..8b70025d53 100644 --- a/inc/modules/admin/action-country.php +++ b/inc/modules/admin/action-country.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-doubler.php b/inc/modules/admin/action-doubler.php index f4a7922f36..a08f335778 100644 --- a/inc/modules/admin/action-doubler.php +++ b/inc/modules/admin/action-doubler.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf(."%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-email.php b/inc/modules/admin/action-email.php index 1e28604ed3..808abc2d70 100644 --- a/inc/modules/admin/action-email.php +++ b/inc/modules/admin/action-email.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-holiday.php b/inc/modules/admin/action-holiday.php index f350201a79..056d423583 100644 --- a/inc/modules/admin/action-holiday.php +++ b/inc/modules/admin/action-holiday.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-login.php b/inc/modules/admin/action-login.php index 9111fbd95e..a7377d80fa 100644 --- a/inc/modules/admin/action-login.php +++ b/inc/modules/admin/action-login.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-menu.php b/inc/modules/admin/action-menu.php index e1245595d9..9b5f8a35c4 100644 --- a/inc/modules/admin/action-menu.php +++ b/inc/modules/admin/action-menu.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-misc.php b/inc/modules/admin/action-misc.php index 95d0b1e589..48222b8e63 100644 --- a/inc/modules/admin/action-misc.php +++ b/inc/modules/admin/action-misc.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-mods.php b/inc/modules/admin/action-mods.php index 20c846844a..1ae0aae9ff 100644 --- a/inc/modules/admin/action-mods.php +++ b/inc/modules/admin/action-mods.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-newsletter.php b/inc/modules/admin/action-newsletter.php index da9c090b61..8d36f0b911 100644 --- a/inc/modules/admin/action-newsletter.php +++ b/inc/modules/admin/action-newsletter.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-payouts.php b/inc/modules/admin/action-payouts.php index 8871db900d..436253e508 100644 --- a/inc/modules/admin/action-payouts.php +++ b/inc/modules/admin/action-payouts.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-primera.php b/inc/modules/admin/action-primera.php index 2d94eade21..3ede03c63e 100644 --- a/inc/modules/admin/action-primera.php +++ b/inc/modules/admin/action-primera.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-rallye.php b/inc/modules/admin/action-rallye.php index 243c179b4f..fd4dc22f31 100644 --- a/inc/modules/admin/action-rallye.php +++ b/inc/modules/admin/action-rallye.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-repair.php b/inc/modules/admin/action-repair.php index 09eba7ec2e..4ae98f8af4 100644 --- a/inc/modules/admin/action-repair.php +++ b/inc/modules/admin/action-repair.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-setup.php b/inc/modules/admin/action-setup.php index 7f28d820d7..f9b44e6b0b 100644 --- a/inc/modules/admin/action-setup.php +++ b/inc/modules/admin/action-setup.php @@ -43,7 +43,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-sponsor.php b/inc/modules/admin/action-sponsor.php index fcb23d131d..58b58b5edf 100644 --- a/inc/modules/admin/action-sponsor.php +++ b/inc/modules/admin/action-sponsor.php @@ -42,11 +42,11 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { - $FATAL[] = ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2; + ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } // ?> diff --git a/inc/modules/admin/action-stats.php b/inc/modules/admin/action-stats.php index 3cd387404b..7422f6c613 100644 --- a/inc/modules/admin/action-stats.php +++ b/inc/modules/admin/action-stats.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-surfbar.php b/inc/modules/admin/action-surfbar.php index d4964c6321..e322bef5d2 100644 --- a/inc/modules/admin/action-surfbar.php +++ b/inc/modules/admin/action-surfbar.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) { +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); } else { diff --git a/inc/modules/admin/action-task.php b/inc/modules/admin/action-task.php index 4c7691cd5c..832c40a582 100644 --- a/inc/modules/admin/action-task.php +++ b/inc/modules/admin/action-task.php @@ -45,14 +45,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-theme.php b/inc/modules/admin/action-theme.php index 8b702b0aef..527b6126fe 100644 --- a/inc/modules/admin/action-theme.php +++ b/inc/modules/admin/action-theme.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-transfer.php b/inc/modules/admin/action-transfer.php index 1eae1b12c2..c832f82dab 100644 --- a/inc/modules/admin/action-transfer.php +++ b/inc/modules/admin/action-transfer.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-user.php b/inc/modules/admin/action-user.php index 1d53df9a13..01f87a7aee 100644 --- a/inc/modules/admin/action-user.php +++ b/inc/modules/admin/action-user.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/action-wernis.php b/inc/modules/admin/action-wernis.php index 5b91251679..e528e044b2 100644 --- a/inc/modules/admin/action-wernis.php +++ b/inc/modules/admin/action-wernis.php @@ -43,14 +43,12 @@ ADD_DESCR("admin", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module include($INC); -} - else -{ +} else { ADD_FATAL(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } + // ?> diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 43f531ceee..377cdfab91 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -194,7 +194,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) { $found = false; // Is the file there and read-/write-able? - if ((file_exists($file)) && (is_readable($file)) && (is_writeable($file))) { + if ((FILE_READABLE($file)) && (is_writeable($file))) { $search = "CFG: ".$comment; $tmp = $file.".tmp"; @@ -309,7 +309,7 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); // Is valid but does the inlcude file exists? $INC = sprintf("%sinc/modules/admin/action-%s.php", PATH, $act); - if ((file_exists($INC)) && (is_readable($INC)) && (VALIDATE_MENU_ACTION("admin", $act, $wht)) && (__ACL_ALLOW == true)) + if ((FILE_READABLE($INC)) && (VALIDATE_MENU_ACTION("admin", $act, $wht)) && (__ACL_ALLOW == true)) { // Ok, we finally load the admin action module include($INC); @@ -416,7 +416,7 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) // ACL is "allow"... hmmm $ACL = true; } - $readable = ((file_exists($INC)) && (is_readable($INC))); + $readable = FILE_READABLE($INC); if ($ACL) { // Insert compiled title and description diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php index fc3d280ea6..9081221758 100644 --- a/inc/modules/admin/what-edit_sponsor.php +++ b/inc/modules/admin/what-edit_sponsor.php @@ -176,8 +176,8 @@ if ((!empty($_GET['id'])) && (!empty($_GET['mode']))) { if (!empty($MSG)) { // Output message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); - } - } elseif (file_exists(PATH."templates/".GET_LANGUAGE()."/html/admin/".$TPL.".tpl")) { + } // END - if + } elseif (FILE_READABLE(sprintf("%stemplates/%s/html/admin/%s.tpl", PATH, GET_LANGUAGE(), $TPL))) { // Create mailto link define('__SPONSOR_VALUE', "".__SURNAME." ".__FAMILY.""); diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 80b0cd03e7..1930311d39 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -369,7 +369,7 @@ case "search": // Search for new extensions on our server if (empty($cver)) $cver = "-.-"; // Is the extension already installed or not? - if (!file_exists($file) || ($ver != $cver)) + if (!FILE_READABLE($file) || ($ver != $cver)) { // No, it isn't. So let's add this one! $EXT_SEARCH['fname'][] = $name; diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index efffe465da..55d0bb06e3 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -46,7 +46,7 @@ if (!empty($_GET['access'])) { $target = sprintf("%slogs/%s", PATH, $access); // Is the file valid and readable? - if ((file_exists($target)) && (is_readable($target))) { + if (FILE_READABLE($target)) { // Load it directly $content = implode("", file($target)); diff --git a/inc/modules/admin/what-surfbar_stats.php b/inc/modules/admin/what-surfbar_stats.php new file mode 100644 index 0000000000..3bc8f9f407 --- /dev/null +++ b/inc/modules/admin/what-surfbar_stats.php @@ -0,0 +1,44 @@ + diff --git a/inc/modules/admin/what-theme_check.php b/inc/modules/admin/what-theme_check.php index acef17b946..f416bd3115 100644 --- a/inc/modules/admin/what-theme_check.php +++ b/inc/modules/admin/what-theme_check.php @@ -82,7 +82,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) if (empty($cver)) $cver = "-.-"; // Is the extension already installed or not? - if (((SQL_NUMROWS($result) == 0) && (!file_exists($file))) || ($ver != $cver)) { + if (((SQL_NUMROWS($result) == 0) && (!FILE_READABLE($file))) || ($ver != $cver)) { // No, it isn't. So let's add this one! $THEMES['fname'][] = $name; $THEMES['fsize'][] = $response[$idx + 1]; diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php index 775f6f493f..ff47824ed7 100644 --- a/inc/modules/admin/what-theme_import.php +++ b/inc/modules/admin/what-theme_import.php @@ -53,7 +53,7 @@ if (!empty($_POST['theme'])) { // Import theme $file = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])); - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { // Load the theme header file include($file); @@ -96,7 +96,7 @@ while ($dir = readdir($handle)) { $theme = sprintf("%stheme/%s/theme.php", PATH, $dir); // Test it... - if (($dir != ".") && ($dir != "..") && (file_exists($theme)) && (is_readable($theme))) { + if (($dir != ".") && ($dir != "..") && (FILE_READABLE($theme))) { // Found a valid directory so let's load it's theme.php file include($theme); @@ -107,8 +107,10 @@ while ($dir = readdir($handle)) { $THEMES['theme_email'][] = $THEME_EMAIL; $THEMES['theme_url'][] = $THEME_URL; $THEMES['theme_ver'][] = $THEME_VERSION; - } -} + } // END - if +} // END - while + +// Close directory closedir($handle); // Sort array by Uni* name @@ -116,7 +118,7 @@ array_pk_sort($THEMES, array("theme_name")); // Generate output lines for the template $OUT = ""; $SW = 2; -foreach ($THEMES['theme_unix'] as $key=>$unix) { +foreach ($THEMES['theme_unix'] as $key => $unix) { // Check if current theme is already imported or not $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1", array($unix), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-usage.php b/inc/modules/admin/what-usage.php index 3a17999e65..4046acd753 100644 --- a/inc/modules/admin/what-usage.php +++ b/inc/modules/admin/what-usage.php @@ -53,7 +53,7 @@ if (!empty($_GET['image'])) { $file = sprintf("%s%s%s_usage_%s.png", PATH, $usage, SQL_ESCAPE($_GET['type']), SQL_ESCAPE($_GET['image'])); } - if ((file_exists($file)) && (is_readable($file))) { + if (FILE_READABLE($file)) { $image = imagecreatefrompng($file); header("Content-type: image/png"); imagepng($image); @@ -61,7 +61,7 @@ if (!empty($_GET['image'])) { } exit(); } elseif (empty($_GET['usage'])) { - $file = PATH.$usage."index.html"; + $file = sprintf("%s%sindex.html", PATH, $usage); } else { $file = sprintf("%s%susage_%s.html", PATH, @@ -71,7 +71,7 @@ if (!empty($_GET['image'])) { } if (!empty($file)) { - if (file_exists($file) && is_readable($file)) { + if (FILE_READABLE($file)) { $tmpl_file = implode("", file($file)); $tmpl_file = addslashes($tmpl_file); $tmpl_file = "\$content=\"".$tmpl_file."\";"; diff --git a/inc/modules/guest/action- b/inc/modules/guest/action- index 38264c411f..2c6d438a15 100644 --- a/inc/modules/guest/action- +++ b/inc/modules/guest/action- @@ -43,14 +43,12 @@ ADD_DESCR("guest", basename(__FILE__)); // Load the include file $INC = sprintf(PATH."inc/modules/guest/what-%s.php", $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the guest action module include($INC); -} - else -{ +} else { ADD_FATAL(GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2); } + // ?> diff --git a/inc/modules/guest/action-admin.php b/inc/modules/guest/action-admin.php index fce845e27a..94dbca97ce 100644 --- a/inc/modules/guest/action-admin.php +++ b/inc/modules/guest/action-admin.php @@ -38,19 +38,16 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) require($INC); } -if (GET_ACTION("guest", $GLOBALS['what']) == "admin") -{ +if (GET_ACTION("guest", $GLOBALS['what']) == "admin") { // Only when one admin link is clicked... $INC = sprintf("%sinc/modules/guest/what-%s.php", PATH, $GLOBALS['what']); - if (file_exists($INC)) - { - // Ok, we finally load the guest action module + if (FILE_READABLE($INC)) { + // Ok, we finally load the guest action module include($INC); - } - else - { + } else { ADD_FATAL(GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2); } -} +} // END - if + // ?> diff --git a/inc/modules/guest/action-main.php b/inc/modules/guest/action-main.php index 0647588b14..4c89048ccd 100644 --- a/inc/modules/guest/action-main.php +++ b/inc/modules/guest/action-main.php @@ -45,18 +45,14 @@ ADD_DESCR("guest", basename(__FILE__)); $INC = sprintf("%sinc/modules/guest/what-%s.php", PATH, $GLOBALS['what']); $IS_VALID = WHAT_IS_VALID(GET_ACTION("guest", $GLOBALS['what']), $GLOBALS['what'], "guest"); -if ((file_exists($INC)) && (is_readable($INC)) && ($IS_VALID)) -{ +if (FILE_READABLE($INC)) && ($IS_VALID)) { // Ok, we finally load the guest action module require_once($INC); -} - elseif ($IS_VALID) -{ +} elseif ($IS_VALID) { ADD_FATAL(GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2); -} - else -{ +} else { ADD_FATAL(GUEST_LOCKED_ACTION); } + // ?> diff --git a/inc/modules/guest/action-members.php b/inc/modules/guest/action-members.php index 1b2c0460a2..3a3b270e6e 100644 --- a/inc/modules/guest/action-members.php +++ b/inc/modules/guest/action-members.php @@ -43,14 +43,12 @@ ADD_DESCR("guest", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/guest/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) -{ +if (FILE_READABLE($INC)) { // Ok, we finally load the guest action module include($INC); -} - else -{ +} else { ADD_FATAL(GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2); } + // ?> diff --git a/inc/modules/guest/action-sponsor.php b/inc/modules/guest/action-sponsor.php index de40dbc715..52d06df863 100644 --- a/inc/modules/guest/action-sponsor.php +++ b/inc/modules/guest/action-sponsor.php @@ -42,11 +42,12 @@ ADD_DESCR("guest", basename(__FILE__)); // Load the include file $INC = sprintf("%sinc/modules/guest/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC)) { +if (FILE_READABLE($INC)) { // Ok, we finally load the guest action module include($INC); } else { - $FATAL[] = GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2; + ADD_FATAL(GUEST_404_ACTION_1.$GLOBALS['what'].GUEST_404_ACTION_2); } + // ?> diff --git a/inc/modules/index.php b/inc/modules/index.php index e5019640be..366c6d16c7 100644 --- a/inc/modules/index.php +++ b/inc/modules/index.php @@ -48,8 +48,7 @@ LOAD_TEMPLATE("guest_header"); // Add message here if (!empty($_GET['msg'])) { - switch ($_GET['msg']) - { + switch ($_GET['msg']) { case CODE_LOGOUT_DONE : $msg = LOGOUT_DONE; break; case CODE_LOGOUT_FAILED : $msg = "".LOGOUT_FAILED.""; break; case CODE_DATA_INVALID : $msg = MAIL_DATA_INVALID; break; @@ -65,8 +64,10 @@ if (!empty($_GET['msg'])) { case CODE_LOGIN_FAILED : $msg = LOGIN_FAILED_GENERAL; break; default : $msg = UNKNOWN_MAILID_CODE_1.$_GET['msg'].UNKNOWN_MAILID_CODE_2; break; } + + // Load message template LOAD_TEMPLATE("message", false, $msg); -} +} // END - if // Some of you needs this to be extracted into a template... ??? LOAD_TEMPLATE("guest_menu_td"); @@ -75,41 +76,33 @@ LOAD_TEMPLATE("guest_menu_td"); if (empty($GLOBALS['what'])) $GLOBALS['what'] = $_CONFIG['index_home']; // Adding the main content module here -if (empty($GLOBALS['action'])) -{ +if (empty($GLOBALS['action'])) { // Get action value from what value $act = GET_ACTION("guest", $GLOBALS['what']); -} - else -{ +} else { // Get action value directly from URL $act = COMPILE_CODE($GLOBALS['action']); } // Add the guest's menu here... -if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) -{ +if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) { // Show only when guest menu is active ADD_MENU("guest", $act, $GLOBALS['what']); -} +} // END - if // TDs between menu and content LOAD_TEMPLATE("guest_menu_content"); $INC_ACTION = sprintf("%sinc/modules/guest/action-%s.php", PATH, $act); -if ((file_exists($INC_ACTION)) && (is_readable($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $act, $GLOBALS['what']))) -{ +if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $act, $GLOBALS['what']))) { // Requested module is available so we load it require_once($INC_ACTION); -} - else -{ +} else { // Invalid module specified or not found... LOAD_URL("modules.php?module=index"); } -if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) -{ +if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) { // TDs between content and LOAD_TEMPLATE("guest_content_footer"); @@ -121,7 +114,7 @@ if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) // Goto TOP template LOAD_TEMPLATE("guest_goto_top"); -} +} // END - if // Footer template (Thanx to Mr. Glaus!) LOAD_TEMPLATE("guest_footer"); diff --git a/inc/modules/login.php b/inc/modules/login.php index 8c493c055b..63871f1ecd 100644 --- a/inc/modules/login.php +++ b/inc/modules/login.php @@ -96,7 +96,7 @@ OUTPUT_HTML(" "); $INC_ACTION = sprintf("%sinc/modules/member/action-%s.php", PATH, $act); -if ((file_exists($INC_ACTION)) && (is_readable($INC_ACTION)) && (VALIDATE_MENU_ACTION("member", GET_ACTION("member", $GLOBALS['what']), $GLOBALS['what']))) { +if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("member", GET_ACTION("member", $GLOBALS['what']), $GLOBALS['what']))) { // Requested module is available so we load it include ($INC_ACTION); } else { diff --git a/inc/modules/member/action- b/inc/modules/member/action- index 456ce52d26..b16433423e 100644 --- a/inc/modules/member/action- +++ b/inc/modules/member/action- @@ -47,7 +47,7 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) { +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); } else { diff --git a/inc/modules/member/action-account.php b/inc/modules/member/action-account.php index e7391a9cf0..4fca9d942d 100644 --- a/inc/modules/member/action-account.php +++ b/inc/modules/member/action-account.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-bank.php b/inc/modules/member/action-bank.php index 4b01b03a09..b2a8a63509 100644 --- a/inc/modules/member/action-bank.php +++ b/inc/modules/member/action-bank.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-extras.php b/inc/modules/member/action-extras.php index 7cd95faabd..4c5e8d6e4f 100644 --- a/inc/modules/member/action-extras.php +++ b/inc/modules/member/action-extras.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-logout.php b/inc/modules/member/action-logout.php index 1a35520733..af6da02380 100644 --- a/inc/modules/member/action-logout.php +++ b/inc/modules/member/action-logout.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-main.php b/inc/modules/member/action-main.php index d3c82ec007..816cac49c5 100644 --- a/inc/modules/member/action-main.php +++ b/inc/modules/member/action-main.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-order.php b/inc/modules/member/action-order.php index 6c3cbfcb9b..b2524b4ba6 100644 --- a/inc/modules/member/action-order.php +++ b/inc/modules/member/action-order.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-rals.php b/inc/modules/member/action-rals.php index 4733d9c326..4f9ffd18b1 100644 --- a/inc/modules/member/action-rals.php +++ b/inc/modules/member/action-rals.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-stats.php b/inc/modules/member/action-stats.php index ac10d889d0..8d731faf70 100644 --- a/inc/modules/member/action-stats.php +++ b/inc/modules/member/action-stats.php @@ -52,14 +52,12 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) -{ +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); -} - else -{ +} else { ADD_FATAL(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } + // ?> diff --git a/inc/modules/member/action-surfbar.php b/inc/modules/member/action-surfbar.php index 27fc07b6f7..3a8201d950 100644 --- a/inc/modules/member/action-surfbar.php +++ b/inc/modules/member/action-surfbar.php @@ -47,7 +47,7 @@ ADD_DESCR("member", basename(__FILE__)); // Load the include file $INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, $GLOBALS['what']); -if (file_exists($INC_WHAT)) { +if (FILE_READABLE($INC_WHAT)) { // Ok, we finally load the member action module include_once($INC_WHAT); } else { diff --git a/inc/modules/member/what-reflinks.php b/inc/modules/member/what-reflinks.php index 0715a595b7..e9dcc54c19 100644 --- a/inc/modules/member/what-reflinks.php +++ b/inc/modules/member/what-reflinks.php @@ -105,9 +105,7 @@ if (SQL_NUMROWS($result) > 0) } } $size = strlen($file); - } - elseif (file_exists($test)) - { + } elseif (FILE_READABLE($test)) { $size = filesize($test); } if ($size > 0) $alt .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." ".KBYTES.")"; diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index e52b8da189..9731f71f5d 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -73,8 +73,7 @@ $THEMES = array( // Read directory "themes" $handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!"); -while ($dir = readdir($handle)) -{ +while ($dir = readdir($handle)) { // Construct absolute theme.php file name $theme = sprintf("%stheme/%s/theme.php", PATH, $dir); @@ -82,7 +81,7 @@ while ($dir = readdir($handle)) $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1", array($dir), __FILE__, __LINE__); - if (($dir != ".") && ($dir != "..") && (file_exists($theme)) && (is_readable($theme)) && (SQL_NUMROWS($result) == 1)) { + if (($dir != ".") && ($dir != "..") && (FILE_READABLE($theme)) && (SQL_NUMROWS($result) == 1)) { // Free memory SQL_FREERESULT($result); @@ -96,8 +95,10 @@ while ($dir = readdir($handle)) $THEMES['theme_email'][] = $THEME_EMAIL; $THEMES['theme_url'][] = $THEME_URL; $THEMES['theme_ver'][] = $THEME_VERSION; - } -} + } // END - if +} // END - while + +// Close directory closedir($handle); // Sort array by Uni* name diff --git a/inc/modules/sponsor.php b/inc/modules/sponsor.php index 7a3258071b..27cf4dc6db 100644 --- a/inc/modules/sponsor.php +++ b/inc/modules/sponsor.php @@ -35,11 +35,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; require($INC); } elseif ((!EXT_IS_ACTIVE("sponsor")) && (!IS_ADMIN())) { - $FATAL[] = EXTENSION_PROBLEM_EXT_INACTIVE; + ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE); return; } elseif (!IS_SPONSOR()) { // No sponsor! - $FATAL[] = SPONSOR_ONLY_AREA_ENTERED; + ADD_FATAL(SPONSOR_ONLY_AREA_ENTERED); return; } elseif (empty($GLOBALS['what'])) { // Empty what value detected! diff --git a/inc/modules/sponsor/.php b/inc/modules/sponsor/.php index 026ba6e9e0..eeb6fe4494 100644 --- a/inc/modules/sponsor/.php +++ b/inc/modules/sponsor/.php @@ -35,11 +35,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; require($INC); } elseif ((!EXT_IS_ACTIVE("sponsor")) && (!IS_ADMIN())) { - $FATAL[] = EXTENSION_PROBLEM_EXT_INACTIVE; + ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE); return; } elseif (!IS_SPONSOR()) { // No sponsor! - $FATAL[] = SPONSOR_ONLY_AREA_ENTERED; + ADD_FATAL(SPONSOR_ONLY_AREA_ENTERED); return; } diff --git a/inc/modules/sponsor/account.php b/inc/modules/sponsor/account.php index 9212ace1e4..ec754c98e1 100644 --- a/inc/modules/sponsor/account.php +++ b/inc/modules/sponsor/account.php @@ -35,11 +35,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; require($INC); } elseif ((!EXT_IS_ACTIVE("sponsor")) && (!IS_ADMIN())) { - $FATAL[] = EXTENSION_PROBLEM_EXT_INACTIVE; + ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE); return; } elseif (!IS_SPONSOR()) { // No sponsor! - $FATAL[] = SPONSOR_ONLY_AREA_ENTERED; + ADD_FATAL(SPONSOR_ONLY_AREA_ENTERED); return; } diff --git a/inc/modules/sponsor/settings.php b/inc/modules/sponsor/settings.php index f9130baf93..c8e7c4b4b7 100644 --- a/inc/modules/sponsor/settings.php +++ b/inc/modules/sponsor/settings.php @@ -35,11 +35,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; require($INC); } elseif ((!EXT_IS_ACTIVE("sponsor")) && (!IS_ADMIN())) { - $FATAL[] = EXTENSION_PROBLEM_EXT_INACTIVE; + ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE); return; } elseif (!IS_SPONSOR()) { // No sponsor! - $FATAL[] = SPONSOR_ONLY_AREA_ENTERED; + ADD_FATAL(SPONSOR_ONLY_AREA_ENTERED); return; } diff --git a/inc/modules/sponsor/welcome.php b/inc/modules/sponsor/welcome.php index bc67c1dedb..e120cc2864 100644 --- a/inc/modules/sponsor/welcome.php +++ b/inc/modules/sponsor/welcome.php @@ -35,11 +35,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; require($INC); } elseif ((!EXT_IS_ACTIVE("sponsor")) && (!IS_ADMIN())) { - $FATAL[] = EXTENSION_PROBLEM_EXT_INACTIVE; + ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE); return; } elseif (!IS_SPONSOR()) { // No sponsor! - $FATAL[] = SPONSOR_ONLY_AREA_ENTERED; + ADD_FATAL(SPONSOR_ONLY_AREA_ENTERED); return; } diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index d3a95764bc..e7d9adecca 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -148,8 +148,8 @@ function CHECK_MODULE($mod) { // Still no luck or not found? if (($ret == "major") || ($ret == "cache_miss") || (!$found)) { - // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name --- - if ((file_exists(PATH."inc/modules/".$mod.".php")) || (file_exists(PATH.$mod.".php")) || (file_exists(PATH.$extension."/".$mod.".php"))) { + // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name --- + if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", PATH, $extension, $mod)))) { // Data is missing so we add it if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { // Since 0.3.6 we have a has_menu column, this took me a half hour @@ -168,13 +168,13 @@ function CHECK_MODULE($mod) { if (SQL_AFFECTEDROWS() == 0) { // Something bad happend! return "major"; - } + } // END - if // Destroy cache here if (GET_EXT_VERSION("cache") >= "0.1.2") { if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); unset($cacheArray['modules']); - } + } // END - if // And reload data $ret = CHECK_MODULE($mod_chk); @@ -182,7 +182,7 @@ function CHECK_MODULE($mod) { // Module not found we don't add it to the database $ret = "404"; } - } + } // END - if // Return the value return $ret; @@ -330,7 +330,7 @@ function ADD_MENU($MODE, $act, $wht) { // Full file name for checking menu //* DEBUG: */ echo __LINE__.":!!!!".$sub_what."!!!
\n"; $test_inc = sprintf("%sinc/modules/%s/what-%s.php", PATH, $MODE, $sub_what); - $test = (file_exists($test_inc) && is_readable($test_inc)); + $test = (FILE_READABLE($test_inc)); if ($test) { if ((!empty($wht)) && (($wht == $sub_what))) { $content = ""; @@ -365,7 +365,7 @@ function ADD_MENU($MODE, $act, $wht) { // This is a menu block... ;-) $BLOCK_MODE = true; $INC_BLOCK = sprintf("%sinc/modules/%s/action-%s.php", PATH, $MODE, $main_action); - if ((file_exists($INC_BLOCK)) && (is_readable($INC_BLOCK))) { + if (FILE_READABLE($INC_BLOCK)) { // Load include file if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML(" "); @@ -1713,7 +1713,7 @@ function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) { ); // Load text for task - if ((file_exists($tpl)) && (is_readable($tpl))) { + if (FILE_READABLE($tpl)) { // Load extension's own text template (HTML!) $msg = LOAD_TEMPLATE("ext_".$ext, true); } else { diff --git a/inc/stylesheet.php b/inc/stylesheet.php index 17572429a2..497339beb8 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -75,7 +75,7 @@ if (($CSS == "1") || ($_CONFIG['css_php'] == "DIRECT")) $file = $BASE.$value; // Do include only existing files and whose are not empty - if ((file_exists($file)) && (filesize($file) > 0)) { + if ((FILE_READABLE($file)) && (filesize($file) > 0)) { switch ($_CONFIG['css_php']) { case "DIRECT": OUTPUT_HTML(""); diff --git a/inc/theme-manager.php b/inc/theme-manager.php index d03bbfa7c2..0ee37962e4 100644 --- a/inc/theme-manager.php +++ b/inc/theme-manager.php @@ -69,10 +69,10 @@ function GET_CURR_THEME() { $theme = sprintf("%stheme/%s/theme.php", PATH, $_GET['theme']); // Installation mode active - if ((!empty($_GET['theme'])) && (file_exists($theme)) && (is_readable($theme))) { + if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) { // Set cookie from URL data set_session("mxchange_theme", $_GET['theme']); - } elseif (file_exists(PATH."theme/".$_POST['theme']."/theme.php")) { + } elseif (FILE_READABLE(PATH."theme/".$_POST['theme']."/theme.php")) { // Set cookie from posted data set_session("mxchange_theme", $_POST['theme']); } @@ -88,7 +88,7 @@ function GET_CURR_THEME() { $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret)); // Try to load the requested include file - if ((@file_exists($theme)) && (is_readable($theme))) $INC_POOL[] = $theme; + if (FILE_READABLE($theme)) $INC_POOL[] = $theme; // Return theme value return $ret; @@ -112,7 +112,7 @@ function THEME_SELECTION_BOX($mod, $act, $wht, $result) { while(list($theme) = SQL_FETCHROW($result)) { // Load it's theme.php file $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme)); - if ((file_exists($INC)) && (is_readable($INC))) { + if (FILE_READABLE($INC)) { // And save all data in array require($INC); $THEMES['theme_unix'][] = $theme; diff --git a/modules.php b/modules.php index 5850e44172..f4e8cbacfb 100644 --- a/modules.php +++ b/modules.php @@ -101,7 +101,7 @@ if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!I define('__MODULE', sprintf("%sinc/modules/%s.php", PATH, $GLOBALS['module'])); // Does the module exists on local file system? - if (((file_exists(__MODULE)) && (is_readable(__MODULE))) && (sizeof($FATAL) == 0)) { + if ((FILE_READABLE(__MODULE)) && (sizeof($FATAL) == 0)) { // Module is valid, active and located on the local disc... $MOD_VALID = true; } elseif (!empty($URL)) { @@ -117,7 +117,7 @@ if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!I break; case "locked": - if (!file_exists(PATH."inc/modules/".$GLOBALS['module'].".php")) + if (!FILE_READABLE(PATH."inc/modules/".$GLOBALS['module'].".php")) { // Module does addionally not exists ADD_FATAL(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2); -- 2.39.5