inc/gen_sql_patches.php -text svneol=unset#text/plain
inc/handler.php -text svneol=unset#text/plain
inc/header.php -text svneol=unset#text/plain
+inc/hourly/.htaccess svneol=native#text/plain
+inc/hourly/hourly_ -text
inc/img/.htaccess -text svneol=unset#text/plain
inc/inc-functions.php svneol=native#text/plain
inc/install-functions.php -text svneol=unset#text/plain
} // END - if
// Version number
-setThisExtensionVersion('0.7.4');
+setThisExtensionVersion('0.7.5');
// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(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', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4'));
+setExtensionVersionHistory(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', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5'));
// Keep this extension always active!
setExtensionAlwaysActive('Y');
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Spalten in Filtertabelle gekürzt (SQL-Fehler wegen zu grossem Schlüssel).");
break;
+
+ case '0.7.5': // SQL queries for v0.7.5
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `last_hour` TINYINT(2) UNSIGNED NOT NULL DEFAULT 00");
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Aktuelle Stunde hinzugefügt (ist nicht konfigurierbar).");
+ break;
} // END - switch
break;
registerFilter('init', 'SET_CURRENT_DATE');
registerFilter('init', 'INIT_RANDOM_NUMBER');
registerFilter('init', 'CHECK_REPOSITORY_REVISION');
+ registerFilter('init', 'RUN_HOURLY_RESET');
registerFilter('init', 'RUN_DAILY_RESET');
registerFilter('init', 'TRIGGER_SENDING_POOL');
registerFilter('init', 'DETERMINE_USERNAME');
// Generic extension update filters
registerFilter('extension_update', 'UPDATE_EXTENSION_DATA');
+ // Do hourly reset stuff, keep this entry first in this chain:
+ registerFilter('hourly', 'RUN_HOURLY_INCLUDES');
+
// Do reset stuff, keep this entry first in this chain:
registerFilter('reset', 'RUN_RESET_INCLUDES');
unset($GLOBALS['update_ver'][$ext_name]);
}
+// Load more hourly reset scripts
+function FILTER_RUN_HOURLY_INCLUDES () {
+ // Is the reset set or old sql_patches?
+ if (((!isHourlyResetEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) && (isHtmlOutputMode())) {
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isHourlyResetEnabled()).',ext_newer[sql_patches:0.7.5]='.intval(isExtensionInstalledAndNewer('sql_patches', '0.7.5')).' Please report this bug. Thanks');
+ } // END - if
+
+ // Get more hourly reset scripts
+ setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_'));
+
+ // Update database
+ if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) {
+ updateConfiguration('last_hour', getHour());
+ } // END - if
+
+ // Run the filter
+ runFilterChain('load_includes', 'hourly');
+}
+
// Load more reset scripts
function FILTER_RUN_RESET_INCLUDES () {
// Is the reset set or old sql_patches?
setIncludePool('reset', getArrayFromDirectory('inc/daily/', 'daily_'));
// Update database
- if ((!isConfigEntrySet('DEBUG_RESET')) || (getConfig('DEBUG_RESET') != 'Y')) updateConfiguration('last_update', 'UNIX_TIMESTAMP()');
+ if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) {
+ updateConfiguration('last_update', 'UNIX_TIMESTAMP()');
+ } // END - if
// Is the config entry set?
if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
// Filter for running daily reset
function FILTER_RUN_DAILY_RESET () {
// Only execute this filter if installed
- if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return;
+ if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) {
+ return;
+ } // END - if
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
- if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
+ if (((getDay(getConfig('last_update')) != getDay()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
// Tell every module we are in reset-mode!
doReset();
} // END - if
}
+// Filter for running hourly reset
+function FILTER_RUN_HOURLY_RESET () {
+ // Only execute this filter if installed
+ if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) {
+ return;
+ } // END - if
+
+ // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
+ if (((getConfig('last_hour') != getHour()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
+ // Tell every module we are in reset-mode!
+ doHourly();
+ } // END - if
+}
+
// Filter for loading more runtime includes (not for installation)
function FILTER_LOAD_RUNTIME_INCLUDES () {
// Load more includes
runFilterChain('reset');
}
+// Enables the reset mode (hourly, weekly and monthly) and runs it
+function doHourly () {
+ // Enable the hourly reset mode
+ $GLOBALS['hourly_enabled'] = true;
+
+ // Run filters (one always!)
+ runFilterChain('hourly');
+}
+
// Our shutdown-function
function shutdown () {
// Call the filter chain 'shutdown'
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 03/04/2005 *
+ * =================== Last change: 06/20/2010 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : hourly_ *
+ * -------------------------------------------------------------------- *
+ * Short description : *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 2247 $ *
+ * $Date:: 2011-01-18 16:44:31 +0100 (Tue, 18 Jan 2011) $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: quix0r $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ die();
+} elseif ((isCssOutputMode()) || (isHourlyResetEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) {
+ // Do not execute when script is in CSS mode or no hourly reset
+ return;
+} elseif (!isExtensionActive('')) {
+ logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
+ return;
+}
+
+// Debug line
+//* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'hourly reset started.');
+
+// Do your hourly-reset things here
+
+// Debug line
+//* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'hourly reset ended.');
+
+// [EOF]
+?>
if (!defined('__SECURITY')) {
die();
} elseif ((isCssOutputMode()) || (isResetModeEnabled())) {
- // Do not execute when script is in CSS mode or no daily reset
+ // Do not execute when script is in CSS mode or no hourly reset
return;
} elseif (!isExtensionActive('')) {
logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
if (!defined('__SECURITY')) {
die();
} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) {
- // Do not execute when script is in CSS mode or no daily reset
+ // Do not execute when script is in CSS mode or no hourly reset
return;
} elseif ((!isExtensionActive('beg')) || (!isBegRallyeEnabled())) {
logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
if (!defined('__SECURITY')) {
die();
} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) {
- // Do not execute when script is in CSS mode or no daily reset
+ // Do not execute when script is in CSS mode or no hourly reset
return;
} elseif (!isExtensionActive('bonus')) {
logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
if (!defined('__SECURITY')) {
die();
} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) {
- // Do not execute when script is in CSS mode or no daily reset
+ // Do not execute when script is in CSS mode or no hourly reset
return;
} elseif (!isExtensionActive('newsletter')) {
logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
if (!defined('__SECURITY')) {
die();
} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) {
- // Do not execute when script is in CSS mode or no daily reset
+ // Do not execute when script is in CSS mode or no hourly reset
return;
} elseif (!isExtensionActive('surfbar')) {
logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
return $GLOBALS[__FUNCTION__];
}
+// Checks wether the hourly reset mode is active
+function isHourlyResetEnabled () {
+ // Now simply check it
+ return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === true));
+}
+
// Checks wether the reset mode is active
function isResetModeEnabled () {
// Now simply check it
return $GLOBALS[__FUNCTION__];
}
+// Checks wether the debug reset is enabled
+function isDebugResetEnabled () {
+ // Is cache set?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Simply check it
+ $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS[__FUNCTION__];
+}
+
// Checks wether SQL debugging is enabled
function isSqlDebuggingEnabled () {
// Is cache set?
return $GLOBALS[__FUNCTION__][$timestamp];
}
+// Getter for current hour (default)
+function getHour ($timestamp = null) {
+ // Is it cached?
+ if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
+ // null is time()
+ if (is_null($timestamp)) {
+ $timestamp = time();
+ } // END - if
+
+ // Then create it
+ $GLOBALS[__FUNCTION__][$timestamp] = date('H', $timestamp);
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$timestamp];
+}
+
// Getter for current day (default)
function getDay ($timestamp = null) {
// Is it cached?
if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
// null is time()
- if (is_null($timestamp)) $timestamp = time();
+ if (is_null($timestamp)) {
+ $timestamp = time();
+ } // END - if
// Then create it
$GLOBALS[__FUNCTION__][$timestamp] = date('d', $timestamp);