2004-10-31 00:57:08 +00:00
#!/usr/bin/php -q
< ? /*
Copyright ( C ) 2004 by Duane Groth < duane_at_CAcert_dot_org >
This file is part of CAcert .
CAcert has been released under a CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address :
http :// www . cacert . org / src - lic . php
CAcert is distributed WITHOUT ANY WARRANTY ; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE . See the License for more details .
*/
2005-01-02 03:39:11 +00:00
include_once ( " /home/cacert/www/includes/mysql.php " );
2004-10-31 00:57:08 +00:00
$query = " select * from `users` where `users`.`verified`=0 and
2005-01-02 03:39:11 +00:00
( UNIX_TIMESTAMP ( NOW ()) - UNIX_TIMESTAMP ( `users` . `created` )) >= 172800 " ;
2004-10-31 00:57:08 +00:00
$res = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $res ))
{
2004-10-31 01:03:19 +00:00
mysql_query ( " delete from `email` where `memid`=' " . $row [ 'id' ] . " ' " );
mysql_query ( " delete from `users` where `id`=' " . $row [ 'id' ] . " ' " );
2004-10-31 00:57:08 +00:00
}
2005-01-02 03:39:11 +00:00
2005-03-12 19:40:24 +00:00
$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 );
2005-01-02 03:39:11 +00:00
$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 )
{
2005-01-03 01:03:03 +00:00
$query = " update `notary` set `expire`=0, `points`='0' where `to`=' $row[to] ' and `from`=' $row[from] ' and `expire`=' $row[expire] ' " ;
2005-01-02 03:39:11 +00:00
} else {
$newpoints = 150 - $drow [ 'points' ];
2005-01-03 01:03:03 +00:00
$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() " ;
2005-01-02 03:39:11 +00:00
}
$data = mysql_fetch_assoc ( mysql_query ( " select * from `users` where `id`=' $row[to] ' " ));
2005-01-03 01:03:03 +00:00
$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 " ;
2005-01-02 03:39:11 +00:00
sendmail ( " cacert-board@lists.cacert.org " , " [CAcert.org] Temporary Increase Expired. " , $body , " website@cacert.org " , " returns@cacert.org " , " " , " CAcert Website " );
if ( $data [ 'language' ] != " " )
{
$userlang = $data [ 'language' ];
putenv ( " LANG= " . $userlang );
setlocale ( LC_ALL , $userlang );
}
$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 " , " returns@cacert.org " , " " , " CAcert Website " );
mysql_query ( $query );
}
2004-10-31 00:57:08 +00:00
?>