view 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
line wrap: on
line source

<?
//
// 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"]." &lt;".$item["email"]."&gt;";
        $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;
}

?>