Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[mailer.git] / inc / libs / autopurge_functions.php
index 76be497ee5ad86b9c2c499907b3aa116d2a10ac9..769099587ece6273c4c9a79d754b7d5562f57d70 100644 (file)
  * $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 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * 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 *
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Add points in autopurge-mode
 function addPointsAutoPurge ($userid, $points) {
+       // Is the userid valid?
+       if (!isValidUserId($userid)) {
+               // Please report all these bugs
+               reportBug(__FUNCTION__, __LINE__, 'Invalid call. userid=' . $userid . ',points=' . $points);
+       } // END - if
+
        // Add points over the ref system directly now
-       addPointsDirectly('autopurge_add', $userid, $points);
+       initReferralSystem();
+       addPointsThroughReferralSystem('autopurge_add', $userid, $points);
 
        // Send out mail to user
        $message = loadEmailTemplate('member_autopurge_points', array('points' => $points), $userid);
-       sendEmail($userid, '{--AUTOPURGE_MEMBER_SUBJECT--}', $message);
+       sendEmail($userid, '{--MEMBER_AUTOPURGE_SUBJECT--}', $message);
+}
+
+// Checks whether auto-purging is enabled
+function isAutoPurgingActive () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = (getConfig('auto_purge_active') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Wrapper for 'autopurge_inactive
+function getAutopurgeInactive () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = (getConfig('autopurge_inactive') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Checks whether purging of inactive accounts is enabled
+function isAutopurgeInactiveEnabled () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = (getAutopurgeInactive() == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
 }
 
 // [EOF]