Merge branch 'bug-1394' into testserver-stable
authorBenny Baumann <BenBE@geshi.org>
Wed, 29 Jul 2015 17:28:04 +0000 (19:28 +0200)
committerBenny Baumann <BenBE@geshi.org>
Wed, 29 Jul 2015 17:28:04 +0000 (19:28 +0200)
105 files changed:
CommModule/.gitignore [new file with mode: 0644]
CommModule/client.pl
CommModule/readme.txt
CommModule/serial.conf [deleted file]
CommModule/server.pl
CommModule/usbclient.pl [deleted file]
README [deleted file]
README.md [new file with mode: 0644]
cgi-bin/siteseal.cgi [deleted file]
config/ttp.ini [new file with mode: 0644]
crt/DIR [new file with mode: 0644]
csr/DIR [new file with mode: 0644]
includes/account.php
includes/account_stuff.php
includes/general.php
includes/general_stuff.php
includes/keygen.php
includes/lib/account.php
includes/lib/general.php
includes/loggedin.php
includes/mysql.php.sample
includes/notary.inc.php
includes/shutdown.php
includes/tverify_stuff.php [deleted file]
pages/account/13.php
pages/account/14.php
pages/account/24.php
pages/account/25.php
pages/account/27.php
pages/account/40.php
pages/account/41.php
pages/account/43.php
pages/account/48.php
pages/account/49.php
pages/account/51.php [deleted file]
pages/account/52.php [deleted file]
pages/account/53.php
pages/account/54.php
pages/account/55.php
pages/account/6.php
pages/advertising/1.php
pages/gpg/2.php
pages/index/0.php
pages/index/1.php
pages/index/11.php
pages/index/13.php
pages/index/3.php
pages/index/6.php
pages/index/feed.rss [new file with mode: 0644]
pages/wot/1.php
pages/wot/12.php
pages/wot/13.php
pages/wot/16.php [new file with mode: 0644]
pages/wot/17.php [new file with mode: 0644]
pages/wot/3.php
pages/wot/4.php
pages/wot/5.php
pages/wot/6.php
pages/wot/8.php
pages/wot/9.php
scripts/cron/refresh_stats.php
scripts/cron/updatesort.php
scripts/send_heartbleed.php [changed mode: 0644->0755]
stamp/.htaccess [deleted file]
stamp/certdet.php [deleted file]
stamp/common.php [deleted file]
stamp/displogo.php [deleted file]
stamp/images/CAverify.png [deleted file]
stamp/index.php [deleted file]
stamp/old_showlogo.php.broken [deleted file]
stamp/report.php [deleted file]
stamp/showlogo.php [deleted file]
stamp/style.css [deleted file]
tverify/.htaccess [deleted file]
tverify/favicon.ico [deleted file]
tverify/index.php [deleted file]
tverify/index/0.php [deleted file]
tverify/index/1.php [deleted file]
www/.gitignore [new file with mode: 0644]
www/ac.php
www/account.php
www/alert_hash_collision.php
www/api/ccsr.php [deleted file]
www/api/cemails.php [deleted file]
www/api/edu.php
www/cacert1-class3-revoke.crl [new symlink]
www/cacert1-revoke.crl [new symlink]
www/cats/cats_import.php
www/certs/cacert.asc
www/certs/class3.crt
www/certs/class3.der
www/certs/class3.txt
www/certs/root.crt
www/certs/root.der
www/certs/root.txt
www/disputes.php
www/gpg.php
www/images/cacert4.png
www/index.php
www/robots.txt [new file with mode: 0644]
www/stats.php
www/styles/default.css
www/tverify/seclayer.php [deleted file]
www/verify.php
www/wot.php

diff --git a/CommModule/.gitignore b/CommModule/.gitignore
new file mode 100644 (file)
index 0000000..40a9309
--- /dev/null
@@ -0,0 +1,19 @@
+# Ignore autogenerated serial conf file
+/serial.conf
+/serialserver.conf
+
+# Ignore *-active files
+/client.pl-active
+/server.pl-active
+
+# Ignore log files
+/logfile20??-??-??.txt
+/nohup.out
+/oldlogs/
+
+# Ignore working files generated by the signer
+/currentcrls/
+/delta?.diff
+/revoke-root?.crl
+/timesync.sh
+/work/
index 0874477..24f0abc 100755 (executable)
@@ -40,8 +40,8 @@ my $paranoid=1;
 
 my $debug=0;
 
-#my $serialport="/dev/ttyS0";
-my $serialport="/dev/ttyUSB0";
+my $serialport="/dev/ttyS1";
+#my $serialport="/dev/ttyUSB0";
 
 my $gpgbin="/usr/bin/gpg";
 
@@ -441,12 +441,12 @@ 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`");
+    my @sum = $dbh->selectrow_array("select sum(`awarded`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to` group by `to`");
     SysLog("Summe: $sum[0]\n") if($debug);
 
-    return ($sum[0]>=50)?730:180;
+    return ($sum[0]>=50)?30:3;
   }
-  return 180;
+  return 3;
 }
 
 sub X509extractSAN($)
@@ -832,7 +832,7 @@ sub HandleCerts($$)
       SysLog "SAN: --$SAN--\n" if($debug);
       SysLog "memid: $row{'memid'}\n" if($debug);
 
-      my $days=$org?($server?(365*2):365):calculateDays($row{"memid"});
+      my $days=$org?30:calculateDays($row{"memid"});
 
       my $md_id = 0;
       $md_id = 1 if( $row{'md'} eq "md5");
@@ -1087,15 +1087,20 @@ sub HandleGPG()
 
     my $prefix="gpg";
     my $short=int($row{'id'}/1000);
-    my $csrname = "../csr/$prefix-".$row{'id'}.".csr";
-    $csrname = "../csr/$prefix/$short/$prefix-".$row{'id'}.".csr" if($newlayout);
-    SysLog("New Layout: "."../csr/$prefix/$short/$prefix-".$row{'id'}.".csr\n");
+
+    my $dirname="../csr";
+    $dirname="../csr/$prefix/$short" if ($newlayout);
+
+    #Ensure the directory exists
+    mkdir $dirname, 0755;
+
+    my $csrname = "$dirname/$prefix-".$row{'id'}.".csr";
+    SysLog("New Layout: $csrname\n");
 
     #my $crtname = "../crt/$prefix-".$row{'id'}.".crt";
     my $crtname=$csrname; $crtname=~s/^\.\.\/csr/..\/crt/; $crtname=~s/\.csr$/.crt/;
     SysLog("New Layout: $crtname\n");
 
-
     #my $csrname = "../csr/gpg-".$row{'id'}.".csr";
     #my $crtname = "../crt/gpg-".$row{'id'}.".crt";
 
index 94f09fe..d80c46e 100644 (file)
@@ -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/serial.conf b/CommModule/serial.conf
deleted file mode 100755 (executable)
index bd9980c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Device::SerialPort_Configuration_File -- DO NOT EDIT --
-/dev/ttyUSB0
-
-C_CFLAG,7346
-C_IFLAG,0
-C_ISPEED,4098
-C_LFLAG,2608
-C_OFLAG,4
-C_OSPEED,4098
-C_VERASE,127
-C_VQUIT,28
-C_VSUSP,26
-C_VINTR,3
-C_VSTOP,19
-C_VSTART,17
-C_VKILL,21
-C_VMIN,0
-C_VEOF,4
-C_VEOL,0
-C_VTIME,0
-CFG_1,none
-RCONST,0
-CFG_2,none
-HNAME,localhost
-ALIAS,/dev/ttyUSB0
-CFG_3,none
-U_MSG,0
-DATYPE,raw
-E_MSG,0
-HADDR,0
-RTOT,0
-DVTYPE,none
index 6084042..31cb537 100755 (executable)
@@ -491,8 +491,8 @@ sub SignX509($$$$$$$$)
   $subject=~ s/\\x([A-F0-9]{2})/pack("C", hex($1))/egi;
   $san=~ s/\\x([A-F0-9]{2})/pack("C", hex($1))/egi;
 
