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