+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 11/10/2012 *
+ * =================== Last change: 11/10/2012 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : daily_user_subids.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Things to be done on daily reset *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Dinge, die beim taeglichen Reset erledigt werden *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * For more information visit: http://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 ((!isHtmlOutputMode()) || (!isResetModeEnabled())) {
+ // Do not execute when script is in CSS mode or no daily reset
+ return;
+} elseif (!isExtensionInstalledAndNewer('user', '0.5.8')) {
+ logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension ext-user disabled or out-dated.');
+ return;
+}
+
+// Debug line
+//* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset started.');
+
+// Is auto-purging activated and configured correctly?
+if ((isApSubidsEnabled()) && (getApSubidsSince() > 0)) {
+ // Start purging
+ SQL_QUERY('DELETE LOW_PRIORITY FROM
+ `{?_MYSQL_PREFIX?}_subid_log`
+WHERE
+ (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`entry_added`)) >= {?ap_subids_since?}',
+ __FILE__, __LINE__);
+
+ // Are some entries deleted?
+ if (SQL_AFFECTEDROWS() > 0) {
+ // Okay, then send an email to the admin
+ sendAdminNotification('{--ADMIN_PURGE_USER_SUBID_LOG_SUBJECT--}', 'admin_purge_user_subid_log', SQL_AFFECTEDROWS());
+ } // END - if
+} // END - if
+
+// Debug line
+//* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset ended.');
+
+// [EOF]
+?>