annotate print.php @ 91:b58a36f4821e

Initial addition of hardcopy / print helper module.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Oct 2013 15:51:56 +0300
parents
children d9de08fb5b28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Printing / hardcopy output helper module
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 $sessionType = "admin";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 require "mconfig.inc.php";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 require "msite.inc.php";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 require "msession.inc.php";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 // Check if we are allowed to execute
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 if (!stCheckHTTPS() || !stAdmSessionAuth())
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 {
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 stSetupCacheControl();
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 stSessionEnd(SESS_ADMIN);
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 stSetStatus(404, "Not Found");
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 exit;
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 }
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 stSetupCacheControl();
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 // Initiate SQL database connection
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 if (!stConnectSQLDB())
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 die("Could not connect to SQL database.");
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 // Fetch non-"hardcoded" settings from SQL database
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 stReloadSettings();
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 if (stChkRequestItem("type"))
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 $type = $_REQUEST["type"];
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 switch ($type)
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 {
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 case "email":
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 // Generic e-mail data dump
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 if (($res = stExecSQLCond(
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC",
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 "Dump OK.")) !== FALSE)
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 {
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 $out1 = array();
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 $out2 = array();
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 foreach ($res as $item)
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 {
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 $out1[] = $item["name"]." &lt;".$item["email"]."&gt;";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 $out2[] = $item["email"];
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 }
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 echo "<br /><hr />".
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 implode(", ", $out1)."<br /><hr /><br />".
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 implode("<br />", $out1)."<br /><hr /><br />".
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 implode(", ", $out2)."<br /><hr /><br />".
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 implode("<br />", $out2)."<br /><hr />";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 }
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 break;
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 case "votekeys":
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 // Print out votekeys
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 //
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 $sql = "SELECT * FROM votekeys ORDER BY id DESC";
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 if (($res = stExecSQLCond($sql, "Done.")) !== FALSE)
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 {
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 }
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 break;
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 default:
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 stSetStatus(404, "Not Found");
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 break;
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
b58a36f4821e Initial addition of hardcopy / print helper module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 ?>