require($INC);
}
-// 01 2 3 32 2 3321 12 3 32 2 21 1 2 21 1 2 21 1 23 321 1 10
-if ((date("d", getConfig('last_update')) != date("d", time())) && ((!defined('mxchange_installing')) || (!mxchange_installing)) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET(('register'))) && ($GLOBALS['output_mode'] != 1)) {
- // Do daily things in external PHP file but only when script is completely setup
- // Daily reset was run!
- define('__DAILY_RESET', true);
+// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
+// 01 2 3 32 2 3321 1 221 1 221 1 221 1 23 321 1 10
+if ((date("d", getConfig('last_update')) != date("d", time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET(('register'))) && ($GLOBALS['output_mode'] != 1)) {
+ // Tell every module we are in reset-mode!
+ enableResetMode();
- // Add more includes
- $INC_POOL = RESET_ADD_INCLUDES();
-
- // Run the filter
- runFilterChain('load_includes', $INC_POOL);
+ // Run all includes
+ runResetIncludes();
} // END - if
//
// Current SVN revision
//define('CURR_SVN_REVISION', getActualVersion(0));
-define('CURR_SVN_REVISION', "810");
+define('CURR_SVN_REVISION', "811");
define('CURR_SVN_DATE' , getActualVersion(1));
define('CURR_SVN_VERSION' , getActualVersion(2));
// Debug output
//* DEBUG: */ print "Query=<pre>".$sql_string."</pre>, affected=<strong>".SQL_AFFECTEDROWS()."</strong>, numrows=<strong>".SQL_NUMROWS($result)."</strong><br />\n";
- if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && (isBooleanConstantAndTrue('DEBUG_MODE')) && (isBooleanConstantAndTrue('DEBUG_SQL'))) {
+ if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && (isDebugModeEnabled()) && (isBooleanConstantAndTrue('DEBUG_SQL'))) {
//
// Debugging stuff...
//
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
+ if (isResetModeEnabled() && (!isDebugModeEnabled()) && ($GLOBALS['output_mode'] != 1)) {
// Yes, we have. So let's auto-purge some campaigns, inactive users and unconfirmed accounts
$INC_POOL[] = sprintf("%sinc/autopurge.php", constant('PATH'));
}
break;
default: // Do stuff when extension is loaded
- if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (getConfig('birthday_points') > 0)) {
+ if ((isResetModeEnabled()) && (getConfig('birthday_points') > 0)) {
// Daily reset was run and we shall pay points so we start checking for members who
// has a birthday for today
$INC_POOL[] = sprintf("%sinc/mails/birthday_mails.php", constant('PATH'));
break;
default: // Do stuff when extension is loaded
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
+ if (isResetModeEnabled() && (!isDebugModeEnabled()) && ($GLOBALS['output_mode'] != 1)) {
// Daily reset was run so let's check if active rallye is activated
if (getConfig('bonus_active') == "Y") {
// Run active rallye
break;
default: // Do stuff when extension is loaded
- if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (getConfig('doubler_send_mode') == "RESET")) {
+ if ((isResetModeEnabled()) && (getConfig('doubler_send_mode') == "RESET")) {
// So let's check for points
$INC_POOL[] = sprintf("%sinc/doubler_send.php", constant('PATH'));
}
'2','3','4','5','6','7','8','9'
);
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
+ if (isResetModeEnabled() && (!isDebugModeEnabled()) && ($GLOBALS['output_mode'] != 1)) {
// Daily reset was run so let's check out for expired newsletter orders
$INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", constant('PATH'));
}
default: // Do stuff when extension is loaded
// Do daily reset only when installed and extension version is at least 0.1.1
- if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isInstalled()) && (isAdminRegistered()) && (GET_EXT_VERSION("order") >= "0.1.1")) {
+ if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (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__);
} // END - if
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
+ if (isResetModeEnabled() && (!isDebugModeEnabled()) && ($GLOBALS['output_mode'] != 1)) {
// So let's check for profiles which needs an update
$INC_POOL[] = sprintf("%sinc/profile-updte.php", constant('PATH'));
}
break;
default: // Do stuff when extension is loaded
- if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (getConfig('ap_transfer') == "Y")) {
+ if ((isResetModeEnabled()) && (getConfig('ap_transfer') == "Y")) {
// Automatically remove outdated or not displayed transactions
TRANSFER_AUTPPURGE(getConfig('transfer_max'), getConfig('transfer_age'));
}
// Output direct
OUTPUT_HTML($ret);
}
- } elseif (isBooleanConstantAndTrue('DEBUG_MODE')) {
+ } elseif (isDebugModeEnabled()) {
// Warning, empty output!
return "E:".$template."<br />\n";
}
// Append header
$FROM .= LOAD_EMAIL_TEMPLATE("header");
}
- } elseif (isBooleanConstantAndTrue('DEBUG_MODE')) {
+ } elseif (isDebugModeEnabled()) {
if (empty($FROM)) {
// Load email header template
$FROM = LOAD_EMAIL_TEMPLATE("header");
// Fix HTML parameter (default is no!)
if (empty($HTML)) $HTML = "N";
- if (isBooleanConstantAndTrue('DEBUG_MODE')) {
+ if (isDebugModeEnabled()) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
print("<pre>
".htmlentities(trim($FROM))."
<br /><br />";
// Debug mode not active? Then remove the HTML tags
- if (!isBooleanConstantAndTrue('DEBUG_MODE')) $newContent = strip_tags($newContent);
+ if (!isDebugModeEnabled()) $newContent = strip_tags($newContent);
} else {
// No template name supplied!
$newContent = getMessage('NO_TEMPLATE_SUPPLIED');
// Debug message logger
function DEBUG_LOG ($funcFile, $line, $message, $force=true) {
// Is debug mode enabled?
- if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force === true)) {
+ if ((isDebugModeEnabled()) || ($force === true)) {
// Log this message away
$fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($funcFile)."|".$line."|".strip_tags($message)."\n");
}
// Load more reset scripts
-function RESET_ADD_INCLUDES () {
+function runResetIncludes () {
// Is the reset set or old sql_patches?
- if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
+ if ((!isResetModeEnabled()) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
// Then abort here
- return array();
+ DEBUG_LOG(__FUNCTION__, __LINE__, "Cannot run reset! Please report this bug. Thanks");
} // END - if
// Get more daily reset scripts
if (!defined('DEBUG_MONTHLY')) UPDATE_CONFIG("last_month", $currMonth);
} // END - if
- // Return array
- return $INC_POOL;
+ // Run the filter
+ runFilterChain('load_includes', $INC_POOL);
}
// Handle extra values
} // END - if
} else {
// Process this entry
- $skip = false; $test2 = "";
+ $skip = false;
+ $test2 = "";
}
}
return isBooleanConstantAndTrue('admin_registered');
}
+// Enables the reset mode. Only call this function if you really want the
+// reset to be run!
+function enableResetMode () {
+ // Enable the reset mode
+ $GLOBALS['reset_enabled'] = true;
+
+ // Run filters
+ runFilterChain('reset_enabled');
+}
+
+// Checks wether the reset mode is active
+function isResetEnabled () {
+ // Now simply check it
+ return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === true));
+}
+
+// Checks wether the debug mode is enabled
+function isDebugModeEnabled () {
+ // Simply check it
+ return isBooleanConstantAndTrue('DEBUG_MODE');
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////
}
// Do not execute when script is in CSS mode
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//
?>
}
// Do not execute when script is in CSS mode
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
// Get current day (01 to 31), month (01 to 12) and year (4-digits year)
$DAY = date("d", time());
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (defined('__DAILY_RESET'))) return;
+if (($CSS == 1) || (isResetModeEnabled())) return;
//
?>
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') != "Y")) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled()) || (getConfig('beg_rallye') != "Y")) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
}
// Don't run on daily reset
-if (defined('__DAILY_RESET')) {
+if (isResetModeEnabled()) {
// Skip here
return false;
} // END - if
}
// Don't run on daily reset
-if (defined('__DAILY_RESET')) {
+if (isResetModeEnabled()) {
// Skip here
return false;
} elseif (!EXT_IS_ACTIVE("bonus")) {
}
// Don't run on daily reset
-if (defined('__DAILY_RESET')) {
+if (isResetModeEnabled()) {
// Skip here
return false;
} elseif (!EXT_IS_ACTIVE("user")) {
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($CSS == 1) || (!isResetModeEnabled())) return;
//
?>
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') == "Y")) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled()) || (getConfig('beg_rallye') == "Y")) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset accounts
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Purge expired entries in _bonus_turbo
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Update user profiles
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
//
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || ((!defined('__DAILY_RESET')) && (getConfig('holiday_mode') == "RESET"))) return;
+if (($GLOBALS['output_mode'] == 1) || ((!isResetModeEnabled()) && (getConfig('holiday_mode') == "RESET"))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Check for holidays we need to enable and send email to user
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
// Simply reset the requests here
UPDATE_CONFIG("yoomedia_requests_remain", getConfig('yoomedia_requests_total'));
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($CSS == 1) || (!isResetModeEnabled())) return;
//
?>
}
// Do not execute when script is in CSS mode or no daily reset
-if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset the surfbar counter