summaryrefslogtreecommitdiff
path: root/scripts/cron/removedead.php
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2012-03-28 23:35:54 +0200
committerMichael Tänzer <neo@nhng.de>2012-03-28 23:35:54 +0200
commit02d307527b6797e8dd6f6117b8ff24707d007137 (patch)
tree8235c0241681f92203cdc51f8b310a7a9f2e6912 /scripts/cron/removedead.php
parentd4bd109238aec503ad1d8abc1cd12ad8a12bba46 (diff)
parentb9d60cb4824796dc85d60e672d076ae25e534682 (diff)
downloadcacert-devel-02d307527b6797e8dd6f6117b8ff24707d007137.tar.gz
cacert-devel-02d307527b6797e8dd6f6117b8ff24707d007137.tar.xz
cacert-devel-02d307527b6797e8dd6f6117b8ff24707d007137.zip
Merge branch 'release' into bug-1024
Conflicts: includes/lib/account.php Signed-off-by: Michael Tänzer <neo@nhng.de>
Diffstat (limited to 'scripts/cron/removedead.php')
-rwxr-xr-xscripts/cron/removedead.php85
1 files changed, 85 insertions, 0 deletions
diff --git a/scripts/cron/removedead.php b/scripts/cron/removedead.php
new file mode 100755
index 0000000..aadda81
--- /dev/null
+++ b/scripts/cron/removedead.php
@@ -0,0 +1,85 @@
+#!/usr/bin/php -q
+<? /*
+ LibreSSL - CAcert web application
+ Copyright (C) 2004-2008 CAcert Inc.
+
+ 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; version 2 of the License.
+
+ 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+ require_once(dirname(__FILE__).'/../../includes/mysql.php');
+ require_once(dirname(__FILE__).'/../../includes/lib/l10n.php');
+
+ $query = "select * from `users` where `users`.`verified`=0 and
+ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`users`.`created`)) >= 172800";
+ $res = mysql_query($query);
+ while($row = mysql_fetch_assoc($res))
+ {
+ mysql_query("delete from `email` where `memid`='".$row['id']."'");
+ mysql_query("delete from `users` where `id`='".$row['id']."'");
+ }
+
+ $query = "delete from `domains` where `hash`!='' and
+ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 172800";
+ mysql_query($query);
+
+ $query = "delete from `email` where `hash`!='' and
+ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 172800";
+ mysql_query($query);
+
+ $query = "delete from `disputedomain` where `hash`!='' and
+ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 21600";
+ mysql_query($query);
+
+ $query = "delete from `disputeemail` where `hash`!='' and
+ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 21600";
+ mysql_query($query);
+
+ $query = "select * from `notary` where `expire`!=0 and `expire`<NOW()";
+ $res = mysql_query($query);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $query = "select sum(`points`) as `points` from `notary` where `to`='$row[to]' and `expire`=0 group by `to`";
+ $dres = mysql_query($query);
+ $drow = mysql_fetch_assoc($dres);
+ if($drow['points'] >= 150)
+ {
+ $query = "update `notary` set `expire`=0, `points`='0' where `to`='$row[to]' and `from`='$row[from]' and `expire`='$row[expire]'";
+ } else {
+ $newpoints = 150 - $drow['points'];
+ $query = "update `notary` set `expire`=0, `points`='0' where `to`='$row[to]' and `from`='$row[from]' and `expire`='$row[expire]'";
+ mysql_query($query);
+ $query = "insert into `notary` set `expire`=0, `points`='$newpoints', `to`='$row[to]', `from`='$row[from]', `when`=NOW(), `method`='Administrative Increase', `date`=NOW()";
+ }
+
+ $data = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='$row[to]'"));
+ $body = sprintf("%s %s (%s) had a temporary increase, but this has just expired and they have been reduced to 150 points.", $data['fname'], $data['lname'], $data['email'])."\n\n";
+ sendmail("cacert-board@lists.cacert.org", "[CAcert.org] Temporary Increase Expired.", $body, "website@cacert.org", "", "", "CAcert Website");
+
+ if($data['language'] != "")
+ {
+ L10n::set_translation($data['language']);
+ }
+
+ $body = _("You are receiving this email because you had a temporary increase to 200 points. This has since expired and you have been reduced to 150 points.")."\n\n";
+ $body = _("If you needed more time or any other extenuating circumstances you should contact us immediately so this situation can be dealt with immediately.")."\n\n";
+
+ $body .= _("Best regards")."\n";
+ $body .= _("CAcert Support Team");
+
+ sendmail($data['email'], "[CAcert.org] "._("Temporary points increase has expired."), $body, "support@cacert.org", "", "", "CAcert Website");
+
+ mysql_query($query);
+ fix_assurer_flag($row[to]);
+ }
+?>