Mercurial > hg > fapweb
view print.php @ 1029:35a00a986f79
Factorize compo entry adding into stAddCompoEntry().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 19 Nov 2015 20:11:30 +0200 |
parents | 2a259e243350 |
children | 7da8bde9b7be |
line wrap: on
line source
<? // // FAPWeb - Simple Web-based Demoparty Management System // Data printout / hardcopy output module // (C) Copyright 2012-2015 Tecnic Software productions (TNSP) // $sessionType = "admin"; require_once "mconfig.inc.php"; require_once "msite.inc.php"; require_once "msession.inc.php"; $pageCSS = "css/hardcopy.css"; // // Check if we are allowed to execute // if (!stCheckHTTPS() || !stAdmSessionAuth(TRUE)) { stSetupCacheControl(); stSessionEnd(SESS_ADMIN); stSetStatus(404, "Not Found"); cmPrintPageHeader("Error"); echo "<h1>Permission denied</h1>\n". "<p>You need to be logged in as administrator to access this data.</p>\n". "<p><a href=\"admin.php\">Click here for login form</a></p>\n"; cmPrintPageFooter(); exit; } // // Initialize // stSetupCacheControl(); if (!stConnectSQLDB()) die("Could not connect to SQL database."); stReloadSettings(); // // Handle request // switch (stGetRequestItem("type", "", TRUE)) { case "results": header("Content-Type: text/plain"); echo stGetCompoResultsASCIIStr(FALSE, intval(stGetRequestItem("flags", RFLAG_NORMAL))); break; case "emails": // // Generic e-mail data dump // $sql = "SELECT * FROM attendees WHERE email IS NOT NULL AND email != '' ORDER BY regtime DESC"; if (($res = stExecSQL($sql)) !== FALSE) { cmPrintPageHeader("E-mails"); $out1 = array(); $out2 = array(); foreach ($res as $item) { $out1[] = $item["name"]." <".$item["email"].">"; $out2[] = $item["email"]; } echo implode(", ", $out1)."<br /><hr /><br />\n". implode("<br />", $out1)."<br /><hr /><br />\n". implode(", ", $out2)."<br /><hr /><br />\n". implode("<br />", $out2)."<br /><hr />\n"; cmPrintPageFooter(); } break; case "votekeys": // // Print out votekeys as a table // $sql = "SELECT * FROM votekeys ORDER BY id ASC"; if (($res = stExecSQL($sql)) !== FALSE) { cmPrintPageHeader("Votekeys"); $keyLen = stGetSetting("userKeyLength"); echo "<div class=\"votekeys\">\n"; foreach ($res as $item) { // This funny code is to ensure that the cells are of uniform width printf("<div class=\"votekey\"><span class=\"keyid\">%03d</span> : ". "<span class=\"keycode\">%s</span></div>\n", $item["id"], str_repeat(" ", $keyLen - strlen($item["key"])).$item["key"]); } echo "</div>\n"; cmPrintPageFooter(); } break; default: stSetStatus(404, "Not Found"); break; } ?>