Mercurial > hg > fapweb
changeset 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 | 32c4654aad50 |
children | 8efda89e765a |
files | print.php |
diffstat | 1 files changed, 76 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/print.php Fri Oct 18 15:51:56 2013 +0300 @@ -0,0 +1,76 @@ +<? +// +// Printing / hardcopy output helper module +// +$sessionType = "admin"; +require "mconfig.inc.php"; +require "msite.inc.php"; +require "msession.inc.php"; + +// Check if we are allowed to execute +if (!stCheckHTTPS() || !stAdmSessionAuth()) +{ + stSetupCacheControl(); + + stSessionEnd(SESS_ADMIN); + + stSetStatus(404, "Not Found"); + exit; +} + +stSetupCacheControl(); + +// Initiate SQL database connection +if (!stConnectSQLDB()) + die("Could not connect to SQL database."); + +// Fetch non-"hardcoded" settings from SQL database +stReloadSettings(); + +if (stChkRequestItem("type")) + $type = $_REQUEST["type"]; + +switch ($type) +{ + case "email": + // + // Generic e-mail data dump + // + if (($res = stExecSQLCond( + "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC", + "Dump OK.")) !== FALSE) + { + $out1 = array(); + $out2 = array(); + + foreach ($res as $item) + { + $out1[] = $item["name"]." <".$item["email"].">"; + $out2[] = $item["email"]; + } + + echo "<br /><hr />". + implode(", ", $out1)."<br /><hr /><br />". + implode("<br />", $out1)."<br /><hr /><br />". + implode(", ", $out2)."<br /><hr /><br />". + implode("<br />", $out2)."<br /><hr />"; + + } + break; + + case "votekeys": + // + // Print out votekeys + // + $sql = "SELECT * FROM votekeys ORDER BY id DESC"; + if (($res = stExecSQLCond($sql, "Done.")) !== FALSE) + { + } + break; + + default: + stSetStatus(404, "Not Found"); + break; +} + +?> \ No newline at end of file