Source code taken from cacert-20130129.tar.bz2
[cacert.git] / scripts / 32de-ate-bonn-mail.php.txt
1 #!/usr/bin/php -q
2 <? /*
3 LibreSSL - CAcert web application
4 Copyright (C) 2004-2009 CAcert Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 include_once("../includes/mysql.php");
20
21 $lines = "";
22 $fp = fopen("32de-ate-bonn-email.txt", "r");
23 while(!feof($fp))
24 {
25 $line = trim(fgets($fp, 4096));
26 $lines .= wordwrap($line, 75, "\n")."\n";
27 }
28 fclose($fp);
29
30
31 // $locid = intval($_REQUEST['location']);
32 // $maxdist = intval($_REQUEST['maxdist']);
33 // maxdist in [Km]
34 $maxdist = 200;
35
36
37 // location location.ID
38 // verified: 29.4.09 u.schroeter
39 // $locid = 7902857; // Paris
40 // $locid = 238568; // Bielefeld
41 // $locid = 715191; // Hamburg
42 // $locid = 1102495; // London
43 // $locid = 520340; // Duesseldorf
44 // $locid = 1260319; // Muenchen
45 // $locid = 606058; // Frankfurt
46 // $locid = 1775784; // Stuttgart
47 // $locid = 228950; // Berlin
48 // $locid = 606058; // Frankfurt
49 // $locid = 599389; // Flensburg
50 // $locid = 61065; // Amsterdam, Eemnes
51 // $locid = 228950; // Berlin
52
53 // Software Freedom Day 19. Sept 2009
54 // $locid = 715191; // Hamburg
55
56 // LISA2009 Baltimore, 1.11.2009
57 // $locid = 2138880; // Baltimore (Baltimore (city)), Maryland, United States
58 // $city = "Baltimore, MD - Nov. 3rd 2009";
59
60 // OpenSourceTreffen-Muenchen, 20.11.2009
61 // $locid = 1260319; // Muenchen
62 // $city = "Muenchen - 20. Nov 2009";
63
64 // BLIT2009, Brandenburger Linux-Infotag, 21.11.2009
65 // $locid = 1486658; // Potsdam
66 // $eventname = "Brandenburger Linux-Infotag (BLIT2009)";
67 // $city = "Potsdam - 21. Nov 2009";
68
69 // ATE-Goteborg, 16.12.2009
70 // $locid = 664715; // Goteborg, Vastra Gotaland, Sweden
71 // $eventname = "ATE-Goteborg";
72 // $city = "Goteborg - Dec 16th 2009";
73
74 // Assurance Event Mission Hills CA, 15.01.2010
75 // $locid = 2094781; // Mission Hills (Los Angeles), California, United States
76 // $eventname = "Assurance Event";
77 // $city = "Mission Hills CA - Jan 15th 2010";
78
79 // Assurance Event OSD Copenhagen DK, 5.03.2010
80 // $locid = 423655; // Copenhagen, Kobenhavn*, Denmark
81 // $eventname = "Assurance Event OpenSource-Days 2010";
82 // $city = "Copenhagen DK - March 5th/6th 2010";
83
84 // SCALE 8x Los Angeles, CA, Feb 19-21 2010
85 // $locid = 2093625; // Copenhagen, Kobenhavn*, Denmark
86 // $eventname = "SCALE 8x 2010";
87 // $city = "Los Angeles, CA - February 19-21 2010";
88
89 // ATE Sydney, AU, Mar 24 2010
90 // $locid = 2257312; // Sydney, New South Wales, Australia
91 // $eventname = "ATE-Sydney";
92 // $city = "March 24, 2010";
93
94 // ATE Essen, DE, Sept 28 2010
95 // $locid = 572764; // Essen, Nordrhein-Westfalen, Germany
96 // $eventname = "ATE-Essen";
97 // $city = "September 28, 2010";
98
99 // ATE Aachen, DE, Oct 4th 2010
100 // $locid = 78; // Aachen, Nordrhein-Westfalen, Germany
101 // $eventname = "ATE-Aachen";
102 // $city = "October 4th, 2010";
103
104 // ATE Muenchen, DE, Apr 2nd 2011
105 // $locid = 1260319; // Muenchen
106 // $eventname = "ATE-Muenchen";
107 // $city = "2. April, 2011";
108
109 // ATE Bonn, DE, Jun 8th 2011
110 $locid = 266635; // Bonn, Nordrhein-Westfalen, Germany
111 $eventname = "ATE-Bonn";
112 $city = "8. Juni, 2011";
113
114
115 $query = "select * from `locations` where `id`='$locid'";
116 $loc = mysql_fetch_assoc(mysql_query($query));
117
118 $query = "SELECT ROUND(6378.137 * ACOS(0.9999999*((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) +
119 (COS(PI() * $loc[lat] / 180 ) * COS(PI() * `locations`.`lat` / 180) *
120 COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180)))), -1) AS `distance`, sum(`points`) as pts, `users`.*
121 FROM `locations`
122 inner join `users` on `users`.`locid` = `locations`.`id`
123 inner join `alerts` on `users`.`id`=`alerts`.`memid`
124 inner join `notary` on `users`.`id`=`notary`.`to`
125 WHERE (`alerts`.`general`=1 OR `alerts`.`country`=1 OR `alerts`.`regional`=1 OR `alerts`.`radius`=1)
126 GROUP BY `users`.`id`
127 HAVING `distance` <= '$maxdist'
128 ORDER BY `distance` ";
129 echo $query;
130
131 // comment next line when starting to send mail not only to me
132 // $query = "select * from `users` where `email` like 'cacerttest%'";
133
134 $res = mysql_query($query);
135 $xrows = mysql_num_rows($res);
136
137 while($row = mysql_fetch_assoc($res))
138 {
139 // uncomment next line to send mails ...
140 sendmail($row['email'], "[CAcert.org] $eventname - $city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
141 }
142 // 1x cc to events.cacert.org
143 sendmail("events@cacert.org", "[CAcert.org] $eventname - $city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
144 // 1x mailing report to events.cacert.org
145 sendmail("events@cacert.org", "[CAcert.org] $eventname - $city Report", "invitation sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
146
147 // 1x mailing report to Arbitrator of case http://wiki.cacert.org/wiki/Arbitrations/a20090525.1
148 sendmail("p.dunkel@cacert.org", "[CAcert.org] $eventname - $city Report", "invitation sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
149 echo "invitation sent to $xrows recipients.\n";
150
151 ?>