More misc fixes and rewrites (sorry, lame description)
[mailer.git] / inc / check-reset.php
index ec19cb89525db351018557dda88790eb0c18faef..909332b6ca2a28c4ca68d6ec6a148c4bdb7662ef 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Prueft ob Reset laufen soll                      *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 }
 
-// 01    2                            2        2         3321    1                         2                     21    1                        2                    21    1                        2                  21    1      2                 21    1         1    1                         2            210
-if ((date("d", $_CONFIG['last_update']) != date("d", time())) && (!defined('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($CSS != 1) && (!defined('DEBUG_MODE'))) {
-       // Do daily things in external PHP file but only when script is completely setup
-       // Daily reset was run!
-       define('__DAILY_RESET', true);
-
-       // Add more includes
-       $INC_POOL = RESET_ADD_INCLUDES();
-
-       // Is this not an array?
-       if (!is_array($INC_POOL)) {
-               // Log the error
-               DEBUG_LOG(basename(__FILE__).":INC_POOL is no array!");
-
-               // Skip further executions
-               return;
-       } // END - if
-
-       // Run the full reset scripts
-       foreach ($INC_POOL as $incFile) {
-               require_once($incFile);
-       } // END - foreach
+// 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                  2          21    1             22     10
+if ((date('d', getConfig('last_update')) != date('d', time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET('register')) && (getOutputMode() != 1)) {
+       // Tell every module we are in reset-mode!
+       enableResetMode();
 
-       // Remove array
-       unset($INC_POOL);
+       // Run all includes
+       runResetIncludes();
 } // END - if
 
 //