]> git.mxchange.org Git - mailer.git/blobdiff - inc/autopurge/purge-unconfirmed.php
Extension ext-coupon continued, a lot improvements applied:
[mailer.git] / inc / autopurge / purge-unconfirmed.php
index 4929f2d97403ea1c9b596d9b6329f18fb39fa5b8..c4eed02a77ac7fc0c926ad38d295ff08bde9d71d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 05/29/2004 *
- * ===============                              Last change: 11/26/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 05/29/2004 *
+ * ===================                          Last change: 11/26/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : autopurge.php                                    *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Auto-Loeschung von veralteten Mail-Links         *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
+       die();
 } // END - if
 
 // Abort if autopurge is not active or disabled by admin
-if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
        // Abort here
        return false;
 } // END - if
 
 // Shall I auto-purge unconfirmed accounts?
-if (getConfig('autopurge_unconfirmed') == "Y") {
-       // Init variables and find unconfirmed accounts which I shall auto-purge
-       $time = getConfig(('ap_un_time'));
-       $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s)
-ORDER BY userid ASC",
-               array($time), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result_uncon) > 0) {
+if (getConfig('autopurge_unconfirmed') == 'Y') {
+       // Init variables and find unconfirmed accounts which I shall auto-purge;
+       $result_uncon = SQL_QUERY("SELECT
+       `userid`, `email`, `joined`
+FROM
+       `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+       `status`='UNCONFIRMED' AND
+       (UNIX_TIMESTAMP() - `joined`) >= {?ap_unconfirmed_time?}
+ORDER BY
+       `userid` ASC", __FILE__, __LINE__);
+       if (!SQL_HASZERONUMS($result_uncon)) {
                // Prepare variable...
-               $UIDs = "";
-               define('__UNCONFIRMED_TIME' , (getConfig('ap_un_time')  / 60 / 60));
+               $userids = '';
+               $content['time'] = (getApUnconfirmedTime()  / 60 / 60);
 
                // Delete inactive accounts
-               while ($content = SQL_FETCHARRAY($result_uncon)) {
+               while ($row = SQL_FETCHARRAY($result_uncon)) {
+                       // Merge both arrays
+                       $content = merge_array($content, $row);
+
                        // Remember userids for the admin
-                       $UIDs .= $content['userid'].", ";
+                       $userids .= $content['userid'] . ', ';
 
                        // Get date/time from timestamp
-                       $content['joined'] = MAKE_DATETIME($content['joined'], "0");
+                       $content['joined'] = generateDateTime($content['joined'], 0);
 
                        // Finnaly delete this inactive account
-                       DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], ""));
+                       deleteUserAccount($content['userid'], loadEmailTemplate('member_autopurge_unconfirmed', $content, ''));
                } // END - while
 
                // Remove last comma
-               $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
+               $userids = str_replace(', ', "\n", substr($userids, 0, -2));
 
                // Send mail notification to admin
-               if (getConfig('ap_un_notify') == "Y") {
-                       SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, "");
+               if (getConfig('ap_un_notify') == 'Y') {
+                       sendAdminNotification('{--ADMIN_AUTOPURGE_UNCONFIRMED_SUBJECT--}', 'admin_autopurge_unconfirmed', $userids);
                } // END - if
        } // END - if
 
        // Free memory
        SQL_FREERESULT($result_uncon);
-}
+} // END - if
 
-//
+// [EOF]
 ?>