summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CommModule/readme.txt3
-rwxr-xr-xCommModule/usbclient.pl1019
-rwxr-xr-xcgi-bin/siteseal.cgi92
-rw-r--r--includes/account.php10
-rw-r--r--includes/general.php12
-rw-r--r--includes/lib/account.php8
-rw-r--r--includes/loggedin.php7
-rw-r--r--includes/notary.inc.php61
-rw-r--r--pages/account/55.php3
-rw-r--r--pages/wot/1.php3
-rw-r--r--pages/wot/9.php3
-rwxr-xr-xscripts/cron/refresh_stats.php20
-rw-r--r--stamp/.htaccess5
-rw-r--r--stamp/certdet.php86
-rw-r--r--stamp/common.php151
-rw-r--r--stamp/displogo.php59
-rw-r--r--stamp/images/CAverify.pngbin3444 -> 0 bytes
-rw-r--r--stamp/index.php75
-rw-r--r--stamp/old_showlogo.php.broken25
-rw-r--r--stamp/report.php121
-rw-r--r--stamp/showlogo.php0
-rw-r--r--stamp/style.css620
-rw-r--r--www/api/ccsr.php109
-rw-r--r--www/api/cemails.php48
-rw-r--r--www/index.php6
-rw-r--r--www/wot.php44
26 files changed, 101 insertions, 2489 deletions
diff --git a/CommModule/readme.txt b/CommModule/readme.txt
index 94f09fe..d80c46e 100644
--- a/CommModule/readme.txt
+++ b/CommModule/readme.txt
@@ -2,6 +2,5 @@ client.pl The real client, running on the webserver
commdaemon Script to run client.pl or server.pl
commmodule Script for startup/shutdown of CommModule from /etc/init.d
logclean.sh Maintenance script for logfiles generated by CommModule
-serial.conf Serial Port configuration file
+serial.conf Serial Port configuration file
server.pl The real server, running on the signing server
-usbclient.pl Obsoleted USB version of client.pl above
diff --git a/CommModule/usbclient.pl b/CommModule/usbclient.pl
deleted file mode 100755
index 6cbc111..0000000
--- a/CommModule/usbclient.pl
+++ /dev/null
@@ -1,1019 +0,0 @@
-#!/usr/bin/perl -w
-
-# CommModule - CAcert Communication module
-# 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
-
-# Production Client / CommModule
-
-use strict;
-use Device::USB;
-use POSIX;
-use Time::HiRes q(usleep);
-use File::CounterFile;
-use File::Copy;
-use DBI;
-use Locale::gettext;
-use IO::Socket;
-use MIME::Base64;
-use Digest::SHA1 qw(sha1_hex sha1);
-
-#Protocol version:
-my $ver=1;
-
-#Debugging does not delete work-files for later inspection
-my $debug=0;
-
-#Paranoid exists the program on a malicious request
-my $paranoid=1;
-
-#Location of the openssl and gpg binaries
-my $gpgbin="/usr/bin/gpg";
-my $opensslbin="/usr/bin/openssl";
-
-my $mysqlphp="/home/cacert/www/includes/mysql.php";
-
-my %revokefile=(2=>"../www/class3-revoke.crl",1=>"../www/revoke.crl",0=>"../www/revoke.crl");
-
-#USB-Link settings
-my $PACKETSIZE=0x100;
-my $SALT="Salz";
-my $HASHSIZE=20;
-
-#End of configurations
-
-########################################################
-
-
-#Reads a while file and returns the content
-#Returns undef on failure
-sub readfile($)
-{
- my $olds=$/;
- my $content=undef;
- if(open READIN,"<$_[0]")
- {
- binmode READIN;
- undef $/;
- $content=<READIN>;
- close READIN;
- $/=$olds;
- }
- return $content;
-}
-
-#Writes/Overwrites a file with content.
-#Returns 1 on success, 0 on failure.
-sub writefile($$)
-{
- if(open WRITEOUT,">$_[0]")
- {
- binmode WRITEOUT;
- print WRITEOUT $_[1];
- close WRITEOUT;
- return 1;
- }
- return 0;
-}
-
-#mkdir "revokehashes";
-foreach (keys %revokefile)
-{
- my $revokehash=sha1_hex(readfile($revokefile{$_}));
- print "Root $_: Hash $revokefile{$_} = $revokehash\n";
-}
-
-my %monarr = ("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12);
-
-my $content=readfile($mysqlphp);
-my $password="";$password=$1 if($content=~m/mysql_connect\("[^"]+",\s*"\w+",\s*"(\w+)"/);
-$content="";
-
-my $dbh = DBI->connect("DBI:mysql:cacert:localhost",$password?"cacert":"",$password, { RaiseError => 1, AutoCommit => 1 }) || die ("Error with the database connection.\n");
-
-
-#Logging functions:
-sub SysLog($)
-{
- my @ltime=localtime;
- my $date=strftime("%Y-%m-%d",@ltime);
- open LOG,">>logfile$date.txt";
- return if(not defined($_[0]));
- my $timestamp=strftime("%Y-%m-%d %H:%M:%S",@ltime);
- #$syslog->write($_[0]."\x00");
- print LOG "$timestamp $_[0]";
- print "$timestamp $_[0]";
- flush LOG;
- close LOG;
-}
-
-
-sub Error($)
-{
- SysLog($_[0]);
- if($paranoid)
- {
- die $_[0];
- }
-}
-
-
-my $timestamp=strftime("%Y-%m-%d %H:%M:%S",localtime);
-
-
-sub mysql_query($)
-{
- $dbh->do($_[0]);
-}
-
-sub trim($)
-{
- my $new=$_[0];
- $new=~s/^\s*//;
- $new=~s/\s*$//;
- return($new);
-}
-
-sub addslashes($)
-{
- my $new=$_[0];
- $new=~s/['"\\]/\\$1/g;
- return($new);
-}
-
-sub recode
-{
- return $_[1];
-}
-
-
-#Hexdump function: Returns the hexdump representation of a string
-sub hexdump($)
-{
- return "" if(not defined($_[0]));
- my $content="";
- $content.=sprintf("%02X ",unpack("C",substr($_[0],$_,1))) foreach (0 .. length($_[0])-1);
- return $content;
-}
-
-#pack3 packs together the length of the data in 3 bytes and the data itself, size limited to 16MB. In case the data is more than 16 MB, it is ignored, and a 0 Byte block is transferred
-sub pack3
-{
- return "\x00\x00\x00" if(!defined($_[0]));
- my $data=(length($_[0]) >= 2**24)? "":$_[0];
- my $len=pack("N",length($data));
- #print "len: ".length($data)."\n";
- return substr($len,1,3).$data;
-}
-
-
-#unpack3 unpacks packed data.
-sub unpack3($)
-{
- return undef if((not defined($_[0])) or length($_[0])<3);
- #print "hexdump: ".hexdump("\x00".substr($_[0],0,3))."\n";
- my $len=unpack("N","\x00".substr($_[0],0,3));
- #print "len3: $len length(): ".length($_[0])." length()-3: ".(length($_[0])-3)."\n";
- return undef if(length($_[0])-3 != $len);
- return substr($_[0],3);
-}
-
-
-#unpack3array extracts a whole array of concatented packed data.
-sub unpack3array($)
-{
- my @retarr=();
- if((not defined($_[0])) or length($_[0])<3)
- {
- SysLog "Datenanfang kaputt\n";
- return ();
- }
- my $dataleft=$_[0];
- while(length($dataleft)>=3)
- {
- #print "hexdump: ".hexdump("\x00".substr($dataleft,0,3))."\n";
- my $len=unpack("N","\x00".substr($dataleft,0,3));
- #print "len3: $len length(): ".length($dataleft)." length()-3: ".(length($dataleft)-3)."\n";
- if(length($dataleft)-3 < $len)
- {
- SysLog "Datensatz abgeschnitten\n";
- return ();
- }
- push @retarr, substr($dataleft,3,$len);
- $dataleft=substr($dataleft,3+$len);
- }
- if(length($dataleft)!=0)
- {
- SysLog "Ende abgeschnitten\n";
- return ();
- }
- return @retarr;
-}
-
-#Pack4 packs and secret-key signs some data.
-sub pack4($)
-{
- return pack("N",length($_[0])).$_[0].sha1($SALT.$_[0]);
-}
-
-
-
-
-
-$timestamp=strftime("%Y-%m-%d %H:%M:%S",localtime);
-
-SysLog("Starting Server at $timestamp\n");
-
-$SALT=readfile(".salt.key");
-
-SysLog("Opening USB-Link interface:\n");
-
-#Opening USB device:
-my $usb = Device::USB->new();
-my @list=$usb->list_devices(0x067b,0x2501);
-my $dev = $list[0];
-if(defined($dev))
-{
- #print "USB-Link Device found: ", $dev->filename(), "\n";
- if($dev->open())
- {
- #print "\t", $dev->manufacturer(), ": ", $dev->product(), "\n";
- $dev->claim_interface(0);
-
- my $buffer=" ";
-
- $dev->control_msg(0xc0 , 0xfb, 0, 0, $buffer, 2, 1000);
-
- if($buffer ne "\x04\x08" and $buffer ne "\x0c\x04" and $buffer ne "\x00\x0c" and $buffer ne "\x04\x0c")
- {
- print "Please plug the USB-Link cable into the other computer.\n";
- }
- else
- {
- print "USB-Link ok.\n";
- }
- }
- else
- {
- print "Unable to work with USB-Link device: $!\n";
- }
-}
-else
-{
- print "USB-Link Device not found. Please plug the cable into this computer.\n";
-}
-
-
-
-
-
-
-#sends a single packet (pack4 encoded). Returns the returncode
-sub send_packet($)
-{
- if((14+length($_[0])+$HASHSIZE) > $PACKETSIZE)
- {
- return -1;
- }
- # 4 Bytes Length, N Bytes Data, 20 Bytes SHA1 Hash, 0 Padding
- my $data="CommModule".pack4($_[0]);
- $data.=("\x00"x($PACKETSIZE-length($data)));
- my $ret=$dev->bulk_write(0x2,$data,length($data),1000);
- print "Send-result: $ret\n";
- return $ret;
-}
-
-#Receives several consecutive packets. Returns the concatenated payload
-sub receive_packets()
-{
- print "Receiving packets ...\n";
- my $collectedpayload="";
- my $done=0;
- while(!$done)
- {
- my $data=" "x$PACKETSIZE;
- my $re=$dev->bulk_read(0x83,$data,length($data),10000);
- writefile("usbpacket.dat",$data);
- print "Read: $re Bytes: ".length($data)."\n";
- if($re > 0)
- {
- $data=~s/^.*?CommModule//s;
- my $len=unpack("N",substr($data,0,4));
- print "len: $len\n";
- if($len>=0 and $len<=$PACKETSIZE-$HASHSIZE-4)
- {
- my $payload=substr($data,4,$len);
- if(sha1($SALT.$payload) eq substr($data,4+$len,$HASHSIZE))
- {
- print "Hash OK!\n";
- $collectedpayload.=substr($payload,1);
- $done=1 if(substr($payload,0,1)eq "0");
- }
- else
- {
- print "Hash NOT OK: ".sha1_hex($SALT.$payload)." vs. ".hexdump(substr($data,4+$len,$HASHSIZE))." !\n";
- return "";
- }
- }
- }
- elsif($re == 0)
- {
- print "USB-Link cable disconnected?\n";
- #return "";
- }
- }
- print "Receiving done.\n";
- return $collectedpayload;
-}
-
-
-
-
-my $MAXCHUNK=$PACKETSIZE-100;
-
-#Sends data over the USB-Link, without handshaking
-sub SendPackets($)
-{
- print "Sending Packets ...\n";
- my $data=pack4($_[0]);
- my $done=0;
- return if(!defined($data) or !length($data));
-
- while(!$done)
- {
- while(length($data)>0)
- {
- my $d=substr($data,0,$MAXCHUNK);
- if(length($data)>$MAXCHUNK)
- {
- send_packet("1".$d);
- $data=substr($data,$MAXCHUNK);
- }
- else
- {
- send_packet("0".$d);
- $data="";
- }
- }
- $done=1;
- }
- print "Sending Packets done.\n";
-}
-
-#Receives several packets, verifies the secret key signature and extracts the payload
-#Returns the payload
-sub Receive
-{
- my $data=receive_packets();
- if (!defined($data) or length($data)<4)
- {
- print "Received data too short!\n";
- return "";
- }
- my $len=unpack("N",substr($data,0,4));
- if($len != (length($data)-$HASHSIZE-4))
- {
- print "Length field does not match data on Receive!\n";
- return "";
- }
- my $payload=substr($data,4,$len);
- if(sha1($SALT.$payload) ne substr($data,4+$len,$HASHSIZE))
- {
- print "Hash on Receive is BROKEN!\n";
- return "";
- }
- return $payload;
-}
-
-
-
-
-# @result(Version,Action,Errorcode,Response)=Request(Version=1,Action=1,System=1,Root=1,Configuration="...",Parameter="...",Request="...");
-sub Request($$$$$$$$$$$)
-{
- print "Version: $_[0] Action: $_[1] System: $_[2] Root: $_[3] Config: $_[4]\n";
- $_[3]=0 if($_[3]<0);
- SendPackets(pack3(pack3(pack("C*",$_[0],$_[1],$_[2],$_[3],$_[4],$_[5],$_[6]>>8,$_[6]&255,$_[7])).pack3($_[8]).pack3($_[9]).pack3($_[10])));
- my $data=Receive();
- if(defined($data) and length($data)>6)
- {
- my @fields=unpack3array(substr($data,3));
-
- SysLog "Answer from Server: ".hexdump($data)."\n" if($debug);
-
- #writefile("result.dat",$data);
-
- return $fields[1];
- }
- return "";
-}
-
-
-sub calculateDays($)
-{
- if($_[0])
- {
- my @sum = $dbh->selectrow_array("select sum(`points`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 group by `to`");
- SysLog("Summe: $sum[0]\n") if($debug);
-
- return ($sum[0]>=50)?730:180;
- }
- return 180;
-}
-
-sub X509extractSAN($)
-{
- my @bits = split("/", $_[0]);
- my $SAN="";
- my $newsubject="";
- foreach my $val(@bits)
- {
- my @bit=split("=",$val);
- if($bit[0] eq "subjectAltName")
- {
- $SAN.="," if($SAN ne "");
- $SAN.= trim($bit[1]);
- }
- else
- {
- $newsubject .= "/".$val;
- }
- }
- $newsubject=~s{^//}{/};
- $newsubject=~s/[\n\r\t\x00"\\']//g;
- $SAN=~s/[ \n\r\t\x00"\\']//g;
- return($SAN,$newsubject);
-}
-
-sub X509extractExpiryDate($)
-{
- # TIMEZONE ?!?
- my $data=`$opensslbin x509 -in "$_[0]" -noout -enddate`;
-
- #notAfter=Aug 8 10:26:34 2007 GMT
- if($data=~m/notAfter=(\w{2,4}) *(\d{1,2}) *(\d{1,2}:\d{1,2}:\d{1,2}) (\d{4}) GMT/)
- {
- my $date="$4-".$monarr{$1}."-$2 $3";
- SysLog "Expiry Date found: $date\n" if($debug);
- return $date;
- }
- else
- {
- SysLog "Expiry Date not found: $data\n";
- }
- return "";
-}
-sub X509extractSerialNumber($)
-{
- # TIMEZONE ?!?
- my $data=`$opensslbin x509 -in "$_[0]" -noout -serial`;
- if($data=~m/serial=([0-9A-F]+)/)
- {
- return $1;
- }
- return "";
-}
-
-sub OpenPGPextractExpiryDate ($)
-{
- my $r="";
- my $cts;
- my @date;
-
- open(RGPG, $gpgbin.' -vv '.$_[0].' 2>&1 |') or Error('Can\'t start GnuPG($gpgbin): '.$!."\n");
- open(OUT, '> infogpg.txt' ) or Error('Can\'t open output file: infogpg.txt: '.$!);
- $/="\n";
- while (<RGPG>)
- {
- print OUT $_;
- unless ($r)
- {
- if ( /^\s*version \d+, created (\d+), md5len 0, sigclass \d+\s*$/ )
- {
- SysLog "Detected CTS: $1\n";
- $cts = int($1);
- } elsif ( /^\s*critical hashed subpkt \d+ len \d+ \(sig expires after ((\d+)y)?((\d+)d)?((\d+)h)?(\d+)m\)\s*$/ )
- {
- SysLog "Detected FRAME $2 $4 $6 $8\n";
- $cts += $2 * 31536000; # secs per year (60 * 60 * 24 * 365)
- $cts += $4 * 86400; # secs per day (60 * 60 * 24)
- $cts += $6 * 3600; # secs per hour (60 * 60)
- $cts += $8 * 60; # secs per min (60)
- $r = $cts;
- }
- elsif(/version/)
- {
- SysLog "Detected VERSION\n";
- }
- }
- }
-
- close(OUT );
- close(RGPG);
-
- SysLog "CTS: $cts R: $r\n";
-
- if ( $r )
- {
- @date = gmtime($r);
- $r = sprintf('%.4i-%.2i-%.2i %.2i:%.2i:%.2i', # date format
- $date[5] + 1900, $date[4] + 1, $date[3], # day
- $date[2], $date[1], $date[0], # time
- );
-
- }
- SysLog "$r\n";
- return $r;
-}
-
-
-# Sets the locale according to the users preferred language
-sub setUsersLanguage($)
-{
- my $lang="de_DE";
- print "Searching for the language of the user $_[0]\n";
- my @a=$dbh->selectrow_array("select language from users where id='".int($_[0])."'");
- $lang = $1 if($a[0]=~m/(\w+_[\w.@]+)/);
-
- SysLog "The users preferred language: $lang\n";
-
- if($lang ne "")
- {
- $ENV{"LANG"}=$lang;
- setlocale(LC_ALL, $lang);
- } else {
- $ENV{"LANG"}="en_AU";
- setlocale(LC_ALL, "en_AU");
- }
-}
-
-
-sub getUserData($)
-{
- my $sth = $dbh->prepare("select * from users where id='$_[0]'");
- $sth->execute();
- #SysLog "USER DUMP:\n";
- while ( my $rowdata = $sth->fetchrow_hashref() )
- {
- my %tmp=%{$rowdata};
- #foreach (sort keys %tmp)
- #{
- #SysLog " $_ -> $tmp{$_}\n";
- #}
- return %tmp;
- }
- return ();
-}
-
-
-sub _($)
-{
- return gettext($_[0]);
-}
-
-sub sendmail($$$$$$$)
-{
- my ($to, $subject, $message, $from, $replyto, $toname, $fromname)=@_;
- my $errorsto="returns\@cacert.org";
- my $extra="";
-
-
- # sendmail($user{email}, "[CAcert.org] Your GPG/PGP Key", $body, "support\@cacert.org", "", "", "CAcert Support");
- my @lines=split("\n",$message);
- $message = "";
- foreach my $line (@lines)
- {
- $line = trim($line);
- if($line eq ".")
- {
- $message .= " .\n";
- } else
- {
- $message .= $line."\n";
- }
- }
-
- $fromname = $from if($fromname eq "");
-
- my @bits = split(",", $from);
- $from = addslashes($bits['0']);
- $fromname = addslashes($fromname);
-
- my $smtp = IO::Socket::INET->new(PeerAddr => 'localhost:25');
- $/="\n";
- SysLog "SMTP: ".<$smtp>."\n";
- print $smtp "HELO hlin.cacert.org\r\n";
- SysLog "SMTP: ".<$smtp>."\n";
- print $smtp "MAIL FROM: <returns\@cacert.org>\r\n";
- SysLog "MAIL FROM: ".<$smtp>."\n";
-
- @bits = split(",", $to);
- foreach my $user (@bits)
- {
- print $smtp "RCPT TO: <".trim($user).">\r\n";
- SysLog "RCPT TO: ".<$smtp>."\n";
- }
- print $smtp "DATA\r\n";
- SysLog "DATA: ".<$smtp>."\n";
-
- print $smtp "X-Mailer: CAcert.org Website\r\n";
- print $smtp "X-OriginatingIP: ".$ENV{"REMOTE_ADDR"}."\r\n";
- print $smtp "Sender: $errorsto\r\n";
- print $smtp "Errors-To: $errorsto\r\n";
- if($replyto ne "")
- {
- print $smtp "Reply-To: $replyto\r\n";
- }
- else
- {
- print $smtp "Reply-To: $from\r\n";
- }
- print $smtp "From: $from ($fromname)\r\n";
- print $smtp "To: $to\r\n";
- my $newsubj=encode_base64(recode("html..utf-8", trim($subject)));
- #SysLog("NewSubj: --".$newsubj."--\n") if($debug);
- $newsubj=~s/\n*$//;
- #SysLog("NewSubj: --".$newsubj."--\n") if($debug);
- print $smtp "Subject: =?utf-8?B?$newsubj?=\r\n";
- print $smtp "Mime-Version: 1.0\r\n";
- if($extra eq "")
- {
- print $smtp "Content-Type: text/plain; charset=\"utf-8\"\r\n";
- print $smtp "Content-Transfer-Encoding: 8bit\r\n";
- } else {
- print $smtp "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
- print $smtp "Content-Transfer-Encoding: quoted-printable\r\n";
- print $smtp "Content-Disposition: inline\r\n";
- };
-# print $smtp "Content-Transfer-Encoding: BASE64\r\n";
- print $smtp "\r\n";
-# print $smtp chunk_split(encode_base64(recode("html..utf-8", $message)))."\r\n.\r\n";
- print $smtp recode("html..utf-8", $message)."\r\n.\r\n";
- SysLog "ENDOFTEXT: ".<$smtp>."\n";
- print $smtp "QUIT\n";
- SysLog "QUIT: ".<$smtp>."\n";
- close($smtp);
-}
-
-
-sub HandleCerts($$)
-{
- my $org=$_[0]?"org":"";
- my $server=$_[1];
-
- my $table=$org.($server?"domaincerts":"emailcerts");
-
- my $sth = $dbh->prepare("select * from $table where crt_name='' and csr_name!='' ");
- $sth->execute();
- #$rowdata;
- while ( my $rowdata = $sth->fetchrow_hashref() )
- {
- my %row=%{$rowdata};
-
- my $csrname = "../csr/".$org.($server?"server-":"client-").$row{'id'}.".csr";
- my $crtname = "../crt/".$org.($server?"server-":"client-").$row{'id'}.".crt";
-
-
- if($server)
- {
- #Weird SQL structure ...
- my @sqlres=$dbh->selectrow_array("select memid from domains where id='".int($row{'domid'})."'");
- $row{'memid'}=$sqlres[0];
- SysLog("Fetched memid: $row{'memid'}\n") if($debug);
- }
-
- SysLog "Opening $csrname\n";
-
- my $crt="";
-
- my $profile=0;
-
- # "0"=>"client.cnf",
- # "1"=>"client-org.cnf",
- # "2"=>"client-codesign.cnf",
- # "3"=>"client-machine.cnf",
- # "4"=>"client-ads.cnf",
- # "5"=>"server.cnf",
- # "6"=>"server-org.cnf",
- # "7"=>"server-jabber.cnf",
- # "8"=>"server-ocsp.cnf",
- # "9"=>"server-timestamp.cnf",
- # "10"=>"proxy.cnf",
- # "11"=>"subca.cnf"
-
-
- if($row{"type"} =~ m/^(8|9)$/)
- {
- $profile=$row{"type"};
- }
- elsif($org)
- {
- if($row{'codesign'})
- {
- $profile=2; ## TODO!
- }
- elsif($server)
- {
- $profile=6;
- }
- else
- {
- $profile=1;
- }
- }
- else
- {
- if($row{'codesign'})
- {
- $profile=2;
- }
- elsif($server)
- {
- $profile=5;
- }
- else
- {
- $profile=0;
- }
-
-
- }
-
-
-
- if(open(IN,"<$csrname"))
- {
- undef $/;
- my $content=<IN>;
- close IN;
- SysLog "Read.\n" if($debug);
- SysLog "Subject: --$row{'subject'}--\n" if($debug);
-
- my ($SAN,$subject)=X509extractSAN($row{'subject'});
- SysLog "Subject: --$subject--\n" if($debug);
- SysLog "SAN: --$SAN--\n" if($debug);
- SysLog "memid: $row{'memid'}\n" if($debug);
-
- my $days=$org?($server?(365*2):365):calculateDays($row{"memid"});
-
-
- $crt=Request($ver,1,1,$row{'rootcert'}-1,$profile,$row{'md'}eq"sha1"?2:0,$days,$row{'keytype'}eq"NS"?1:0,$content,$SAN,$subject);
- if(length($crt))
- {
- if($crt=~m/^-----BEGIN CERTIFICATE-----/)
- {
- open OUT,">$crtname";
- print OUT $crt;
- close OUT;
- }
- else
- {
- open OUT,">$crtname.der";
- print OUT $crt;
- close OUT;
- system "$opensslbin x509 -in $crtname.der -inform der -out $crtname";
- }
- }
-
- }
- else
- {
- print "Error: $! Konnte $csrname nicht laden\n";
- }
-
-
-
- if(-s $crtname)
- {
- SysLog "Opening $crtname\n";
-
- my $date=X509extractExpiryDate($crtname);
- my $serial=X509extractSerialNumber($crtname);
-
- setUsersLanguage($row{memid});
-
- my %user=getUserData($row{memid});
-
- foreach (sort keys %user)
- {
- SysLog " $_ -> $user{$_}\n" if($debug);
- }
-
- SysLog("update `$table` set `crt_name`='$crtname', modified=now(), serial='$serial', `expire`='$date' where `id`='".$row{'id'}."'\n");
-
- $dbh->do("update `$table` set `crt_name`='$crtname', modified=now(), serial='$serial', `expire`='$date' where `id`='".$row{'id'}."'");
-
- my $body = _("Hi")." $user{fname},\n\n";
- $body .= sprintf(_("You can collect your certificate for %s by going to the following location:")."\n\n", $row{'email'});
- $body .= "https://www.cacert.org/account.php?id=".($server?"15":"6")."&cert=$row{id}\n\n";
- $body .= _("If you havent imported CAcert´s root certificate, please go to:")."\n";
- $body .= "https://www.cacert.org/index.php?id=3\n";
- $body .= "Root cert fingerprint = A6:1B:37:5E:39:0D:9C:36:54:EE:BD:20:31:46:1F:6B\n";
- $body .= "Root cert fingerprint = 135C EC36 F49C B8E9 3B1A B270 CD80 8846 76CE 8F33\n\n";
- $body .= _("Best regards")."\n"._("CAcert.org Support!")."\n\n";
- sendmail($user{email}, "[CAcert.org] "._("Your certificate"), $body, "support\@cacert.org", "", "", "CAcert Support");
- } else {
- $dbh->do("delete from `$table` where `id`='".$row{'id'}."'");
- }
- }
-}
-
-sub HandleNewCRL($$)
-{
- my ($crl,$crlname)=@_;
- if(length($crl))
- {
- if($crl=~m/^\%XD/)
- {
- writefile("$crlname.patch",$crl);
- system "xdelta patch $crlname.patch $crlname $crlname.tmp";
- }
- elsif($crl=~m/^-----BEGIN X509 CRL-----/)
- {
- writefile("$crlname.pem",$crl);
- system "$opensslbin crl -in $crlname.pem -outform der -out $crlname.tmp";
- }
- elsif($crl=~m/^\x30/)
- {
- writefile("$crlname.tmp",$crl);
- }
- else
- {
- Error "Unknown CRL format!".(substr($crl,0,5))."\n";
- }
- rename "$crlname.tmp","$crlname"; # Atomic move
- }
-}
-
-
-sub RevokeCerts($$)
-{
- my $org=$_[0]?"org":"";
- my $server=$_[1];
-
- my $table=$org.($server?"domaincerts":"emailcerts");
-
- my $sth = $dbh->prepare("select * from $table where revoked='1970-01-01 10:00:01'"); # WHICH TIMEZONE?
- $sth->execute();
- #$rowdata;
- while ( my $rowdata = $sth->fetchrow_hashref() )
- {
- my %row=%{$rowdata};
-
- my $csrname = "../csr/".$org.($server?"server-":"client-").$row{'id'}.".csr";
- my $crtname = "../crt/".$org.($server?"server-":"client-").$row{'id'}.".crt";
- my $crlname = $revokefile{$row{'rootcert'}};
-
- my $crt="";
-
-
- if(open(IN,"<$crtname"))
- {
- undef $/;
- my $content=<IN>;
- close IN;
- my $revokehash=sha1_hex(readfile($crlname));
-
- my $crl=Request($ver,2,1,$row{'rootcert'}-1,0,0,365,0,$content,"",$revokehash);
- HandleNewCRL($crl,$crlname);
-
- if(-s $crlname)
- {
- setUsersLanguage($row{memid});
-
- my %user=getUserData($row{memid});
-
- $dbh->do("update `$table` set `revoked`=now() where `id`='".$row{'id'}."'");
-
- my $body = _("Hi")." $user{fname},\n\n";
- $body .= sprintf(_("Your certificate for %s has been revoked, as per request.")."\n\n", $row{'CN'});
- $body .= _("Best regards")."\n"._("CAcert.org Support!")."\n\n";
- sendmail($user{email}, "[CAcert.org] "._("Your certificate"), $body, "support\@cacert.org", "", "", "CAcert Support");
- }
-
- }
- else
- {
- SysLog("Error: $crtname $!\n") if($debug);
- }
-
- }
-
-}
-
-
-
-
-
-sub HandleGPG()
-{
- my $sth = $dbh->prepare("select * from gpg where crt='' and csr!='' ");
- $sth->execute();
- my $rowdata;
- while ( $rowdata = $sth->fetchrow_hashref() )
- {
- my %row=%{$rowdata};
-
- my $csrname = "../csr/gpg-".$row{'id'}.".csr";
- my $crtname = "../crt/gpg-".$row{'id'}.".crt";
-
- SysLog "Opening $csrname\n";
-
- my $crt="";
-
- if(-s $csrname && open(IN,"<$csrname"))
- {
- undef $/;
- my $content=<IN>;
- close IN;
- SysLog "Read.\n";
- $crt=Request($ver,1,2,0,0,2,366,0,$content,"","");
- if(length($crt))
- {
- open OUT,">$crtname";
- print OUT $crt;
- close OUT;
- }
-
- }
- else
- {
- #Error("Error: $!\n");
- next;
- }
-
- if(-s $crtname)
- {
- SysLog "Opening $crtname\n";
- setUsersLanguage($row{memid});
-
- my $date=OpenPGPextractExpiryDate($crtname);
- my %user=getUserData($row{memid});
-
- $dbh->do("update `gpg` set `crt`='$crtname', issued=now(), `expire`='$date' where `id`='".$row{'id'}."'");
-
- my $body = _("Hi")." $user{fname},\n\n";
- $body .= sprintf(_("Your CAcert signed key for %s is available online at:")."\n\n", $row{'email'});
- $body .= "https://www.cacert.org/gpg.php?id=3&cert=$row{id}\n\n";
- $body .= _("To help improve the trust of CAcert in general, it's appreciated if you could also sign our key and upload it to a key server. Below is a copy of our primary key details:")."\n\n";
- $body .= "pub 1024D/65D0FD58 2003-07-11 CA Cert Signing Authority (Root CA) <gpg\@cacert.org>\n";
- $body .= "Key fingerprint = A31D 4F81 EF4E BD07 B456 FA04 D2BB 0D01 65D0 FD58\n\n";
- $body .= _("Best regards")."\n"._("CAcert.org Support!")."\n\n";
- sendmail($user{email}, "[CAcert.org] Your GPG/PGP Key", $body, "support\@cacert.org", "", "", "CAcert Support");
- } else {
- $dbh->do("delete from `gpg` where `id`='".$row{'id'}."'");
- }
- }
-}
-
-
-# Main program loop
-
-while(1)
-{
- SysLog("Handling GPG database ...\n");
-# HandleGPG();
- SysLog("Issueing certs ...\n");
-# HandleCerts(0,0); #personal client certs
-# HandleCerts(0,1); #personal server certs
-# HandleCerts(1,0); #org client certs
-# HandleCerts(1,1); #org server certs
-# SysLog("Revoking certs ...\n");
-# RevokeCerts(0,0); #personal client certs
-# RevokeCerts(0,1); #personal server certs
-# RevokeCerts(1,0); #org client certs
-# RevokeCerts(1,1); #org server certs
-
- #print "Sign Request X.509, Root0\n";
- #my $reqcontent="";
- #Request($ver,1,1,0,5,2,365,0,$reqcontent,"","/CN=supertest.cacert.at");
-
- SysLog("NUL Request:\n");
- my $timestamp=strftime("%m%d%H%M%Y.%S",gmtime);
- my $ret=Request($ver,0,0,0,0,0,0,0,$timestamp,"","");
- print "RET: $ret\n";
-
- SysLog("Generate regular CRLs:\n");
- foreach my $root ((1,2))
- {
- my $crlname = $revokefile{$root};
- my $revokehash=sha1_hex(readfile($crlname));
- print "Aktueller Hash am Webserver: $revokehash\n";
- my $crl=Request($ver,2,1,$root-1,0,0,365,0,"","",$revokehash);
- HandleNewCRL($crl,$crlname);
- }
-
- usleep(700000);
-}
diff --git a/cgi-bin/siteseal.cgi b/cgi-bin/siteseal.cgi
deleted file mode 100755
index ac28697..0000000
--- a/cgi-bin/siteseal.cgi
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/php -q
-<?
-/**
- * check site seal
- *
- * @package org.cacert.framework
- * @author Duane Groth <duane@groth.net>
- * @copyright Copyright (C) 2003-2008, {@link http://www.cacert.org/ CAcert Inc.}
- * @license GPL Version 2
- * @version $Id: siteseal.cgi,v 1.4 2008-04-06 19:44:25 root Exp $
- */
-
-if($_SERVER["HTTPS"] == "on")
- $http = "https";
-else
- $http = "http";
-
-/* obfuscate var names */
-srand((double)microtime()*1000000);
-$var1 = "ca1-".md5(rand(0,9999999));
-$var2 = "ca2-".md5(rand(0,9999999));
-$var3 = "ca3-".md5(rand(0,9999999));
-$var4 = "ca4-".md5(rand(0,9999999));
-$var5 = "ca5-".md5(rand(0,9999999));
-$var6 = "ca6-".md5(rand(0,9999999));
-$var7 = "ca7-".md5(rand(0,9999999));
-$var8 = "ca8-".md5(rand(0,9999999));
-$var9 = "ca9-".md5(rand(0,9999999));
-$var10 = "caa-".md5(rand(0,9999999));
-$var11 = "cab-".md5(rand(0,9999999));
-
-header("Content-Type: text/javascript");
-header("Content-Disposition: inline; filename=\"siteseal.js\"");
-
-?>
-
-var <?=$var1?> = window.location.href;
-<? // var <?=$var2?> = '<?=$http?>://www.cacert.org/certdetails.php?referer=' + <?=$var1?>; ?>
-var <?=$var2?> = '<?=$http?>://www.cacert.org';
-var <?=$var3?> = (new Date()).getTimezoneOffset();
-
-var <?=$var4?> = navigator.userAgent.toLowerCase();
-var <?=$var5?> = false;
-if (<?=$var4?>.indexOf("msid") != 1) {
- <?=$var5?> = (<?=$var4?>.indexOf("msie 5") == -1 && <?=$var4?>.indexOf("msie 6") == -1);
-}
-
-function <?=$var6?>(e) {
- if (document.addEventListener) {
- if (e.target.name == '<?=$var7?>') {
- <?=$var8?>();
- return false;
- }
- } else if (document.captureEvents) {
- if (e.target.toString().indexOf('certdetails') != -1) {
- <?=$var8?>();
- return false;
- }
- }
- return true;
-}
-
-function <?=$var9?>() {
- if (event.button == 1) {
- if (<?=$var5?>) {
- return true;
- } else {
- <?=$var8?>();
- return false;
- }
- } else if (event.button == 2) {
- <?=$var8?>();
- return false;
- }
-}
-
-function <?=$var8?>() {
- cacertWindow = window.open(<?=$var2?>, '<?=$var10?>', config='height=420,width=523,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=yes');
- cacertWindow.focus();
-}
-
-if (document.addEventListener) {
- document.addEventListener('mouseup', <?=$var6?>, true);
-} else {
- if (document.layers) {
- document.captureEvents(Event.MOUSEDOWN);
- document.onmousedown=<?=$var6?>;
- }
-}
-
-document.write("<a href='" + <?=$var2?> + "' target='<?=$var10?>' tabindex='-1' onmousedown='<?=$var9?>(); return false;'><img name='<?=$var7?>' border='0' src='<?=$http?>://www.cacert.org/sealgen.php?cert=<?=$cert?>&referer=" + <?=$var1?> + "' alt='Click to verify' oncontextmenu='return false;' /></a>"); ?>
-
diff --git a/includes/account.php b/includes/account.php
index 6dacf2d..843dbe6 100644
--- a/includes/account.php
+++ b/includes/account.php
@@ -1275,10 +1275,7 @@ function buildSubjectFromSession() {
if($oldid == 13 && $process != "")
{
- $ddquery = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $ddres = mysql_query($ddquery);
- $ddrow = mysql_fetch_assoc($ddres);
- $_SESSION['profile']['points'] = $ddrow['total'];
+ update_points_in_profile();
if($_SESSION['profile']['points'] == 0)
{
@@ -1337,10 +1334,7 @@ function buildSubjectFromSession() {
$_SESSION['profile'] = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($_SESSION['profile']['id'])."'"));
$_SESSION['profile']['loggedin'] = 1;
- $ddquery = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $ddres = mysql_query($ddquery);
- $ddrow = mysql_fetch_assoc($ddres);
- $_SESSION['profile']['points'] = $ddrow['total'];
+ update_points_in_profile();
$id = 13;
diff --git a/includes/general.php b/includes/general.php
index 17b449b..889b8d8 100644
--- a/includes/general.php
+++ b/includes/general.php
@@ -47,8 +47,7 @@
if(array_key_exists('HTTP_HOST',$_SERVER) &&
$_SERVER['HTTP_HOST'] != $_SESSION['_config']['normalhostname'] &&
$_SERVER['HTTP_HOST'] != $_SESSION['_config']['securehostname'] &&
- $_SERVER['HTTP_HOST'] != $_SESSION['_config']['tverify'] &&
- $_SERVER['HTTP_HOST'] != "stamp.cacert.org")
+ $_SERVER['HTTP_HOST'] != $_SESSION['_config']['tverify'])
{
if(array_key_exists('HTTPS',$_SERVER) && $_SERVER['HTTPS'] == "on")
header("location: https://".$_SESSION['_config']['normalhostname']);
@@ -82,10 +81,7 @@
$locked = mysql_fetch_assoc(mysql_query("select `locked` from `users` where `id`='".intval($_SESSION['profile']['id'])."'"));
if($locked['locked'] == 0)
{
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
} else {
$_SESSION['profile'] = "";
unset($_SESSION['profile']);
@@ -477,9 +473,7 @@
if($id <= 0)
$id = $_SESSION['profile']['id'];
- $query = "select sum(`points`) as `points` from `notary` where `to`='$id' and `deleted` = 0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
+ $points = get_received_total_points($id);
$dob = date("Y-m-d", mktime(0,0,0,date("m"),date("d"),date("Y")-18));
$query = "select * from `users` where `id`='".intval($_SESSION['profile']['id'])."' and `dob` < '$dob'";
diff --git a/includes/lib/account.php b/includes/lib/account.php
index dd8afd3..6e17dda 100644
--- a/includes/lib/account.php
+++ b/includes/lib/account.php
@@ -48,8 +48,8 @@ function fix_assurer_flag($userID = NULL)
AND `cp`.`user_id` = `u`.`id`
)
AND (
- SELECT SUM(`points`) FROM `notary` AS `n`
- WHERE `n`.`to` = `u`.`id`
+ SELECT SUM(`awarded`) FROM `notary` AS `n`
+ WHERE `n`.`to` = `u`.`id` AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND (`n`.`expire` > now()
OR `n`.`expire` IS NULL)
AND `n`.`deleted` = 0
@@ -81,8 +81,8 @@ function fix_assurer_flag($userID = NULL)
AND `cp`.`user_id` = `u`.`id`
)
OR (
- SELECT SUM(`points`) FROM `notary` AS `n`
- WHERE `n`.`to` = `u`.`id`
+ SELECT SUM(`awarded`) FROM `notary` AS `n`
+ WHERE `n`.`to` = `u`.`id` AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND (
`n`.`expire` > now()
OR `n`.`expire` IS NULL
diff --git a/includes/loggedin.php b/includes/loggedin.php
index c14f8c2..8a1dab3 100644
--- a/includes/loggedin.php
+++ b/includes/loggedin.php
@@ -102,12 +102,9 @@
if($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname'] && $_SESSION['profile']['id'] > 0 && $_SESSION['profile']['loggedin'] > 0)
{
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
- if($_SESSION['profile']['language'] == "")
+ If($_SESSION['profile']['language'] == "")
{
$query = "update `users` set `language`='".L10n::get_translation()."'
where `id`='".intval($_SESSION['profile']['id'])."'";
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index 3b8e736..954029b 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -322,6 +322,63 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$rank_of_assuree = get_top_assuree_position($num_of_assurees);
}
+ /**
+ * Helper function to sum all assurance points received by the user
+ * @param int $userid
+ */
+ function get_received_assurance_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_points;
+ }
+
+ /**
+ * Helper function to sum all assurance points received by the user
+ * @param int $userid
+ */
+ function get_received_experience_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_experience;
+ }
+
+ /**
+ * Helper function to sum all points received by the user
+ * @param int $userid
+ */
+ function get_received_total_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_experience + $sum_points;
+ }
+
+ /**
+ * Updates the assurance points in $_SESSION['profile']
+ */
+ function update_points_in_profile(){
+ $_SESSION['profile']['points'] = get_received_total_points($_SESSION['profile']['id']);
+ }
// ************* html table definitions ******************
@@ -585,7 +642,7 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$log)
{
$sum_points = 0;
- $sumexperience = 0;
+ $sum_experience = 0;
$res = get_given_assurances(intval($userid), $log);
while($row = mysql_fetch_assoc($res))
{
@@ -615,7 +672,7 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$log)
{
$sum_points = 0;
- $sumexperience = 0;
+ $sum_experience = 0;
$res = get_received_assurances(intval($userid), $log);
while($row = mysql_fetch_assoc($res))
{
diff --git a/pages/account/55.php b/pages/account/55.php
index 24cc86d..1f01771 100644
--- a/pages/account/55.php
+++ b/pages/account/55.php
@@ -90,10 +90,11 @@
$query = '
SELECT `u`.`id`,
`u`.`assurer`,
- SUM(`points`)
+ SUM(`awarded`)
FROM `users` AS `u`,
`notary` AS `n`
WHERE `u`.`id` = \''.intval($_SESSION['profile']['id']).'\'
+ AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND `n`.`to` = `u`.`id`
AND `expire` < NOW()
AND `n`.`deleted` = 0
diff --git a/pages/wot/1.php b/pages/wot/1.php
index 9047f27..df6b3c3 100644
--- a/pages/wot/1.php
+++ b/pages/wot/1.php
@@ -92,7 +92,8 @@
$query = "select *, `users`.`id` as `id` from `users`,`notary` where `listme`='1' and
`ccid`='".$ccid."' and `regid`='".$regid."' and
`locid`='".$locid."' and `users`.`id`=`notary`.`to` and `notary`.`deleted`=0
- group by `notary`.`to` HAVING SUM(`points`) >= 100 order by `points` desc";
+ AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to`
+ group by `notary`.`to` HAVING SUM(`awarded`) >= 100 order by `points` desc";
$list = mysql_query($query);
if(mysql_num_rows($list) > 0)
{
diff --git a/pages/wot/9.php b/pages/wot/9.php
index 20f2c6d..f68cc16 100644
--- a/pages/wot/9.php
+++ b/pages/wot/9.php
@@ -27,8 +27,7 @@
$user = mysql_fetch_array($res);
$userlang = L10n::normalise_translation($user['language']);
- $points = mysql_num_rows(mysql_query("select sum(`points`) as `total` from `notary`
- where `to`='".intval($user['id'])."' and `deleted`=0 group by `to` HAVING SUM(`points`) > 0"));
+ $points = get_received_total_points(intval($user['id']));
if($points <= 0) {
echo _("Sorry, I was unable to locate that user.");
} else {
diff --git a/scripts/cron/refresh_stats.php b/scripts/cron/refresh_stats.php
index 3b446ba..2d6b2de 100755
--- a/scripts/cron/refresh_stats.php
+++ b/scripts/cron/refresh_stats.php
@@ -122,24 +122,24 @@ function getDataFromLive() {
$stats['users_1to49'] = number_format(tc(
"select count(*) as `count` from (
select 1 from `notary`
- where `deleted` = 0
+ where `deleted` = 0 AND `method` != 'Administrative Increase' AND `from` != `to`
group by `to`
- having sum(`points`) > 0 and sum(`points`) < 50
+ having sum(`awarded`) > 0 and sum(`awarded`) < 50
) as `low_points`"));
$stats['users_50to99'] = number_format(tc(
"select count(*) as `count` from (
select 1 from `notary`
- where `deleted` = 0
+ where `deleted` = 0 AND `method` != 'Administrative Increase' AND `from` != `to`
group by `to`
- having sum(`points`) >= 50 and sum(`points`) < 100
+ having sum(`awarded`) >= 50 and sum(`awarded`) < 100
) as `high_points`"));
$stats['assurer_candidates'] = number_format(tc(
"select count(*) as `count` from `users`
where (
- select sum(`points`) from `notary`
- where `to`=`users`.`id`
+ select sum(`awarded`) from `notary`
+ where `to`=`users`.`id` AND `method` != 'Administrative Increase' AND `from` != `to`
and `deleted` = 0
) >= 100
and not exists(
@@ -153,8 +153,8 @@ function getDataFromLive() {
$stats['aussurers_with_test'] = number_format(tc(
"select count(*) as `count` from `users`
where (
- select sum(`points`) from `notary`
- where `to`=`users`.`id`
+ select sum(`awarded`) from `notary`
+ where `to`=`users`.`id` AND `method` != 'Administrative Increase' AND `from` != `to`
and `deleted` = 0
) >= 100
and exists(
@@ -194,7 +194,7 @@ function getDataFromLive() {
where `when` >= '$first' and `when` < '$next_month'
and `method`!='Administrative Increase'
and `deleted` = 0
- group by `to` having sum(`points`) >= 100
+ group by `to` having sum(`awarded`) >= 100
) as `assurer_candidates`");
$certs = tc(
@@ -257,7 +257,7 @@ function getDataFromLive() {
where `when` >= '$first' and `when` < '$next_year'
and `method`!='Administrative Increase'
and `deleted` = 0
- group by `to` having sum(`points`) >= 100
+ group by `to` having sum(`awarded`) >= 100
) as `assurer_candidates`");
$certs = tc(
diff --git a/stamp/.htaccess b/stamp/.htaccess
deleted file mode 100644
index 3ad2abb..0000000
--- a/stamp/.htaccess
+++ /dev/null
@@ -1,5 +0,0 @@
-php_value auto_prepend_file /www/stamp/common.php
-php_value output_buffering 1
-errordocument 404 /error404.php
-errordocument 403 /error403.php
-errordocument 401 /error401.php
diff --git a/stamp/certdet.php b/stamp/certdet.php
deleted file mode 100644
index a43d2a0..0000000
--- a/stamp/certdet.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<? /*
- 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
-*/
- $org = $invalid = 0;
- $tz = intval($_REQUEST['tz']);
- $now = date("Y-m-d", gmmktime("U") + ($tz * 3600));
-
- $arr = explode("//", mysql_real_escape_string(trim($_REQUEST['refer'])), 2);
- $arr = explode("/", $arr['1'], 2);
- $ref = $arr['0'];
-
- $arr = explode("//", mysql_real_escape_string(trim($_SERVER['HTTP_REFERER'])), 2);
- $arr = explode("/", $arr['1'], 2);
- $siteref = $arr['0'];
-
- if($siteref != "")
- $siterefer = $_SERVER['HTTP_REFERER'];
- else
- $siterefer = $_REQUEST['refer'];
-
- if($ref == "" || ($ref != $siteref && $siteref != ""))
- {
- $invalid = 2;
- } else {
- if($_SESSION['_stamp']['ref'] == "")
- $_SESSION['_stamp']['ref'] = $siterefer;
- list($invalid, $info) = checkhostname($ref);
- }
-?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>CAcert.org Certificate Details!</title>
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body>
- <div id="pagecell1">
- <div id="pageName"><br>
- <h2><a href="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org">
- <img src="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org/images/cacert3.png" border="0" alt="CAcert.org logo"></a></h2>
-<? if($_SERVER['HTTPS']!="on") { ?>
-<div id="googlead"><br><script type="text/javascript"><!--
-google_ad_client = "pub-0959373285729680";
-google_alternate_color = "ffffff";
-google_ad_width = 234;
-google_ad_height = 60;
-google_ad_format = "234x60_as";
-google_ad_type = "text";
-google_ad_channel = "";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>
-<? } ?>
- </div>
- <div id="content">
- <div class="story">
- <h3>SSL Certificate Details for <?=$ref?></h3>
-<? if($invalid == 0) { ?>
- <p>
- Status: Valid<br />
- Valid From: <?=$info['issued']?> GMT<br />
- Valid To: <?=$info['expire']?> GMT<br />
- Subject: <a href="#" title="<?=$info['subject']?>" onClick="return false;"><?=substr($info['subject'],0,80)?></a><br />
- Organisation: <? if($info['org'] == 0) { ?>N/A<? } else { echo $info['O'].", ".$info['L']." ".$info['ST']." ".$info['C']; } ?><br />
- Verification: <? if($info['points'] >= 50) { echo "Person had been assured at time of issue with at least 50 points."; }
- else if($info['org'] == 1) { ?>This organisation was assured at the time the certificate was issued.<? } ?></p>
-<? } else { ?>
- <p style="color:red">This site has potentially abused CAcert logos and Copyrights, please report it so we may further investigate.</p>
-<? } ?>
- <p><a href="report.php">Problem with this site? Please report it</a></p>
- </div>
- </div>
-</body>
-</html>
diff --git a/stamp/common.php b/stamp/common.php
deleted file mode 100644
index d99a23a..0000000
--- a/stamp/common.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<? /*
- 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
-*/
-
- include_once("/www/includes/general.php");
-
- function clean($key)
- {
- return(mysql_real_escape_string(strip_tags(trim($_REQUEST[$key]))));
- }
-
- function checkhostname($ref)
- {
- $ref = trim($ref);
- if($ref[count($ref)-1] == "." || $ref[count($ref)-1] == ":")
- $ref = substr($ref, 0, -1);
-
- $stampid = 0;
- $query = "select * from `stampcache` where `hostname`='$ref'";
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $row = mysql_fetch_assoc($res);
- if($row['cacheexpire'] >= date("U"))
- return(array($row['valid'], $row));
- else {
- if($row['certid'] > 0)
- {
- if($row['org'] == 0)
- $query = "select * from `domaincerts` where `id`='".intval($row['certid'])."' and `expire`>NOW() and `revoked`=0";
- else
- $query = "select * from `orgdomaincerts` where `id`='".intval($row['certid'])."' and `expire`>NOW() and `revoked`=0";
- if($_REQUEST['debug'] == 1)
- echo $query."<br>\n";
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $query = "update `stampcache` set `cacheexpire`='".(date("U")+600)."' where `id`='$row[id]'";
- if($_REQUEST['debug'] == 1)
- echo $query."<br>\n";
- mysql_query($query);
- return(array($row['valid'], $row));
- }
- }
- $stampid = $row['id'];
- }
- }
-
- $query = "select *,`domaincerts`.`id` as `certid`,`domaincerts`.`created` as `issued` from `domlink`,`domains`,`domaincerts`
- where `domlink`.`domid`=`domains`.`id` and `domlink`.`certid`=`domaincerts`.`id` and
- `domaincerts`.`revoked`=0 and `domaincerts`.`expire` > NOW() and
- (`domaincerts`.`subject` like '%=DNS:$ref/%' OR `domaincerts`.`subject` like '%=$ref/%' OR
- `domaincerts`.`subject` like '%=DNS:$ref' OR `domaincerts`.`subject` like '%=$ref')
- group by `domaincerts`.`id` order by `domaincerts`.`id`";
- if($_REQUEST['debug'] == 1)
- echo $query."<br>\n";
- $res = mysql_query($query);
- if(mysql_num_rows($res) <= 0)
- {
- $bits = explode(".", $ref);
- for($i = 1; $i < count($bits); $i++)
- {
- if($ref2 != "")
- $ref2 .= ".";
- $ref2 .= $bits[$i];
- }
- $query = "select *,`domaincerts`.`id` as `certid`,`domaincerts`.`created` as `issued` from `domlink`,`domains`,`domaincerts`
- where `domlink`.`domid`=`domains`.`id` and `domlink`.`certid`=`domaincerts`.`id` and
- `domaincerts`.`revoked`=0 and `domaincerts`.`expire` > NOW() and
- (`domaincerts`.`subject` like '%=DNS:$ref/%' or `domaincerts`.`subject` like '%=DNS:*.$ref2/%' OR
- `domaincerts`.`subject` like '%=DNS:$ref' or `domaincerts`.`subject` like '%=DNS:*.$ref2' OR
- `domaincerts`.`subject` like '%=$ref/%' or `domaincerts`.`subject` like '%=*.$ref2/%' OR
- `domaincerts`.`subject` like '%=$ref' or `domaincerts`.`subject` like '%=*.$ref2')
- group by `domaincerts`.`id` order by `domaincerts`.`id`";
- if($_REQUEST['debug'] == 1)
- echo $query."<br>\n";
- $res = mysql_query($query);
- if(mysql_num_rows($res) <= 0)
- {
- $query = "select *,`orgdomaincerts`.`id` as `certid`,`orgdomaincerts`.`created` as `issued` from `orgdomaincerts`,`orgdomlink`,`orgdomains` where
- (`orgdomaincerts`.`subject` like '%=DNS:$ref/%' or `orgdomaincerts`.`subject` like '%=DNS:*.$ref2/%' OR
- `orgdomaincerts`.`subject` like '%=DNS:$ref' or `orgdomaincerts`.`subject` like '%=DNS:*.$ref2' OR
- `orgdomaincerts`.`subject` like '%=$ref/%' or `orgdomaincerts`.`subject` like '%=*.$ref2/%' OR
- `orgdomaincerts`.`subject` like '%=$ref' or `orgdomaincerts`.`subject` like '%=*.$ref2') AND
- `orgdomaincerts`.`id`=`orgdomlink`.`orgcertid` and `orgdomlink`.`orgdomid`=`orgdomains`.`id` and
- `orgdomaincerts`.`revoked`=0 and `orgdomaincerts`.`expire` > NOW()
- group by `orgdomaincerts`.`id` order by `orgdomaincerts`.`id`";
- if($_REQUEST['debug'] == 1)
- echo $query."<br>\n";
- $res = mysql_query($query);
- if(mysql_num_rows($res) <= 0)
- {
- $invalid = 1;
- } else {
- $org = 1;
- }
- }
- }
-
- if($invalid == 0)
- {
- $cert = mysql_fetch_assoc($res);
- if($org == 0)
- {
- $query = "SELECT *, sum(`points`) AS `total` FROM `users`, `notary` WHERE `users`.`id` = '$cert[memid]' AND
- `notary`.`to` = `users`.`id` and `notary`.`when` <= '$cert[issued]' and `notary`.`deleted`=0 GROUP BY `notary`.`to`";
- $user = mysql_fetch_assoc(mysql_query($query));
- } else {
- $query = "select * from `orginfo` where `id`='$cert[orgid]'";
- $orgi = mysql_fetch_assoc(mysql_query($query));
- }
-
- if($stampid <= 0)
- {
- $query = "insert into `stampcache` set `certid`='$cert[certid]',`cacheexpire`='".(date("U")+600)."',`issued`='$cert[issued]',
- `expire`='$cert[expire]',`subject`='$cert[subject]',`hostname`='$ref',`org`='$org',`points`='$user[total]',
- `O`='$orgi[O]',`L`='$orgi[L]',`ST`='$orgi[ST]',`C`='$orgi[C]',`valid`='$invalid'";
- } else {
- $query = "update `stampcache` set `certid`='$cert[certid]',`cacheexpire`='".(date("U")+600)."',`issued`='$cert[issued]',
- `expire`='$cert[expire]',`subject`='$cert[subject]',`hostname`='$ref',`org`='$org',`points`='$user[total]',
- `O`='$orgi[O]',`L`='$orgi[L]',`ST`='$orgi[ST]',`C`='$orgi[C]',`valid`='$invalid' where `id`='$stampid'";
- }
- mysql_query($query);
- } else if($stampid > 0) {
- mysql_query("update `stampcache` set `cacheexpire`='".(date("U")+600)."' where `id`='$stampid'");
- } else {
- $query = "insert into `stampcache` set `cacheexpire`='".(date("U")+600)."',`hostname`='$ref',`valid`='$invalid'";
- mysql_query($query);
- }
-
- $arr = array("issued" => $cert['issued'], "expire" => $cert['expire'], "subject" => $cert['subject'], "hostname" => $ref,
- "org" => $org, "points" => $user['total'], "O" => $orgi['O'], "L" => $orgi['L'], "ST" => $orgi['ST'],
- "C" => $orgi['C']);
-
- return(array($invalid, $arr));
- }
-?>
diff --git a/stamp/displogo.php b/stamp/displogo.php
deleted file mode 100644
index 9c1f534..0000000
--- a/stamp/displogo.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<? /*
- 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
-*/
- $img = "/www/stamp/images/CAverify.png";
- $arr = explode("//", mysql_real_escape_string(trim($_REQUEST['refer'])), 2);
- $arr = explode("/", $arr['1'], 2);
- $ref = $arr['0'];
-
- $arr = explode("//", mysql_real_escape_string(trim($_SERVER['HTTP_REFERER'])), 2);
- $arr = explode("/", $arr['1'], 2);
- $siteref = $arr['0'];
-
- if($_REQUEST['debug'] != 1)
- header('Content-type: image/png');
- $im = imagecreatefrompng($img);
-
- if($ref == "" || ($ref != $siteref && $siteref != ""))
- {
- $tc = imagecolorallocate ($im, 255, 0, 0);
- imagestring ($im, 2, 1, 30, "INVALID DOMAIN", $tc);
- imagestring ($im, 2, 1, 45, "Click to Report", $tc);
- imagepng($im);
- exit;
- }
-
- list($invalid, $info) = checkhostname($ref);
-
- if($invalid > 0)
- {
- $tc = imagecolorallocate ($im, 255, 0, 0);
- imagestring ($im, 2, 1, 30, "INVALID DOMAIN", $tc);
- imagestring ($im, 2, 1, 45, "Click to Report", $tc);
- imagepng($im);
- exit;
- }
-
- $tz = intval($_REQUEST['tz']);
- $now = date("Y-m-d", gmmktime("U") + ($tz * 3600));
-
- $tc = imagecolorallocate ($im, 0, 0, 0);
- imagestring ($im, 4, 1, 27, "Valid Cert!", $tc);
- imagestring ($im, 1, 7, 42, "Click to Verify", $tc);
- imagestring ($im, 1, 20, 52, $now, $tc);
- imagepng($im);
-?>
diff --git a/stamp/images/CAverify.png b/stamp/images/CAverify.png
deleted file mode 100644
index ab5c1ea..0000000
--- a/stamp/images/CAverify.png
+++ /dev/null
Binary files differ
diff --git a/stamp/index.php b/stamp/index.php
deleted file mode 100644
index 81a88db..0000000
--- a/stamp/index.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<? /*
- 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
-*/ ?>
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>CAcert.org Site Stamp DISCONTINUED!</title>
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body>
- <div id="pagecell1">
- <div id="pageName"><br>
- <h2><a href="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org">
- <img src="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org/images/cacert3.png" border="0" alt="CAcert.org logo"></a></h2>
-<? if($_SERVER['HTTPS']!="on") { ?>
-<div id="googlead"><br><script type="text/javascript"><!--
-google_ad_client = "pub-0959373285729680";
-google_alternate_color = "ffffff";
-google_ad_width = 234;
-google_ad_height = 60;
-google_ad_format = "234x60_as";
-google_ad_type = "text";
-google_ad_channel = "";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>
-<? } ?>
- </div>
- <div id="content">
- <div class="story">
- <h3>CAcert.org Site Stamp DISCONTINUED!</h3>
-
- The CAcert Site Stamp service is currently being discontinued. Please remove the stamps from your website.
- <!--
- <p>The CAcert Site Stamp Programme is a very useful tool for site owners everywhere, it allows you yet another option to prevent people
- from stealing your content or making a fake site to pretend to be your site to carry out a phishing attack against your customers.</p>
- <p>To add the CAcert logo to your site you need to register for a <a href="https://www.cacert.org">CAcert</a> server certificate, then add the
- following line somewhere on your website:</p>
- <p>&lt;script type="text/javascript"&gt;<br />
- &lt;!- -<br />
- document.write('&lt;');<br />
- document.write('script type="text/javascript" src="'+location.protocol+'//stamp.cacert.org/showlogo.php"&gt;&lt;');<br />
- document.write('/script&gt;');<br />
- // - -&gt;<br />
- &lt;/script&gt;</p>
- < s c ript type="text/javascript">
- < ! -<? ?> -
- document.write('<');
- document.write('script type="text/javascript" src="'+location.protocol+'//stamp.cacert.org/showlogo.php"><');
- document.write('/script>');
- //- ->
- </script>
- <br /><br /><br /><br />
- -->
- </div>
-
- </div>
- </div>
-</body>
-</html>
diff --git a/stamp/old_showlogo.php.broken b/stamp/old_showlogo.php.broken
deleted file mode 100644
index 7f9045c..0000000
--- a/stamp/old_showlogo.php.broken
+++ /dev/null
@@ -1,25 +0,0 @@
-try
-{
- var URI = location.protocol+'//stamp.cacert.org';
- var URL = encodeURIComponent(URI);
- var curDateTime = new Date();
- var tz = -(curDateTime.getTimezoneOffset()/60);
- var rf = encodeURIComponent(parent==self ? window.document.referrer : top.document.referrer);
- var ul = encodeURIComponent(navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage);
- if(typeof(screen)=="object")
- {
- var sr = encodeURIComponent(screen.width+","+screen.height);
- var cd = encodeURIComponent(screen.colorDepth);
- var jo = encodeURIComponent(navigator.javaEnabled()?"Yes":"No");
- }
-
- document.write("<script type='text/javascript'>function popup() { ");
- document.write("window.open('"+URI+"/certdet.php?refer="+location.href+"&tz="+tz+"', 'CertInfo',");
- document.write("'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left=200,top=100'); } </script>");
- document.write("<a href='#' onClick='popup(); return false;'>");
- document.write("<img src='"+URI+"/displogo.php?refer="+location.href+"&tz="+tz+"&rf="+rf+"&ul="+ul+"&sr="+sr+"&cd="+cd+"&jo="+jo+"&URL="+URL+"' border='0' /></a>");
-}
-catch(e)
-{
- document.write("<img src='http://stamp.cacert.org/javascript_is_broken.php'/>");
-}
diff --git a/stamp/report.php b/stamp/report.php
deleted file mode 100644
index 519aa3a..0000000
--- a/stamp/report.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<? /*
- 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
-*/
- $arr = explode("//", mysql_real_escape_string(trim($_SESSION['_stamp']['ref'])), 2);
- $arr = explode("/", $arr['1'], 2);
- $ref = $arr['0'];
-
- $refer = mysql_real_escape_string(strip_tags(trim($_SESSION['_stamp']['ref'])));
- $name = clean('name');
- $email = clean('email');
- $comment = clean('comment');
- $reason = clean('reason');
- $process = clean('process');
-
- if($process != "" && ($_POST['pagehash'] != $_SESSION['_stamp']['pagehash'] || $_SESSION['_stamp']['pagehash'] == ""))
- {
- $errmsg = "Your report seemed to be posted is a suspicious manner, please try to re-submit it, or contact support for further help.";
- $process = "";
- }
-
- if($process != "" && ($name == "" || $email == "" || $comment == "" || $reason == ""))
- {
- $errmsg = "You must supply your name, a valid email address and comment.";
- $process = "";
- }
-
- if($process != "")
- {
- $checkemail = checkEmail($email);
- if($checkemail != "OK")
- {
- $errmsg = $checkemail;
- $process = "";
- }
- } else {
- $_SESSION['_stamp']['pagehash'] = $pagehash = md5(date("U").$ref);
- }
-
- if($process != "")
- {
- $IP = mysql_real_escape_string(trim($_SERVER['REMOTE_ADDR']));
- $iplong = ip2long($IP);
- mysql_query("insert into `abusereports` set `when`=NOW(), `IP`='$iplong', `url`='$refer', `name`='$name', `email`='$email',
- `comment`='$comment', `reason`='$reason'");
- $id = mysql_insert_id();
-
- $body = "New Abuse Report has been lodged via the the Stamp Interface:\n\n";
- $body .= "Reported ID: $id\n";
- $body .= "Reported IP: $IP\n";
- $body .= "From: $name <$email>\n";
- $body .= "URL: $refer\n";
- $body .= "Reason: $reason\n";
- $body .= "Comment: $comment\n";
-
- sendmail("cacert-abuse@lists.cacert.org", "[CAcert.org] Abuse Report.", $body, "website@cacert.org", "", "", "CAcert Website");
- }
-
-?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>CAcert.org Abuse Report!</title>
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body>
- <div id="pagecell1">
- <div id="pageName"><br>
- <h2><a href="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org">
- <img src="http<? if($_SERVER['HTTPS']=="on") { echo "s"; } ?>://www.cacert.org/images/cacert3.png" border="0" alt="CAcert.org logo"></a></h2>
-<? if($_SERVER['HTTPS']!="on") { ?>
-<div id="googlead"><br><script type="text/javascript"><!--
-google_ad_client = "pub-0959373285729680";
-google_alternate_color = "ffffff";
-google_ad_width = 234;
-google_ad_height = 60;
-google_ad_format = "234x60_as";
-google_ad_type = "text";
-google_ad_channel = "";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>
-<? } ?>
- </div>
- <div id="content">
- <div class="story">
- <h3>Report abuse for <?=$ref?></h3>
-<? if($process == "") { ?>
-<? if($errmsg != "") { ?><p style="color:red"><?=$errmsg?></p><? } else { ?><br /><? } ?>
- <form method="post" action="report.php">
- <label for="refer">URL: </label><input type="text" name="refer" value="<?=$refer?>" readonly="1" /><br />
- <label for="name">Name: </label><input type="text" name="name" value="<?=$name?>" /><br />
- <label for="email">Email: </label><input type="text" name="email" value="<?=$email?>" /><br />
- <label for="reason">Reason: </label><select name="reason">
- <option value='invalid'<? if($reason == "invalid") { echo " selected"; } ?>>Invalid Domain</option>
- <option value='phishing'<? if($reason == "phishing") { echo " selected"; } ?>>Phishing Site</option>
- <option value='spam'<? if($reason == "spam") { echo " selected"; } ?>>Spam</option>
- <option value='other'<? if($reason == "other") { echo " selected"; } ?>>Other</option>
- </select><br />
- <label for="comment">Comment/Other: </label><input type="text" name="comment" value="<?=$comment?>" /><br /><br />
- <label for="sub">&nbsp;</label><input type="submit" name="process" value="Report Site"><br />
- <input type="hidden" name="pagehash" value="<?=$pagehash?>">
- </form>
-<? } else { ?>
- <p>We thank you for your attention to detail, your report has been accepted and we will tend to your report as soon as humanly possible.</p>
-<? } ?>
- </div>
- </div>
-</body>
-</html>
diff --git a/stamp/showlogo.php b/stamp/showlogo.php
deleted file mode 100644
index e69de29..0000000
--- a/stamp/showlogo.php
+++ /dev/null
diff --git a/stamp/style.css b/stamp/style.css
deleted file mode 100644
index c00a4c7..0000000
--- a/stamp/style.css
+++ /dev/null
@@ -1,620 +0,0 @@
-/***********************************************/
-/* emx_nav_right.css */
-/* Use with template Halo_rightNav.html */
-/***********************************************/
-
-/***********************************************/
-/* HTML tag styles */
-/***********************************************/
-body {
- font-family: Arial,sans-serif;
- color: #333333;
- line-height: 1.166;
- margin: 0px;
- padding: 0px;
- background: #cccccc;
-/* url("/siteimages/bg_grad.jpg") fixed; */
-}
-
-
-/******* hyperlink and anchor tag styles *******/
-
-a:link, a:visited {
- color: #005FA9;
- text-decoration: none;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-/************** header tag styles **************/
-
-h1 {
- font: bold 120% Arial,sans-serif;
- color: #334d55;
- margin: 0px;
- padding: 0px;
-}
-
-h2 {
- font: bold 114% Arial,sans-serif;
- color: #006699;
- margin: 0px;
- padding: 0px;
-}
-
-h3 {
- font: bold 100% Arial,sans-serif;
- color: #334d55;
- margin: 0px;
- padding: 0px;
- cursor: pointer;
- /* cursor: hand; */
-}
-
-h4 {
- font: bold 100% Arial,sans-serif;
- color: #333333;
- margin: 0px;
- padding: 0px;
-}
-
-h5 {
- font: 100% Arial,sans-serif;
- color: #334d55;
- margin: 0px;
- padding: 0px;
-}
-
-
-/*************** list tag styles ***************/
-
-ul.menu {
- list-style: none;
- margin :0px 0px 0px 15px;
- padding-left: 5px;
- border-left: 1px dotted #000;
-}
-
-ul.top {
- list-style: none;
- margin: 0px 0px 0px 15px;
- padding-left: 5px;
- border-left: 0px;
-}
-
-ul {
- list-style: none;
- margin: 0px 0px 0px 15px;
- padding-left: 5px;
- border-left: 1px dotted #000;
-}
-
-/***********************************************/
-/* Layout Divs */
-/***********************************************/
-#pagecell1 {
- position:absolute;
- top: 2%;
- left: 2%;
- right: 2%;
- width: 96%;
- background-color: #ffffff;
-}
-
-#tl {
- position:absolute;
- top: -1px;
- left: -1px;
- margin: 0px;
- padding: 0px;
- z-index: 100;
-}
-
-#tr {
- position:absolute;
- top: -1px;
- right: -1px;
- margin: 0px;
- padding: 0px;
- z-index: 100;
-}
-
-#masthead{
- position: absolute;
- top: 0px;
- left: 2%;
- right: 2%;
- width:95.6%;
-
-}
-
-#pageNav{
- float: right;
- width:178px;
- padding: 0px;
- background-color: #F5f7f7;
- border-left: 1px solid #cccccc;
- font: small Verdana,sans-serif;
-}
-
-#content{
- padding: 0px 10px 0px 0px;
- margin:0px 0px 0px 0px;
-}
-
-
-/***********************************************/
-/* Component Divs */
-/***********************************************/
-#siteName{
- margin: 0px;
- padding: 16px 0px 8px 0px;
- color: #ffffff;
- font-weight: normal;
-}
-
-/************** utility styles *****************/
-
-#utility{
- font: 75% Verdana,sans-serif;
- position: absolute;
- top: 16px;
- right: 0px;
- color: #919999;
-}
-
-#utility a{
- color: #ffffff;
-}
-
-#utility a:hover{
- text-decoration: underline;
-}
-
-/************** pageName styles ****************/
-
-#pageName{
- padding: 0px 0px 14px 10px;
- margin: 0px;
- border-bottom:1px solid #ccd2d2;
-}
-
-#pageName h2{
- font: bold 175% Arial,sans-serif;
- color: #000000;
- margin:0px;
- padding: 0px;
-}
-
-/************* globalNav styles ****************/
-
-#globalNav{
-position: relative;
-width: 100%;
-min-width: 640px;
-height: 32px;
-color: #cccccc;
-padding: 0px;
-margin: 0px;
-background-image: url("siteimages/glbnav_background.gif");
-}
-
-#globalNav img{
- margin-bottom: -4px;
-
-}
-
-#gnl {
- position: absolute;
- top: 0px;
- left:0px;
-}
-
-#gnr {
- position: absolute;
- top: 0px;
- right:0px;
-}
-
-#globalLink{
- position: absolute;
- top: 6px;
- height: 22px;
- min-width: 640px;
- padding: 0px;
- margin: 0px;
- left: 10px;
- z-index: 100;
-}
-
-
-a.glink, a.glink:visited{
- font-size: small;
- color: #000000;
- font-weight: bold;
- margin: 0px;
- padding: 2px 5px 4px 5px;
- border-right: 1px solid #8FB8BC;
-}
-
-a.glink:hover{
- background-image: url("siteimages/glblnav_selected.gif");
- text-decoration: none;
-}
-
-.skipLinks {display: none;}
-
-/************ subglobalNav styles **************/
-
-.subglobalNav{
- position: absolute;
- top: 84px;
- left: 0px;
- /*width: 100%;*/
- min-width: 640px;
- height: 20px;
- padding: 0px 0px 0px 10px;
- visibility: hidden;
- color: #ffffff;
-}
-
-.subglobalNav a:link, .subglobalNav a:visited {
- font-size: 80%;
- color: #ffffff;
-}
-
-.subglobalNav a:hover{
- color: #cccccc;
-}
-
-/*************** search styles *****************/
-/*
-#listshow {
- z-order: 101;
-}
-*/
-#search{
- position: absolute;
- top: 125px;
- right: 0px;
-}
-
-#search form {
- position: absolute;
- top: 125px;
- right: 300px;
-}
-#search input {
- font-size: 11px;
-}
-
-#search1{
- position: absolute;
- top: 85px;
- right: 300px;
-}
-
-#search2{
- position: absolute;
- top: 100px;
- right: 300px;
-}
-
-#search3{
- position: absolute;
- top: 85px;
- right: 240px;
-}
-
-#search4{
- position: absolute;
- top: 100px;
- right: 226px;
-}
-
-#googlead{
- position: absolute;
- top: 5px;
- right: 5px;
- z-index: 101;
-}
-
-#search input{
- font-size: 70%;
- margin: 0px 0px 0px 10px;
- }
-
-#search a:link, #search a:visited {
- font-size: 80%;
- font-weight: bold;
-
-}
-
-#search a:hover{
- margin: 0px;
-}
-
-
-/************* breadCrumb styles ***************/
-
-#breadCrumb{
- padding: 5px 0px 5px 10px;
- font: small Verdana,sans-serif;
- color: #AAAAAA;
-}
-
-#breadCrumb a{
- color: #AAAAAA;
-}
-
-#breadCrumb a:hover{
- color: #005FA9;
- text-decoration: underline;
-}
-
-
-/************** feature styles *****************/
-
-.feature{
- padding: 0px 0px 10px 10px;
- font-size: 80%;
- min-height: 200px;
- height: 200px;
-}
-html>body .feature {height: auto;}
-
-.feature h3{
- font: bold 175% Arial,sans-serif;
- color: #000000;
- padding: 30px 0px 5px 0px;
-}
-
-.feature img{
- float: left;
- padding: 0px 10px 0px 0px;
-}
-
-
-/*************** story styles ******************/
-
-.story {
- padding: 10px 0px 0px 10px;
- font-size: 80%;
- min-height: 272px;
-}
-
-.story h3{
- font: bold 125% Arial,sans-serif;
- color: #000000;
-}
-
-.story p {
- padding: 0px 0px 10px 0px;
-}
-
-.story a.capsule{
- font: bold 1em Arial,sans-serif;
- color: #005FA9;
- display:block;
- padding-bottom: 5px;
-}
-
-.story a.capsule:hover{
- text-decoration: underline;
-}
-
-td.storyLeft{
- padding-right: 12px;
-}
-
-
-/************** siteInfo styles ****************/
-
-#siteInfo{
- clear: both;
- border-top: 1px solid #cccccc;
- font-size: small;
- color: #cccccc;
- padding: 10px 10px 10px 10px;
-}
-
-/************ sectionLinks styles **************/
-
-#sectionLinks{
- margin: 0px;
- padding: 0px;
-
-}
-
-#sectionLinks h3{
- padding: 10px 0px 2px 10px;
- border-bottom: 1px solid #cccccc;
-}
-
-#sectionLinks a:link, #sectionLinks a:visited {
- display: block;
- border-top: 1px solid #ffffff;
- border-bottom: 1px solid #cccccc;
- background-image: url("siteimages/bg_nav.jpg");
- font-weight: bold;
- padding: 3px 0px 3px 10px;
- color: #21536A;
-}
-
-#sectionLinks a:hover{
- border-top: 1px solid #cccccc;
- background-color: #DDEEFF;
- background-image: none;
- font-weight: bold;
- text-decoration: none;
-}
-
-
-/************* relatedLinks styles **************/
-
-.relatedLinks{
- margin: 0px;
- padding: 0px 0px 10px 10px;
- border-bottom: 1px solid #cccccc;
-}
-
-.relatedLinks h3{
- padding: 10px 0px 2px 0px;
-}
-
-.relatedLinks a{
- display: block;
-}
-
-
-/**************** advert styles *****************/
-
-#advert{
- padding: 10px;
-}
-
-#advert img{
- display: block;
-}
-
-/********************* end **********************/
-
-.DataTD input, .DataTD textarea {
- FONT-SIZE: 92%;
-}
-
-.DataTD select, .DataTD option {
- FONT-SIZE: 92%;
-}
-
-.DataTD {
- background-color: #E2E2E2;
- border-style: inset;
- border-width: 1px;
- FONT-SIZE: 8pt;
- COLOR: #000000;
- FONT-FAMILY: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
- background: #ffffff;
- padding: 1px 5px 1px 5px;
- border: 1px #CFCFCF solid;
- border-left: 1px #CFCFCF dotted;
- border-right: 1px #CFCFCF dotted;
-}
-
-.DataTDGrey {
- background-color: #EFEDED;
- border-style: inset;
- border-width: 1px;
- FONT-SIZE: 8pt;
- COLOR: #000000;
- FONT-FAMILY: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
- padding: 1px 5px 1px 5px;
- border: 1px #CFCFCF solid;
- border-left: 1px #CFCFCF dotted;
- border-right: 1px #CFCFCF dotted;
-}
-
-.DataTDNotDotted {
- background-color: #E2E2E2;
- border-style: inset;
- border-width: 1px;
- FONT-SIZE: 8pt;
- COLOR: #000000;
- FONT-FAMILY: Arial, Tahoma, Verdana, Helvetica, sans-serif;
-
- background: #ffffff;
- padding: 1px 5px 1px 5px;
- border: 1px #CFCFCF solid;
- border-left: 1px #CFCFCF solid;
- border-right: 1px #CFCFCF solid;
-}
-
-.wrapper {
- border-collapse: collapse;
- font-family: verdana, sans-serif;
- font-size: 11px;
- text-align: center;
-}
-
-td.greytxt {
- color: #CCCCCC;
- font-size: smaller;
- text-align: right;
- vertical-align: bottom;
-}
-
-.title {
- background: #E2E2E2;
- font-weight:BOLD;
- padding: 1px 5px 1px 5px;
- border: 1px solid #CFCFCF;
- border-bottom: 3px double #CFCFCF;
- border-top: 1px solid #656565;
- text-align: center;
-}
-
-.errmsg {
- font-weight: BOLD;
- color: #FF0000;
-}
-
-.ac_menu
-{
- border:1px solid black
-}
-.ac_normal
-{
- background-color:#ffffff;
- cursor:pointer;
-}
-.ac_highlight
-{
- background-color:#3366cc;
- color:white;
- cursor:pointer;
-}
-.ac_normal .a
-{
- font-size:13px;
- color:black;
-}
-.ac_highlight .a
-{
- font-size:13px;
-}
-.ac_normal .d
-{
- float:right;
- font-size:10px;
- color:green;
-}
-.ac_highlight .d
-{
- float:right;
- font-size:10px;
-}
-
-br {
- clear: left;
-}
-
-label {
- font-size: 90%;
-}
-
-label,input,select {
- display: block;
- width: 250px;
- float: left;
- margin-bottom: 10px;
-}
-
-label {
- text-align: right;
- width: 75px;
- padding-right: 20px;
-}
diff --git a/www/api/ccsr.php b/www/api/ccsr.php
deleted file mode 100644
index 3bfe55a..0000000
--- a/www/api/ccsr.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<? /*
- 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 '../../includes/lib/check_weak_key.php';
-
- $username = mysql_real_escape_string($_REQUEST['username']);
- $password = mysql_real_escape_string($_REQUEST['password']);
-
- $query = "select * from `users` where `email`='$username' and (`password`=old_password('$password') or `password`=sha1('$password'))";
- $res = mysql_query($query);
- if(mysql_num_rows($res) != 1)
- die("403,That username couldn't be found\n");
- $user = mysql_fetch_assoc($res);
- $memid = $user['id'];
- $emails = array();
- foreach($_REQUEST['email'] as $email)
- {
- $email = mysql_real_escape_string(trim($email));
- $query = "select * from `email` where `memid`='".intval($memid)."' and `hash`='' and `deleted`=0 and `email`='$email'";
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $row = mysql_fetch_assoc($res);
- $id = $row['id'];
- $emails[$id] = $email;
- }
- }
- if(count($emails) <= 0)
- die("404,Wasn't able to match any emails sent against your account");
- $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `notary`.`deleted`=0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
-
- $name = "CAcert WoT User\n";
- $newname = mysql_real_escape_string(trim($_REQUEST['name']));
- if($points >= 50)
- {
- if($newname == $user['fname']." ".$user['lname'] ||
- $newname == $user['fname']." ".$user['mname']." ".$user['lname'] ||
- $newname == $user['fname']." ".$user['lname']." ".$user['suffix'] ||
- $newname == $user['fname']." ".$user['mname']." ".$user['lname']." ".$user['suffix'])
- $name = $newname;
- }
-
- $codesign = 0;
- if($user['codesign'] == "1" && $_REQUEST['codesign'] == "1" && $points >= 100)
- $codesign = 1;
-
- $CSR = trim($_REQUEST['optionalCSR']);
-
- if (($weakKey = checkWeakKeyCSR($CSR)) !== "")
- {
- die("403, $weakKey");
- }
-
- $incsr = tempnam("/tmp", "ccsrIn");
- $checkedcsr = tempnam("/tmp", "ccsrOut");
- $fp = fopen($incsr, "w");
- fputs($fp, $CSR);
- fclose($fp);
- $incsr_esc = escapeshellarg($incsr);
- $checkedcsr_esc = escapeshellarg($checkedcsr);
- $do = shell_exec("/usr/bin/openssl req -in $incsr_esc -out $checkedcsr_esc");
- @unlink($incsr);
- if(filesize($checkedcsr) <= 0)
- die("404,Invalid or missing CSR");
-
- $csrsubject = "/CN=$name";
- foreach($emails as $id => $email)
- $csrsubject .= "/emailAddress=".$email;
-
- $query = "insert into `emailcerts` set `CN`='".mysql_real_escape_string($user['email'])."', `keytype`='MS',
- `memid`='".intval($user['id'])."', `created`=FROM_UNIXTIME(UNIX_TIMESTAMP()),
- `subject`='".mysql_real_escape_string($csrsubject)."', `codesign`='".intval($codesign)."'";
- mysql_query($query);
- $certid = mysql_insert_id();
- $CSRname = generatecertpath("csr","client",$certid);
- rename($checkedcsr, $CSRname);
-
- mysql_query("update `emailcerts` set `csr_name`='$CSRname' where `id`='$certid'");
-
- foreach($emails as $emailid => $email)
- mysql_query("insert into `emaillink` set `emailcertsid`='$certid', `emailid`='".intval($emailid)."'");
-
- $do = shell_exec("../../scripts/runclient");
- sleep(10); // THIS IS BROKEN AND SHOULD BE FIXED
- $query = "select * from `emailcerts` where `id`='$certid' and `crt_name` != ''";
- $res = mysql_query($query);
- if(mysql_num_rows($res) <= 0)
- die("404,Your certificate request has failed. ID: ".intval($certid));
- $cert = mysql_fetch_assoc($res);
- echo "200,Authentication Ok\n";
- readfile("../".$cert['crt_name']);
-?>
diff --git a/www/api/cemails.php b/www/api/cemails.php
deleted file mode 100644
index f937069..0000000
--- a/www/api/cemails.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<? /*
- 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
-*/
- $username = mysql_escape_string($_REQUEST['username']);
- $password = mysql_escape_string($_REQUEST['password']);
-
- $query = "select * from `users` where `email`='$username' and (`password`=old_password('$password') or `password`=sha1('$password'))";
- $res = mysql_query($query);
- if(mysql_num_rows($res) != 1)
- die("403,That username couldn't be found\n");
- echo "200,Authentication Ok\n";
- $user = mysql_fetch_assoc($res);
- $memid = $user['id'];
- $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `notary`.`deleted`=0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
- echo "CS=".intval($user['codesign'])."\n";
- echo "NAME=CAcert WoT User\n";
- if($points >= 50)
- {
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['lname'])."\n";
- if($user['mname'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['mname'])." ".sanitizeHTML($user['lname'])."\n";
- if($user['suffix'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['lname'])." ".sanitizeHTML($user['suffix'])."\n";
- if($user['mname'] != "" && $user['suffix'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['mname'])." ".sanitizeHTML($user['lname'])." ".sanitizeHTML($user['suffix'])."\n";
- }
- $query = "select * from `email` where `memid`='".intval($memid)."' and `hash`='' and `deleted`=0";
- $res = mysql_query($query);
- while($row = mysql_fetch_assoc($res)) {
- echo "EMAIL=".sanitizeHTML($row['email'])."\n";
- }
-?>
diff --git a/www/index.php b/www/index.php
index 8c5560c..b54eb2f 100644
--- a/www/index.php
+++ b/www/index.php
@@ -210,10 +210,8 @@ require_once('../includes/notary.inc.php');
L10n::set_translation($_SESSION['profile']['language']);
L10n::init_gettext();
}
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted`=0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
+
$_SESSION['profile']['loggedin'] = 1;
if($_SESSION['profile']['Q1'] == "" || $_SESSION['profile']['Q2'] == "" ||
$_SESSION['profile']['Q3'] == "" || $_SESSION['profile']['Q4'] == "" ||
diff --git a/www/wot.php b/www/wot.php
index 35dce1f..9560f39 100644
--- a/www/wot.php
+++ b/www/wot.php
@@ -336,24 +336,13 @@ function send_reminder()
{
$max = maxpoints();
- $awarded = $newpoints = intval($_POST['points']);
- if($newpoints > $max)
- $newpoints = $awarded = $max;
- if($newpoints < 0)
- $newpoints = $awarded = 0;
+ $awarded = intval($_POST['points']);
+ if($awarded > $max)
+ $awarded = $max;
+ if($awarded < 0)
+ $awarded = 0;
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['_config']['notarise']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $drow = mysql_fetch_assoc($res);
-
- $_POST['expire'] = 0;
-
- if(($drow['total'] + $newpoints) > 100 && $max < 100)
- $newpoints = 100 - $drow['total'];
- if(($drow['total'] + $newpoints) > $max && $max >= 100)
- $newpoints = $max - $drow['total'];
- if($newpoints < 0)
- $newpoints = 0;
+ $drow_points = get_received_total_points(intval($_SESSION['_config']['notarise']['id']));
if(mysql_real_escape_string(stripslashes($_POST['date'])) == "")
$_POST['date'] = date("Y-m-d H:i:s");
@@ -376,7 +365,7 @@ function send_reminder()
{
$query = "insert into `notary` set `from`='".intval($_SESSION['profile']['id'])."',
`to`='".intval($_SESSION['_config']['notarise']['id'])."',
- `points`='".intval($newpoints)."', `awarded`='".intval($awarded)."',
+ `points`='0', `awarded`='".intval($awarded)."',
`location`='".mysql_real_escape_string(stripslashes($_POST['location']))."',
`date`='".mysql_real_escape_string(stripslashes($_POST['date']))."',
`when`=NOW()";
@@ -416,17 +405,15 @@ function send_reminder()
L10n::set_translation($_SESSION['_config']['notarise']['language']);
$body = sprintf(_("You are receiving this email because you have been assured by %s %s (%s)."), $_SESSION['profile']['fname'], $_SESSION['profile']['lname'], $_SESSION['profile']['email'])."\n\n";
- if($_POST['points'] != $newpoints)
- $body .= sprintf(_("You were issued %s points however the system has rounded this down to %s and you now have %s points in total."), $_POST['points'], $newpoints, ($newpoints + $drow['total']))."\n\n";
- else
- $body .= sprintf(_("You were issued %s points and you now have %s points in total."), $newpoints, ($newpoints + $drow['total']))."\n\n";
- if(($drow['total'] + $newpoints) < 100 && ($drow['total'] + $newpoints) >= 50)
+ $body .= sprintf(_("You were issued %s assurance points and you now have %s assurance points in total."), $awarded, ($awarded + $drow_total))."\n\n";
+
+ if(($drow_total + $awarded) < 100 && ($drow_total + $awarded) >= 50)
{
$body .= _("You now have over 50 points, and can now have your name added to client certificates, and issue server certificates for up to 2 years.")."\n\n";
}
- if(($drow['total'] + $newpoints) >= 100 && $newpoints > 0)
+ if(($drow_total + $awarded) >= 100 && $drow_total < 0 && !is_assurer(intval($_SESSION['_config']['notarise']['id'])) )
{
$body .= _("You have at least 100 Assurance Points, if you want to become an assurer try the Assurer Challenge")." ( https://cats.cacert.org )\n\n";
$body .= _("To make it easier for others in your area to find you, it's helpful to list yourself as an assurer (this is voluntary), as well as a physical location where you live or work the most. You can flag your account to be listed, and add a comment to the display by going to:")."\n";
@@ -443,10 +430,7 @@ function send_reminder()
L10n::set_translation($my_translation);
$body = sprintf(_("You are receiving this email because you have assured %s %s (%s)."), $_SESSION['_config']['notarise']['fname'], $_SESSION['_config']['notarise']['lname'], $_SESSION['_config']['notarise']['email'])."\n\n";
- if($_POST['points'] != $newpoints)
- $body .= sprintf(_("You issued %s points however the system has rounded this down to %s and they now have %s points in total."), $_POST['points'], $newpoints, ($newpoints + $drow['total']))."\n\n";
- else
- $body .= sprintf(_("You issued %s points and they now have %s points in total."), $newpoints, ($newpoints + $drow['total']))."\n\n";
+ $body .= sprintf(_("You issued %s assurance points and they now have %s assurance points in total."), $awarded, ($awarded + $drow['total']))."\n\n";
$body .= _("Best regards")."\n";
$body .= _("CAcert Support Team");
@@ -491,9 +475,7 @@ function send_reminder()
$subject = $_REQUEST['subject'];
$userid = intval($_REQUEST['userid']);
$user = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($userid)."' and `listme`=1"));
- $points = mysql_num_rows(mysql_query("select sum(`points`) as `total` from `notary`
- where `to`='".intval($user['id'])."' and `deleted` = 0 group by `to` HAVING SUM(`points`) > 0"));
- if($points > 0)
+ if(is_assurer($userid) > 0)
{
$my_translation = L10n::get_translation();
L10n::set_translation($user['language']);