-  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00"'\\]/);
-  Error "Invalid characters in Subject: ".hexdump($subject)." - $subject\n" if($subject=~m/[\n\r\t\x00"'\\]/);
+  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00#"'\\]/);
+  Error "Invalid characters in Subject: ".hexdump($subject)." - $subject\n" if($subject=~m/[\n\r\t\x00#"'\\]/);
 
   print "Subject: $subject\n";
   print "SAN: $san\n";
@@ -590,8 +590,8 @@ sub SignOpenPGP
 
   my $keyid=undef;
 
-  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00"'\\]/);
-  Error "Invalid characters in Subject!\n" if($subject=~m/[ \n\r\t\x00"'\\;]/);
+  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00#"'\\]/);
+  Error "Invalid characters in Subject!\n" if($subject=~m/[ \n\r\t\x00#"'\\;]/);
 
 
   if(open OUT,">$wid/request.key")
@@ -843,7 +843,7 @@ sub RevokeX509
 {
   my ($root,$template,$hash,$days,$spkac,$request,$san,$subject)=@_;
 
-  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00"'\\]/);
+  Error "Invalid characters in SubjectAltName!\n" if($san=~m/[ \n\r\t\x00#"'\\]/);
   Error "Invalid characters in Hash!\n" if(! $subject=~m/^[0-9a-fA-F]+$/);
 
   SysLog "Widerrufe $PkiSystems{$_[0]}\n";
@@ -1002,7 +1002,7 @@ my @ready=$sel->can_read($starttime);
 my $count=0;
 
 #As soon as the client connected successfully, the client has to send a request faster than every 10 seconds
-while(@ready = $sel->can_read(15) && -f "./server.pl-active")
+while((@ready = $sel->can_read(15)) && -f "./server.pl-active")
 {
   my $data="";
   #my $length=read SER,$data,1;
diff --git a/CommModule/usbclient.pl b/CommModule/usbclient.pl
deleted file mode 100755 (executable)
index 6cbc111..0000000
+++ /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/README b/README
deleted file mode 100644 (file)
index 7f2ca78..0000000
--- a/README
+++ /dev/null
@@ -1,17 +0,0 @@
-LibreSSL Documentation
-
-(c) 2005-2008 by CAcert Inc.
-License: GNU-GPLv2
-
-System Requirements:
-Linux/POSIX
-PHP
-GetText
-UFPDF - PDF generation library from http://acko.net/node/56
-OpenSSL - X.509 toolkit from http://www.openssl.org/
-openssl-vulnkey including blacklists for all common key sizes
-GnuPG - OpenPGP toolkit from http://www.gnupg.org/
-whois - whois client from http://www.linux.it/~md/software/
-XEnroll - Enrollment Active-X control for IE5/6 from Microsoft (search for xenroll.cab)
-CommModule - CAcert Communication Module
-
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..39c9d68
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+LibreSSL Documentation
+======================
+
+(c) 2005-2013 by CAcert Inc.
+License: GNU-GPLv2
+
+## System Requirements:
+
+ * Linux/POSIX
+ * PHP 5.3
+ * GetText PECL module for PHP
+ * UFPDF - PDF generation library from http://acko.net/node/56
+ * OpenSSL - X.509 toolkit from http://www.openssl.org/
+ * openssl-vulnkey including blacklists for all common key sizes
+ * GnuPG - OpenPGP toolkit from http://www.gnupg.org/
+ * whois - whois client from http://www.linux.it/~md/software/
+ * XEnroll - Enrollment Active-X control for IE5/6 from Microsoft (search for xenroll.cab)
+ * CommModule - CAcert Communication Module
+
diff --git a/cgi-bin/siteseal.cgi b/cgi-bin/siteseal.cgi
deleted file mode 100755 (executable)
index ac28697..0000000
+++ /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/config/ttp.ini b/config/ttp.ini
new file mode 100644 (file)
index 0000000..d0a0913
--- /dev/null
@@ -0,0 +1,6 @@
+; list of countries and the TTP CAP form to be used
+[ttp_country]
+Australia=ttp
+Puerto Rico=ttp
+US Virgin Island=ttp
+USA =ttp
\ No newline at end of file
diff --git a/crt/DIR b/crt/DIR
new file mode 100644 (file)
index 0000000..87975fb
--- /dev/null
+++ b/crt/DIR
@@ -0,0 +1 @@
+# This directory has to be writeable by the web server
diff --git a/csr/DIR b/csr/DIR
new file mode 100644 (file)
index 0000000..87975fb
--- /dev/null
+++ b/csr/DIR
@@ -0,0 +1 @@
+# This directory has to be writeable by the web server
index 72db509..bc90314 100644 (file)
@@ -907,7 +907,8 @@ function buildSubjectFromSession() {
                                                `rootcert`='".intval($row['rootcert'])."',
                                                `type`='".intval($row['type'])."',
                                                `pkhash`='".mysql_real_escape_string($row['pkhash'])."',
-                                               `description`='".mysql_real_escape_string($row['description'])."'";
+                                               `description`='".mysql_real_escape_string($row['description'])."',
+                                               `md`='".HashAlgorithms::clean($row['md'])."'";
                                mysql_query($query);
                                $newid = mysql_insert_id();
                                $newfile=generatecertpath("csr","server",$newid);
@@ -1087,7 +1088,8 @@ function buildSubjectFromSession() {
                                                `disablelogin`='".intval($row['disablelogin'])."',
                                                `codesign`='".intval($row['codesign'])."',
                                                `rootcert`='".intval($row['rootcert'])."',
-                                               `description`='".mysql_real_escape_string($row['description'])."'";
+                                               `description`='".mysql_real_escape_string($row['description'])."',
+                                               `md`='".HashAlgorithms::clean($row['md'])."'";
                                mysql_query($query);
                                $newid = mysql_insert_id();
                                $newfile=generatecertpath("csr","client",$newid);
@@ -1212,6 +1214,23 @@ function buildSubjectFromSession() {
                exit;
        }
 
+       if($oldid == 6 && $_REQUEST['certid'] != "")
+       {
+               if(trim($_REQUEST['description']) != ""){
+                       $description= trim(mysql_real_escape_string(stripslashes($_REQUEST['description'])));
+               }else{
+                       $description= "";
+               }
+
+               if(trim($_REQUEST['disablelogin']) == "1"){
+                       $disablelogin = 1;
+               }else{
+                       $disablelogin = 0;
+               }
+
+               mysql_query("update `emailcerts` set `disablelogin`='$disablelogin', `description`='$description' where `id`='".$_REQUEST['certid']."' and `memid`='".$_SESSION['profile']['id']."'");
+       }
+
        if($oldid == 13 && $process != "" && $showdetails!="")
        {
                csrf_check("perschange");
@@ -1277,10 +1296,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)
                {
@@ -1339,10 +1355,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;
@@ -1364,7 +1377,7 @@ function buildSubjectFromSession() {
                showheader(_("My CAcert.org Account!"));
                if($_SESSION['_config']['user']['pword1'] == "" || $_SESSION['_config']['user']['pword1'] != $_SESSION['_config']['user']['pword2'])
                {
-                       echo '<h3 style="color:red">', _("Failure: Pass Phrase not Changed"),
+                       echo '<h3 class="error_fatal">', _("Failure: Pass Phrase not Changed"),
                                '</h3>', "\n";
                        echo _("New Pass Phrases specified don't match or were blank.");
                } else {
@@ -1382,15 +1395,15 @@ function buildSubjectFromSession() {
                        }
 
                        if(strlen($_SESSION['_config']['user']['pword1']) < 6) {
-                               echo '<h3 style="color:red">',
+                               echo '<h3 class="error_fatal">',
                                        _("Failure: Pass Phrase not Changed"), '</h3>', "\n";
                                echo _("The Pass Phrase you submitted was too short.");
                        } else if($score < 3) {
-                               echo '<h3 style="color:red">',
+                               echo '<h3 class="error_fatal">',
                                        _("Failure: Pass Phrase not Changed"), '</h3>', "\n";
                                printf(_("The Pass Phrase you submitted failed to contain enough differing characters and/or contained words from your name and/or email address. Only scored %s points out of 6."), $score);
                        } else if($rc <= 0) {
-                               echo '<h3 style="color:red">',
+                               echo '<h3 class="error_fatal">',
                                        _("Failure: Pass Phrase not Changed"), '</h3>', "\n";
                                echo _("You failed to correctly enter your current Pass Phrase.");
                        } else {
@@ -1716,7 +1729,8 @@ function buildSubjectFromSession() {
                                                `modified`=NOW(),
                                                `codesign`='".intval($row['codesign'])."',
                                                `rootcert`='".intval($row['rootcert'])."',
-                                               `description`='".mysql_real_escape_string($row['description'])."'";
+                                               `description`='".mysql_real_escape_string($row['description'])."',
+                                               `md`='".HashAlgorithms::clean($row['md'])."'";
                                mysql_query($query);
                                $newid = mysql_insert_id();
                                $newfile=generatecertpath("csr","orgclient",$newid);
@@ -2068,7 +2082,8 @@ function buildSubjectFromSession() {
                                                `subject`='".mysql_real_escape_string($row['subject'])."',
                                                `type`='".intval($row['type'])."',
                                                `rootcert`='".intval($row['rootcert'])."',
-                                               `description`='".mysql_real_escape_string($row['description'])."'";
+                                               `description`='".mysql_real_escape_string($row['description'])."',
+                                               `md`='".HashAlgorithms::clean($row['md'])."'";
                                mysql_query($query);
                                $newid = mysql_insert_id();
                                //echo "NewID: $newid<br/>\n";
@@ -2236,7 +2251,7 @@ function buildSubjectFromSession() {
                                                `contact`='".$_SESSION['_config']['contact']."',
                                                `L`='".$_SESSION['_config']['L']."',
                                                `ST`='".$_SESSION['_config']['ST']."',
-                                               `C`='".$_SESSION['_config']['C']."',
+                                               `C`='".strtoupper($_SESSION['_config']['C'])."',
                                                `comments`='".$_SESSION['_config']['comments']."'");
                        showheader(_("My CAcert.org Account!"));
                        printf(_("'%s' has just been successfully added as an organisation to the database."), sanitizeHTML($_SESSION['_config']['O']));
@@ -2264,7 +2279,7 @@ function buildSubjectFromSession() {
                                                `contact`='".$_SESSION['_config']['contact']."',
                                                `L`='".$_SESSION['_config']['L']."',
                                                `ST`='".$_SESSION['_config']['ST']."',
-                                               `C`='".$_SESSION['_config']['C']."',
+                                               `C`='".strtoupper($_SESSION['_config']['C'])."',
                                                `comments`='".$_SESSION['_config']['comments']."'
                                        where `id`='".intval($_SESSION['_config']['orgid'])."'");
                        showheader(_("My CAcert.org Account!"));
@@ -2787,8 +2802,8 @@ function buildSubjectFromSession() {
                        $row = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($_REQUEST['userid'])."'"));
                        printf(_("The password for %s has been updated successfully in the system."), sanitizeHTML($row['email']));
 
-               $my_translation = L10n::get_translation();
-               L10n::set_recipient_language(intval($_REQUEST['userid']));
+                       $my_translation = L10n::get_translation();
+                       L10n::set_recipient_language(intval($_REQUEST['userid']));
                        $body  = sprintf(_("Hi %s,"),$row['fname'])."\n\n";
                        $body .= _("You are receiving this email because a CAcert administrator ".
                                        "has changed the password on your account.")."\n\n";
@@ -2797,7 +2812,7 @@ function buildSubjectFromSession() {
 
                        sendmail($row['email'], "[CAcert.org] "._("Password Update Notification"), $body,
                                                "support@cacert.org", "", "", "CAcert Support");
-               L10n::set_translation($my_translation);
+                       L10n::set_translation($my_translation);
                }
 
                showfooter();
@@ -2904,25 +2919,6 @@ function buildSubjectFromSession() {
                }
        }
 
-       /* presently not needed
-       if($id == 43 && array_key_exists('tverify',$_REQUEST) && $_REQUEST['tverify'] > 0 && $ticketvalidation==TRUE)
-       {
-               $memid = $_REQUEST['userid'] = intval($_REQUEST['tverify']);
-               if (!write_se_log($memid, $_SESSION['profile']['id'],'SE Change tverify status',$ticketno)) {
-                       showheader(_("Something went wrong"));
-                       echo _("Writing to the admin log failed. Can't continue.");
-                       showfooter();
-                       exit;
-               }
-               $query = "select * from `users` where `id`='$memid'";
-               $row = mysql_fetch_assoc(mysql_query($query));
-               $ver = !$row['tverify'];
-               mysql_query("update `users` set `tverify`='$ver' where `id`='$memid'");
-       }elseif($id == 43 && array_key_exists('tverify',$_REQUEST) && $_REQUEST['tverify'] > 0 && $ticketvalidation==FALSE){
-               $_SESSION['ticketmsg']='No action taken. Ticket number is missing!';
-       }
-       */
-
        if($id == 43 && array_key_exists('assurer',$_REQUEST) && $_REQUEST['assurer'] > 0 && $ticketvalidation == TRUE)
        {
                csrf_check('admsetassuret');
index 0fda2f1..9ff794d 100644 (file)
                case 506:
                case 509:
                case 511:
-               case 512: $expand = " explode('WoT');"; break;          // Find Assurer
+               case 512:                                               // Find Assurer
+               case 516:                                               // TTP form
+               case 517: $expand = " explode('WoT');"; break;          // Assurer check
                case 1000:
                case 1001:
                case 1002:                                              // View GPG key
 <title><?=$title?></title>
 <? if(array_key_exists('header',$_SESSION) && $_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
 <link rel="stylesheet" href="/styles/default.css" type="text/css" />
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <script language="JavaScript" type="text/javascript">
 function explode(e) {
     if (document.getElementById(e).style.display == 'none') {
@@ -177,12 +178,8 @@ function hideall() {
     </div>
     <div class="relatedLinks">
       <h3 class="pointer" onclick="explode('mydetails')">+ <?=_("My Details")?></h3>
-      <ul class="menu" id="mydetails"><li><a href="account.php?id=13"><?=_("View/Edit")?></a></li><li><a href="account.php?id=14"><?=_("Change Password")?></a></li><li><a href="account.php?id=41"><?=_("Default Language")?></a></li><li><a href="wot.php?id=8"><?=_("My Listing")?></a></li><li><a href="wot.php?id=13"><?=_("My Location")?></a></li><li><a href="account.php?id=36"><?=_("My Alert Settings")?></a></li><li><a href="account.php?id=55"><?=_("My Trainings")?></a></li><li><a href="wot.php?id=10"><?=_("My Points")?></a></li><?
-/* to delete
-       if($_SESSION['profile']['id'] == 1 || $_SESSION['profile']['id'] == 5897)
-               echo "<li><a href='sqldump.php'>SQL Dump</a></li>";
-*/
-       ?></ul>
+      <ul class="menu" id="mydetails"><li><a href="account.php?id=13"><?=_("View/Edit")?></a></li><li><a href="account.php?id=14"><?=_("Change Password")?></a></li><li><a href="account.php?id=41"><?=_("Default Language")?></a></li><li><a href="wot.php?id=8"><?=_("My Listing")?></a></li><li><a href="wot.php?id=13"><?=_("My Location")?></a></li><li><a href="account.php?id=36"><?=_("My Alert Settings")?></a></li><li><a href="account.php?id=55"><?=_("My Trainings")?></a></li><li><a href="wot.php?id=10"><?=_("My Points")?></a></li>
+     </ul>
     </div>
     <div class="relatedLinks">
       <h3 class="pointer" onclick="explode('emailacc')">+ <?=_("Email Accounts")?></h3>
@@ -224,7 +221,7 @@ function hideall() {
 <? } ?>
     <div class="relatedLinks">
       <h3 class="pointer" onclick="explode('WoT')">+ <?=_("CAcert Web of Trust")?></h3>
-      <ul class="menu" id="WoT"><li><a href="wot.php?id=0"><?=_("About")?></a></li><li><a href="wot.php?id=12"><?=_("Find an Assurer")?></a></li><li><a href="wot.php?id=3"><?=_("Rules")?></a></li><li><? if($_SESSION['profile']['assurer'] != 1) { ?><a href="wot.php?id=2"><?=_("Becoming an Assurer")?></a><? } else { ?><a href="wot.php?id=5"><?=_("Assure Someone")?></a><? } ?></li><li><a href="wot.php?id=4"><?=_("Trusted ThirdParties")?></a></li><? if($_SESSION['profile']['points'] >= 500) { ?><li><a href="wot.php?id=11"><div style="white-space:nowrap"><?=_("Organisation Assurance")?></div></a></li><? } ?></ul>
+      <ul class="menu" id="WoT"><li><a href="wot.php?id=0"><?=_("About")?></a></li><li><a href="wot.php?id=12"><?=_("Find an Assurer")?></a></li><li><a href="wot.php?id=3"><?=_("Rules")?></a></li><li><a href="wot.php?id=17"><?=_("Check Assurer Status")?></a></li><li><? if($_SESSION['profile']['assurer'] != 1) { ?><a href="wot.php?id=2"><?=_("Becoming an Assurer")?></a><? } else { ?><a href="wot.php?id=5"><?=_("Assure Someone")?></a><? } ?></li><li><a href="wot.php?id=4"><?=_("Trusted ThirdParties")?></a></li><? if($_SESSION['profile']['points'] >= 500) { ?><li><a href="wot.php?id=11"><div style="white-space:nowrap"><?=_("Organisation Assurance")?></div></a></li><? } ?><li><a href="account.php?id=55"><?=_("Training")?></a></li></ul>
     </div>
     <div class="relatedLinks">
       <h3 class="pointer" onclick="explode('WoTForms')">+ <?=_("CAP Forms")?></h3><?
@@ -275,7 +272,7 @@ function hideall() {
     <div class="story">
       <h3><?=$title2?></h3>
 <? if($_SESSION['_config']['errmsg'] != "") { ?>
-<p><font color="#ff0000" size="+2"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
+<p class="error_fatal"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?></p>
 <? } ?>
 <?
        }
index 17b449b..76c6831 100644 (file)
@@ -17,6 +17,7 @@
 */
 
        require_once(dirname(__FILE__)."/lib/general.php");
+       require_once(dirname(__FILE__)."/notary.inc.php");
 
        session_name("cacert");
        session_start();
 //     if($_SESSION['profile']['id'] > 0)
 //             session_regenerate_id();
 
+       //cf. http://stackoverflow.com/a/14532168
+       if(!defined('ENT_HTML401'))     define('ENT_HTML401', 0);
+       if(!defined('ENT_XML1'))        define('ENT_XML1', 16);
+       if(!defined('ENT_XHTML'))       define('ENT_XHTML', 32);
+       if(!defined('ENT_HTML5'))       define('ENT_HTML5', (32|16));
+
        $pageLoadTime_Start = microtime(true);
 
        $junk = array(_("Face to Face Meeting"), _("Trusted Third Parties"), _("Thawte Points Transfer"), _("Administrative Increase"),
@@ -46,9 +53,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']['securehostname'])
        {
                if(array_key_exists('HTTPS',$_SERVER) && $_SERVER['HTTPS'] == "on")
                        header("location: https://".$_SESSION['_config']['normalhostname']);
        }
 
        if(array_key_exists('HTTP_HOST',$_SERVER) &&
-                       ($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname'] ||
-                       $_SERVER['HTTP_HOST'] == $_SESSION['_config']['tverify']))
+                       ($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname']))
        {
                if(array_key_exists('HTTPS',$_SERVER) && $_SERVER['HTTPS'] == "on")
                {
                }
                else
                {
-                       if($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname'])
-                       header("location: https://". $_SESSION['_config']['securehostname']);
-                       if($_SERVER['HTTP_HOST'] == $_SESSION['_config']['tverify'])
-                       header("location: https://".$_SESSION['_config']['tverify']);
+                       if($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname']){
+                               header("location: https://". $_SESSION['_config']['securehostname']);
+                       }
                        exit;
+
                }
        }
 
                $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']);
 
        function loadem($section = "index")
        {
-               if($section != "index" && $section != "account" && $section != "tverify")
+               if($section != "index" && $section != "account")
                {
                        $section = "index";
                }
 
-               if($section == "account")
+               if($section == "account"){
                        include_once($_SESSION['_config']['filepath']."/includes/account_stuff.php");
+               }
 
-               if($section == "index")
+               if($section == "index"){
                        include_once($_SESSION['_config']['filepath']."/includes/general_stuff.php");
-
-               if($section == "tverify")
-                       include_once($_SESSION['_config']['filepath']."/includes/tverify_stuff.php");
+               }
        }
 
        function includeit($id = "0", $section = "index")
        {
                $id = intval($id);
-               if($section != "index" && $section != "account" && $section != "wot" && $section != "help" && $section != "gpg" && $section != "disputes" && $section != "tverify" && $section != "advertising")
+               if($section != "index" && $section != "account" && $section != "wot" && $section != "help" && $section != "gpg" && $section != "disputes" && $section != "advertising")
                {
                        $section = "index";
                }
 
-               if($section == "tverify" && file_exists($_SESSION['_config']['filepath']."/tverify/index/$id.php"))
-                       include_once($_SESSION['_config']['filepath']."/tverify/index/$id.php");
-               else if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php"))
+               if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php")){
                        include_once($_SESSION['_config']['filepath']."/pages/$section/$id.php");
+               }
                else {
                        $id = "0";
 
-                       if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php"))
+                       if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php")){
                                include_once($_SESSION['_config']['filepath']."/pages/$section/$id.php");
-                       else {
+                       else {
 
                                $section = "index";
                                $id = "0";
 
-                               if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php"))
+                               if(file_exists($_SESSION['_config']['filepath']."/pages/$section/$id.php")){
                                        include_once($_SESSION['_config']['filepath']."/pages/$section/$id.php");
-                               else
+                               } else {
                                        include_once($_SESSION['_config']['filepath']."/www/error404.php");
+                               }
                        }
                }
        }
                }
        }
 
+       function isValidWildcard($name){
+               if(substr($name,0,2) == "*."){
+                       $name = substr($name, 2);
+               }
+               if(!preg_match('/^(\\.(?!-)[a-z0-9_-]*[a-z0-9])+$/i','.'.$name)){
+                       return false;
+               }
+               return strpos($name, "*") === false;
+       }
+
        function getcn()
        {
                unset($_SESSION['_config']['rows']);
                        $bits = explode(".", $CN);
                        $dom = "";
                        $cnok = 0;
+
+                       if(!isValidWildcard($CN)){
+                               $_SESSION['_config']['rejected'][] = $CN;
+                               continue;
+                       }
+
                        for($i = count($bits) - 1; $i >= 0; $i--)
                        {
                                if($dom)
                                        $dom = $bits[$i];
                                $_SESSION['_config']['row'] = "";
                                $dom = mysql_real_escape_string($dom);
-                               $query = "select * from domains where `memid`='".intval($_SESSION['profile']['id'])."' and `domain` like '$dom' and `deleted`=0 and `hash`=''";
+                               $query = "select * from domains where `memid`='".intval($_SESSION['profile']['id'])."' and `domain` = '$dom' and `deleted`=0 and `hash`=''";
                                $res = mysql_query($query);
                                if(mysql_num_rows($res) > 0)
                                {
                                }
                        }
 
-                       if($cnok == 0)
+                       if(!preg_match("/(?=^.{4,253}$)(^(?:\\*\\.)?((?!-)[a-zA-Z0-9_-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/i", $CN)) {
+                               $cnok = 0;
+                       }
+
+                       if($cnok == 0) {
                                $_SESSION['_config']['rejected'][] = $CN;
+                               continue;
+                       }
 
                        if($_SESSION['_config']['row'] != "")
                                $rows[] = $CN;
                        else
                                continue;
 
+                       if(!isValidWildcard($alt)){
+                               $_SESSION['_config']['rejected'][] = $alt;
+                               continue;
+                       }
+
                        $bits = explode(".", $alt);
                        $dom = "";
                        $altok = 0;
                                        $dom = $bits[$i];
                                $_SESSION['_config']['altrow'] = "";
                                $dom = mysql_real_escape_string($dom);
-                               $query = "select * from domains where `memid`='".intval($_SESSION['profile']['id'])."' and `domain` like '$dom' and `deleted`=0 and `hash`=''";
+                               $query = "select * from domains where `memid`='".intval($_SESSION['profile']['id'])."' and `domain` = '$dom' and `deleted`=0 and `hash`=''";
                                $res = mysql_query($query);
                                if(mysql_num_rows($res) > 0)
                                {
                                }
                        }
 
-                       if($altok == 0)
+                       if(!preg_match("/(?=^.{4,253}$)(^(?:\\*\\.)?((?!-)[a-zA-Z0-9_-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/i", $alt)) {
+                               $altok = 0;
+                       }
+
+                       if($altok == 0) {
                                $_SESSION['_config']['rejected'][] = $alt;
+                               continue;
+                       }
 
                        if($_SESSION['_config']['altrow'] != "")
                                $altrows[] = $subalt;
                        $CN = $_SESSION['_config']["$cnc.CN"];
                        $bits = explode(".", $CN);
                        $dom = "";
+
+                        if(!isValidWildcard($CN)){
+                                $_SESSION['_config']['rejected'][] = $CN;
+                                continue;
+                        }
+
                        for($i = count($bits) - 1; $i >= 0; $i--)
                        {
                                if($dom)
                                }
                        }
 
+                       if(!preg_match("/(?=^.{4,253}$)(^(?:\\*\\.)?((?!-)[a-zA-Z0-9_-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/i", $CN)) {
+                               continue;
+                       }
+
                        if($_SESSION['_config']['row'] != "")
                                $rows[] = $CN;
                }
                        else
                                continue;
 
+                        if(!isValidWildcard($alt)){
+                                $_SESSION['_config']['rejected'][] = $alt;
+                                continue;
+                        }
+
                        $bits = explode(".", $alt);
                        $dom = "";
                        for($i = count($bits) - 1; $i >= 0; $i--)
                                }
                        }
 
+                       if(!preg_match("/(?=^.{4,253}$)(^(?:\\*\\.)?((?!-)[a-zA-Z0-9_-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/i", $alt)) {
+                               continue;
+                       }
+
                        if($_SESSION['_config']['altrow'] != "")
                                $altrows[] = $subalt;
                }
                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'";
                return(0);
        }
 
+       /**
+        * Decode UTF-8 byte sequences into HTML entities
+        *
+        * @see https://blog.benny-baumann.de/?p=332
+        */
+       function charset_decode_utf8_callback($match) {
+               $m = $match[0];
+
+               switch(strlen($m)) {
+               case 6:
+                       // decode six byte unicode characters
+                       return '&#'.((ord($m[0])-252)*1073741824+(ord($m[1])-200)*16777216+(ord($m[2])-200)*262144+(ord($m[3])-128)*4096+(ord($m[4])-128)*64+(ord($m[5])-128)).';';
+               case 5:
+                       // decode five byte unicode characters
+                       return '&#'.((ord($m[0])-248)*16777216+(ord($m[1])-200)*262144+(ord($m[2])-128)*4096+(ord($m[3])-128)*64+(ord($m[4])-128)).';';
+               case 4:
+                       // decode four byte unicode characters
+                       return '&#'.((ord($m[0])-240)*262144+(ord($m[1])-128)*4096+(ord($m[2])-128)*64+(ord($m[3])-128)).';';
+               case 3:
+                       // decode three byte unicode characters
+                       return '&#'.((ord($m[0])-224)*4096+(ord($m[1])-128)*64+(ord($m[2])-128)).';';
+               case 2:
+                       // decode two byte unicode characters
+                       return '&#'.((ord($m[0])-192)*64+(ord($m[1])-128)).';';
+               default:
+                       return $m;
+               }
+       }
+
+       /**
+        * Decode utf-8 strings
+        * @param string $string Encoded string
+        * @return string Decoded string
+        * @see https://blog.benny-baumann.de/?p=332
+        */
+       function charset_decode_utf8 ($string) {
+               // decode 2-6 byte unicode characters
+               $string = preg_replace_callback("/[\374-\375][\200-\277][\200-\277][\200-\277][\200-\277][\200-\277]|".
+                       "[\370-\373][\200-\277][\200-\277][\200-\277][\200-\277]|".
+                       "[\360-\367][\200-\277][\200-\277][\200-\277]|".
+                       "[\340-\357][\200-\277][\200-\277]|".
+                       "[\300-\337][\200-\277]/",
+                       'charset_decode_utf8_callback', $string);
+
+               // remove broken unicode
+               $string = preg_replace("/[\200-\237]|\240|[\241-\377]/",'?',$string);
+
+               return $string;
+       }
+
        function gpg_hex2bin($data)
        {
                while(strstr($data, "\\x"))
                        $after = substr($data, $pos + 4);
                        $data = $before.$char.$after;
                }
-               return(utf8_decode($data));
+
+               return htmlentities(charset_decode_utf8($data), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', false);
        }
 
        function signmail($to, $subject, $message, $from, $replyto = "")
 
                                        $line = mysql_real_escape_string(trim(strip_tags($line)));
                                        $query = "insert into `pinglog` set `when`=NOW(), `email`='$myemail', `result`='$line'";
-                                       if(is_array($_SESSION['profile'])) $query.=", `uid`='".intval($_SESSION['profile']['id'])."'";
+                                       if(isset($_SESSION['profile']) && is_array($_SESSION['profile']) && isset($_SESSION['profile']['id'])) $query.=", `uid`='".intval($_SESSION['profile']['id'])."'";
                                        mysql_query($query);
 
                                        if(substr($line, 0, 3) != "250")
                        $subject="";
                        if(mysql_num_rows($res) > 0)
                        {
-                               printf(_("Your certificate request is still queued and hasn't been processed yet. Please wait, and go to Certificates -> View to see it's status."));
+                               printf('<p>' . _("Your certificate request is still queued and hasn't been processed yet. Please wait, and go to Certificates -> View to see it's status." . '</p>'));
                                $subject="[CAcert.org] Certificate TIMEOUT";
                                $body = "A certificate has timed out!\n\n";
                        }
                        else
                        {
-                               printf(_("Your certificate request has failed to be processed correctly, see %sthe WIKI page%s for reasons and solutions.")." certid:$table:".intval($certid), "<a href='http://wiki.cacert.org/wiki/FAQ/CertificateRenewal'>", "</a>");
+                               printf('<p>' . _("Your certificate request has failed to be processed correctly, see %sthe WIKI page%s for reasons and solutions.") . " certid:$table:".intval($certid) . '</p>', "<a href='http://wiki.cacert.org/wiki/FAQ/CertificateRenewal'>", "</a>");
                                $subject="[CAcert.org] Certificate FAILURE";
                                $body = "A certificate has failed: $table $certid $id $show\n\n";
                        }
 
                        $body .= _("Best regards")."\n"._("CAcert.org Support!");
 
-                       sendmail("philipp@cacert.org", $subject, $body, "returns@cacert.org", "", "", "CAcert Support");
+                       sendmail("sw-message@cacert.org", $subject, $body, "returns@cacert.org", "", "", "CAcert Support");
 
                        if($show) showfooter();
                        if($show) exit;
 
        function sanitizeHTML($input)
        {
-               return htmlentities(strip_tags($input), ENT_QUOTES, 'ISO-8859-1');
+               return htmlentities(strip_tags($input), ENT_QUOTES | ENT_SUBSTITUTE, 'ISO-8859-1', false);
                //In case of problems, please use the following line again:
                //return htmlentities(strip_tags(utf8_decode($input)), ENT_QUOTES);
                //return htmlspecialchars(strip_tags($input));
                return $res;
        }
 
+       /**
+         * Returns the given ip address truncated to /16 (ipv4) or to /48 (ipv6)
+         */
+       function anonymizeIP($ip){
+               $bits = @inet_pton($ip);
+               if($bits === false) {
+                       return false;
+               }
 
-?>
+               if(strlen($bits) == 4) {
+                       $bits[2] = "\0";
+                       $bits[3] = "\0";
+                       $newIP = @inet_ntop($bits);
+                       if($newIP !== false) {
+                               $newIP .= "/16";
+                       }
+                       return $newIP;
+               } else if(strlen($bits) == 16) {
+                       for($i=6;$i<16;$i++){
+                               $bits[$i]="\0";
+                       }
+                       $newIP = @inet_ntop($bits);
+                       if($newIP !== false) {
+                               $newIP .= "/48";
+                       }
+                       return $newIP;
+               }
+               return false;
+       }
index 10c4e0a..08eb807 100644 (file)
@@ -66,7 +66,7 @@ google_color_border = "FFFFFF";
     </div>
     <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
     <div class="relatedLinks">
-      <h3 class="pointer" onclick="explode('recom')"><?=_("Advertising")?></h3>
+      <h3 class="pointer" onclick="explode('recom')">Funding</h3>
       <ul class="menu" id="recom"><?
        $query = "select * from `advertising` where `expires`>NOW() and `active`=1";
        $res = mysql_query($query);
@@ -80,7 +80,7 @@ google_color_border = "FFFFFF";
     <div class="story">
 <? if($title2!="") echo "<h3>$title2</h3>"; ?>
 <? if($_SESSION['_config']['errmsg'] != "") { ?>
-<p><font color="#ff0000" size="+2"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
+<p class="error_fatal"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?></p>
 <? } ?>
 <?
 
index 15dee8a..270a569 100644 (file)
@@ -24,7 +24,7 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) && strstr($_SERVER['HTTP_USER_A
                        'manually created certificate requests instead.')?></p>
        </noscript>
 
-       <div id="noActiveX" style="color:red">
+       <div id="noActiveX" class="error_fatal">
                <p><?=_('Could not initialize ActiveX object required for certificate generation.')?></p>
                <p><?=_('You have to enable ActiveX for this to work. On Windows Vista, Windows 7 and '.
                        'later versions you have to add this website to the list of trusted sites '.
@@ -41,7 +41,7 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) && strstr($_SERVER['HTTP_USER_A
                </p>
        </div>
 
-       <form method="post" style="display:none" action="account.php"
+       <form method="post" style="display:none;" action="account.php"
                        id="CertReqForm">
                <input type="hidden" name="oldid" value="<?=intval($id)?>" />
                <input type="hidden" id="CSR" name="CSR" />
@@ -72,7 +72,7 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) && strstr($_SERVER['HTTP_USER_A
                                // the maximum is 2048, then only 1024, 1536 and 2048 bits may
                                // be specified as key size.
                                echo _('Step')?>: <span id="keySizeStep"></span></p>
-                       <p style="color:red"><?php
+                       <p class="error_fatal"><?php
                                printf(_('Please note that RSA key sizes smaller than %d bit '.
                                        'will not be accepted by CAcert.'),
                                        2048)?>
index dd8afd3..f9c1399 100644 (file)
@@ -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
index 127c6b7..3c18731 100644 (file)
@@ -15,7 +15,7 @@
     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( __DIR__ . "/../notary.inc.php");
 /**
  * Checks if the user may log in and retrieve the user id
  *
@@ -32,9 +32,9 @@
 function get_user_id_from_cert($serial, $issuer_cn)
 {
        $query = "select `memid` from `emailcerts` where
-                       `serial`='".mysql_escape_string($serial)."' and
+                       `serial`='".mysql_real_escape_string($serial)."' and
                        `rootcert`= (select `id` from `root_certs` where
-                               `Cert_Text`='".mysql_escape_string($issuer_cn)."') and
+                               `Cert_Text`='".mysql_real_escape_string($issuer_cn)."') and
                        `revoked`=0 and disablelogin=0 and
                        UNIX_TIMESTAMP(`expire`) - UNIX_TIMESTAMP() > 0";
        $res = mysql_query($query);
@@ -146,9 +146,7 @@ function runCommand($command, $input = "", &$output = null, &$errors = true) {
                        $Result |= 5;
                }
 
-               $query = mysql_query('SELECT SUM(`points`) AS `points` FROM `notary` AS `n` WHERE `n`.`to` = \''.(int)intval($userID).'\' AND `n`.`expire` < now() and `deleted` = 0');
-               $row = mysql_fetch_assoc($query);
-               if ($row['points'] < 100) {
+               if (get_received_assurance_points(intval($userID)) < 100) {
                        $Result |= 3;
                }
 
index c14f8c2..cf36592 100644 (file)
 
        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'] == "")
                {
index 10185fc..d5e0ad9 100644 (file)
@@ -24,9 +24,8 @@
        }
        $_SESSION['_config']['normalhostname'] = "www.cacert.org";
        $_SESSION['_config']['securehostname'] = "secure.cacert.org";
-       $_SESSION['_config']['tverify'] = "tverify.cacert.org";
 
-       function sendmail($to, $subject, $message, $from, $replyto = "", $toname = "", $fromname = "", $errorsto = "returns@cacert.org", $extra="")
+       function sendmail($to, $subject, $message, $from, $replyto = "", $toname = "", $fromname = "", $errorsto = "returns@cacert.org", $use_utf8 = true)
        {
                $lines = explode("\n", $message);
                $message = "";
@@ -49,7 +48,7 @@
                $smtp = fsockopen("localhost", 25);
                if(!$smtp)
                {
-                  echo("Could not connect to mailserver at localhost:25\n");
+                 echo("Could not connect to mailserver at localhost:25\n");
                  return;
                }
                $InputBuffer = fgets($smtp, 1024);
                        fputs($smtp, "Subject: $subject\r\n");
                }
                fputs($smtp, "Mime-Version: 1.0\r\n");
-               if($extra == "")
+               if($use_utf8)
                {
                        fputs($smtp, "Content-Type: text/plain; charset=\"utf-8\"\r\n");
-                       fputs($smtp, "Content-Transfer-Encoding: 8bit\r\n");
-               } else {
+               }
+               else
+               {
                        fputs($smtp, "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n");
-                       fputs($smtp, "Content-Transfer-Encoding: quoted-printable\r\n");
-                       fputs($smtp, "Content-Disposition: inline\r\n");
                }
+               fputs($smtp, "Content-Transfer-Encoding: quoted-printable\r\n");
+               fputs($smtp, "Content-Disposition: inline\r\n");
+
 //             fputs($smtp, "Content-Transfer-Encoding: BASE64\r\n");
                fputs($smtp, "\r\n");
 //             fputs($smtp, chunk_split(base64_encode(recode("html..utf-8", $message)))."\r\n.\r\n");
-               fputs($smtp, recode("html..utf-8", $message)."\r\n.\r\n");
+               $encoded_lines = explode( "\n", str_replace("\r", "", $message) );
+               array_walk( $encoded_lines,
+               function (&$a) {
+                 $a = quoted_printable_encode(recode("html..utf-8", $a));
+               });
+               $encoded_message = implode("\n", $encoded_lines);
+
+               $encoded_message = str_replace("\r.", "\r=2E", $encoded_message);
+               $encoded_message = str_replace("\n.", "\n=2E", $encoded_message);
+               fputs($smtp, $encoded_message);
+               fputs($smtp, "\r\n.\r\n");
                fputs($smtp, "QUIT\n");
                $InputBuffer = fgets($smtp, 1024);
                fclose($smtp);
index 3b8e736..4d1def9 100644 (file)
@@ -194,6 +194,7 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
 
        /**
         * Calculate the experience points from a given Assurance
+        *
         * @param array  $row - [inout] associative array containing the data from
         *     the `notary` table, the keys 'experience' and 'calc_awarded' will be
         *     added
@@ -254,7 +255,6 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
                                $row['deleted'] = THAWTE_REVOCATION_DATETIME;
                                break;
                }
-
                // Don't count revoked assurances even if we are displaying them
                if ($row['deleted'] !== NULL_DATETIME) {
                        $row['experience'] = 0;
@@ -322,6 +322,69 @@ 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));
+               while($row = mysql_fetch_assoc($res))
+               {
+                       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));
+
+               // this loop sums experience points from recieved assurances
+               // this happens when the member has assurances with more than 150 points (super assurances)
+               // such points/assurances should be removed from the database. Afterwards, this logic can be removed.
+               while($row = mysql_fetch_assoc($res))
+               {
+                       calc_assurances($row, $sum_points, $sum_experience);
+               }
+
+               $res = get_given_assurances(intval($userid));
+               while($row = mysql_fetch_assoc($res))
+               {
+                       calc_experience($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)
+       {
+               $assurance = min(100, get_received_assurance_points($userid));
+               $experience = min(50, get_received_experience_points($userid));
+               if($assurance < 100) {
+                       return $assurance;
+               } else {
+                       return 100 + $experience;
+               }
+       }
+
+       /**
+         * 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 ******************
 
@@ -332,15 +395,15 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
 
 ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
-       <tr>
-               <td class="title"><?=_("Assurer Ranking")?></td>
-       </tr>
-       <tr>
-               <td class="DataTD"><?=sprintf(_("You have made %s assurances which ranks you as the #%s top assurer."), intval($num_of_assurances), intval($rank_of_assurer) )?></td>
-       </tr>
-       <tr>
-               <td class="DataTD"><?=sprintf(_("You have received %s assurances which ranks you as the #%s top assuree."), intval($num_of_assurees), intval($rank_of_assuree) )?></td>
-       </tr>
+    <tr>
+       <td class="title"><?=_("Assurer Ranking")?></td>
+    </tr>
+    <tr>
+       <td class="DataTD"><?=sprintf(_("You have made %s assurances which ranks you as the #%s top assurer."), intval($num_of_assurances), intval($rank_of_assurer) )?></td>
+    </tr>
+    <tr>
+       <td class="DataTD"><?=sprintf(_("You have received %s assurances which ranks you as the #%s top assuree."), intval($num_of_assurees), intval($rank_of_assuree) )?></td>
+    </tr>
 </table>
 <br/>
 <?
@@ -354,15 +417,11 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
         */
        function output_assurances_header($title, $support, $log)
        {
-               if ($support == 1) {
-                       $log = 1;
-               }
-
                $colspan = 7;
                if ($support == 1) {
                        $colspan += 2;
                }
-               if ($log == 1) {
+               if ($log == 1 || $support == 1) {
                        $colspan += 1;
                }
 ?>
@@ -377,25 +436,25 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
                if ($support == 1)
                {
 ?>
-               <td class="DataTD"><strong><?=_("When")?></strong></td>
-               <td class="DataTD"><strong><?=_("Email")?></strong></td>
+       <td class="DataTD"><strong><?=_("When")?></strong></td>
+       <td class="DataTD"><strong><?=_("Email")?></strong></td>
 <?
                }
 ?>
-               <td class="DataTD"><strong><?=_("Who")?></strong></td>
-               <td class="DataTD"><strong><?=_("Points")?></strong></td>
-               <td class="DataTD"><strong><?=_("Location")?></strong></td>
-               <td class="DataTD"><strong><?=_("Method")?></strong></td>
-               <td class="DataTD"><strong><?=_("Experience Points")?></strong></td>
+       <td class="DataTD"><strong><?=_("Who")?></strong></td>
+       <td class="DataTD"><strong><?=_("Points")?></strong></td>
+       <td class="DataTD"><strong><?=_("Location")?></strong></td>
+       <td class="DataTD"><strong><?=_("Method")?></strong></td>
+       <td class="DataTD"><strong><?=_("Experience Points")?></strong></td>
 <?
-               if ($log == 1)
+               if ($log == 1 || $support == 1)
                {
 ?>
                <td class="DataTD"><strong><?=_("Revoked")?></strong></td>
 <?
                }
 ?>
-       </tr>
+    </tr>
 <?
        }
 
@@ -424,10 +483,10 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
                <td class="DataTD"><strong><?=$experience_txt?>:</strong></td>
                <td class="DataTD"><?=intval($sumexperience)?></td>
 <?
-               if ($log == 1)
+               if ($log == 1 || $support == 1)
                {
 ?>
-               <td class="DataTD">&nbsp;</td>
+       <td class="DataTD">&nbsp;</td>
 <?
                }
 ?>
@@ -532,14 +591,14 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
        {
 ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
-       <tr>
-               <td colspan="4" class="title"><?=_("Summary of your Points")?></td>
-       </tr>
-       <tr>
-               <td class="DataTD"><strong><?=_("Description")?></strong></td>
-               <td class="DataTD"><strong><?=_("Points")?></strong></td>
-               <td class="DataTD"><strong><?=_("Countable Points")?></strong></td>
-               <td class="DataTD"><strong><?=_("Remark")?></strong></td>
+    <tr>
+       <td colspan="4" class="title"><?=_("Summary of your Points")?></td>
+    </tr>
+    <tr>
+       <td class="DataTD"><strong><?=_("Description")?></strong></td>
+       <td class="DataTD"><strong><?=_("Points")?></strong></td>
+       <td class="DataTD"><strong><?=_("Countable Points")?></strong></td>
+       <td class="DataTD"><strong><?=_("Remark")?></strong></td>
     </tr>
 <?
        }
@@ -555,12 +614,12 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
        function output_summary_row($title,$points,$points_countable,$remark)
        {
 ?>
-       <tr>
-               <td class="DataTD"><strong><?=$title?></strong></td>
-               <td class="DataTD"><?=$points?></td>
-               <td class="DataTD"><?=$points_countable?></td>
-               <td class="DataTD"><?=$remark?></td>
-       </tr>
+    <tr>
+       <td class="DataTD"><strong><?=$title?></strong></td>
+       <td class="DataTD"><?=$points?></td>
+       <td class="DataTD"><?=$points_countable?></td>
+       <td class="DataTD"><?=$remark?></td>
+    </tr>
 <?
        }
 
@@ -585,7 +644,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 +674,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))
                {
@@ -1402,8 +1461,196 @@ function get_user_agreements($memid, $type=null, $active=null){
                return (strtotime($date)<=time()+$diff*86400);
        }
 
+       // table layout for organisation
+       /**
+        * org_edit_org_table()
+        *
+        * @param mixed $orgname
+        * @param mixed $contactmail
+        * @param mixed $town
+        * @param mixed $state
+        * @param mixed $country
+        * @param mixed $comment
+        * @param integer $type  0 - new, 1, edit
+        * @return
+        */
+       function org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, $type=0){
+               if ($type > 0) {
+                       $title = _('Edit Organisation');
+                       $action = _('Update');
+               } else {
+                       $title = _('New Organisation');
+                       $action = _('Next');
+               }
+               org_edit_org_table_header($title);
+               org_edit_org_table_row(_('Organisation Name'), 'O', $orgname, 64);
+               org_edit_org_table_row(_('Contact Email'), 'contact', $contactmail, 255);
+               org_edit_org_table_row(_('Town/Suburb'), 'L', $town, 128);
+               org_edit_org_table_row(_('State/Province'), 'ST', $state, 128);
+               org_edit_org_table_country(_('Country'), 'C', $country, 2);
+               org_edit_org_table_comment(_('Comments'), 'comments', $comment);
+               org_edit_org_table_footer($action);
+       }
+
+       /**
+        * org_edit_org_table_header()
+        *
+        * @param mixed $title
+        * @return
+        */
+       function org_edit_org_table_header($title){
+?>
+               <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
+                       <tr>
+                               <td colspan="3" class="title"><?=$title?></td>
+                       </tr>
+<?
+       }
+
+       /**
+        * org_edit_org_table_row()
+        *
+        * @param mixed $label
+        * @param mixed $name
+        * @param mixed $value
+        * @param mixed $length
+        * @return
+        */
+       function org_edit_org_table_row($label, $name, $value, $length){
+?>
+                       <tr>
+                               <td class="DataTD"><?=$label?>:</td>
+                               <td class="DataTD"><input type="text" name="<?=$name?>" value="<?=SanitizeHTML($value)?>" maxlength="<?=intval($length)?>" size="90"></td>
+                               <td class="DataTD"><? printf(_('max %d characters'),$length)?></td>
+                       </tr>
+<?
+       }
+
+       /**
+        * org_edit_org_table_country()
+        *
+        * @param mixed $label
+        * @param mixed $name
+        * @param mixed $value
+        * @param mixed $length
+        * @return
+        */
+       function org_edit_org_table_country($label, $name, $value, $length){
+?>
+                       <tr>
+                               <td class="DataTD"><?=$label?>:</td>
+                               <td class="DataTD">
+                                       <input type="text" name="<?=$name?>" value="<?=SanitizeHTML($value)?>" maxlength="<?=intval($length)?>" size="<?=intval($length)?>" />
+                                       <? printf(_('(2 letter %s ISO code %s )'), '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">', '</a>')?>
+                               </td>
+                               <td class="DataTD"><?=sprintf(_('max %d characters'),$length)?></td>
+                       </tr>
+<?
+       }
+
+       /**
+        * org_edit_org_table_comment()
+        *
+        * @param mixed $label
+        * @param mixed $name
+        * @param mixed $value
+        * @return
+        */
+       function org_edit_org_table_comment($label, $name, $value){
+?>
+                       <tr>
+                               <td class="DataTD"><?=$label?>:</td>
+                               <td class="DataTD"><textarea name="<?=$name?>" cols=60 rows=10><?=SanitizeHTML($value)?></textarea></td>
+                               <td class="DataTD">&nbsp</td>
+                       </tr>
+<?
+       }
+
+       /**
+        * org_edit_org_table_footer()
+        *
+        * @param mixed $label
+        * @return
+        */
+       function org_edit_org_table_footer($label){
+?>
+                       <tr>
+                               <td class="DataTD" colspan="3"><input type="submit" name="process" value="<?=$label?>"></td>
+                       </tr>
+               </table>
+<?
+    }
+
+       /**
+        * get_array_from_ini()
+        *  gets an array from an ini file and trims all entries
+        * @param mixed $inifile, path and filename of the ini file
+        * @return
+        */
+       function get_array_from_ini($inifile){
+               $array = parse_ini_file('../config/ttp.ini');
+               ksort($array);
+               foreach($array as $key => $value)
+               {
+                       unset($array[$key]);
+                       $array[trim($key)] = trim($value);
+               }
+               return  $array;
+       }
+
+       /**
+       *  create_selectbox_HTML()
+        *
+        * @param mixed $name, name for the select element
+        * @param mixed $options, array with the data for the dropdown
+        * @param string $value, TRUE if the value for the option should be added
+        * @param string $firstline, if the should be a first line like´Choose country
+        * @param string $selected, if selection matches option key the
+        *         entry is preselected in the dropdownbox
+        * @return
+        */
+       function create_selectbox_HTML($name, array $options, $firstline = '', $value='', $selected = ''){
+               $return_str='<select name="' . $name . '">';
+               if (''!= $firstline) {
+                       $return_str .= '<option>' . $firstline .'</option>';
+               }
+               foreach ($options as $key => $avalue) {
+                       $return_str.='<option';
+                       if ($value) {
+                               $return_str.=' value="'.$avalue.'"';
+                       }
+                       if ($key==$selected){
+                               $return_str.=' selected="selected"';
+                       }
+                       $return_str.='>'.$key.'</option>';
+               }
+               $return_str.='</select>';
+               return  $return_str;
+       }
+
+       //user function
+       function get_user_id_from_email($email){
+               $email = mysql_real_escape_string(trim($email));
+               $res = query_init ("select `id` from `users` where `email` = '" . $email . "'");
+               $row = query_getnextrow($res);
+
+               return intval($row['id']);
+       }
+
+       function get_number_of_adminlog_entries($uid, $typeid, $hours=1){
+               $uid = intval($uid);
+               $typeid = intval($typeid);
+               $hours = intval($hours);
+               $res = query_init ("SELECT count(*) AS `no` FROM `adminlog`
+                       WHERE `adminid` = " . $uid . " AND `actiontypeid`=" . $typeid . " and `when` >  NOW() - INTERVAL " . $hours . " HOUR " );
+               $row = query_getnextrow($res);
+
+               return intval($row['no']);
+       }
+
 /**
- * Write some information to the adminlog
+ * write_se_log()
+ *  writes an information to the adminlog
  *
  * @param int $uid - id of the user account
  * @param int $adminid - id of the admin
@@ -1411,14 +1658,15 @@ function get_user_agreements($memid, $type=null, $active=null){
  * @param string $info - the ticket / arbitration number or other information
  * @return bool - true := success, false := error
  */
-function write_se_log($uid, $adminid, $type, $info){
+function write_se_log($uid, $adminid, $type, $info, $typeid=1){
        //records all support engineer actions changing a user account
        $uid = intval($uid);
        $adminid = intval($adminid);
        $type = mysql_real_escape_string($type);
        $info = mysql_real_escape_string($info);
-       $query="insert into `adminlog` (`when`, `uid`, `adminid`,`type`,`information`) values
-               (Now(), $uid, $adminid, '$type', '$info')";
+       $typeid = intval($typeid);
+       $query="insert into `adminlog` (`when`, `uid`, `adminid`,`type`,`information`,`actiontypeid`) values
+               (Now(), $uid, $adminid, '$type', '$info', '$typeid')";
        return mysql_query($query);
 }
 
@@ -2138,3 +2386,40 @@ function output_gpg_certs($row, $support=0, $readonly=true){
        </tr>
        <?
 }
+
+/**
+ * revoke_assurance()
+ * revokes an assurance and adjusts the old point calculation
+ * @param mixed $assuranceid - id of the assurance
+ * @param mixed $toid        - id of the assuree
+ * @return
+ */
+function revoke_assurance($assuranceid, $toid){
+       $assuranceid = intval($assuranceid);
+       $toid = intval($toid);
+       $points = 0;
+
+       $query = "update `notary` set `deleted` = NOW() where `id` = '$assuranceid' LIMIT 1";
+       mysql_query($query);
+       recalculate_old_assurance_points($toid);
+       fix_assurer_flag($toid);
+}
+
+/**
+ * recalculates the old points of an assuree
+ * @param int $toid        - id of the assuree
+ */
+function recalculate_old_assurance_points($toid){
+       $query = "select * from `notary` where `to` = '$toid' and `method` != 'Administrative Increase' and `deleted` = 0 order by `when`";
+       $res = mysql_query($query);
+       while($row = mysql_fetch_assoc($res)){
+               $maxToAward = max(100 - $points, 0);
+               $newpoints = min($row['awarded'], $maxToAward);
+
+               $points += $row['awarded'];
+
+               $query = "update `notary` set `points` = '". (int)$newpoints ."' where `id`='" . (int)$row['id'] . "' LIMIT 1";
+               mysql_query($query);
+       }
+
+}
index 4ceaf25..03b7814 100644 (file)
@@ -21,8 +21,8 @@
 
        if(0)
        { ?>
-               <font color="#ff0000"><? printf(_("This function is currently disabled. Please visit %s for more information."),
-                       "<a target='_blank' href='http://wiki.cacert.org/wiki/ClientSecurity'>http://wiki.cacert.org/wiki/ClientSecurity</a>")?></font>
+               <span class="error_fatal"><? printf(_("This function is currently disabled. Please visit %s for more information."),
+                       "<a target='_blank' href='http://wiki.cacert.org/wiki/ClientSecurity'>http://wiki.cacert.org/wiki/ClientSecurity</a>")?></span>
 <?
                exit;
        }
diff --git a/includes/tverify_stuff.php b/includes/tverify_stuff.php
deleted file mode 100644 (file)
index 93f7c32..0000000
+++ /dev/null
@@ -1,78 +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
-*/
-
-if(!function_exists("showheader"))
-{
-       function showheader($title = "CAcert.org", $title2 = "")
-       {
-
-?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title><?=$title?></title>
-<? if($_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
-<link rel="stylesheet" href="/styles/default.css" type="text/css">
-<link href="http://my.rsscache.com/www.cacert.org/rss.php" rel="alternate" type="application/rss+xml" title="rss">
-</head>
-<body>
- <div id="pagecell1">
-  <div id="pageName"><br>
-    <h2><a href="http://<?=$_SESSION['_config']['normalhostname']?>"><img src="https://www.CAcert.org/images/cacert4.png" border="0" alt="CAcert.org logo"></a></h2>
-<div id="googlead"><h2><?=_("Free digital certificates!")?></h2></div>
-  </div>
-  <div id="pageNav">
-    <div class="relatedLinks">
-      <h3><?=_("Join CAcert.org")?></h3>
-      <a href="http://<?=$_SESSION['_config']['normalhostname']?>/"><?=_("Main Website")?></a> 
-      <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=1"><?=_("Join")?></a> 
-    </div>
-    <div class="relatedLinks">
-      <h3><?=_("My Account")?></h3>
-      <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=4"><?=_("Normal Login")?></a> 
-      <a href="https://<?=$_SESSION['_config']['securehostname']?>/index.php?id=4"><?=_("Cert Login")?></a>
-      <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=5"><?=_("Lost Password")?></a>
-    </div>
-  </div>
-  <div id="content">
-    <div class="story">
-      <h3><?=$title2?></h3>
-<? if($_SESSION['_config']['errmsg'] != "") { ?>
-<p><font color="#ff0000" size="+2"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
-<? } ?>
-<?
-       }
-}
-
-if(!function_exists("showfooter"))
-{
-       function showfooter()
-       {
-?>
-      </div>
-    </div>
-  <div id="siteInfo">
-        <a href="//wiki.cacert.org/FAQ/AboutUs"><?=_("About Us")?></a> | <a href="/index.php?id=13"><?=_("Donations")?></a> | <a href="http://wiki.cacert.org/wiki/CAcertIncorporated"><?=_("Association Membership")?></a> |
-        <a href="/index.php?id=10"><?=_("Privacy Policy")?></a> |
-        <a href="/index.php?id=51"><?=_("Mission Statement")?></a> | <a href="/index.php?id=11"><?=_("Contact Us")?></a> |
-        <a href="/index.php?id=19"><?=_("Further Information")?></a> | &copy;2002-<?=date("Y")?> <?=_("by CAcert")?></div>
-</div>  
-</body>             
-</html><?
-       }
-}
-?>
index ea28c0e..767e721 100644 (file)
@@ -14,8 +14,8 @@
     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
-*/ ?>
-<?
+*/
+
   $query = "select * from `users` where `id`='".intval($_SESSION['profile']['id'])."' and `users`.`deleted`=0";
   $res = mysql_query($query);
   $user = mysql_fetch_assoc($res);
 
   if($showdetails){
     $body  = sprintf(_("Hi %s,"),$user['fname'])."\n\n";
-    $body .= _("You receive this automatic mail since you yourself or someone ".
+    $ip = anonymizeIp($_SERVER['REMOTE_ADDR']);
+    if($ip === false) {
+      $ip = _("Error anonymising IP/network information");
+    }
+    $body .= sprintf(_("You receive this automatic mail since you yourself or someone ".
       "else looked up your secret questions and answers for a forgotten ".
       "password.\n\n".
+      "Network: %s\nTime: %s\n\n".
       "If it was you who looked up or changed that data, or clicked ".
       "through the menu in your account, everything is in best order ".
       "and you can ignore this mail.\n\n".
       "But if you received this mail without a recognisable reason, ".
       "there is a danger that an unauthorised person accessed your ".
       "account, and you should promptly change your password and your ".
-      "secret questions and answers.")."\n\n";
+      "secret questions and answers."),
+      $ip,
+      date("Y-m-d H:i:s T"))."\n\n";
 
     $body .= _("Best regards")."\n"._("CAcert Support");
 
index 29aeb21..97f6f05 100644 (file)
   </tr>
 <? } ?>
   <tr>
-    <td class="DataTD"><?=_("New Pass Phrase")?><font color="red">*</font>: </td>
+    <td class="DataTD"><?=_("New Pass Phrase")?><span class="error_indicator">*</span>: </td>
     <td class="DataTD"><input type="password" name="pword1"></td>
   </tr>
   <tr>
-    <td class="DataTD"><?=_("Pass Phrase Again")?><font color="red">*</font>: </td>
+    <td class="DataTD"><?=_("Pass Phrase Again")?><span class="error_indicator">*</span>: </td>
     <td class="DataTD"><input type="password" name="pword2"></td>
   </tr>
   <tr>
-    <td class="DataTD" colspan="2"><font color="red">*</font><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol (all white spaces at the beginning and end are removed).")?></td>
+    <td class="DataTD" colspan="2"><span class="error_indicator">*</span><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol (all white spaces at the beginning and end are removed).")?></td>
   </tr>
   <tr>
     <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Update Pass Phrase")?>"></td>
index 14a47c0..2ad526e 100644 (file)
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */ ?>
 <?
-       // Reset session variables regarding Org's, present empty form  
-       if (array_key_exists('O',$_SESSION['_config']))         $_SESSION['_config']['O'] = "";
-  if (array_key_exists('contact',$_SESSION['_config']))   $_SESSION['_config']['contact'] = "";        
-  if (array_key_exists('L',$_SESSION['_config']))         $_SESSION['_config']['L'] = "";
-  if (array_key_exists('ST',$_SESSION['_config']))        $_SESSION['_config']['ST'] = "";
-  if (array_key_exists('C',$_SESSION['_config']))         $_SESSION['_config']['C'] = "";
-  if (array_key_exists('comments',$_SESSION['_config']))  $_SESSION['_config']['comments'] = "";
-       
+$orgname = '';
+$contactmail = '';
+$town = '';
+$state = '';
+$country = '';
+$comment = '';
+
+       // Reset session variables regarding Org's, present empty form
+if (array_key_exists('O',$_SESSION['_config']))         $_SESSION['_config']['O'] = "";
+if (array_key_exists('contact',$_SESSION['_config']))   $_SESSION['_config']['contact'] = "";
+if (array_key_exists('L',$_SESSION['_config']))         $_SESSION['_config']['L'] = "";
+if (array_key_exists('ST',$_SESSION['_config']))        $_SESSION['_config']['ST'] = "";
+if (array_key_exists('C',$_SESSION['_config']))         $_SESSION['_config']['C'] = "";
+if (array_key_exists('comments',$_SESSION['_config']))  $_SESSION['_config']['comments'] = "";
+
 ?>
 <form method="post" action="account.php">
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
-  <tr>
-    <td colspan="2" class="title"><?=_("New Organisation")?></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Organisation Name")?>:</td>
-    <td class="DataTD"><input type="text" name="O" value="" maxlength="50" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Contact Email")?>:</td>
-    <td class="DataTD"><input type="text" name="contact" value="" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Town/Suburb")?>:</td>
-    <td class="DataTD"><input type="text" name="L" value="" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("State/Province")?>:</td>
-    <td class="DataTD"><input type="text" name="ST" value="" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Country")?>:</td>
-    <td class="DataTD"><input type="text" name="C" value="" size="5">
-        <?php printf(_('(2 letter %s ISO code %s )'),
-            '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">',
-            '</a>')?>
-    </td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Comments")?>:</td>
-    <td class="DataTD"><textarea name="comments" cols="60" rows="10"></textarea></td>
-  </tr>
-  <tr>
-    <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Next")?>"></td>
-  </tr>
-</table>
+<?
+org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, 0);
+?>
 <input type="hidden" name="oldid" value="<?=$id?>">
 </form>
index a70f608..db63529 100644 (file)
@@ -63,7 +63,7 @@
                $domcount = mysql_num_rows($r2);
 ?>
   <tr>
-    <td class="DataTD"><?=htmlspecialchars($row['O'])?>, <?=htmlspecialchars($row['ST'])?> <?=htmlspecialchars($row['C'])?></td>
+    <td class="DataTD"><?=sanitizeHTML($row['O'])?>, <?=sanitizeHTML($row['ST'])?> <?=sanitizeHTML($row['C'])?></td>
     <td class="DataTD"><a href="account.php?id=26&amp;orgid=<?=intval($row['id'])?>"><?=_("Domains")?> (<?=$domcount?>)</a></td>
     <td class="DataTD"><a href="account.php?id=32&amp;orgid=<?=$row['id']?>"><?=_("Admins")?> (<?=$admincount?>)</a></td>
     <td class="DataTD"><a href="account.php?id=27&amp;orgid=<?=$row['id']?>"><?=_("Edit")?></a></td>
index a1086d4..d07a781 100644 (file)
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */ ?>
 <?
-       $row = mysql_fetch_assoc(mysql_query("select * from `orginfo` where `id`='".intval($_REQUEST['orgid'])."'"));
+    $orgid = intval($_REQUEST['orgid']);
+    $row = mysql_fetch_assoc(mysql_query("select * from `orginfo` where `id`='" . $orgid . "'"));
+    $orgname = $row['O'];
+    $contactmail = $row['contact'];
+    $town = $row['L'];
+    $state = $row['ST'];
+    $country = $row['C'];
+    $comment = $row['comments'];
 ?>
 <form method="post" action="account.php">
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
-  <tr>
-    <td colspan="2" class="title"><?=_("Edit Organisation")?></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Organisation Name")?>:</td>
-    <td class="DataTD"><input type="text" name="O" value="<?=$row['O']?>" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Contact Email")?>:</td>
-    <td class="DataTD"><input type="text" name="contact" value="<?=($row['contact'])?>" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Town/Suburb")?>:</td>
-    <td class="DataTD"><input type="text" name="L" value="<?=($row['L'])?>" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("State/Province")?>:</td>
-    <td class="DataTD"><input type="text" name="ST" value="<?=($row['ST'])?>" size="90"></td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Country")?>:</td>
-    <td class="DataTD"><input type="text" name="C" value="<?=($row['C'])?>" size="5">
-        <?php printf(_('(2 letter %s ISO code %s )'),
-            '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">',
-            '</a>')?>
-    </td>
-  </tr>
-  <tr>
-    <td class="DataTD"><?=_("Comments")?>:</td>
-    <td class="DataTD"><textarea name="comments" cols=60 rows=10><?=($row['comments'])?></textarea></td>
-  </tr>
-  <tr>
-    <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Update")?>"></td>
-  </tr>
-</table>
+<?
+    org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, 1);
+?>
 <input type="hidden" name="oldid" value="<?=intval($id)?>">
-<input type="hidden" name="orgid" value="<?=intval($_REQUEST['orgid'])?>">
+<input type="hidden" name="orgid" value="<?=$orgid?>">
 <input type="hidden" name="csrf" value="<?=make_csrf('orgdetchange')?>" />
 </form>
index a809595..9613c2d 100644 (file)
@@ -1,6 +1,6 @@
 <? /*
     LibreSSL - CAcert web application
-    Copyright (C) 2004-2008  CAcert Inc.
+    Copyright (C) 2004-2014  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
 */
 if(!array_key_exists('secrethash',$_SESSION['_config'])) $_SESSION['_config']['secrethash'] = md5(date("YmdHis").rand(0, intval(date("u"))));
 ?>
-<H3><?=_("Contact Us")?></H3>
+<h3><?=_("Contact Us")?></h3>
 
 <p><b><?=_("General Questions")?></b></p>
-<p><b><?=_("PLEASE NOTE: Due to the large amounts of support questions, incorrectly directed emails may be over looked, this is a volunteer effort and directing general questions to the right place will help everyone, including yourself as you will get a reply quicker.")?></b></p>
+<p><b><?=_("PLEASE NOTE: CAcert support is a volunteer effort. You would help everyone, including yourself to get a reply quickly, by directing general questions to the right place. Due to the large amounts of support questions, incorrectly directed emails may be overlooked.")?></b></p>
 <p><b><?=_("If you are contacting us about advertising, please use the form at the bottom of the website, the first contact form is not the correct place.")?></b></p>
-<p><?=sprintf(_("If you are having trouble with your username or password, please visit our %swiki page%s for more information"), "<a href='http://wiki.cacert.org/wiki/FAQ/LostPasswordOrAccount' target='_new'>", "</a>");?></p>
+<p><?=sprintf(_("If you are having trouble with your username or password, please visit our %swiki page%s for more information"), "<a href='//wiki.cacert.org/wiki/FAQ/LostPasswordOrAccount' target='_new'>", "</a>");?></p>
 <p><?=_("Before contacting us, be sure to read the information on our official and unofficial HowTo and FAQ pages.")?> - <a href="//wiki.cacert.org/HELP/"><?=_("Go here for more details.")?></a></p>
-<p><?=_("General questions about CAcert should be sent to the general support list, please send all emails in ENGLISH only, this list has many more volunteers then those directly involved with the running of the website, everyone on the mailing list understands english, even if this isn't their native language this will increase your chance at a competent reply. While it's best if you sign up to the mailing list to get replied to, you don't have to, but please make sure you note this in your email, otherwise it might seem like you didn't get a reply to your question.")?></p>
-<p><a href="https://lists.cacert.org/wws/info/cacert-support"><?=_("Click here to go to the Support List")?></a></p>
-<p><?=_("You can alternatively use the form below, however joining the list is the prefered option to support your queries")?></p>
+<p><?=_("General questions about CAcert should be sent to the general support mailing list. This list is read by many more volunteers, then those directly involved in the support team. Please send all emails in ENGLISH only, as everyone on the mailing list understands English, even if this is not their native language. Doing so will increase your chance to get a competent reply.")?></p>
+<p>
+<?=sprintf(_("You can use the form below to contact the support team directly. The mail is NOT send to the mailing list. Alternatively you can contact the support team by writing an email to %ssupport@cacert.org%s"), "<a href='mailto:support@cacert.org'>", "</a>");?></p>
 <form method="post" action="account.php" name="form1">
   <input type="hidden" name="oldid" value="<?=$id?>">
 <!--   <input type="hidden" name="support" value="yes"> --> 
@@ -35,23 +35,32 @@ if(!array_key_exists('secrethash',$_SESSION['_config'])) $_SESSION['_config']['s
     <label>If you're human leave this blank:</label>
     <input name="robotest" type="text" id="robotest" class="robotest" />
   </p>
-<table border="0">
-    <tr><td width="100"><?=_("Your Name")?>:</td><td width="100"><input type="text" name="who"></td><td width="100"></td><td width="100"></td>
-    <tr><td width="100"><?=_("Your Email")?>:</td><td colspan="3"><input type="text" name="email"></td>
-    <tr><td width="100"><?=_("Subject")?>:</td><td colspan="3"><input type="text" name="subject"></td></tr>
-    <tr><td width="100" valign="top"><?=_("Message")?>:</td><td colspan="3"><textarea name="message" cols="70" rows="10"></textarea></td></tr>
-
+  <table border="0">
+    <tr>
+      <td width="100"><?=_("Your Name")?>:</td>
+      <td width="300"><input type="text" name="who"></td>
+    </tr>
+    <tr>
+      <td><?=_("Your Email")?>:</td>
+      <td><input type="text" name="email"></td>
+    </tr>
+    <tr>
+      <td><?=_("Subject")?>:</td>
+      <td><input type="text" name="subject"></td>
+    </tr>
+    <tr>
+      <td valign="top"><?=_("Message")?>:</td>
+      <td><textarea name="message" cols="70" rows="10"></textarea></td>
+    </tr>
     <tr>
-      <td colspan="2"><font color="#ff0000"><?=_("Warning: Please do not use \"send to mailing list\" when you entered confidential data. The request is being sent to a public mailinglist.")?></font></td>
       <td colspan="2"><?=_("For confidential data use \"send to support\".")?></td>
     </tr>
     <tr>
-      <td colspan="2"><input type="submit" name="process[0]" value="<?=_("Send to mailing list")?>"></td>
       <td colspan="2"><input type="submit" name="process[1]" value="<?=_("Send to support")?>"></td>
     </tr>
   </table>
 </form>
-
+<p><a href="https://lists.cacert.org/wws/info/cacert-support"><?=_("Click here to go to the Support List")?></a></p>
 <p><b>IRC</b></p>
 <p><a href="irc://irc.CAcert.org/CAcert">irc://irc.CAcert.org/CAcert</a></p>
 <p><b>Secure IRC</b></p>
index d61d8db..f644025 100644 (file)
@@ -57,7 +57,7 @@ require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php');
        $res = mysql_query($query);
        while($row = mysql_fetch_assoc($res))
        {
-               $lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='".mysql_escape_string($row['lang'])."'"));
+               $lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='".mysql_real_escape_string($row['lang'])."'"));
 ?>
   <tr>
     <td class="DataTD"><?=_("Additional Language")?>:</td>
index c889ce3..279da15 100644 (file)
@@ -37,7 +37,7 @@ if(intval(array_key_exists('userid',$_REQUEST)?$_REQUEST['userid']:0) <= 0)
 {
     $_REQUEST['userid'] = 0;
 
-    $emailsearch = $email = mysql_real_escape_string(stripslashes($_REQUEST['email']));
+    $emailsearch = $email = mysql_real_escape_string(stripslashes(trim($_REQUEST['email'])));
 
     //Disabled to speed up the queries
     //if(!strstr($email, "%"))
@@ -112,17 +112,10 @@ if(intval(array_key_exists('userid',$_REQUEST)?$_REQUEST['userid']:0) <= 0)
 // display user information for given user id
 if(intval($_REQUEST['userid']) > 0) {
     $userid = intval($_REQUEST['userid']);
-    $res =get_user_data($userid);
-    if(mysql_num_rows($res) <= 0) {
+    $user_data_res =get_user_data($userid);
+    if(mysql_num_rows($user_data_res) <= 0) {
         echo _("I'm sorry, the user you were looking for seems to have disappeared! Bad things are afoot!");
     } else {
-        $row = mysql_fetch_assoc($res);
-        $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($row['id'])."' and `deleted` = 0";
-        $dres = mysql_query($query);
-        $drow = mysql_fetch_assoc($dres);
-        $alerts =get_alerts(intval($row['id']));
-
-//display account data
 
 //deletes an assurance
         if(array_key_exists('assurance',$_REQUEST) && $_REQUEST['assurance'] > 0 && $ticketvalidation == true)
@@ -136,8 +129,7 @@ if(intval($_REQUEST['userid']) > 0) {
                 if ($res) {
                     $trow = mysql_fetch_assoc($res);
                     if ($trow) {
-                        mysql_query("update `notary` set `deleted`=NOW() where `id`='".intval($assurance)."'");
-                        fix_assurer_flag($trow['to']);
+                        revoke_assurance(intval($assurance),$trow['to']);
                     }
                 }
             }
@@ -145,6 +137,15 @@ if(intval($_REQUEST['userid']) > 0) {
             $ticketmsg=_('No assurance revoked. Ticket number is missing!');
         }
 
+        $row = mysql_fetch_assoc($user_data_res);
+        $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($row['id'])."' and `deleted` = 0";
+        $dres = mysql_query($query);
+        $drow = mysql_fetch_assoc($dres);
+        $alerts =get_alerts(intval($row['id']));
+
+//display account data
+
+
 //Ticket number
 ?>
 
@@ -283,12 +284,6 @@ if(intval($_REQUEST['userid']) > 0) {
             <td class="DataTD"><?=_("Ad Admin")?>:</td>
             <td class="DataTD"><a href="account.php?id=43&amp;adadmin=<?=intval($row['id'])?>&amp;ticketno=<?=sanitizeHTML($ticketno)?>"><?=intval($row['adadmin'])?></a> (0 = none, 1 = submit, 2 = approve)</td>
         </tr>
-    <!-- presently not needed
-        <tr>
-            <td class="DataTD"><?=_("Tverify Account")?>:</td>
-            <td class="DataTD"><a href="account.php?id=43&amp;tverify=<?=intval($row['id'])?>&amp;ticketno=<?=sanitizeHTML($ticketno)?>"><?=intval($row['tverify'])?></a></td>
-        </tr>
-    -->
         <tr>
             <td class="DataTD"><?=_("General Announcements")?>:</td>
             <td class="DataTD"><a href="account.php?id=43&amp;general=<?=intval($row['id'])?>&amp;ticketno=<?=sanitizeHTML($ticketno)?>"><?=intval($alerts['general'])?></a></td>
@@ -327,6 +322,19 @@ if(intval($_REQUEST['userid']) > 0) {
         </tr>
     <?
                     } else {
+                        $body  = sprintf(_("Hi %s,"),$row['fname'])."\n\n";
+                        $body .= sprintf(_("You receive this automatic mail becasue a supporter ".
+                            "looked up your secret questions and answers for a forgotten ".
+                            "password.\n\n".
+                            "Time: %s\n\n".
+                            "If you received this mail without a recognisable reason, ".
+                            "there is a danger that an unauthorised person accessed your ".
+                            "account, and you should promptly report this to support@cacert.org."),
+                            date("Y-m-d H:i:s T"))."\n\n";
+
+                        $body .= _("Best regards")."\n"._("CAcert Support");
+
+                        sendmail($row['email'], "[CAcert.org] "._("Email Notification"), $body, "support@cacert.org", "", "", "CAcert Support");
     ?>
         <tr>
             <td class="DataTD"><?=_("Lost Password")?> - Q1:</td>
@@ -390,7 +398,7 @@ if(intval($_REQUEST['userid']) > 0) {
     ?>
         <tr>
             <td class="DataTD"><?=_("Assurance Points")?>:</td>
-            <td class="DataTD"><?=intval($drow['points'])?></td>
+            <td class="DataTD"><?=get_received_total_points(intval($row['id']))?></td>
         </tr>
     <?
     // show account history
index 8cdd7ac..67f2520 100644 (file)
@@ -26,6 +26,9 @@
     <td class="DataTD"><input type="text" name="domain" value="<?=array_key_exists('domain',$_POST)?sanitizeHTML($_POST['domain']):''?>"></td>
   </tr>
   <tr>
+    <td class="DataTD" colspan="2"><?=_("For search by ID use # prefix e.g. #123456")?></td>
+  </tr>
+  <tr>
     <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Next")?>"></td>
   </tr>
 </table>
index 0218fa0..e9973f2 100644 (file)
        $userid=0; if(array_key_exists('userid',$_GET)) $userid=intval($_GET['userid']);
        if($userid <= 0)
        {
-               $domainsearch = $domain = mysql_escape_string(stripslashes($_POST['domain']));
-               if(!strstr($domain, "%"))
+               $domainsearch = $domain = mysql_real_escape_string(trim(stripslashes($_POST['domain'])));
+               if(!strstr($domain, "%")) {
                        $domainsearch = "%$domain%";
-               if(preg_match("/^\d+$/",$domain))
+               }
+
+               //check if request is id if not set search ID to -1
+               if(preg_match('/^#(\d+)$/', $domain, $match)) {
                        $domainsearch = "";
+                       $domainid = intval($match[1]);
+               } else {
+                       $domainid = -1;
+               }
+
                $query = "select `users`.`id` as `id`, `domains`.`domain` as `domain`, `domains`.`id`as `domid` from `users`,`domains`
                                where `users`.`id`=`domains`.`memid` and
-                               (`domains`.`domain` like '$domainsearch' or `domains`.`id`='$domain') and
+                               (`domains`.`domain` like '$domainsearch' or `domains`.`id`='$domainid') and
                                `domains`.`deleted`=0 and `users`.`deleted`=0 and
                                `users`.`verified`=1
                                group by `users`.`id` limit 100";
                $res = mysql_query($query);
-               if(mysql_num_rows($res) >= 1) { ?>
+               if(mysql_num_rows($res) > 1) { ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
     <td colspan="5" class="title"><?=_("Select Specific User Account Details")?></td>
   </tr>
-<?
-       while($row = mysql_fetch_assoc($res))
-       { ?>
+<?                     while($row = mysql_fetch_assoc($res)) { ?>
   <tr>
     <td class="DataTD"><?=_("Domain")?>:</td>
     <td class="DataTD"><?=$row['domid']?></td>
     <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=$row['id']?>"><?=sanitizeHTML($row['domain'])?></a></td>
   </tr>
-<? } if(mysql_num_rows($res) >= 100) { ?>
+<?                     }
+                       if(mysql_num_rows($res) >= 100) { ?>
   <tr>
     <td class="DataTD" colspan="3"><?=_("Only the first 100 rows are displayed.")?></td>
   </tr>
-<? } else { ?>
+<?                     } else { ?>
   <tr>
     <td class="DataTD" colspan="3"><? printf(_("%s rows displayed."), mysql_num_rows($res)); ?></td>
   </tr>
-<? } ?>
+<?                     } ?>
 </table><br><br>
 <?             } elseif(mysql_num_rows($res) == 1) {
                        $row = mysql_fetch_assoc($res);
-                       $_GET['userid'] = intval($row['id']);
+                       $userid = intval($row['id']);
                } else {
                        ?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
                                <tr>
                        </tr>
                </table><br><br><?
                }
-
-               $query = "select `orgid`,`domain`,`id` from `orgdomains` where `domain` like '$domainsearch' or `id`='$domain' limit 100";
+               $query = "select `orgid`,`domain`,`id` from `orgdomains` where `domain` like '$domainsearch' or `id`='$domainid' limit 100";
                $res = mysql_query($query);
-               if(mysql_num_rows($res) >= 1) { ?>
+               if(mysql_num_rows($res) > 1) { ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
     <td colspan="5" class="title"><?=_("Select Specific Organisation Account Details")?></td>
   </tr>
-<?
-       while($row = mysql_fetch_assoc($res))
-       { ?>
+<?                     while($row = mysql_fetch_assoc($res)) { ?>
   <tr>
     <td class="DataTD"><?=_("Domain")?>:</td>
     <td class="DataTD"><?=$row['id']?></td>
     <td class="DataTD"><a href="account.php?id=26&amp;orgid=<?=intval($row['orgid'])?>"><?=sanitizeHTML($row['domain'])?></a></td>
   </tr>
-<? } if(mysql_num_rows($res) >= 100) { ?>
+<?                     }
+                       if(mysql_num_rows($res) >= 100) { ?>
   <tr>
     <td class="DataTD" colspan="3"><?=_("Only the first 100 rows are displayed.")?></td>
   </tr>
-<? } else { ?>
+<?                     } else { ?>
   <tr>
     <td class="DataTD" colspan="3"><? printf(_("%s rows displayed."), mysql_num_rows($res)); ?></td>
   </tr>
-<? } ?>
+<?                     } ?>
 </table><br><br>
 <?             } elseif(mysql_num_rows($res) == 1) {
                        $row = mysql_fetch_assoc($res);
-                       $_GET['userid'] = intval($row['id']);
+                       $userid = intval($row['id']);
                } else {
                        ?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
                                <tr>
 
        if($userid > 0)
        {
-               header("location: account.php?id=43&userid=".intval($_GET['userid']));
+               header("location: account.php?id=43&userid=".intval($userid));
                exit;
        }
 ?>
diff --git a/pages/account/51.php b/pages/account/51.php
deleted file mode 100644 (file)
index 7273840..0000000
+++ /dev/null
@@ -1,34 +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
-*/ ?>
-<? if($_SESSION['profile']['tverify'] <= 0) { echo _("You don't have access to this area."); } else { ?>
-<?
-       $uid = intval($_GET['photoid']);
-       $query = "select * from `tverify` where `id`='$uid' and `modified`=0";
-       $res = mysql_query($query);
-       if(mysql_num_rows($res) > 0) { ?>
-<img src="account.php?id=51&amp;photoid=<?=$uid ?>&amp;img=show" border="0" width="800">
-<? } else {
-        $query = "select * from `tverify` where `id`='$uid' and `modified`=1";
-        $res = mysql_query($query);
-        if(mysql_num_rows($res) > 0)
-        {
-                echo _("This UID has already been voted on.");
-        } else {
-                echo _("Unable to locate a valid request for that UID.");
-        }
- } } ?>
diff --git a/pages/account/52.php b/pages/account/52.php
deleted file mode 100644 (file)
index 6c00c26..0000000
+++ /dev/null
@@ -1,105 +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
-*/
-
-if($_SESSION['profile']['tverify'] <= 0) {
-    echo _("You don't have access to this area.");
-} else {
-       $uid = intval($_GET['uid']);
-       $query = "select * from `tverify` where `id`='".intval($uid)."' and `modified`=0";
-       $res = mysql_query($query);
-       if(mysql_num_rows($res) > 0) {
-               $row = mysql_fetch_assoc($res);
-               $memid = intval($row['memid']);
-
-               $query2 = "select * from `tverify-vote` where `tverify`='".intval($uid)."' and `memid`='".intval($_SESSION['profile']['id'])."'";
-               $rc2 = mysql_num_rows(mysql_query($query2));
-               if($rc2 > 0) {
-                       showheader(_("My CAcert.org Account!"));
-                       echo _("You have already voted on this request.");
-                       showfooter();
-                       exit;
-               }
-
-               $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `deleted` = 0";
-               $notary = mysql_fetch_assoc(mysql_query($query));
-               $query = "select * from `users` where `id`='".intval($memid)."'";
-               $user = mysql_fetch_assoc(mysql_query($query));
-               $tobe = 50 - $notary['points'];
-               if($row['URL'] != '' && $row['photoid'] != '') {
-                       $tobe = 150 - $notary['points'];
-               } else if($row['URL'] != '') {
-                       $tobe = 90 - $notary['points'];
-               }
-               if(intval($tobe) <= 0) {
-                       $tobe = 0;
-               }
-?>
-<?=_("Request Details")?>:<br>
-<?=_("Name on file")?>: <?=sanitizeHTML($user['fname']." ".$user['mname']." ".$user['lname']." ".$user['suffix'])?><br>
-<?=_("Primary email address")?>: <?=sanitizeHTML($user['email'])." (".intval($user['id']).")"?><br>
-<?=_("Certificate Subject")?>: <?=sanitizeHTML($row['CN'])?><br>
-<?             if($row['URL'] != '') { ?>
-<?=_("Notary URL")?>: <a href="<?=$row['URL']?>"><?=$row['URL']?></a><br>
-<?             } ?>
-<?             if($row['photoid'] != '') { ?>
-<?=_("Photo ID URL")?>: <a href="/account.php?id=51&amp;photoid=<?=intval($row['id'])?>"><?=_("Here")?></a><br>
-<?             } ?>
-<?=_("Current Points")?>: <?=intval($notary['points'])?><br>
-<?=_("Potential Points")?>: <?=intval($tobe)?><br>
-<?=_("Date of Birth")?>: <?=$user['dob']?> (YYYY-MM-DD)<br>
-
-<br>
-<form method="post" action="account.php">
-<?=_("Comment")?>: <input type="text" name="comment"><br>
-<input type="submit" name="agree" value="<?=_("I agree with this Application")?>">
-<input type="submit" name="disagree" value="<?=_("I don't agree with this Application")?>">
-<input type="hidden" name="oldid" value="<?=intval($_GET['id'])?>">
-<input type="hidden" name="uid" value="<?=intval($uid)?>">
-</form>
-<?
-       } else {
-               $query = "select * from `tverify` where `id`='".intval($uid)."' and `modified`=1";
-               $res = mysql_query($query);
-               if(mysql_num_rows($res) > 0) {
-                       echo _("This UID has already been voted on.")."<br/>";
-               } else {
-                       if($uid) echo _("Unable to locate a valid request for that UID.")."<br/>";
-               }
-
-               // Search for open requests:
-               $query = "select * from `tverify` where `modified`=0";
-               $res = mysql_query($query);
-               if(mysql_num_rows($res) > 0) {
-                       echo "<br/>"._("The following requests are still open:")."<br/><ul>";
-                       while($row = mysql_fetch_assoc($res)) {
-                               $uid=intval($row['id']);
-                               $query3 = "select * from `tverify-vote` where `tverify`='".intval($uid)."' and `memid`='".intval($_SESSION['profile']['id'])."'";
-                               $rc3 = mysql_num_rows(mysql_query($query3));
-                               if($rc3 <= 0)
-                               {
-                                       echo "<li><a href='account.php?id=52&amp;uid=".intval($row['id'])."'>".intval($row['id'])."</a></li>\n";
-                               }
-                       }
-                       echo "</ul>\n<br>\n";
-               } else {
-                       echo "<br/>"._("There are no pending requests where you haven't voted yet.");
-               }
-       }
-}
-
-?>
index cc9e2d6..1ec04b2 100644 (file)
@@ -16,7 +16,7 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */ ?>
 <?
-       $town = array_key_exists('town',$_REQUEST)?mysql_escape_string(stripslashes($_REQUEST['town'])):"";
+       $town = array_key_exists('town',$_REQUEST)?mysql_real_escape_string(stripslashes($_REQUEST['town'])):"";
        $regid = array_key_exists('regid',$_REQUEST)?intval($_REQUEST['regid']):0;
        $ccid = array_key_exists('ccid',$_REQUEST)?intval($_REQUEST['ccid']):0;
        $start = array_key_exists('start',$_REQUEST)?intval($_REQUEST['start']):0;
index 753b4af..35dce33 100644 (file)
@@ -19,7 +19,7 @@
        $ccid = array_key_exists('ccid',$_REQUEST)?intval($_REQUEST['ccid']):0;
        $regid = array_key_exists('regid',$_REQUEST)?intval($_REQUEST['regid']):0;
        $locid = array_key_exists('locid',$_REQUEST)?intval($_REQUEST['locid']):0;
-       $name = array_key_exists('name',$_REQUEST)?mysql_escape_string($_REQUEST['name']):"";
+       $name = array_key_exists('name',$_REQUEST)?mysql_real_escape_string($_REQUEST['name']):"";
 
        if($ccid > 0 && $_REQUEST['action'] == "add") { ?>
 <form method="post" action="account.php">
index 24cc86d..2032b18 100644 (file)
         $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
index de8d1a3..2719e27 100644 (file)
@@ -97,6 +97,11 @@ if (array_key_exists('format', $_REQUEST)) {
 
 } else {
        showheader(_("My CAcert.org Account!"), _("Install your certificate"));
+
+       echo '<p>'.sprintf(_('Find the signed certificate together with links for download below. Depending on the way your key was generated you will need to either import the certificate into your browser and export the combined key from there, or save the certificate and combine it with your key file using a tool like OpenSSL or XCA. More information is available in the %sWiki%s.'), '<a href="https://wiki.cacert.org/HowToDocuments/InstallClientCertificate" target="_blank">','</a>').'</p>';
+
+       echo '<p>'.sprintf(_('Nota bene: We need your support to keep our services operational. Please consider to %sdonate%s or support our teams with your work.'), '<a href="https://funding.cacert.org" target="_blank">','</a>').'</p>';
+
        echo '<ul class="no_indent">';
        echo "<li><a href='account.php?id=$id&amp;cert=$certid&amp;install'>".
                _("Install the certificate into your browser").
@@ -113,8 +118,8 @@ if (array_key_exists('format', $_REQUEST)) {
        $crtname=escapeshellarg($row['crt_name']);
        $cert = shell_exec("/usr/bin/openssl x509 -in $crtname -outform PEM");
        echo "<pre>$cert</pre>";
+?>
 
-       ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
        <tr>
                <td colspan="2" class="title"><?=_("Information about the certificate")?></td>
index 5de2ad3..a7c781e 100644 (file)
@@ -15,7 +15,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */ ?>
-<? global $errmsg, $link, $title, $months; if($errmsg != "") { ?><p style="color:red"><?=$errmsg?></p><? } ?>
+<? global $errmsg, $link, $title, $months; if($errmsg != "") { ?><p class="error_fatal"><?=$errmsg?></p><? } ?>
 <form method="post" action="advertising.php" ACCEPTCHARSET="utf-8">
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
index 84e11d2..dc6164f 100644 (file)
@@ -64,7 +64,7 @@
 <? } ?>
     <td class="DataTD"><?=$row['expire']?></td>
     <td class="DataTD"><a href="gpg.php?id=3&amp;cert=<?=intval($row['id'])?>"><?=sanitizeHTML($row['keyid'])?></a></td>
-    <td class="DataTD"><input name="comment_<?=intval($row['id'])?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td>
+    <td class="DataTD"><input name="comment_<?=intval($row['id'])?>" type="text" value="<?=sanitizeHTML($row['description'])?>" /></td>
     <td class="DataTD"><input type="checkbox" name="check_comment_<?=intval($row['id'])?>" /></td>
   </tr>
 <? } ?>
index 6cca117..5cd0afc 100644 (file)
@@ -19,7 +19,7 @@
 
 <p><?=_("CAcert.org is a community-driven Certificate Authority that issues certificates to the public at large for free.")?></p>
 
-<p><?=_("CAcert's goal is to promote awareness and education on computer security through the use of encryption, specifically by providing cryptographic certificates. These certificates can be used to digitally sign and encrypt email, authenticate and authorize users connecting to websites and secure data transmission over the internet. Any application that supports the Secure Socket Layer Protocol (SSL or TLS) can make use of certificates signed by CAcert, as can any application that uses X.509 certificates, e.g. for encryption or code signing and document signatures.")?></p>
+<p><?=_("CAcert's goal is to promote awareness and education on computer security through the use of encryption, specifically by providing cryptographic certificates. These certificates can be used to digitally sign and encrypt email, authenticate and authorize users connecting to websites and secure data transmission over the internet. Any application that supports the Secure Socket Layer protocol (SSL or TLS) can make use of certificates signed by CAcert, as can any application that uses X.509 certificates, e.g. for encryption or code signing and document signatures.")?></p>
 
 <p><?=sprintf(_("If you want to have free certificates issued to you, %s join the CAcert Community %s."),'<a href="https://www.cacert.org/index.php?id=1">', '</a>')?></p>
 
@@ -27,7 +27,7 @@
 <?=sprintf(_("This license applies to using the CAcert %s root keys %s."),'<a href="/index.php?id=3">','</a>')?></p>
 
 
-<? if(!array_key_exists('mconn',$_SESSION) || !$_SESSION['mconn']) echo "<font size='+1'>"._("Most CAcert functions are currently unavailable. Please come back later.")."</font>";?>
+<? if(!array_key_exists('mconn',$_SESSION) || !$_SESSION['mconn']) echo "<span class=\"error_fatal\">"._("Most CAcert functions are currently unavailable. Please come back later.")."</span>";?>
 
 
 
index 0f63e7b..5370d8f 100644 (file)
 
   <tr>
     <td class="DataTD" width="125"><?=_("First Name")?>: </td>
-    <td class="DataTD" width="125"><input type="text" name="fname" size="30" value="<?=array_key_exists('fname',$_REQUEST)?sanitizeHTML($_REQUEST['fname']):""?>" autocomplete="off"></td>
-    <td rowspan="4" class="DataTD" width="125"><? printf(_("Help on Names %sin the wiki%s"),'<a href="//wiki.cacert.org/FAQ/HowToEnterNamesInJoinForm" target="_blank">','</a>')?></td>
+    <td class="DataTD" width="125"><input type="text" name="fname" size="30" value="<?=array_key_exists('fname',$_REQUEST)?sanitizeHTML($_REQUEST['fname']):""?>" tabindex="1" autocomplete="off"></td>
+    <td rowspan="4" class="DataTD" width="125"><? printf(_("Help on Names %sin the wiki%s"),'<a tabindex="1" href="//wiki.cacert.org/FAQ/HowToEnterNamesInJoinForm" target="_blank">','</a>')?></td>
   </tr>
 
   <tr>
     <td class="DataTD" valign="top"><?=_("Middle Name(s)")?><br>
       (<?=_("optional")?>)
     </td>
-    <td class="DataTD"><input type="text" name="mname" size="30" value="<?=array_key_exists('mname',$_REQUEST)?sanitizeHTML($_REQUEST['mname']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="mname" size="30" value="<?=array_key_exists('mname',$_REQUEST)?sanitizeHTML($_REQUEST['mname']):""?>" tabindex="3" autocomplete="off"></td>
   </tr>
 
   <tr>
     <td class="DataTD"><?=_("Last Name")?>: </td>
-    <td class="DataTD"><input type="text" name="lname" size="30" value="<?=array_key_exists('lname',$_REQUEST)?sanitizeHTML($_REQUEST['lname']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="lname" size="30" value="<?=array_key_exists('lname',$_REQUEST)?sanitizeHTML($_REQUEST['lname']):""?>" tabindex="4" autocomplete="off"></td>
   </tr>
 
   <tr>
     <td class="DataTD"><?=_("Suffix")?><br>
       (<?=_("optional")?>)</td>
-    <td class="DataTD"><input type="text" name="suffix" size="30" value="<?=array_key_exists('suffix',$_REQUEST)?sanitizeHTML($_REQUEST['suffix']):""?>" autocomplete="off"><br><?=sprintf(_("Please only write Name Suffixes into this field."))?></td>
+    <td class="DataTD"><input type="text" name="suffix" size="30" value="<?=array_key_exists('suffix',$_REQUEST)?sanitizeHTML($_REQUEST['suffix']):""?>" tabindex="5" autocomplete="off"><br><?=sprintf(_("Please only write Name Suffixes into this field."))?></td>
   </tr>
 
   <tr>
     <td class="DataTD"><?=_("Date of Birth")?><br>
            (<?=_("dd/mm/yyyy")?>)</td>
-    <td class="DataTD"><nobr><select name="day">
+    <td class="DataTD"><nobr><select name="day" tabindex="6">
 <?
        for($i = 1; $i <= 31; $i++)
        {
@@ -71,7 +71,7 @@
        }
 ?>
     </select>
-    <select name="month">
+    <select name="month" tabindex="7">
 <?
        for($i = 1; $i <= 12; $i++)
        {
        }
 ?>
     </select>
-    <input type="text" name="year" value="<?=array_key_exists('year',$_SESSION['signup']) ? sanitizeHTML($_SESSION['signup']['year']):""?>" size="4" autocomplete="off"></nobr>
+    <input type="text" name="year" value="<?=array_key_exists('year',$_SESSION['signup']) ? sanitizeHTML($_SESSION['signup']['year']):""?>" size="4" tabindex="8" autocomplete="off"></nobr>
     </td>
     <td class="DataTD">&nbsp;</td>
   </tr>
 
   <tr>
     <td class="DataTD"><?=_("Email Address")?>: </td>
-    <td class="DataTD"><input type="text" name="email" size="30" value="<?=array_key_exists('email',$_REQUEST)?sanitizeHTML($_REQUEST['email']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="email" size="30" value="<?=array_key_exists('email',$_REQUEST)?sanitizeHTML($_REQUEST['email']):""?>" tabindex="9" autocomplete="off"></td>
     <td class="DataTD"><?=_("I own or am authorised to control this email address")?></td>
   </tr>
 
   <tr>
-    <td class="DataTD"><?=_("Pass Phrase")?><font color="red">*</font>: </td>
-    <td class="DataTD"><input type="password" name="pword1" size="30" autocomplete="off"></td>
+    <td class="DataTD"><?=_("Pass Phrase")?><span class="error_indicator">*</span>: </td>
+    <td class="DataTD"><input type="password" name="pword1" size="30" tabindex="10" autocomplete="off"></td>
     <td class="DataTD" rowspan="2">&nbsp;</td>
   </tr>
+
   <tr>
-    <td class="DataTD"><?=_("Pass Phrase Again")?><font color="red">*</font>: </td>
-    <td class="DataTD"><input type="password" name="pword2" size="30" autocomplete="off"></td>
+    <td class="DataTD"><?=_("Pass Phrase Again")?><span class="error_indicator">*</span>: </td>
+    <td class="DataTD"><input type="password" name="pword2" size="30" tabindex="11" autocomplete="off"></td>
   </tr>
 
   <tr>
-    <td class="DataTD" colspan="3"><font color="red">*</font><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol.")?></td>
+    <td class="DataTD" colspan="3"><span class="error_indicator">*</span><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol.")?></td>
   </tr>
 
   <tr>
 
   <tr>
     <td class="DataTD">1)</td>
-    <td class="DataTD"><input type="text" name="Q1" size="30" value="<?=array_key_exists('Q1',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q1']):""?>"></td>
-    <td class="DataTD"><input type="text" name="A1" size="30" value="<?=array_key_exists('A1',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A1']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="Q1" size="30" value="<?=array_key_exists('Q1',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q1']):""?>" tabindex="12"></td>
+    <td class="DataTD"><input type="text" name="A1" size="30" value="<?=array_key_exists('A1',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A1']):""?>" tabindex="13" autocomplete="off"></td>
   </tr>
 
   <tr>
     <td class="DataTD">2)</td>
-    <td class="DataTD"><input type="text" name="Q2" size="30" value="<?=array_key_exists('Q2',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q2']):""?>"></td>
-    <td class="DataTD"><input type="text" name="A2" size="30" value="<?=array_key_exists('A2',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A2']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="Q2" size="30" value="<?=array_key_exists('Q2',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q2']):""?>" tabindex="14"></td>
+    <td class="DataTD"><input type="text" name="A2" size="30" value="<?=array_key_exists('A2',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A2']):""?>" tabindex="15" autocomplete="off"></td>
   </tr>
 
   <tr>
     <td class="DataTD">3)</td>
-    <td class="DataTD"><input type="text" name="Q3" size="30" value="<?=array_key_exists('Q3',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q3']):""?>"></td>
-    <td class="DataTD"><input type="text" name="A3" size="30"value="<?=array_key_exists('A3',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A3']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="Q3" size="30" value="<?=array_key_exists('Q3',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q3']):""?>" tabindex="16"></td>
+    <td class="DataTD"><input type="text" name="A3" size="30"value="<?=array_key_exists('A3',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A3']):""?>" tabindex="17" autocomplete="off"></td>
   </tr>
 
   <tr>
     <td class="DataTD">4)</td>
-    <td class="DataTD"><input type="text" name="Q4" size="30"" value="<?=array_key_exists('Q4',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q4']):""?>"></td>
-    <td class="DataTD"><input type="text" name="A4" size="30" value="<?=array_key_exists('A4',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A4']):""?>" autcomplete="off"></td>
+    <td class="DataTD"><input type="text" name="Q4" size="30"" value="<?=array_key_exists('Q4',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q4']):""?>" tabindex="18"></td>
+    <td class="DataTD"><input type="text" name="A4" size="30" value="<?=array_key_exists('A4',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A4']):""?>" tabindex="19" autcomplete="off"></td>
   </tr>
 
   <tr>
   <td class="DataTD">5)</td>
-    <td class="DataTD"><input type="text" name="Q5" size="30" value="<?=array_key_exists('Q5',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q5']):""?>"></td>
-    <td class="DataTD"><input type="text" name="A5" size="30" value="<?=array_key_exists('A5',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A5']):""?>" autocomplete="off"></td>
+    <td class="DataTD"><input type="text" name="Q5" size="30" value="<?=array_key_exists('Q5',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['Q5']):""?>" tabindex="20"></td>
+    <td class="DataTD"><input type="text" name="A5" size="30" value="<?=array_key_exists('A5',$_SESSION['signup'])?sanitizeHTML($_SESSION['signup']['A5']):""?>" tabindex="21" autocomplete="off"></td>
   </tr>
 
   <tr>
   <tr>
     <td class="DataTD" valign="top"><?=_("Alert me if")?>: </td>
     <td class="DataTD" align="left">
-        <input type="checkbox" name="general" value="1" <?=array_key_exists('general',$_SESSION['signup'])? ($_SESSION['signup']['general'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("General Announcements")?><br>
-       <input type="checkbox" name="country" value="1" <?=array_key_exists('country',$_SESSION['signup'])? ($_SESSION['signup']['country'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Country Announcements")?><br>
-       <input type="checkbox" name="regional" value="1" <?=array_key_exists('regional',$_SESSION['signup'])? ($_SESSION['signup']['regional'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Regional Announcements")?><br>
-       <input type="checkbox" name="radius" value="1" <?=array_key_exists('radius',$_SESSION['signup'])? ($_SESSION['signup']['radius'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Within 200km Announcements")?></td>
+        <input type="checkbox" name="general" value="1" tabindex="22" <?=array_key_exists('general',$_SESSION['signup'])? ($_SESSION['signup']['general'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("General Announcements")?><br>
+       <input type="checkbox" name="country" value="1" tabindex="23" <?=array_key_exists('country',$_SESSION['signup'])? ($_SESSION['signup']['country'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Country Announcements")?><br>
+       <input type="checkbox" name="regional" value="1" tabindex="24" <?=array_key_exists('regional',$_SESSION['signup'])? ($_SESSION['signup']['regional'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Regional Announcements")?><br>
+       <input type="checkbox" name="radius" value="1" tabindex="25" <?=array_key_exists('radius',$_SESSION['signup'])? ($_SESSION['signup']['radius'] == "0" ?"":"checked=\"checked\""):"checked=\"checked\"" ?>><?=_("Within 200km Announcements")?></td>
     <td class="DataTD">&nbsp;</td>
   </tr>
 
     <td class="DataTD" colspan="3"><?=_("When you click on next, we will send a confirmation email to the email address you have entered above.")?></td>
   </tr>
   <tr>
-    <td class="DataTD" colspan="3"><input type="checkbox" name="cca_agree" value="1" <?=array_key_exists('cca_agree',$_SESSION['signup'])? ($_SESSION['signup']['cca_agree'] == "1" ?"checked=\"checked\"":""):"" ?> ><?=_("I agree to the terms and conditions of the CAcert Community Agreement")?>: <a href="/policy/CAcertCommunityAgreement.html">http://www.cacert.org/policy/CAcertCommunityAgreement.html</a></td>
+    <td class="DataTD" colspan="3">
+      <input type="checkbox" name="cca_agree" tabindex="26" value="1" <?=array_key_exists('cca_agree',$_SESSION['signup'])? ($_SESSION['signup']['cca_agree'] == "1" ?"checked=\"checked\"":""):"" ?> >
+      <br/>
+      <?=_("I agree to the terms and conditions of the CAcert Community Agreement")?>: <a href="/policy/CAcertCommunityAgreement.html" tabindex="28" >http://www.cacert.org/policy/CAcertCommunityAgreement.php</a>
+    </td>
   </tr>
 
   <tr>
-    <td class="DataTD" colspan="3"><input type="submit" name="process" value="<?=_("Next")?>"></td>
+    <td class="DataTD" colspan="3"><input type="submit" name="process" value="<?=_("Next")?>" tabindex="27"></td>
   </tr>
 
 </table>
index d1ef4df..3939352 100644 (file)
@@ -1,6 +1,6 @@
 <? /*
     LibreSSL - CAcert web application
-    Copyright (C) 2004-2008  CAcert Inc.
+    Copyright (C) 2004-2014  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
 */
 if(!array_key_exists('secrethash',$_SESSION['_config'])) $_SESSION['_config']['secrethash'] = md5(date("YmdHis").rand(0, intval(date("u"))));
 ?>
-<H3><?=_("Contact Us")?></H3>
+<h3><?=_("Contact Us")?></h3>
 
 <p><b><?=_("General Questions")?></b></p>
-<p><b><?=_("PLEASE NOTE: Due to the large amounts of support questions, incorrectly directed emails may be over looked, this is a volunteer effort and directing general questions to the right place will help everyone, including yourself as you will get a reply quicker.")?></b></p>
+<p><b><?=_("PLEASE NOTE: CAcert support is a volunteer effort. You would help everyone, including yourself to get a reply quickly, by directing general questions to the right place. Due to the large amounts of support questions, incorrectly directed emails may be overlooked.")?></b></p>
 <p><b><?=_("If you are contacting us about advertising, please use the form at the bottom of the website, the first contact form is not the correct place.")?></b></p>
-<p><?=sprintf(_("If you are having trouble with your username or password, please visit our %swiki page%s for more information"), "<a href='http://wiki.cacert.org/wiki/FAQ/LostPasswordOrAccount' target='_new'>", "</a>");?></p>
+<p><?=sprintf(_("If you are having trouble with your username or password, please visit our %swiki page%s for more information"), "<a href='//wiki.cacert.org/wiki/FAQ/LostPasswordOrAccount' target='_new'>", "</a>");?></p>
 <p><?=_("Before contacting us, be sure to read the information on our official and unofficial HowTo and FAQ pages.")?> - <a href="//wiki.cacert.org/HELP/"><?=_("Go here for more details.")?></a></p>
-<p><?=_("General questions about CAcert should be sent to the general support list, please send all emails in ENGLISH only, this list has many more volunteers then those directly involved with the running of the website, everyone on the mailing list understands english, even if this isn't their native language this will increase your chance at a competent reply. While it's best if you sign up to the mailing list to get replied to, you don't have to, but please make sure you note this in your email, otherwise it might seem like you didn't get a reply to your question.")?></p>
-<p><a href="https://lists.cacert.org/wws/info/cacert-support"><?=_("Click here to go to the Support List")?></a></p>
-<p><?=_("You can alternatively use the form below, however joining the list is the prefered option to support your queries")?></p>
+<p><?=_("General questions about CAcert should be sent to the general support mailing list. This list is read by many more volunteers, then those directly involved in the support team. Please send all emails in ENGLISH only, as everyone on the mailing list understands English, even if this is not their native language. Doing so will increase your chance to get a competent reply.")?></p>
+<p>
+<?=sprintf(_("You can use the form below to contact the support team directly. The mail is NOT send to the mailing list. Alternatively you can contact the support team by writing an email to %ssupport@cacert.org%s"), "<a href='mailto:support@cacert.org'>", "</a>");?></p>
 <form method="post" action="index.php" name="form1">
   <input type="hidden" name="oldid" value="<?=$id?>">
-<!--   <input type="hidden" name="support" value="yes"> --> 
+<!--   <input type="hidden" name="support" value="yes"> -->
   <input type="hidden" name="secrethash2" value="">
   <p class="robotic" id="pot">
     <label>If you're human leave this blank:</label>
     <input name="robotest" type="text" id="robotest" class="robotest" />
   </p>
   <table border="0">
-    <tr><td width="100"><?=_("Your Name")?>:</td><td width="100"><input type="text" name="who"></td><td width="100"></td><td width="100"></td>
-    <tr><td width="100"><?=_("Your Email")?>:</td><td colspan="3"><input type="text" name="email"></td>
-    <tr><td width="100"><?=_("Subject")?>:</td><td colspan="3"><input type="text" name="subject"></td></tr>
-    <tr><td width="100" valign="top"><?=_("Message")?>:</td><td colspan="3"><textarea name="message" cols="70" rows="10"></textarea></td></tr>
-
     <tr>
-      <td colspan="2"><font color="#ff0000"><?=_("Warning: Please do not use \"send to mailing list\" when you entered confidential data. The request is being sent to a public mailinglist.")?></font></td>
+      <td width="100"><?=_("Your Name")?>:</td>
+      <td width="300"><input type="text" name="who"></td>
+    </tr>
+    <tr>
+      <td><?=_("Your Email")?>:</td>
+      <td><input type="text" name="email"></td>
+    </tr>
+    <tr>
+      <td><?=_("Subject")?>:</td>
+      <td><input type="text" name="subject"></td>
+    </tr>
+    <tr>
+      <td valign="top"><?=_("Message")?>:</td>
+      <td><textarea name="message" cols="70" rows="10"></textarea></td>
+    </tr>
+    <tr>
       <td colspan="2"><?=_("For confidential data use \"send to support\".")?></td>
     </tr>
     <tr>
-      <td colspan="2"><input type="submit" name="process[0]" value="<?=_("Send to mailing list")?>"></td>
       <td colspan="2"><input type="submit" name="process[1]" value="<?=_("Send to support")?>"></td>
     </tr>
   </table>
 </form>
-
+<p><a href="https://lists.cacert.org/wws/info/cacert-support"><?=_("Click here to go to the Support List")?></a></p>
 <p><b>IRC</b></p>
 <p><a href="irc://irc.CAcert.org/CAcert">irc://irc.CAcert.org/CAcert</a></p>
 <p><b>Secure IRC</b></p>
index 612422f..5c2c97e 100644 (file)
@@ -44,6 +44,8 @@ Account No.:  180264
 
 <p><?=_("Thank you very much for your support, your donations help CAcert to continue to operate.")?></p>
 
+<h3>Funding</h3>
+<p><?=sprintf(_("If you want to support some special funding projects please visit the %sfunding page%s."), '<a href="https://funding.cacert.org" target="_blank">','</a>')?></p>
 
 <h3><?=_("Using Our Affiliate Partners")?></h3>
 
index f060c8f..7c52447 100644 (file)
@@ -29,6 +29,7 @@
 <ul class="no_indent">
        <li><a href="certs/root.crt"><?=_("Root Certificate (PEM Format)")?></a></li>
        <li><a href="certs/root.der"><?=_("Root Certificate (DER Format)")?></a></li>
+       <li><a href="certs/root.cer"><?=_("Root Certificate (CER Format base64 encoded)")?></a></li>
        <li><a href="certs/root.txt"><?=_("Root Certificate (Text Format)")?></a></li>
        <li><a href="<?=$_SERVER['HTTPS']?"https":"http"?>://crl.cacert.org/revoke.crl">CRL</a></li>
        <li><?=_("SHA1 Fingerprint:")?> 13:5C:EC:36:F4:9C:B8:E9:3B:1A:B2:70:CD:80:88:46:76:CE:8F:33</li>
@@ -39,6 +40,7 @@
 <ul class="no_indent">
        <li><a href="certs/class3.crt"><?=_("Intermediate Certificate (PEM Format)")?></a></li>
        <li><a href="certs/class3.der"><?=_("Intermediate Certificate (DER Format)")?></a></li>
+       <li><a href="certs/class3.der"><?=_("Intermediate Certificate (CER Format base64 encoded)")?></a></li>
        <li><a href="certs/class3.txt"><?=_("Intermediate Certificate (Text Format)")?></a></li>
        <li><a href="<?=$_SERVER['HTTPS']?"https":"http"?>://crl.cacert.org/class3-revoke.crl">CRL</a></li>
 <?php /*
index fe57d81..22b7711 100644 (file)
   </tr>
 <? } ?>
   <tr>
-    <td class="DataTD"><?=_("New Pass Phrase")?><font color="red">*</font>: </td>
+    <td class="DataTD"><?=_("New Pass Phrase")?><span class="error_indicator">*</span>: </td>
     <td class="DataTD"><input type="password" name="newpass1" autocomplete="off"></td>
   </tr>
   <tr>
-    <td class="DataTD"><?=_("Repeat")?><font color="red">*</font>: </td>
+    <td class="DataTD"><?=_("Repeat")?><span class="error_indicator">*</span>: </td>
     <td class="DataTD"><input type="password" name="newpass2" autocomplete="off"></td>
   </tr>
   <tr>
-    <td class="DataTD" colspan="2"><font color="red">*</font><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol.")?></td>
+    <td class="DataTD" colspan="2"><span class="error_indicator">*</span><?=_("Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol.")?></td>
   </tr>
   <tr>
     <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Next")?>"></td>
diff --git a/pages/index/feed.rss b/pages/index/feed.rss
new file mode 100644 (file)
index 0000000..def221f
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.5.1" -->
+<rss version="0.92">
+       <channel>
+               <title>CAcert NEWS Blog</title>
+               <link>http://blog.cacert.org</link>
+               <description>CAcert NEWS and up coming events.</description>
+               <lastBuildDate>Fri, 20 Aug 2010 11:54:30 +0000</lastBuildDate>
+               <docs>http://backend.userland.com/rss092</docs>
+               <language>en</language>
+
+               <item>
+                       <title>Looking for confirmation email on creating account?</title>
+                       <description>Please go to https://ca-mgr1.it-sls.de/login login with your just created account and password. Under MAIL you'll find your individual confirmation email.
+                       </description>
+                       <link>https://ca-mgr1.it-sls.de/testsystemdoc.html</link>
+               </item>
+               <item>
+                       <title>You are interested in helping Testing ?</title>
+                       <description>Create your test account on the Testserver. Beware of the confirmation email (see above) Entry page for Testers: https://wiki.cacert.org/Software/CurrentTest. Please contact Ulrich becoming a Testteam member.</description>
+                       <link>https://wiki.cacert.org/Software/CurrentTest</link>
+               </item>
+               <item>
+                       <title>Dear Testers</title>
+                       <description>We had one work with no activity on the testserver caused by inactivity by the Software-Assessment team, caused by router problems at the hosting site of the testserver. Probably latter has been fixed.
+
+                               The reported bugs can be categorized into
+                               1. Testserver-Mgmt-System related
+                               2. Production Server recovery process to Testserver
+                               3. general software errors
+
+                               Group 1+2 are essential for our current test phase, as they covers the problems in building the base testserver environment that is needed for testing.
+
+                               So language and country selection support is an essential feature we've worked on the last week.
+
+                               One problem couldn't be solved till today: secondary language selection all other country and language related bugs should be fixed in the meantime.
+
+                               Also the Show my Points details now has the correct script (after some confusion in the Software-Assessment team and one developer), comparable to the script on the production website.
+
+                               On the main entry page for testers https://wiki.cacert.org/Software/CurrentTest the updates on the bugs are marked with (i) so here comes the 2nd test round ...
+
+                               Please report your found bugs and also success reports to the listed bug numbers
+
+                               Thanks for your assistance .... ;)</description>
+                       <link>https://cacert1.it-sls.de/</link>
+               </item>
+       </channel>
+</rss>
index 9047f27..e69178d 100644 (file)
@@ -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)
        {
     <td class="DataTD"><?=maxpoints($row['id'])?></td>
     <td class="DataTD"><?=sanitizeHTML($row['contactinfo'])?></td>
     <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['id'])?>"><?=_("Email Me")?></a></td>
-    <td class="DataTD"><?=$row['assurer']?_("Yes"):("<font color=\"#ff0000\">"._("Not yet!")."</font>")?></td>
+    <td class="DataTD"><?=$row['assurer']?_("Yes"):("<span class=\"error_indicator\">"._("Not yet!")."</span>")?></td>
   </tr>
 <?
                }
index a0bbf50..e6b20ca 100644 (file)
@@ -65,9 +65,9 @@ document.f.location.focus();
        {
                $bits = explode(",", $_REQUEST['location']);
 
-               $loc = trim(mysql_escape_string($bits['0']));
-               $reg = ""; if(array_key_exists('1',$bits)) $reg=trim(mysql_escape_string($bits['1']));
-               $ccname = ""; if(array_key_exists('2',$bits)) $ccname=trim(mysql_escape_string($bits['2']));
+               $loc = trim(mysql_real_escape_string($bits['0']));
+               $reg = ""; if(array_key_exists('1',$bits)) $reg=trim(mysql_real_escape_string($bits['1']));
+               $ccname = ""; if(array_key_exists('2',$bits)) $ccname=trim(mysql_real_escape_string($bits['2']));
 
                $query = "select `locations`.`id` as `locid` from `locations`, `regions`, `countries` where
                        `locations`.`name` like '$loc%' and `regions`.`name` like '$reg%' and `countries`.`name` like '$ccname%' and
index eac7e18..1143769 100644 (file)
@@ -21,9 +21,9 @@ if(array_key_exists('location',$_REQUEST) && $_REQUEST['location'] != "") {
        {
                $bits = explode(",", $_REQUEST['location']);
 
-               $loc = trim(mysql_escape_string($bits['0']));
-               $reg = ''; if(array_key_exists('1',$bits)) $reg=trim(mysql_escape_string($bits['1']));
-               $ccname = ''; if(array_key_exists('2',$bits)) $ccname=trim(mysql_escape_string($bits['2']));
+               $loc = trim(mysql_real_escape_string($bits['0']));
+               $reg = ''; if(array_key_exists('1',$bits)) $reg=trim(mysql_real_escape_string($bits['1']));
+               $ccname = ''; if(array_key_exists('2',$bits)) $ccname=trim(mysql_real_escape_string($bits['2']));
                $query = "select `locations`.`id` as `locid` from `locations`, `regions`, `countries` where
                        `locations`.`name` like '$loc%' and `regions`.`name` like '$reg%' and `countries`.`name` like '$ccname%' and
                        `locations`.`regid`=`regions`.`id` and `locations`.`ccid`=`countries`.`id`
diff --git a/pages/wot/16.php b/pages/wot/16.php
new file mode 100644 (file)
index 0000000..069b7a2
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+/*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
+*/
+
+//*******************  TTP Console ************
+
+if ($_SESSION['profile']['ttpadmin'] < 1) {
+       echo _("You are not allowed to view this page.");
+       exit;
+}
+
+//Check for test or productive environment, in case of test the user data for the print out is extended by 'test system'
+$testserver='';
+if ($_SESSION['_config']['normalhostname']=='cacert1.it-sls.de') {
+       $testserver=' test system';
+}
+
+$row = $_SESSION['_config']['notarise'];
+$fname = $row['fname'];
+$mname = $row['mname'];
+$lname = $row['lname'];
+$suffix = $row['suffix'];
+$fullname = $fname." ".$mname." ".$lname." ".$suffix;
+$email = $row['email'];
+$dob = date_format(new DateTime($row['dob']), 'Y-m-d');
+$userid = $row['id'];
+
+//List TTP Assurances and TotalPoints
+//changed get_received_assurances ($userid, $support)
+
+//include_once($_SESSION['_config']['filepath']."/includes/wot.inc.php");
+include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php");
+
+output_received_assurances(intval($userid),2); //support==2 => TTP
+
+
+$query = "select sum(`points`) as `points` from `notary` where `to`='".intval($userid)."'";
+$dres = mysql_query($query);
+$drow = mysql_fetch_assoc($dres);
+
+$points=$drow['points'];
+if ($points<1) {
+       $points=0;
+}
+
+$res = get_received_assurances(intval($userid), 2);
+$ttp_assurances_count=$num_rows = mysql_num_rows($res);
+
+//Form
+?>
+<table align="center" class="wrapper">
+       <tr>
+               <td class="title"><?=sprintf(_('Total assurance points for %s'),$fullname)?></td>
+       </tr>
+       <tr>
+               <td><?=sprintf(_('%s points'), $points)?></td>
+       </tr>
+</table>
+<br/>
+<form action="https://pdf.cacert.eu/cacertpdf.php" method="get" accept-charset="UTF-8">
+       <table align="center" class="wrapper">
+               <tr>
+                       <td colspan="2" class="title"><?= _('TTP CAP form creation')?></td>
+               </tr>
+               <tr>
+                       <td colspan="2" class="title"><?= _('User information')?></td>
+               </tr>
+               <tr>
+                       <td><?=_('Fullname')?><input type="hidden" name="fullname" value="<?=$fullname.$testserver?>"/></td>
+                       <td><?=$fullname?></td>
+               </tr>
+               <tr>
+                       <td><?=_('Date of Birth')?><input type="hidden" name="dob" value="<?=$dob.$testserver?>"/></td>
+                       <td><?=$dob?></td>
+               </tr>
+               <tr>
+                       <td><?=_('Email')?><input type="hidden" name="email" value="<?=$email.$testserver?>"/></td>
+                       <td><?=$email?></td>
+               </tr>
+               <tr></tr>
+               <tr>
+                       <td><?=_('Country where the TTP will be visited')?></td>
+                       <td>
+                               <?
+                               $ttpcountries=get_array_from_ini('../config/ttp.ini');
+                               echo create_selectbox_HTML('type',$ttpcountries, '',TRUE);
+                               ?>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2" class="title"><?=_('TTP Admin postal address, including name, street, country etc.')?></td>
+               </tr>
+               <tr>
+                       <td><?=_('Line').' 1'?></td>
+                       <td><input type="text" name="adress" /></td>
+               </tr>
+               <tr>
+                       <td><?=_('Line').' 2'?></td>
+                       <td><input type="text" name="adress1" /></td>
+               </tr>
+               <tr>
+                       <td><?=_('Line').' 3'?></td>
+                       <td><input type="text" name="adress2" /></td>
+               </tr>
+               <tr>
+                       <td><?=_('Line').' 4'?></td>
+                       <td><input type="text" name="adress3" /></td>
+               </tr>
+               <tr>
+                       <td><?=_('Line').' 5'?></td>
+                       <td><input type="text" name="adress4" /></td>
+               </tr>
+               <tr>
+                       <td colspan="2" class="title">
+                       <?
+                       if ($points>=100 || $ttp_assurances_count>=2) {
+                               echo _('No TTP assurance allowed');
+                       }else{
+                               ?><input type="submit" value="<?=_('Create TTP CAP pdf file')?>"/><?
+                       }?>
+                       </td>
+               </tr>
+       </table>
+       <input type="hidden" name="lang" value="en"/>
+</form>
+
+<div class="blockcenter">
+       <a href="wot.php?id=6&amp;userid=<?=$userid ?>"><?=_("Back")?></a>
+</div>
diff --git a/pages/wot/17.php b/pages/wot/17.php
new file mode 100644 (file)
index 0000000..657f990
--- /dev/null
@@ -0,0 +1,76 @@
+<? /*
+   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("../includes/shutdown.php");
+require_once("../includes/lib/l10n.php");
+
+if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "")
+{
+    ?><font color="orange" size="+1">
+        <? echo _("ERROR").": ".$_SESSION['_config']['error'] ?>
+    </font>
+    <?unset($_SESSION['_config']['error']);
+}
+
+if(array_key_exists('noemailfound',$_SESSION['_config']) && $_SESSION['_config']['noemailfound'] == 1) {
+    unset($_SESSION['_config']['noemailfound']);
+}
+
+?>
+<form method="post" action="wot.php" name="form1">
+<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
+    <tr>
+        <td colspan="2" class="title"><?=_('Check Assurer Status')?></td>
+    </tr>
+    <tr>
+    <td class="DataTD"><?=_('Email to check')?>:</td>
+<? if(array_key_exists('remindersent',$_SESSION['_config']) && $_SESSION['_config']['remindersent'] == 1) { unset($_SESSION['_config']['remindersent']) ?>
+        <td class="DataTD"><input type="text" name="email" id="email" value=""></td>
+        <? } else { ?>
+        <td class="DataTD"><input type="text" name="email" id="email" value="<?=array_key_exists('email',$_POST)?sanitizeHTML($_POST['email']):""?>"></td>
+            <? } ?>
+    </tr>
+    <tr>
+        <td class="DataTD"><?=_('Reason why the assurer status is needed')?>:</td>
+        <td class="DataTD"><select name="reason"><option>--</option>
+                <option><?=_('Assurance')?></option>
+                <option><?=_('Event Preparation')?></option>
+                <option><?=_('Arbitration')?></option>
+                <option><?=_('CARS check')?></option>
+                <option><?=_('CATS certificate creation')?></option>
+                <option><?=_('Organisation Assurance')?></option>
+            </select></td>
+    </tr>
+    <tr>
+        <td class="DataTD" colspan="2"><?=_('If you request the assurer status the result is send via mail to the person of whom you request the status of.')?></td>
+    </tr>
+    <tr>
+        <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Next")?>"></td>
+    </tr>
+</table>
+<input type="hidden" name="oldid" value="<?=$id?>">
+</form>
+<SCRIPT LANGUAGE="JavaScript">
+//<![CDATA[
+    function my_init()
+    {
+        document.getElementById("email").focus();
+    }
+
+    window.onload = my_init();
+//]]>
+</script>
index 0864ffd..cb3a008 100644 (file)
 */ ?>
 <h3><?=_("CAcert Web of Trust Rules")?></h3>
 
-<p><?=_("It is essential that CAcert Assurers understand and follow the rules below to ensure that applicants for assurance are suitably identified, which, in turn, maintains trust in the system.")?></p>
+<p><?=_("CAcert Assurers should understand and follow the rules.")?></p>
+<p><?=_("The assurance process consists of two parts")?></p>
+<ol>
+   <li><?=_("a face to face meeting between the assurer and the assuree")?></li>
+   <li><?=_("the assurer validating that data while entering it to the CAcert system")?></li>
+</ol>
+<h4><?=_("Face to face meeting")?></h4>
+<ul>
+   <li><?=_("Assurer and assuree have to meet in person")?></li>
+   <li><?=_("A CAcert Assurance Programme (CAP) form has to be filled and signed by the assuree. It must contain the following information:")?>
+     <ul>
+       <li><?=_("All names of the assuree that appear in the account")?></li>
+       <li><?=_("Date of birth of the assuree")?></li>
+       <li><?=_("Primary email address of the assuree")?></li>
+       <li><?=sprintf(_("The acceptance of the %sCAcert Community Agreement%s (CCA) by the assuree"), "<a href=\"/policy/CAcertCommunityAgreement.html\">", "</a>")?></li>
+       <li><?=_("The agreement to enter an assurance by the assuree")?></li>
+       <li><?=_("The signature of the assuree")?></li>
+       <li><?=_("The date of the signature")?></li>
+      </ul></li>
+   <li><?=("At least one government issued photo identification document (ID-Card, drivers license, passport, ...) of the assuree has to be checked by the assurer. We prefer and advise to check two such documents, if possible.")?></li>
+</ul>
+<ul>
+   <li><?=_("The assurer has to compare the data of the document with the data entered in the CAP-form. Missing data needs to be added. The signatures on the documents and CAP-form should be compared. The photo should match the person. If there is any doubt in those points, the assurer should consider to either reduce the points (for minor issues) or decide to refuse to finish the assurance at all.")?></li>
+   <li><?=_("It is recommended that the assurer also notes if the assuree has an account and to repeat entries that may be hard to read in the assurers hand.")?></li>
+   <li><?=_("The assurer is asked to verify, if the assuree understands the crucial points of the CAcert Community Agreement and the assurance process.")?></li>
+   <li><?=_("If there are major issues the assurer (or the assuree) should consider to file a dispute, by sending a mail to support@cacert.org.")?></li>
+   <li><?=_("If the assurer is convinced that the assurance was ok, the assurer has to approve this by adding the following data to the CAP-form.")?>
+     <ul>
+       <li><?=_("Name of the assurer")?></li>
+       <li><?=_("Date of the assurance")?></li>
+       <li><?=_("Place of the assurance")?></li>
+       <li><?=_("Record over the type of documents used during the assurance (no numbers may be noted)")?></li>
+       <li><?=_("Points issued by the assurer")?></li>
+       <li><?=sprintf(_("That the assurance was done under the %sAssurance Policy%s (AP)"), "<a href=\"/policy/AssurancePolicy.html\">", "</a>")?></li>
+       <li><?=_("The signature of the assurer")?></li>
+     </ul>
+   </li>
+</ul>
+<h4><?=_("Validating and entering the data to the CAcert system")?></h4>
+<p><?=_("After the meeting the assurer has to log into the CAcert webpage and follow the \"Assure Someone\" link.")?></p>
+<ul>
+   <li><?=_("The primary email address and the date of birth from the assuree, as written on the CAP-form have to be entered by the assurer.")?></li>
+   <li><?=_("Only if they were entered correctly the assurer gets access to the assurance page with the remaining data of the assuree.")?></li>
+   <li><?=_("This page shows the names, date of birth and primary email address of the assuree.")?></li>
+   <li><?=_("It has to be compared to the data written on the CAP-form by the assurer.")?></li>
+   <li><?=sprintf(_("If the data matches completely, the assurer may enter the assurance. (The acceptable discrepancies for the names can be found in the %sAssurance Handbook%s (AH))"), "<a href=\"//wiki.cacert.org/AssuranceHandbook2\">", "</a>")?></li>
+   <li><?=_("The assurer has to enter the assurance points.")?></li>
+   <li><?=_("The assurer has to acknowledge the face-to-face meeting with the assuree, that the data on the pages matches the assuree, and that the CCA is accepted by the assurer.
+")?></li>
+</ul>
+<h4><?=_("Privacy")?></h4>
+<p><?=_("The assurer is responsible to maintain the confidentiality and privacy of the assuree.")?></p>
+<p><?=_("In particular the CAP-forms have to be stored safely for at least 7 years and not to be shown to anybody but")?></p>
+<ul>
+   <li><?=_("the assuree")?></li>
+   <li><?=_("the Arbitrator of a valid arbitration case who requests to see it with a good reason based on the case")?></li>
+   <li><?=_("another person named by such an Arbitrator.")?></li>
+</ul>
+<p><?=_("Exceptions may be made only with the explicit consent of the assuree.")?></p>
 
-<p><?=_("Contact")?><br>
-<br>
-* <?=_("You must meet the applicant in person;")?><br>
-* <?=_("You must sight at least one form of government issued photo identification.  It's preferable if 2 forms of Government issued photo ID are presented, as less points may be issued if there is any doubt on the person by the person issuing points;")?><br>
-* <?=_("Complete the assurance form if the applicant has not already done so.  Ensure that all information matches.")?><br>
-</p>
+<h4><?=_("Fees")?></h4>
+<p><?=_("The assurer may charge a fee for the expenses however not for the assurance itself, but only if the assuree has been advised of the amount prior to the meeting.")?></p>
 
-<p><?=_("Processing")?><br>
-<?=_("After the meeting, visit the CAcert Web site's make an Assurance page and:")?><br>
-<br>
-* <?=_("Enter the applicant's email address;")?><br>
-* <?=_("Compare the online information to the information recorded on the paper form;")?><br>
-* <?=_("If, and only if, the two match completely - you may award trust points up to the maximum points you are able to allocate;")?><br>
-</p>
-
-<p><?=_("Privacy")?><br>
-<?=_("It is imperative that you maintain the confidentiality and privacy of the applicant, and never disclose the information obtained without the applicant's consent.")?></p>
-
-<p><?=_("Fees")?><br>
-<?=_("You may charge a fee for your expenses if the applicant has been advised of the amount prior to the meeting.")?></p>
-
-<p><?=_("Liability")?><br>
-<?=_("A CAcert Assurer who knowingly, or reasonably ought to have known, assures an applicant contrary to this policy may be held liable.")?></p>
-
-<p><?=_("Assurance Points")?><br>
-<?=_("CAcert may, from time to time, alter the amount of Assurance Points that a class of assurer may assign as is necessary to effect a policy or rule change.  We may also alter the amount of Assurance Points available to an individual, or new class of assurer, should another policy of CAcert require this.")?></p>
+<h4><?=_("Liability")?></h4>
+<p><?=_("An assurer who assures someone contrary to this process, as it is defined in the Assurance Policy (AP) may be held liable up to 1000 EUR per case.")?></p>
index 628e6a5..954bc76 100644 (file)
@@ -43,12 +43,13 @@ if ($_SESSION['profile']['points']<100){
                <form method="post" action="wot.php">
                <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
                        <tr>
-                               <td class="DataTD"><?=_("Country where you want to visit the TTP")?></td>
-                               <td class="DataTD"><select size="1" name="country">
-                                               <option>Australia</option>
-                                               <option>Puerto Rico</option>
-                                               <option>USA</option>
-                                       </select></td>
+                               <td class="DataTD"><?=_('Country where you want to visit the TTP')?></td>
+                               <td class="DataTD">
+                                       <?
+                                               $ttpcountries=get_array_from_ini('../config/ttp.ini');
+                                               echo create_selectbox_HTML('country',$ttpcountries, _('Choose country'));
+                                       ?>
+                               </td>
                        </tr>
                        <tr>
                                <td class="DataTD"><?=_("I want to take part in the TTP Topup programme")?></td>
@@ -72,7 +73,7 @@ if ($_SESSION['profile']['points']<100){
                </form>
 */
 ?>
-       <p><?=_("We are working to develop the TTP TOPUP process to be able to fill the gap of the missing 30 assurance points to 100 assurance points. Meanwhile you have to close this gap with face to face assurances from CAcert Assurers. Think not only travelling to populated countries, but as well to assurers visiting your country or area.")?></p>  
+       <p><?=_("We are working to develop the TTP TOPUP process to be able to fill the gap of the missing 30 assurance points to 100 assurance points. Meanwhile you have to close this gap with face to face assurances from CAcert Assurers. Think not only travelling to populated countries, but as well to assurers visiting your country or area.")?></p>
 <?
        }
 } else {
index 565dd6a..01737e1 100644 (file)
@@ -21,9 +21,9 @@
 <?
   if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "")
   {
-    ?><font color="orange" size="+1">
+    ?><span class="error_warning">
       <? echo _("ERROR").": ".$_SESSION['_config']['error'] ?>
-    </font>
+    </span>
     <?unset($_SESSION['_config']['error']);
   }
 
index 39605f3..edecc20 100644 (file)
 */ ?>
 <?
 
-        if(!array_key_exists('notarise',$_SESSION['_config']))
+if(!array_key_exists('notarise',$_SESSION['_config']))
        {
-          echo "Error: No user data found.";
-         exit;
+               echo "Error: No user data found.";
+               exit;
        }
 
        $row = $_SESSION['_config']['notarise'];
        $_SESSION['assuresomeone']['month'] = 0;
        $_SESSION['assuresomeone']['day'] = 0;
 
-       if($_SESSION['profile']['ttpadmin'] == 1)
-//             $methods = array("Face to Face Meeting", "Trusted 3rd Parties", "TopUP");
-//     else
-               $methods = array("Face to Face Meeting", "Trusted 3rd Parties");
+       if($_SESSION['profile']['ttpadmin'] == 2)
+               $methods = array('Face to Face Meeting', 'TTP-Assisted', 'TTP-TOPUP');
+       elseif($_SESSION['profile']['ttpadmin'] == 1)
+               $methods = array('Face to Face Meeting', 'TTP-Assisted');
        else
-               $methods = array("Face to Face Meeting");
+               $methods = array('Face to Face Meeting');
 
        $mnames = array(
                '01' => _('January'),
@@ -85,4 +85,9 @@
        AssureTextLine(_("Policy"),"<a href=\"/policy/CAcertCommunityAgreement.html\" target=\"_blank\">"._("CAcert Community Agreement")."</a> - <a href=\"/policy/AssurancePolicy.html\" target=\"_blank\">"._("Assurance Policy")."</a> - <a href=\"http://wiki.cacert.org/AssuranceHandbook2\" target=\"_blank\">"._("Assurance Handbook")."</a>");
        AssureInboxLine("points",_("Points"),"","<br />(Max. ".maxpoints().")");
        AssureFoot($id,_("I confirm this Assurance"));
+
+       if($_SESSION['profile']['ttpadmin'] >= 1) {
+               ?><div class='blockcenter'><a href="wot.php?id=16"><?=_('Show TTP details')?></a></div><?
+       }
+
 ?>
index af67d0b..8b1e0e2 100644 (file)
@@ -15,7 +15,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */ ?>
-<? if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "") { ?><font color="#ff0000">ERROR: <?=$_SESSION['_config']['error']?></font><? unset($_SESSION['_config']['error']); } ?>
+<? if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "") { ?><span class="error_fatal">ERROR: <?=$_SESSION['_config']['error']?></span><? unset($_SESSION['_config']['error']); } ?>
 <form method="post" action="wot.php">
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
index 20f2c6d..ffdb26b 100644 (file)
 
                $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 {
 
                        $_SESSION['_config']['pagehash'] = md5(date("U"));
 ?>
-<? if($_SESSION['_config']['error'] != "") { ?><font color="#ff0000" size="+1">ERROR: <?=$_SESSION['_config']['error']?></font><? unset($_SESSION['_config']['error']); } ?>
+<? if($_SESSION['_config']['error'] != "") { ?><span class="error_fatal">ERROR: <?=$_SESSION['_config']['error']?></span><? unset($_SESSION['_config']['error']); } ?>
 <form method="post" action="wot.php">
 <input type="hidden" name="userid" value="<?=intval($user['id'])?>">
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
index 3b446ba..b9d1f8e 100755 (executable)
@@ -122,57 +122,37 @@ 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`
-                                       and `deleted` = 0
-                               ) >= 100
-                       and not exists(
-                               select 1 from `cats_passed` as `cp`, `cats_variant` as `cv`
-                                       where `cp`.`user_id`=`users`.`id`
-                                       and `cp`.`variant_id`=`cv`.`id`
-                                       and `cv`.`type_id`=1
-                               )"
-               ));
-
-       $stats['aussurers_with_test'] = number_format(tc(
-               "select count(*) as `count` from `users`
-                       where (
-                               select sum(`points`) from `notary`
-                                       where `to`=`users`.`id`
-                                       and `deleted` = 0
-                               ) >= 100
-                       and exists(
-                               select 1 from `cats_passed` as `cp`, `cats_variant` as `cv`
-                                       where `cp`.`user_id`=`users`.`id`
-                                       and `cp`.`variant_id`=`cv`.`id`
-                                       and `cv`.`type_id`=1
-                               )"
-               ));
+       $startdate = date("Y-m-d", mktime(0, 0, 0, 1, 1, 2002));
+       $enddate = date("Y-m-d", mktime(0, 0, 0, 1, 1, date("Y") + 1));
+
+       $assurercount = assurer_count($startdate, $enddate, 1);
+       $stats['assurer_with_test'] = number_format($assurercount);
+
+       $stats['assurer_candidates'] = number_format(assurer_count($startdate, $enddate,0) - $assurercount);
 
        $stats['points_issued'] = number_format(tc(
                "select sum(greatest(`points`, `awarded`)) as `count` from `notary`
                        where `deleted` = 0
                        and `method` = 'Face to Face Meeting'"));
 
-       $totalusers=0;
-       $totassurers=0;
-       $totalcerts=0;
+       $totalcerts = 0;
+       $totalusers = 0;
+       $totalcandidates = 0;
+       $totalassurers = 0;
+
        for($i = 0; $i < 12; $i++) {
                $first_ts = mktime(0, 0, 0, date("m") - $i, 1, date("Y"));
                $next_month_ts =  mktime(0, 0, 0, date("m") - $i + 1, 1, date("Y"));
@@ -188,14 +168,8 @@ function getDataFromLive() {
                                and `deleted` = 0
                                and `locked` = 0");
 
-               $totassurers += $assurers = tc(
-                       "select count(*) as `count` from (
-                               select 1 from `notary`
-                                       where `when` >= '$first' and `when` < '$next_month'
-                                       and `method`!='Administrative Increase'
-                                       and `deleted` = 0
-                                       group by `to` having sum(`points`) >= 100
-                               ) as `assurer_candidates`");
+               $totalcandidates += $candidates = assurer_count($first, $next_month, 0);
+               $totalassurers += $assurers = assurer_count($first, $next_month, 1);
 
                $certs = tc(
                        "select count(*) as `count` from `domaincerts`
@@ -222,6 +196,7 @@ function getDataFromLive() {
                $tmp_arr = array();
                $tmp_arr['date'] = date("Y-m", $first_ts);
                $tmp_arr['new_users'] = number_format($users);
+               $tmp_arr['new_candidates'] = number_format($candidates);
                $tmp_arr['new_assurers'] = number_format($assurers);
                $tmp_arr['new_certificates'] = number_format($certs);
 
@@ -229,13 +204,16 @@ function getDataFromLive() {
        }
        $stats['growth_last_12m_total'] = array(
                        'new_users' => number_format($totalusers),
-                       'new_assurers' => number_format($totassurers),
+                       'new_candidates' => number_format($totalcandidates),
+                       'new_assurers' => number_format($totalassurers),
                        'new_certificates' => number_format($totalcerts),
                );
 
        $totalcerts = 0;
        $totalusers = 0;
-       $totassurers = 0;
+       $totalcandidates = 0;
+       $totalassurers = 0;
+
        for($i = date("Y"); $i >= 2002; $i--) {
                $first_ts = mktime(0, 0, 0, 1, 1, $i);
                $next_year_ts =  mktime(0, 0, 0, 1, 1, $i + 1);
@@ -251,14 +229,8 @@ function getDataFromLive() {
                                and `deleted` = 0
                                and `locked` = 0");
 
-               $totassurers += $assurers = tc(
-                       "select count(*) as `count` from (
-                               select 1 from `notary`
-                                       where `when` >= '$first' and `when` < '$next_year'
-                                       and `method`!='Administrative Increase'
-                                       and `deleted` = 0
-                                       group by `to` having sum(`points`) >= 100
-                               ) as `assurer_candidates`");
+               $totalcandidates += $candidates = assurer_count($first, $next_year, 0);
+               $totalassurers += $assurers = assurer_count($first, $next_year, 1);
 
                $certs = tc(
                        "select count(*) as `count` from `domaincerts`
@@ -285,6 +257,7 @@ function getDataFromLive() {
                $tmp_arr = array();
                $tmp_arr['date'] = $i;
                $tmp_arr['new_users'] = number_format($users);
+               $tmp_arr['new_candidates'] = number_format($candidates);
                $tmp_arr['new_assurers'] = number_format($assurers);
                $tmp_arr['new_certificates'] = number_format($certs);
 
@@ -292,13 +265,81 @@ function getDataFromLive() {
        }
        $stats['growth_last_years_total'] = array(
                        'new_users' => number_format($totalusers),
-                       'new_assurers' => number_format($totassurers),
+                       'new_candidates' => number_format($totalcandidates),
+                       'new_assurers' => number_format($totalassurers),
                        'new_certificates' => number_format($totalcerts),
                );
 
        return $stats;
 }
 
+/**
+ * assurer_count()
+ *   returns the number of new assurer in period given through from and to, type is defining the CATS type that is used as definition to be assurer
+ * @param mixed $from
+ * @param mixed $to
+ * @param integer $type
+ * @return
+ */
+function assurer_count($from, $to, $type = 1){
+    if ($type == 0) {
+        $atype = "";
+        $btype = "";
+    } else {
+        $atype = " AND n.`to` in (SELECT c.user_id FROM cats_passed as c, cats_variant as v WHERE c.variant_id = v.id and v.type_id = $type and pass_date < @a) ";
+        $btype = " AND n.`to` in (SELECT c.user_id FROM cats_passed as c, cats_variant as v WHERE c.variant_id = v.id and v.type_id = $type and pass_date < @b) ";
+    }
+
+    $query1 = "SET @a = '$from';";
+
+    $query2 = "SET @b = '$to';";
+
+    $query3 = "CREATE TEMPORARY TABLE a
+            SELECT n.`to`, sum(n.awarded) as `received_pts`, max(n.`when`) as `last_assurance`
+            FROM cacert.notary as n
+            WHERE 1
+                AND n.`from` != n.`to`
+                AND (n.`deleted` = '0000-00-00 00:00:00')
+                AND n.`when` < @a
+                $atype
+            GROUP by n.`to`
+            HAVING 1
+                AND `received_pts` >= 100
+            ORDER by `last_assurance` DESC;";
+
+    $query4 = "CREATE TEMPORARY TABLE b
+            SELECT n.`to`, sum(n.awarded) as `received_pts`, max(n.`when`) as `last_assurance`
+            FROM cacert.notary as n
+            WHERE 1
+                AND n.`from` != n.`to`
+                AND (n.`deleted` = '0000-00-00 00:00:00')
+                AND n.`when` < @b
+                $btype
+            GROUP by n.`to`
+            HAVING 1
+                AND `received_pts` >= 100
+            ORDER by `last_assurance` DESC;";
+
+    $query5 = "SELECT count(*) as `count` FROM b WHERE b.`to` NOT IN (SELECT a.`to` FROM a);";
+
+    $query6 = "DROP TEMPORARY TABLE a;";
+
+    $query7 = "DROP TEMPORARY TABLE b;";
+
+
+    sql_query($query1);
+    sql_query($query2);
+    sql_query($query3);
+    sql_query($query4);
+
+    $row = mysql_fetch_assoc(sql_query($query5));
+
+    sql_query($query6);
+    sql_query($query7);
+
+    return(intval($row['count']));
+}
+
 
 $stats = getDataFromLive();
 if (! updateCache($stats) ) {
index 051b179..4b2c29b 100755 (executable)
@@ -28,7 +28,7 @@
 
        mysql_query("update `locations` set `acount`=0");
        $query = "SELECT `users`.`locid` AS `locid`, count(*) AS `total` FROM `users`
-                       WHERE users.assurer='1' AND `users`.`locid` != 0 and users.listme=1
+                       WHERE users.assurer='1' AND `users`.`locid` != 0 and users.listme=1 and `users`.`deleted` = 0
                        GROUP BY `users`.`locid`";
        $res = mysql_query($query);
        while($row = mysql_fetch_assoc($res))
@@ -41,7 +41,7 @@
 
        mysql_query("update `regions` set `acount`=0");
        $query = "SELECT `users`.`regid` AS `regid`, count(*) AS `total` FROM `users`
-                       WHERE users.assurer='1' AND `users`.`regid` != 0 and users.listme=1
+                       WHERE users.assurer='1' AND `users`.`regid` != 0 and users.listme=1 and `users`.`deleted` = 0
                        GROUP BY `users`.`regid`";
        $res = mysql_query($query);
        while($row = mysql_fetch_assoc($res))
@@ -56,7 +56,7 @@
 
        mysql_query("update `countries` set `acount`=0");
        $query = "SELECT `users`.`ccid` AS `ccid`, count(*) AS `total` FROM `users`
-                       WHERE users.assurer='1' AND `users`.`ccid` != 0 and users.listme=1
+                       WHERE users.assurer='1' AND `users`.`ccid` != 0 and users.listme=1 and `users`.`deleted` = 0
                        GROUP BY `users`.`ccid`";
        $res = mysql_query($query);
        while($row = mysql_fetch_assoc($res))
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/stamp/.htaccess b/stamp/.htaccess
deleted file mode 100644 (file)
index 3ad2abb..0000000
+++ /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 (file)
index a43d2a0..0000000
+++ /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 (file)
index d99a23a..0000000
+++ /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 (file)
index 9c1f534..0000000
+++ /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 (file)
index ab5c1ea..0000000
Binary files a/stamp/images/CAverify.png and /dev/null differ
diff --git a/stamp/index.php b/stamp/index.php
deleted file mode 100644 (file)
index 81a88db..0000000
+++ /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 (file)
index 7f9045c..0000000
+++ /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 (file)
index 519aa3a..0000000
+++ /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 (file)
index e69de29..0000000
diff --git a/stamp/style.css b/stamp/style.css
deleted file mode 100644 (file)
index c00a4c7..0000000
+++ /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/tverify/.htaccess b/tverify/.htaccess
deleted file mode 100644 (file)
index bb5fe0e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-php_value auto_prepend_file /www/includes/general.php
-php_value output_buffering 1
-errordocument 404 /error404.php
-errordocument 403 /error403.php
-errordocument 401 /error401.php
diff --git a/tverify/favicon.ico b/tverify/favicon.ico
deleted file mode 100644 (file)
index 3c9c9c2..0000000
Binary files a/tverify/favicon.ico and /dev/null differ
diff --git a/tverify/index.php b/tverify/index.php
deleted file mode 100644 (file)
index 8976341..0000000
+++ /dev/null
@@ -1,163 +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
-*/ ?>
-<?
-//     phpinfo(); exit;
-       include_once("../includes/general.php");
-       loadem("tverify");
-
-       $id = intval($_GET['id']);
-       if(intval($_REQUEST['id']) > 0)
-               $id = intval($_REQUEST['id']);
-
-       if($id == 1)
-       {
-               $nofile = 1;
-               $filename = "";
-               $photoid = $_FILES['photoid'];
-               if($photoid['error'] == 0 && $_REQUEST["notaryURL"] != "")
-               {
-                       $filename = $photoid['tmp_name'];
-                       $do = trim(`file -b -i $filename`);
-                       $type = strtolower($do);
-                       switch($type)
-                       {
-                               case 'image/gif': $ext = "gif"; $nofile = 0; break;
-                               case 'image/jpeg': $ext = "jpg"; $nofile = 0; break;
-                               case 'image/jpg': $ext = "jpg"; $nofile = 0; break;
-                               case 'image/png': $ext = "png"; $nofile = 0; break;
-                               default:
-                                       $id = 0;
-                                       $_SESSION['_config']['errmsg'] = _("Only jpg, gif and png file types are acceptable, your browser sent a file of type: ").$type;
-                       }
-               }
-       }
-
-       if($id == 1)
-       {
-               $email = mysql_escape_string(trim($_REQUEST["email"]));
-               $password = mysql_escape_string(stripslashes(trim($_REQUEST["pword"])));
-               $URL = mysql_escape_string(trim($_REQUEST["notaryURL"]));
-               $CN = mysql_escape_string($_SESSION['_config']['CN']);
-               $memid = intval($_SESSION['_config']['uid']);
-               $user = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='$memid'"));
-               $tmp = mysql_fetch_assoc(mysql_query("select sum(`points`) as `points` from `notary` where `to`='$memid'"));
-
-               if($URL != "" && $nofile == 0)
-                       $max = 150;
-               else if($URL != "")
-                       $max = 90;
-               else
-                       $max = 50;
-
-               if($URL != "")
-               if(!preg_match("/^https:\/\/www\.thawte\.com\/cgi\/personal\/wot\/directory\.exe\?(.*?&)?node=\d+(&.*)?$/",$URL))
-               {
-                       showheader(_("Thawte Points Transfer"));
-                       echo _("You failed to enter a valid Thawte Notary URL.");
-                       showfooter();
-                       exit;
-               }
-
-               if($tmp['points'] >= $max)
-               {
-                       showheader(_("Thawte Points Transfer"));
-                       echo _("Your request would not gain you any more points and will not be taken any further.").
-                               sprintf(_("You have %s points already and you would have been issued up to %s points."), $tmp['points'], $max);
-                       showfooter();
-                       exit;
-               }
-
-       }
-
-       if($id == 1)
-       {
-               $query = "select * from `users`,`email` where `email`.`memid`='$memid' and `email`.`email`='$email' and `users`.`id`=`email`.`memid` and
-                               (`password`=old_password('$password') or `password`=sha1('$password') or `password`=password('$password'))";
-               if(mysql_num_rows(mysql_query($query)) <= 0)
-               {
-                       $_SESSION['_config']['errmsg'] = _("I'm sorry, I couldn't match your login details (password) to your certificate to an account on this system.");
-                       $id = 0;
-               } else {
-                       $query = "insert into `tverify` set `memid`='$memid', `URL`='$URL', `CN`='$CN', `created`=NOW()";
-                       mysql_query($query);
-                       $tverify = mysql_insert_id();
-                       if($nofile == 0)
-                       {
-                               $filename = $photoid['tmp_name'];
-                               $newfile = mysql_escape_string('/www/photoid/'.$tverify.".".$ext);
-                               move_uploaded_file($filename, $newfile);
-                               $query = "update `tverify` set `photoid`='$newfile' where `id`='$tverify'";
-                               mysql_query($query);
-                       }
-               }
-       }
-
-       if($id == 1)
-       {
-               $points = 0;
-               if($URL != "" && $newfile != "")
-                       $points = 150 - intval($tmp['points']);
-               else if($URL != "")
-                       $points = 90 - intval($tmp['points']);
-               else
-                       $points = 50 - intval($tmp['points']);
-
-               if($points < 0)
-                       $points = 0;
-       }
-
-       if($id == 1 && $max == 50)
-       {
-               if($points > 0)
-               {
-                       mysql_query("insert into `notary` set `from`='0', `to`='$memid', `points`='$points',
-                                       `method`='Thawte Points Transfer', `when`=NOW()");
-                       fix_assurer_flag($memid);
-               }
-               $totalpoints = intval($tmp['points']) + $points;
-               mysql_query("update `tverify` set `modified`=NOW() where `id`='$tverify'");
-
-               $body  = _("Your request to have points transfered was sucessful. You were issued $points points as a result, and you now have $totalpoints in total")."\n\n";
-
-               $body .= _("Best regards")."\n";
-               $body .= _("CAcert Support Team");
-               sendmail($user['email'], "[CAcert.org] Thawte Notary Points Transfer", $body, "website-form@cacert.org", "returns@cacert.org", "", "CAcert Tverify");
-       } else if($id == 1) {
-               $body  = "There is a new valid request for thawte points tranfer, details as follows:\n\n";
-               $body .= "To vote on this application, go to: https://www.cacert.org/account.php?id=52&uid=$tverify\n\n";
-               $body .= "Or use the certificate login: https://secure.cacert.org/account.php?id=52&uid=$tverify\n\n";
-
-               $body .= "We know that by signing into https://tverify.cacert.org that\n";
-               $body .= "1. they have possession of a cert issued from Thawte\n";
-               $body .= "2. the person named in the cert has been verified by Thawte's Web of Trust\n";
-               $body .= "3. at least 1 of the emails listed as valid in that cert belongs to a\n";
-               $body .= "CAcert.org user\n\n";
-               $body .= "It's up to us as voting members to verify the details that can't be\n";
-               $body .= "programatically handled, that means checking the ID, and signing into\n";
-               $body .= "the Thawte site and validating their name is listed as a notary.\n\n";
-
-               $body .= "Best regards"."\n";
-               $body .= "CAcert Support Team";
-
-               sendmail("cacert-tverify@lists.cacert.org", "[CAcert.org] Thawte Notary Points Transfer", $body, "website-form@cacert.org", "returns@cacert.org", "", "CAcert Tverify");
-       }
-
-       showheader(_("Thawte Points Transfer"));
-       includeit($id, "tverify");
-       showfooter();
-?>
diff --git a/tverify/index/0.php b/tverify/index/0.php
deleted file mode 100644 (file)
index 2264bab..0000000
+++ /dev/null
@@ -1,149 +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
-*/
-       $continue = 1;
-       //Checking for Thawte Freemail members, who aren´t notaries
-       if($_SERVER['SSL_CLIENT_S_DN_CN'] == 'Thawte Freemail Member')
-       {
-               $continue = 0;
-               echo _("I wasn't able to locate your name on your certificate, as such you can't continue with this process.");
-       }
-
-       //Extracting the Email address from the certificate that is presented, looking up the email in the database to find the user that has registered it.
-       if($continue == 1)
-       {
-               $addy = array();
-               $emails = explode("/", trim($_SERVER['SSL_CLIENT_S_DN']));
-               foreach($emails as $email)
-               {
-                       $bits = explode("=", $email);
-                       if($bits['0'] == "emailAddress")
-                       {
-                               $query = "select * from `email` where `email`='".$bits['1']."' and `deleted`=0 and hash=''";
-                               $account = mysql_query($query);
-                               if(mysql_num_rows($account))
-                                       $addy[] = $bits['1'];
-                       }
-               }
-       }
-
-       //Verifying that we found a record with that email address
-       if(count($addy) <= 0 && $continue == 1)
-       {
-               $continue = 0;
-               echo _("I wasn't able to match any email accounts on your certificate to any accounts in our database, as such I can't continue with this process.");
-       }
-
-       //If we found one, we extract the member-id from the sql result of the query we did above, and fetch the name of that user
-       if($continue == 1)
-       {
-               $row = mysql_fetch_assoc($account);
-               $memid = $row['memid'];
-
-
-                //Fetching the name of the user we have in the database:
-                $query = "select `fname`, `mname`, `lname`, `suffix` from `users` where `id`='$memid' and `deleted`=0";
-               $res = mysql_query($query);
-               $row = mysql_fetch_assoc($res);
-
-               //Building the user´s name, and ignoring punctuation
-               $cacert_name=$row['fname']." ".$row['mname']." ".$row['lname']." ".$row['suffix'];
-               $cacert_name=strtr($cacert_name,",.","");
-               $cacert_name=trim(str_replace("  ", " ", $cacert_name));
-
-               //Generate a short name form without the middle name
-               $cacert_short_name=$row['fname']." ".$row['lname']." ".$row['suffix'];
-               $cacert_short_name=strtr($cacert_short_name,",.","");
-               $cacert_short_name=trim(str_replace("  ", " ", $cacert_short_name));
-
-
-               $tverifybits = explode(" ", trim($_SERVER['SSL_CLIENT_S_DN_G']), 2);
-               $firstname = trim($tverifybits['0']);
-               $givenname = trim($_SERVER['SSL_CLIENT_S_DN_G']);
-               $lastname = trim($_SERVER['SSL_CLIENT_S_DN_S']);
-               $tverify_name=strtr("$givenname $lastname",",.","");
-               $tverify_short_name=strtr("$firstname $lastname",",.","");
-
-               if(($cacert_name != $tverify_name) and ($cacert_short_name == $tverify_name))
-               {
-                       $continue =