summaryrefslogtreecommitdiff
path: root/scripts/oa02-orgainformation.php.txt
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2013-01-16 05:03:11 +0100
committerBenny Baumann <BenBE@geshi.org>2013-01-16 05:03:11 +0100
commitaba34728a556c0e83658b91bf425d9e9d3d7af81 (patch)
tree9ad1fb27bd7de557343351c5adb10ae7d147925d /scripts/oa02-orgainformation.php.txt
parent82dbce519b4a3abab2c2b2bd714ceb248542b941 (diff)
parent95f5aeb888e4ce1b9e66db3462fd23ad280a7e8d (diff)
downloadcacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.tar.gz
cacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.tar.xz
cacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.zip
Merge branch 'bug-512' into release
Diffstat (limited to 'scripts/oa02-orgainformation.php.txt')
-rw-r--r--scripts/oa02-orgainformation.php.txt119
1 files changed, 119 insertions, 0 deletions
diff --git a/scripts/oa02-orgainformation.php.txt b/scripts/oa02-orgainformation.php.txt
new file mode 100644
index 0000000..e0d8ca2
--- /dev/null
+++ b/scripts/oa02-orgainformation.php.txt
@@ -0,0 +1,119 @@
+#!/usr/bin/php -q
+<? /*
+ LibreSSL - CAcert web application
+ Copyright (C) 2004-2009 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");
+ include_once("../includes/lib/general.php");
+
+ //default mail text
+ $lines = "";
+ $fp = fopen("oa02-mailingtextPoints.txt", "r");
+ while(!feof($fp))
+ {
+ $line = trim(fgets($fp, 4096));
+ $lines .= wordwrap($line, 75, "\n")."\n";
+ }
+ fclose($fp);
+
+ //first variant of mail text
+ $lines1 = "";
+ $fp = fopen("oa02-mailingtextCats.txt", "r");
+ while(!feof($fp))
+ {
+ $line = trim(fgets($fp, 4096));
+ $lines1 .= wordwrap($line, 75, "\n")."\n";
+ }
+ fclose($fp);
+
+ //second variant of mail text
+ $lines2 = "";
+ $fp = fopen("oa02-mailingtextPointsCats.txt", "r");
+ while(!feof($fp))
+ {
+ $line = trim(fgets($fp, 4096));
+ $lines2 .= wordwrap($line, 75, "\n")."\n";
+ }
+ fclose($fp);
+
+ // comment next line when starting to send mail not only to me
+ // $query = "select * from `users` where `email` like 'cacerttest%'";
+
+ $query = "
+ SELECT
+ `users`.`email`,
+ `users`.`fname`,
+ `users`.`lname`,
+ `orginfo`.`O`,
+ `orginfo`.`id`,
+ `org`.`memid`
+ FROM
+ `users`,
+ `orginfo`,
+ `org`
+ WHERE `org`.`orgid` = `orginfo`.`id`
+ AND `org`.`memid` = `users`.`id`
+ AND `users`.`assurer` = 0
+ AND `org`.`deleted` = 0
+ ORDER BY
+ `users`.`email`,
+ `orginfo`.`O`
+ ";
+
+ $res = mysql_query($query);
+ $xrows = mysql_num_rows($res);
+
+ $report = "";
+ $report1 = "";
+ $report2 = "";
+ $report3 = "";
+
+ while($row = mysql_fetch_assoc($res))
+ {
+ // uncomment next line to send mails ...
+ $fullname = $row['fname']." ".$row['lname'];
+ $status = get_assurer_status($row['memid']);
+ if (3 == $status) {
+ $mail = str_replace("<name>",$fullname,$lines);
+ sendmail($row['email'], "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators", $mail, "support@cacert.org", "", "", "CAcert Organisation Assurer", "returns@cacert.org", 1);
+ $report = $row['email'].", ".$fullname.", ".$row['O']."\n";
+ } elseif (5 == $status) {
+ $mail = str_replace("<name>",$fullname,$lines1);
+ sendmail($row['email'], "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators", $mail, "support@cacert.org", "", "", "CAcert Organisation Assurer", "returns@cacert.org", 1);
+ $report1 = $row['email'].", ".$fullname.", ".$row['O']."\n";
+ } elseif (7 == $status){
+ $mail = str_replace("<name>",$fullname,$lines2);
+ sendmail($row['email'], "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators", $mail, "support@cacert.org", "", "", "CAcert Organisation Assurer", "returns@cacert.org", 1);
+ $report2 = $row['email'].", ".$fullname.", ".$row['O']."\n";
+ } else {
+ $report3 = $row['email'].", ".$fullname.", ".$row['O']."\n";
+ }
+ }
+
+ // 1x cc to oao.cacert.org
+ sendmail("oao@cacert.org", "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators", $lines."\n\n".$lines1."\n\n".$lines2, "oao@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+
+ // 1x mailing report to oao.cacert.org
+ sendmail("oao@cacert.org", "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators - Report", "oa-mailing sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert OA Support", "returns@cacert.org", 1);
+
+ // 1x detailed mailing report to OAO
+ $reporttotal = "Result of the Mailing \n\n Organisation Administrators with missing points \n".$report."\n\n Organisation Adminstrators with missing points ".$report1."\n\n Organisation Adminstrators with missing points and CATS ".$report2."\n\n Organisation Adminstrators with blocked assurer ".$report3;
+ sendmail("oao@cacert.org", "[CAcert.org] Assurer Status Requirement Check on Organisation Adminstrators - Report", $reporttotal, "support@cacert.org", "", "", "CAcert Organisation Assurer", "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] Assurer Status Requirement Check on Organisation Adminstrators - 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";