Source code taken from cacert-20131016.tar.bz2
[cacert-devel.git] / scripts / 27au-ate-melbourne-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("27au-ate-melbourne-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 = 50;
34
35
36 // location location.ID
37 // verified: 29.4.09 u.schroeter
38 // $locid = 7902857; // Paris
39 // $locid = 238568; // Bielefeld
40 // $locid = 715191; // Hamburg
41 // $locid = 1102495; // London
42 // $locid = 520340; // Duesseldorf
43 // $locid = 1260319; // Muenchen
44 // $locid = 606058; // Frankfurt
45 // $locid = 1775784; // Stuttgart
46 // $locid = 228950; // Berlin
47 // $locid = 606058; // Frankfurt
48 // $locid = 599389; // Flensburg
49 // $locid = 61065; // Amsterdam, Eemnes
50 // $locid = 228950; // Berlin
51
52 // Software Freedom Day 19. Sept 2009
53 // $locid = 715191; // Hamburg
54
55 // LISA2009 Baltimore, 1.11.2009
56 // $locid = 2138880; // Baltimore (Baltimore (city)), Maryland, United States
57 // $city = "Baltimore, MD - Nov. 3rd 2009";
58
59 // OpenSourceTreffen-Muenchen, 20.11.2009
60 // $locid = 1260319; // Muenchen
61 // $city = "Muenchen - 20. Nov 2009";
62
63 // BLIT2009, Brandenburger Linux-Infotag, 21.11.2009
64 // $locid = 1486658; // Potsdam
65 // $eventname = "Brandenburger Linux-Infotag (BLIT2009)";
66 // $city = "Potsdam - 21. Nov 2009";
67
68 // ATE-Goteborg, 16.12.2009
69 // $locid = 664715; // Goteborg, Vastra Gotaland, Sweden
70 // $eventname = "ATE-Goteborg";
71 // $city = "Goteborg - Dec 16th 2009";
72
73 // Assurance Event Mission Hills CA, 15.01.2010
74 // $locid = 2094781; // Mission Hills (Los Angeles), California, United States
75 // $eventname = "Assurance Event";
76 // $city = "Mission Hills CA - Jan 15th 2010";
77
78 // Assurance Event OSD Copenhagen DK, 5.03.2010
79 // $locid = 423655; // Copenhagen, Kobenhavn*, Denmark
80 // $eventname = "Assurance Event OpenSource-Days 2010";
81 // $city = "Copenhagen DK - March 5th/6th 2010";
82
83 // SCALE 8x Los Angeles, CA, Feb 19-21 2010
84 // $locid = 2093625; // Copenhagen, Kobenhavn*, Denmark
85 // $eventname = "SCALE 8x 2010";
86 // $city = "Los Angeles, CA - February 19-21 2010";
87
88 // ATE Sydney, AU, Mar 24 2010
89 // $locid = 2257312; // Sydney, New South Wales, Australia
90 // $eventname = "ATE-Sydney";
91 // $city = "March 24, 2010";
92
93 // ATE Essen, DE, Sept 28 2010
94 // $locid = 572764; // Essen, Nordrhein-Westfalen, Germany
95 // $eventname = "ATE-Essen";
96 // $city = "September 28, 2010";
97
98 // ATE Canberra, AU, Oct 12 2010
99 // $locid = 2255408; // Canberra, Australian Capital Territory, Australia
100 // $eventname = "ATE-Canberra";
101 // $city = "Tuesday 12th October";
102
103 // BLIT2010, 7. Brandenburger Linux-Infotag, 6.11.2010
104 // $locid = 1486658; // Potsdam, Brandenburg, Germany
105 // $eventname = "7. Brandenburger Linux-Infotag (BLIT2010)";
106 // $city = "Potsdam - 6. Nov 2010";
107
108 // LISA2010, Nov 7-12, 2010
109 // $locid = 2096344; // San Jose (Santa Clara), California, United States
110 // $eventname = "LISA2010";
111 // $city = "San Jose, CA - Nov 7-12, 2010";
112
113 // ATE Melbourne, AU, Dec 16 2010
114 $locid = 2262656; // Melbourne, VIC, Australia
115 $eventname = "ATE-Melbourne";
116 $city = "Thursday 16th December";
117
118
119
120 $query = "select * from `locations` where `id`='$locid'";
121 $loc = mysql_fetch_assoc(mysql_query($query));
122
123 $query = "SELECT ROUND(6378.137 * ACOS(0.9999999*((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) +
124 (COS(PI() * $loc[lat] / 180 ) * COS(PI() * `locations`.`lat` / 180) *
125 COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180)))), -1) AS `distance`, sum(`points`) as pts, `users`.*
126 FROM `locations`
127 inner join `users` on `users`.`locid` = `locations`.`id`
128 inner join `alerts` on `users`.`id`=`alerts`.`memid`
129 inner join `notary` on `users`.`id`=`notary`.`to`
130 WHERE (`alerts`.`general`=1 OR `alerts`.`country`=1 OR `alerts`.`regional`=1 OR `alerts`.`radius`=1)
131 GROUP BY `users`.`id`
132 HAVING `distance` <= '$maxdist'
133 ORDER BY `distance` ";
134 echo $query;
135
136 // comment next line when starting to send mail not only to me
137 // $query = "select * from `users` where `email` like 'cacerttest%'";
138
139 $res = mysql_query($query);
140 $xrows = mysql_num_rows($res);
141
142 while($row = mysql_fetch_assoc($res))
143 {
144 // uncomment next line to send mails ...
145 sendmail($row['email'], "[CAcert.org] $eventname - $city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
146 }
147 // 1x cc to events.cacert.org
148 sendmail("events@cacert.org", "[CAcert.org] $eventname - $city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
149 // 1x mailing report to events.cacert.org
150 sendmail("events@cacert.org", "[CAcert.org] $eventname - $city Report", "invitation sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
151
152 // 1x mailing report to Arbitrator of case http://wiki.cacert.org/wiki/Arbitrations/a20090525.1
153 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);
154
155 echo "invitation sent to $xrows recipients.\n";
156 ?>