require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Simply redirect... :-)
LOAD_URL("modules.php?module=admin&action=login");
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Simply redirect... :-)
LOAD_URL("modules.php?module=index&what=agb");
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed)) {
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed'))) {
// Check for userid
if (!empty($_GET['uid'])) {
// Init user ID
// Load the required file(s)
require ("inc/config.php");
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Script is installed so let's check for his confirmation link...
$uid = strip_tags(bigintval($_GET['uid']));
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed) && (admin_registered))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')))
{
// Base URL for redirection
$URL = URL."/modules.php?module=index&what=confirm&hash=";
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Probe for referral ID
if (!empty($_GET['refid'])) $GLOBALS['refid'] = bigintval($_GET['refid']);
// Load the required file(s)
require ("inc/config.php");
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
if (!empty($_GET['code']))
{
// When we are not installing
if (!defined('mxchange_installing')) define('mxchange_installing', false);
-// Language stuff (default is german)
-require_once(PATH."inc/language.php");
-
-// We need general functions and database stuff here
-require_once(PATH."inc/functions.php");
-require_once(PATH."inc/mysql-manager.php");
-
// Your MySQL data (we don't like M$ SQL ;-) )
$MySQL = array(
// CFG: MYSQL-HOST
{
global $link, $CSS, $_CONFIG, $OK;
+ // Remove \t, \n and \r from queries they may confuse some MySQL version I have heard
+ $sql_string = str_replace("\t", " ", str_replace("\n", " ", str_replace("\r", " ", $sql_string)));
+
// Run SQL command
$result = @mysql_query($sql_string, $link)
or ADD_FATAL($F." (".$L."):".mysql_error()."<br />
$_CONFIG['sql_count']++;
// Debug output
- //* DEBUG: */ print "Query=<em>".$sql_string."</em>, affected=<b>".SQL_AFFECTEDROWS()."</b>, numrows=<b>".SQL_NUMROWS($result)."</b><br />\n";
+ //* DEBUG: */ print "Query=<pre>".$sql_string."</pre>, affected=<b>".SQL_AFFECTEDROWS()."</b>, numrows=<b>".SQL_NUMROWS($result)."</b><br />\n";
if (($CSS != "1") && ($CSS != "-1") && (DEBUG_MODE) && (DEBUG_SQL))
{
************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
// Create include file name
$INC = PATH."inc/db/lib-"._DB_TYPE.".php";
-if (file_exists($INC))
-{
+if ((file_exists($INC)) && (is_readable($INC))) {
// Include abstraction layer
require_once($INC);
-}
- else
-{
+} else {
// Bye, bye...
die("Cannot load database abstraction layer! R.I.P.");
}
global $cacheArray, $_CONFIG;
// Extensions are all inactive during installation
- if ((!mxchange_installed) || (mxchange_installing) || (empty($ext_name))) return false;
+ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false;
// Extension's file name will also be checked
$file = PATH."inc/extensions/ext-".$ext_name.".php";
$ret = false;
// Extensions are all inactive during installation
- if ((!mxchange_installed) || (mxchange_installing)) return "";
+ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return "";
// Is the cache written?
if (!empty($cacheArray['extensions']['ext_version'][$ext_name])) {
unset($dummy);
// Do daily reset only when installed and extension version is at least 0.1.1
- if ((defined('__DAILY_RESET')) && (!mxchange_installing) && (mxchange_installed) && (admin_registered) && (GET_EXT_VERSION("order") >= "0.1.1"))
+ if ((defined('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1"))
{
// Reset mail order values
$result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
}
// Version number
-$EXT_VERSION = "0.4.1";
+$EXT_VERSION = "0.4.2";
// Auto-set extension version
if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2");
switch ($EXT_LOAD_MODE)
{
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Tabellen-Schlüssel neu gesetzt und Parsing-Zeit im Footer eingeblendet.";
break;
+
+ case "0.4.2": // SQL queries for v0.4.2
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_online` ADD INDEX `admin_member` (`is_admin`, `is_member`)";
+ break;
}
break;
// Set unset variable
if (empty($check)) $check = "";
- if (mxchange_installing) {
+ if (isBooleanConstantAndTrue('mxchange_installing')) {
// While we are installing ouput other header than while it is installed... :-)
$OUT = "";
foreach ($FATAL as $key=>$value) {
// Load main template
LOAD_TEMPLATE("install_fatal_table", false, $OUT);
- } elseif (mxchange_installed) {
+ } elseif (isBooleanConstantAndTrue('mxchange_installed')) {
// Display all runtime fatal errors
$OUT = "";
foreach ($FATAL as $key=>$value) {
// Output the raw HTML code
function OUTPUT_RAW ($HTML) {
- if ((mxchange_installed) && (basename($_SERVER['PHP_SELF']) != "install.php")) {
+ if ((isBooleanConstantAndTrue('mxchange_installed')) && (basename($_SERVER['PHP_SELF']) != "install.php")) {
// Not in install-mode so strip slashes away
echo stripslashes($HTML);
} else {
}
// Does the special template exists?
- if (!file_exists($file)) {
+ if ((!file_exists($file)) || (!is_readable($file))) {
// Reset to default template
$file = $BASE.$template.".tpl";
}
// Now does the final template exists?
- if (file_exists($file)) {
+ if ((file_exists($file)) && (is_readable($file))) {
// The local file does exists so we load it. :)
$tmpl_file = implode("", file($file));
// Add surrounding HTML comments to help finding bugs faster
$ret = "<!-- Template ".$template." - Start -->\n".$ret."<!-- Template ".$template." - End -->\n";
- } elseif ((IS_ADMIN()) || ((mxchange_installing) && (!mxchange_installed))) {
+ } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) {
// Only admins shall see this warning or when installation mode is active
$ret = "<br /><SPAN class=\"guest_failed\">".TEMPLATE_404."</SPAN><br />
(".basename($file).")<br />
//
function generatePassString($passHash) {
global $_CONFIG;
- $ret = "*FAILED*";
+
+ // Return vanilla password hash
+ $ret = $passHash;
// Is a secret key and master salt already initialized?
if ((!empty($_CONFIG['secret_key'])) && (!empty($_CONFIG['master_salt']))) {
$start += 4;
$newHash .= $mod;
}
+
//* DEBUG: */ die($passHash."<br>".$newHash." (".strlen($newHash).")");
$ret = generateHash($newHash, $_CONFIG['master_salt']);
}
//* DEBUG: */ echo "IGNORED:".$var."=".$value."<br />\n";
return true;
}
+// Check wether a boolean constant is set
+// Taken from user comments in PHP documentation for function constant()
+function isBooleanConstantAndTrue($constname) { // : Boolean
+ $res = false;
+ if (defined($constname)) $res = (constant($constname) === true);
+ return($res);
+}
//
//////////////////////////////////////////////
// Remember title in constant for the template
define('__PAGE_TITLE', html_entity_decode($TITLE));
- } elseif ((!mxchange_installed) || (!admin_registered)) {
+ } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
// Load language file because it was missing in installation finalizer step... *sigh*
require_once(sprintf("%sinc/language/install_%s.php",
PATH,
LOAD_TEMPLATE("metadata");
// Add meta description to header
- if ((mxchange_installed) && (admin_registered) && ($GLOBALS['module'] != "admin") && ($GLOBALS['module'] != "login") && (isset($db)) && (isset($link))) {
+ if ((isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && ($GLOBALS['module'] != "admin") && ($GLOBALS['module'] != "login") && (isset($db)) && (isset($link))) {
// Add meta description not in admin and login module and when the script is installed
META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);
}
************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
//
function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) {
- $done = false; $sneak++;
- if (file_exists($file)) {
+ // Initialize all and count up the "seak" value
+ $done = false;
+ $next = 0;
+ $sneak++;
+ if ((file_exists($file)) && (is_readable($file))) {
$search = "CFG: ".$comment;
$tmp = $file.".tmp";
$fp = @fopen($file, 'r') or OUTPUT_HTML("<STRONG>READ:</STRONG> ".$file."<br />");
fputs($fp_tmp, $line);
}
fclose($fp_tmp);
+
// Finished writing tmp file
$done = true;
}
}
// Is MXChange installed or no admin registered so far?
-if ((!mxchange_installed) || (!admin_registered))
+if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
{
// Set URL for FORM actions
define('__BURL_ACTION', $burl);
break;
case "finalize": // Write captured data to files
- if ((!empty($_POST['finalize'])) && (!mxchange_installed)) {
+ if ((!empty($_POST['finalize'])) && (!isBooleanConstantAndTrue('mxchange_installed'))) {
// You have submitted data then we have to reset the fatal messages
$FATAL = array(); $SQLs = array();
LOAD_URL($URL);
}
}
- elseif (mxchange_installed)
+ elseif (isBooleanConstantAndTrue('mxchange_installed'))
{
// Redirection after writing data... :-)
LOAD_TEMPLATE("install_finished");
require($INC);
}
+// Set default language
if (empty($mx_lang)) $mx_lang = DEFAULT_LANG;
// Look for file
$file = sprintf(PATH."inc/language/%s.php", $mx_lang);
-if (!file_exists($file))
-{
+if ((!file_exists($file)) || (!is_readable($file))) {
// Switch to default (DO NOT CHANGE!!!)
set_session("mx_lang", "de");
$mx_lang = "de";
unset($file);
// Check for installation mode
-if (!mxchange_installed)
-{
+if (isBooleanConstantAndTrue('mxchange_installing')) {
// Load matching language file
require(PATH."inc/language/install_".$mx_lang.".php");
}
{
// Check if we can create a file inside the path
@touch($path."dummy.tmp", 'w');
- if (file_exists($path."dummy.tmp"))
- {
+ if (file_exists($path."dummy.tmp")) {
// Yes, we can do. So let's remove it
- unlink($path."dummy.tmp");
+ @unlink($path."dummy.tmp");
// Is there a .htaccess file?
- if (file_exists($path.".htaccess"))
- {
+ if (file_exists($path.".htaccess")) {
// Update database that we have tested it
$result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET cache_tested='1' WHERE config=0 LIMIT 1", __FILE__, __LINE__);
$this->ret="done";
// All done!
return "done";
- }
- else
- {
+ } else {
// Stop! Set a .htaccess file first
$this->ret="htaccess";
return "htaccess";
}
}
- }
- elseif ($tested)
- {
+ } elseif ($tested) {
// System already tested
$this->ret="done";
return "done";
$ADD = "";
// Skip loading extensions
-if ((!mxchange_installed) || (mxchange_installing)) return;
+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"))
// Is the logout empty?
if (empty($_GET['logout'])) $_GET['logout'] = "";
-if (!admin_registered) {
+if (!isBooleanConstantAndTrue('admin_registered')) {
// Admin is not registered so we have to inform the user
if ((isset($_POST['ok'])) && ((empty($_POST['login'])) || (empty($_POST['pass'])) || (strlen($_POST['pass']) < 4))) $_POST['ok'] = "***";
if ((isset($_POST['ok'])) && ($_POST['ok'] != "***")) {
// Any other kind
$ret = "done";
}
- if (!admin_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);
}
} elseif ($_GET['logout'] == "1") {
// Only try to remove cookies
- if (set_session("admin_login", "", (time() - 3600), COOKIE_PATH) && set_session("admin_md5", "", (time() - 3600), COOKIE_PATH) && set_session("admin_last", "", (time() - 3600), COOKIE_PATH) && set_session("admin_to", "", (time() - 3600), COOKIE_PATH)) {
+ if (set_session("admin_login", "") && set_session("admin_md5", "") && set_session("admin_last", "") && set_session("admin_to", "")) {
// Also remove array elements
unset($_SESSION['admin_login']);
unset($_SESSION['admin_md5']);
}
}
-if (admin_registered)
+if (isBooleanConstantAndTrue('admin_registered'))
{
// Check config.php and inc directory for right access rights
if (is_INCWritable("config")) ADD_FATAL(FATAL_CONFIG_WRITABLE);
// Load library
require_once(PATH."inc/db/lib.php");
+// Load general functions
+require_once(PATH."inc/functions.php"); // Non-database functions
+require_once(PATH."inc/extensions.php");
+require_once(PATH."inc/language.php");
+
// Check if the user setups his MySQL stuff...
-if ((empty($MySQL['login'])) && (!mxchange_installing) && (!isset($_GET['installing'])) && (mxchange_installed))
-{
+if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
// No login entered and outside installation mode
echo "<STRONG>".LANG_WARNING.":</STRONG> ";
- if (mxchange_installed)
- {
+ if (isBooleanConstantAndTrue('mxchange_installed')) {
// You have changed my configuration file!
die(DIE_CONFIG_CHANGED_YOU);
- }
- else
- {
+ } else {
// Please run the installation script (maybe again)
die(DIE_RUN_INSTALL_MYSQL);
}
-}
- elseif ((!mxchange_installing) && (!isset($_GET['installing'])) && (empty($MySQL['password'])) && (warn_no_pass))
-{
+} elseif ((!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (empty($MySQL['password'])) && (warn_no_pass)) {
// No database password entered!!!
echo "<STRONG>".LANG_WARNING.":</STRONG> ".WARN_NULL_PASSWORD;
}
+
+// Init configuration arrays
+$_CONFIG = array(
+ 'code_length' => 0
+);
+
// Check if this file is writeable or read-only and warn the user
-if ((!mxchange_installing) && (mxchange_installed))
-{
+if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) {
// Check for write-permission for config.php and inc directory
if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index";
- if (($GLOBALS['module'] != "admin") && (admin_registered))
- {
+ if (($GLOBALS['module'] != "admin") && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_SERVER['WINDIR']))) {
if (is_INCWritable("config")) ADD_FATAL(FATAL_CONFIG_WRITABLE);
if (is_INCWritable("dummy")) ADD_FATAL(FATAL_INC_WRITABLE);
}
-
- // Init configuration arrays
- $_CONFIG = array(
- 'code_length' => 0
- );
$EXT_CSS_FILES = array();
- // Load general stuff, like...
- require_once(PATH."inc/extensions.php"); // Extension management
- require_once(PATH."inc/functions.php"); // Non-database functions
+ // Load "databases" aka static arrays
require_once(PATH."inc/databases.php"); // Several hard-coded databases (arrays, constants)
if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
// Connect to DB
+ global $link;
$link = SQL_CONNECT($MySQL['host'], $MySQL['login'], $MySQL['password'], __FILE__, __LINE__);
// Is the link valid?
if (is_resource($link)) {
// Choose the database
+ global $db;
$db = SQL_SELECT_DB($MySQL['dbase'], $link, __FILE__, __LINE__);
// Is it a valid resource?
if ($db === true) {
// Load configuration stuff
- $result = SQL_QUERY("SELECT pass_len, points_register, points_ref, least_cats, check_double_email, check_double_pass, admin_notify, url_tlock, test_text, max_tlength, test_subj, autosend_active, max_send, url_blacklist, auto_purge, auto_purge_active, last_update, unconfirmed, profile_lock, online_timeout, mad_timestamp, mad_count, profile_update, send_prof_update, resend_profile_update, code_length, patch_level, patch_ctime, guest_stats, ref_payout, activate_xchange, order_multi_page, display_refid, ip_timeout, allow_direct_pay, config FROM "._MYSQL_PREFIX."_config WHERE config=0 LIMIT 1", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT pass_len, points_register, points_ref, least_cats, check_double_email, check_double_pass, admin_notify, url_tlock, test_text, max_tlength, test_subj, autosend_active, max_send, url_blacklist, auto_purge, auto_purge_active, last_update, unconfirmed, profile_lock, online_timeout, mad_timestamp, mad_count, profile_update, send_prof_update, resend_profile_update, code_length, patch_level, patch_ctime, guest_stats, ref_payout, activate_xchange, order_multi_page, display_refid, ip_timeout, allow_direct_pay, config
+FROM "._MYSQL_PREFIX."_config
+WHERE config=0
+LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data when previous SQL query did not fail
require_once(PATH."inc/mysql-manager.php"); // Functions which interact with the database
// Run daily reset
- if ((date("d", $_CONFIG['last_update']) != date("d", time()) || (DEBUG_MODE == true)) && (!mxchange_installing) && (mxchange_installed) && (admin_registered) && (!isset($_GET['register'])) && ($CSS != 1)) {
+ if ((date("d", $_CONFIG['last_update']) != date("d", time()) || (DEBUG_MODE == true)) && (!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($CSS != 1)) {
// Do daily things in external PHP file but only when script is completely setup
$INC_POOL[] = PATH."inc/reset/reset_daily.php";
// Include required files
require_once(PATH."inc/databases.php");
- require_once(PATH."inc/extensions.php");
require_once(PATH."inc/theme-manager.php");
require_once(PATH."inc/load_extensions.php");
require_once(PATH."inc/session.php");
}
// Double-check installation mode
- if ((!mxchange_installed) || (!admin_registered)) {
+ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
// Check for file permissions
if (!is_INCWritable("config")) {
ADD_FATAL(CONFIG_IS_WRITE_PROTECTED);
// Any fatal messages?
if (!is_array($FATAL)) $FATAL = array();
-if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (mxchange_installed) && (!mxchange_installing) && ($CSS != "1"))
+if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!isBooleanConstantAndTrue('mxchange_installing')) && ($CSS != "1"))
{
// One or more fatal error(s) occur during connect...
include (PATH."inc/header.php");
global $cacheArray, $_CONFIG;
$name = ""; $result = false;
// Load title
- if (!mxchange_installing)
- {
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module'])) && (isset($cacheArray['modules']['module'][$mod])))
- {
+ if (!isBooleanConstantAndTrue('mxchange_installed')) {
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module'])) && (isset($cacheArray['modules']['module'][$mod]))) {
// Load from cache
$name = $cacheArray['modules']['title'][$mod];
// Update cache hits
$_CONFIG['cache_hits']++;
- }
- else
- {
+ } else {
// Load from database
$result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__);
list($name) = SQL_FETCHROW($result);
$name = trim($name);
// Still no luck or empty title?
- if (empty($name))
- {
+ if (empty($name)) {
// No name found
$name = LANG_UNKNOWN_MODULE." (".$mod.")";
- if (SQL_NUMROWS($result) == 0)
- {
+ if (SQL_NUMROWS($result) == 0) {
// Add module to database
$dummy = CHECK_MODULE($mod);
}
$ret = "major";
// Check if script is installed if not return a "done" to prevent some errors
- if ((!mxchange_installed) || (mxchange_installing) || (!admin_registered)) return "done";
+ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (!isBooleanConstantAndTrue('admin_registered'))) return "done";
// Check if cache is latest version
$locked = 'Y'; $hidden = 'N'; $admin = 'N'; $mem = 'N'; $found = false;
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
// If admin login is not given take current from cookies...
- if ((empty($admin)) && (!empty($_SESSION['admin_login'])) && (!empty($_SESSION['admin_md5'])))
- {
+ if ((empty($admin)) && (!empty($_SESSION['admin_login'])) && (!empty($_SESSION['admin_md5']))) {
$admin = SQL_ESCAPE($_SESSION['admin_login']); $passCookie = $_SESSION['admin_md5'];
}
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."<br />";
// Search in array for entry
- if ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin)))
- {
+ if ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) {
// Count cache hits
$_CONFIG['cache_hits']++;
// Login data is valid or not?
$valPass = generatePassString($cacheArray['admins']['password'][$admin]);
- }
- elseif (!empty($admin))
- {
+ } elseif (!empty($admin)) {
// Search for admin
$result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
array($admin), __FILE__, __LINE__);
// Is he admin?
$passDB = "";
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
// Admin login was found so let's load password from DB
list($passDB) = SQL_FETCHROW($result);
$valPass = generatePassString($passDB);
SQL_FREERESULT($result);
}
- if (!empty($valPass))
- {
+ if (!empty($valPass)) {
// Check if password is valid
//* DEBUG: */ echo __LINE__."*".$valPass."/".$passCookie)."*<br>";
$ret = (($valPass == $passCookie) || (($valPass == "*FAILED*") && (!EXT_IS_ACTIVE("cache"))));
}
// Test session if index.php or modules.php is loaded
-if ((basename($_SERVER['PHP_SELF']) == "index.php") || (basename($_SERVER['PHP_SELF']) == "modules.php") || (mxchange_installing)) {
+if ((basename($_SERVER['PHP_SELF']) == "index.php") || (basename($_SERVER['PHP_SELF']) == "modules.php") || (isBooleanConstantAndTrue('mxchange_installing'))) {
if (count($_SESSION) > 0) {
// Session variables accepted!
define('__COOKIES', true);
);
// Add stylesheet for installation
-if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!mxchange_installed) || (isset($_GET['installing']))) $STYLES[] = "install.css";
+if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
// When no CSS output-mode is set, set it to file-output
if (empty($_CONFIG['css_php'])) $_CONFIG['css_php'] = "FILE";
{
// Now we load all CSS files from css.php!
OUTPUT_HTML("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"".URL."/css.php", false);
- if (mxchange_installing)
+ if (isBooleanConstantAndTrue('mxchange_installing'))
{
// Default theme first
$NEW_THEME = "default";
// Free memory
SQL_FREERESULT($result);
- } elseif ((!mxchange_installed) && ((mxchange_installing) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
+ } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
// Prepare FQFN for checking
$theme = sprintf("%stheme/%s/theme.php", PATH, $_GET['theme']);
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed)) {
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed'))) {
// Header
require(PATH."inc/header.php");
set_session("visited", "true", (time() + $_CONFIG['index_cookie']), COOKIE_PATH);
} elseif (!empty($_SESSION['visited'])) {
// Remove cookie when admin set 0 in setup
- set_session("visited", "", (time() - 3600), COOKIE_PATH);
+ set_session("visited", "");
}
// Template laden
}
// Already installed?
-if ((mxchange_installed) && (admin_registered)) {
+if ((isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered'))) {
// Add fatal message
ADD_FATAL(ALREADY_INSTALLED);
}
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed)) {
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed'))) {
// Header
require(PATH."inc/header.php");
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Simply redirect... :-)
LOAD_URL("modules.php?module=index&what=login");
// Load the required file(s)
require ("inc/config.php");
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Is the extension active
if (!EXT_IS_ACTIVE("mailid", true)) {
// Load the required file(s)
require ("inc/config.php");
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Is the extension active
if (!EXT_IS_ACTIVE("mailid", true)) {
require ("inc/config.php");
// Redirect only to registration page when this script is installed
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Base URL for redirection
switch ($_CONFIG['refid_target'])
require ("inc/config.php");
// List only rankings when script is installed
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Include header
include(PATH."inc/header.php");