summaryrefslogtreecommitdiff
path: root/scripts/oa03-csr_org_client_cert.php.txt
diff options
context:
space:
mode:
authorBernhard Fröhlich <bernhard@cacert.org>2018-10-29 20:07:10 +0100
committerBernhard Fröhlich <bernhard@cacert.org>2018-10-29 20:07:10 +0100
commitf8210d43aa91c16ca565f771fd23deb9b02af41d (patch)
tree337846293df774b27d7ced35df2c5ea7598d9465 /scripts/oa03-csr_org_client_cert.php.txt
parent000b17a9a909737930d59dee82c40e7eab2fa337 (diff)
downloadcacert-devel-f8210d43aa91c16ca565f771fd23deb9b02af41d.tar.gz
cacert-devel-f8210d43aa91c16ca565f771fd23deb9b02af41d.tar.xz
cacert-devel-f8210d43aa91c16ca565f771fd23deb9b02af41d.zip
source code taken from cacert-20180906.tar.bz2
Diffstat (limited to 'scripts/oa03-csr_org_client_cert.php.txt')
-rw-r--r--scripts/oa03-csr_org_client_cert.php.txt98
1 files changed, 98 insertions, 0 deletions
diff --git a/scripts/oa03-csr_org_client_cert.php.txt b/scripts/oa03-csr_org_client_cert.php.txt
new file mode 100644
index 0000000..89a49c4
--- /dev/null
+++ b/scripts/oa03-csr_org_client_cert.php.txt
@@ -0,0 +1,98 @@
+#!/usr/bin/php -q
+<? /*
+ LibreSSL - CAcert web application
+ Copyright (C) 2004-2011 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/mysql.php");
+
+ $lines = "";
+ $fp = fopen("oa03-csr_org_client_cert.txt", "r");
+ while(!feof($fp))
+ {
+ $line = trim(fgets($fp, 4096));
+ $lines .= wordwrap($line, 75, "\n")."\n";
+ }
+ fclose($fp);
+
+// --- Variable parameters --- begin
+
+// $country
+// "" (empty) email to _all_ countries
+// "DE" 2-digit country code, eg. email to Germany Org's only
+
+// $status
+// Status: 1 mails to org contacts only
+// 2 mails to org admins only
+// 3 mails to org contacts + org admins
+
+// $subject
+// sample:
+// with
+// mailing subject results in
+// a) $country = ""
+// "[CAcert.org] Allowance to publish Organisation Assurance on CAcert website"
+// b) $country = "DE"
+// "[CAcert.org] Allowance to publish Organisation Assurance on CAcert website (DE)"
+
+
+////OA Allowance
+//$country = ""; // "DE" or ""
+//$status = 3; // 1, 2 or 3 3 = 1+2
+//$subject = "Allowance to publish Organisation Assurance on CAcert website";
+
+
+//OA Org Client Cert Information
+$country = ""; // "DE" or ""
+$status = 3; // 1, 2 or 3 3 = 1+2
+$subject = "New Feature in CAcert Organisation Accounts";
+
+// --- Variable parameters --- end
+
+$query = "SELECT orginfo.contact as email, orginfo.O, 1 as status
+ FROM orginfo
+ WHERE (orginfo.C like '$country%' and (1=$status or 3=$status))
+ UNION
+ Select users.email, orginfo.O, 2 as status
+ FROM users
+ inner join org on users.id = org.memid
+ inner join orginfo on org.orgid=orginfo.id
+ WHERE (orginfo.C like '$country%' and (2=$status or 3=$status))
+ ORDER BY O";
+
+
+ echo $query;
+
+ // comment next line when starting to send mail not only to me
+ // $query = "select * from `users` where `email` like 'cacerttest%'";
+
+ $res = mysql_query($query);
+ $xrows = mysql_num_rows($res);
+
+ while($row = mysql_fetch_assoc($res))
+ {
+ // uncomment next line to send mails ...
+ sendmail($row['email'], "[CAcert.org] ".$subject.(empty($country)?"":" (".$country.")") , $lines, "support@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+ }
+ // 1x cc to oao.cacert.org
+ sendmail("oao@cacert.org", "[CAcert.org] ".$subject.(empty($country)?"":" (".$country.")"), $lines, "oao@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+ // 1x mailing report to oao.cacert.org
+ sendmail("oao@cacert.org", "[CAcert.org] ".$subject.(empty($country)?"":" (".$country.")")." - Report", "oa-mailing sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+
+ // 1x mailing report to Arbitrator of case http://wiki.cacert.org/wiki/Arbitrations/a20110608.1
+ sendmail("bernhard@cacert.org", "[CAcert.org] ".$subject.(empty($country)?"":" (".$country.")")." - Report", "oa-mailing sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+
+ echo "oa-mailing sent to $xrows recipients.\n";
+?>