inc/pool/pool-user.php svneol=native#text/plain
inc/purge/.htaccess svneol=native#text/plain
inc/purge/purge- svneol=native#text/plain
+inc/purge/purge-coupon.php svneol=native#text/plain
inc/purge/purge-general.php svneol=native#text/plain
inc/purge/purge-inact.php svneol=native#text/plain
inc/purge/purge-mails.php svneol=native#text/plain
templates/de/emails/admin/admin_coupon.tpl svneol=native#text/plain
templates/de/emails/admin/admin_coupon_cashed.tpl svneol=native#text/plain
templates/de/emails/admin/admin_coupon_code.tpl svneol=native#text/plain
+templates/de/emails/admin/admin_coupon_purge.tpl svneol=native#text/plain
+templates/de/emails/admin/admin_coupon_purge_row.tpl svneol=native#text/plain
templates/de/emails/admin/admin_del_surfbar_urls.tpl svneol=native#text/plain
templates/de/emails/admin/admin_edit_surfbar_urls.tpl svneol=native#text/plain
templates/de/emails/admin/admin_extension_deactivated.tpl svneol=native#text/plain
./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table?
./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y');
./inc/extensions-functions.php:155: // @TODO Do we still need this? setExtensionUpdateNotes('');
-./inc/extensions-functions.php:1943:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
-./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
-./inc/extensions-functions.php:559: // @TODO Extension is loaded, what next?
+./inc/extensions-functions.php:1947:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
+./inc/extensions-functions.php:425:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
+./inc/extensions-functions.php:562: // @TODO Extension is loaded, what next?
./inc/filter/bonus_filter.php:56: // @TODO This query isn't right, it will only update if the user was for a longer time away!
./inc/filter/cache_filter.php:92: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
./inc/functions.php:1223: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
}
// Registers an extension and possible update dependencies
-function registerExtension ($ext_name, $taskId, $dry_run = false) {
+function registerExtension ($ext_name, $taskId, $dry_run = false, $ignoreUpdates = false) {
// Set current extension name
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',task_id=' . $taskId . ',dry_run=' . intval($dry_run) . ' - ENTERED!');
setCurrentExtensionName($ext_name);
} // END - if
// When this extension is already in registration/update phase, all is fine
- if ((isExtensionRegistrationRunning($ext_name)) || (isExtensionUpdateRunning($ext_name))) {
+ if ((isExtensionRegistrationRunning($ext_name)) || ((isExtensionUpdateRunning($ext_name)) && ($ignoreUpdates === false))) {
// Then abort here with 'true' becaus it is fine
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - already in registration/update phase, all fine.');
+ ///* BUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',taskId=' . $taskId . ',dry_run=' . intval($dry_run) . ' - Please investigate!');
return true;
} // END - if
// Init variables
$ret = false;
- $test = false;
+ $processResult = false;
initIncludePool('extension');
// By default we have no failures
- setExtensionReportsFailure(false);
+ enableExtensionReportingFailure();
// Does this extension exists?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
// Extension version set? If empty the extension is not registered
if (empty($ext_ver)) {
// Extension not registered so far so first load task's id...
- $task = determineExtensionTaskId($ext_update);
+ $taskId = determineExtensionTaskId($ext_update);
// Entry found?
- if ($task > 0) {
+ if ($taskId > 0) {
// Try to register the extension
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ':ext_update=' . $ext_update . ',taskId=' . $task);
- $test = registerExtension($ext_update, $task, isExtensionDryRun(), false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_update=' . $ext_update . ',taskId=' . $taskId . ',isExtensionDryRun()=' . isExtensionDryRun());
+ $processResult = registerExtension($ext_update, $taskId, isExtensionDryRun(), true);
// Reset extension name
setCurrentExtensionName($ext_name);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_update=' . $ext_update . ',processResult=' . intval($processResult));
} // END - if
} elseif ($ext_ver != getCurrentExtensionVersion()) {
// Ok, update this extension now
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',currVer=' . getCurrentExtensionVersion());
// All okay!
- $test = true;
+ $processResult = true;
} else {
// Nothing to register / update before...
- $test = true;
+ $processResult = true;
}
} else {
// Required file for update does not exists!
- $test = true;
+ $processResult = true;
// But this is fine for the first time...
}
// Is there no update?
if (countExtensionUpdateDependencies(getCurrentExtensionName()) == 0) {
// Then test is passed!
- $test = true;
+ $processResult = true;
} // END - if
// Switch back to register mode
setExtensionMode('register');
// Remains true if extension registration reports no failures
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
- $test = (($test === true) && (getExtensionReportsFailure() === false));
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',processResult=' . intval($processResult));
+ $processResult = (($processResult === true) && (isExtensionReportingFailure() === false));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',processResult=' . intval($processResult));
// Does everthing before wents ok?
- if ($test === true) {
+ if ($processResult === true) {
// "Dry-run-mode" activated?
if ((isExtensionDryRun() === false) && (!isExtensionOnRemovalList())) {
// Init SQLs and transfer ext->generic
$ret = false;
}
} elseif (($taskId > 0) && (getCurrentExtensionName() != '')) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
// Remove task from system when id and extension's name is valid
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s AND `status`='NEW' LIMIT 1",
array(bigintval($taskId)), __FUNCTION__, __LINE__);
}
// Return status code
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ',test=' . intval($test) . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ',processResult=' . intval($processResult) . ' - EXIT!');
return $ret;
}
// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
function doExtensionSqls ($ext_id, $load_mode) {
// This shall never do a non-admin user!
- if (!isAdmin()) return false;
+ if (!isAdmin()) {
+ return false;
+ } // END - if
// Get extension's name
$ext_name = getExtensionName($ext_id);
// Is this extension update already running?
if (isExtensionUpdateRunning($ext_name)) {
// This is fine but needs logging ATM
- /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - already in update phase, all fine.');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - already in update phase, all fine.');
return true;
} // END - if
// Is the extension there?
if (isExtensionInstalled($ext_depend)) {
// Update another extension first!
- $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), isExtensionDryRun());
+ $processResult = updateExtension($ext_depend, getExtensionVersion($ext_depend), isExtensionDryRun());
} else {
// Register new extension
- $test = registerExtension($ext_depend, 0, isExtensionDryRun(), false);
+ $processResult = registerExtension($ext_depend, 0, isExtensionDryRun());
}
} // END - if
} // END - foreach
// Checks wether an update is already running for given extension
function isExtensionUpdateRunning ($ext_name) {
// Current and given extensions means whole array
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currentExtension=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ' - ENTERED!');
if ($ext_name == getCurrentExtensionName()) {
// Default is not found
$isRunning = false;
if (($ext1 == $ext_name) || (in_array($ext_name, $depends))) {
// Found
$isRunning = true;
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext1=' . $ext1 . ',ext_name=' . $ext_name . ',isRunning=' . intval($isRunning));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext1=' . $ext1 . ',ext_name=' . $ext_name . ',isRunning=' . intval($isRunning) . ' - ADDED!');
break;
} // END - if
} // END - foreach
// Return result
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currentExtension=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ', isRunning=' . intval($isRunning));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currentExtension=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ', isRunning=' . intval($isRunning) . ' - EXIT!');
return $isRunning;
} // END - if
$isRunning = ((isExtensionUpdateDependenciesInitialized()) && (in_array($ext_name, getExtensionRunningUpdates())));
// Return it
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currentExtension=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ', isRunning=' . intval($isRunning));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currentExtension=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ', isRunning=' . intval($isRunning) . ' - EXIT!');
return $isRunning;
}
}
// Setter for EXT_REPORTS_FAILURE flag
-function setExtensionReportsFailure ($reportsFailure) {
+function enableExtensionReportingFailure ($reportsFailure = false) {
$GLOBALS['ext_reports_failure'] = (bool) $reportsFailure;
}
// Getter for EXT_REPORTS_FAILURE flag
-function getExtensionReportsFailure () {
+function isExtensionReportingFailure () {
return $GLOBALS['ext_reports_failure'];
}
// SQL commands to run
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` CHANGE `data_type` `data_type` ENUM('TEMP','SEND','NEW','ADMIN','ACTIVE','DELETED') NOT NULL DEFAULT 'TEMP'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` CHANGE `data_type` ENUM('NEW','QUEUE','SEND','DELETED') NOT NULL DEFAULT 'NEW'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` CHANGE `data_type` `data_type` ENUM('NEW','QUEUE','SEND','DELETED') NOT NULL DEFAULT 'NEW'");
break;
case 'remove': // Do stuff when removing extension
case 'register': // Do stuff when installtion is running
// This extension requires an up-to-date ext-user
addExtensionDependency('user');
+ addExtensionDependency('autopurge');
// Coupon data
addDropTableSql('coupon_data');
case 'register': // Do stuff when installation is running
// Check if mod_rewrite is loadeded
if (!isApacheModuleLoaded('mod_rewrite')) {
- setExtensionReportsFailure(true);
+ enableExtensionReportingFailure(true);
addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}');
} // END - if
// Check if mod_rewrite is loadeded
if (!isApacheModuleLoaded('mod_rewrite')) {
SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__);
- setExtensionReportsFailure(true);
+ enableExtensionReportingFailure(true);
addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}');
} // END - if
case '0.1.3':
// Check if mod_rewrite is loadeded
if (!isApacheModuleLoaded('mod_rewrite')) {
- setExtensionReportsFailure(true);
+ enableExtensionReportingFailure(true);
//addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}');
} // END - if
setExtensionUpdateNotes("Es wird beim Registrieren und aktivieren geprüft, ob im Apache das Modul mod_rewrite geladen wurde. Wenn mod_rewrite nicht gefunden werden konnte, wird abgebrochen.");
case 'init': // Do stuff when extension is initialized
// Check if mod_rewrite is loadeded
if (!isApacheModuleLoaded('mod_rewrite')) {
- setExtensionReportsFailure(true);
+ enableExtensionReportingFailure(true);
SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__);
- if (!isAdmin()) addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}');
+ if (!isAdmin()) {
+ addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}');
+ } // END - if
} // END - if
break;
'MEMBER_COUPON_SUBJECT' => "Gutschein bei {?MAIN_TITLE?}",
'ADMIN_COUPON_SUBJECT' => "Es wurde ein Gutschein versendet",
'ADMIN_COUPON_CASHED_SUBJECT' => "Ein Mitglied hat seinen Gutschein eingelöst",
+ 'ADMIN_COUPON_PURGE_SUBJECT' => "Bereinigung von abgelaufenen Gutscheinen",
// Language strings for admin/member
'COUPON_ID' => "Gutscheinnummer",
'ADMIN_STATUS_CHANGED' => "Es wurden <span class=\"data\">%s</span> von <span class=\"data\">%s</span> Einträgen geändert.",
// Missing menu entries
- 'ADMIN_MENU_ACTION_404' => "Hauptmenü <span class=\"data\">%s</span> deaktiviert, da keine Scriptdatei auf dem Server gefunden wurde.",
- 'ADMIN_MENU_WHAT_404' => "Untermenü <span class=\"data\">%s</span> deaktiviert, da keine Scriptdatei auf dem Server gefunden wurde.",
+ 'ADMIN_MENU_ACTION_404' => "Hauptmenü '%s' deaktiviert, da keine Scriptdatei auf dem Server gefunden wurde.",
+ 'ADMIN_MENU_WHAT_404' => "Untermenü '%s' deaktiviert, da keine Scriptdatei auf dem Server gefunden wurde.",
// Cache messages
'CACHE_PROBLEMS_DETECTED' => "Probleme mit dem Cache-Subsystem erkannt.",
--- /dev/null
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 07/05/2011 *
+ * =================== Last change: 07/05/2011 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : purge-coupon.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Purge expired coupons after some time *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Nach einer Weile angelaufene Gutscheine entf. *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * -------------------------------------------------------------------- *
+ * 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 (!isExtensionActive('coupon')) {
+ logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
+ return;
+}
+
+// Search for all expired coupons that we can purge
+$result = SQL_QUERY('SELECT
+ `id`,
+ UNIX_TIMESTAMP(`coupon_created`) AS `coupon_created`,
+ UNIX_TIMESTAMP(`coupon_expired`) AS `coupon_expired`,
+ `total_created`,
+ `total_cashed`,
+ `points`,
+ `coupon_description`
+FROM
+ `{?_MYSQL_PREFIX?}_coupon_data`
+WHERE
+ (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`coupon_expired`)) >= {?coupon_autopurge_time?}
+ORDER BY
+ `id` ASC', __FILE__, __LINE__);
+
+// Do we have entries?
+if (SQL_NUMROWS($result) > 0) {
+ // Init variables
+ $out = '';
+ $ids = array();
+
+ // Start purging all
+ while ($content = SQL_FETCHARRAY($result)) {
+ // Add id
+ $ids[] = $content['id'];
+
+ // Translate some data
+ $content['coupon_created'] = generateDateTime($content['coupon_created'], '2');
+ $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2');
+
+ // Load email row template
+ $out .= loadEmailTemplate('admin_coupon_purge_row', $content);
+ } // END - while
+
+ // Purge all entries
+ SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_coupon_data` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`coupon_expired`)) >= {?coupon_autopurge_time?}', __FILE__, __LINE__);
+
+ // Purge also user entries
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_coupons` WHERE `coupon_id` IN (%s) LIMIT %s",
+ array(
+ implode(',', $ids),
+ count($ids)
+ ), __FILE__, __LINE__);
+
+ // Send admin notification
+ sendAdminNotification('{--ADMIN_COUPON_PURGE_SUBJECT--}', 'admin_coupon_purge', $out);
+} // END - if
+
+// Free result
+SQL_FREERESULT($result);
+
+// [EOF]
+?>
$content['expiration'] = '{--MAIL_WILL_NEVER_EXPIRE--}';
} elseif (isConfigEntrySet('auto_purge')) {
// Create nice date string
- $content['expiration'] = '{%pipe,getAutoPurge,createFancyTime%}';
+ $content['expiration'] = '{%config,createFancyTime=auto_purge%}';
} else {
// Missing entry
$content['expiration'] = '{--MAIL_NO_CONFIG_AUTO_PURGE--}';
--- /dev/null
+Hallo Administrator,
+
+es wurden soeben abgelaufene Gutscheine, die mehr als {%config,createFancyTime=coupon_autopurge_time%} noch gespeichert waren.
+
+Hier sind alle Daten der/des Gutscheine(s):
+$content
+------------------------------------
+
+Mit freundlichen Grüßen,
+ Ihr {?MAIN_TITLE?} Team
+
+{?URL?}/login.php ({?WEBMASTER?})
--- /dev/null
+------------------------------------
+Gutschein-Id: $content[id]
+Vergütung: {%pipe,translateComma=$content[points]%} {?POINTS?}
+Einstellungszeitpunkt: $content[coupon_created]
+Ablaufzeitpunkt: $content[coupon_expired]
+Anzahl erstellt: $content[total_created]
+Anzahl eingelöst: $content[total_cashed]
+------------------------------------
+Beschreibung/Hinweis:
+$content[coupon_description]