//Authenticated session timeout - how long an authenticated session lasts
// this should usually be a few hours (3600s per hour)
$ClientSessionTimeout=2*3600;
+
+
+///////////
+//Web-Client Configuration
+
+//how long the stuff in a shopping cart is stored
+$CartTimeout=3600;
?>
\ No newline at end of file
public function select($table,$cols,$where)
{
- $res=mysql_query("SELECT $cols FROM ".$this->tableName($table)." WHERE ".$where);
+ $query="SELECT $cols FROM ".$this->tableName($table);
+ if($where!="")$query.=" WHERE ".$where;
+ $res=mysql_query($query);
if($res===false)return false;
$nr=mysql_num_rows($res);
$ret=array();
"ordertime" => array("int32","notnull"),
"senttime" => array("int32"),
//comments made on web form (eg. "urgently needed for dads birthday")
- "comments" => array("text")
+ "comments" => array("text"),
+ //how much has been paid already (including used vouchers)
+ //this is for comparison with the price fields in ticket and voucher tables
+ "amountpaid" => array("int32")
);
//tickets
$this->scheme["ticket"]=array(
//remaining value in cents
"value" => array("int32","notnull")
);
+
+ //shopping cart
+ $this->scheme["cart"]=array(
+ //the cookie for this cart
+ "cartid" => array("string:32","primarykey"),
+ //when the cart expires
+ "timeout" => array("int32","notnull")
+ );
+ //buying tickets
+ $this->scheme["cart_ticket"]=array(
+ "ctid" => array("int64","primarykey"),
+ //tickets in the cart
+ "eventid" => array("int32","foreignkey:event:eventid"),
+ "amount" => array("int32","notnull"),
+ );
+ //buying vouchers
+ $this->scheme["cart_voucher"]=array(
+ "cvid" => array("int64","primarykey"),
+ //voucher value
+ "value" => array("int32","notnull")
+ );
+
}
/**return the tables to be created in order*/
--- /dev/null
+<?
+//
+// PHP Implementation: event
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+
+/**Get an overview of all events:
+returns an array of array("eventid"=>int, "title"=>string,"starttime"=>int)*/
+function getAllEvents()
+{
+ global $db;
+ return $db->select("event","eventid,title,starttime","");
+}
+
+/**Machine-wrapper for getAllEvents() */
+function getAllEventsXml()
+{
+ $all=getAllEvents();
+ if($all===false){
+ header("X-MagicSmoke-Status: Error");
+ echo "Database Error.";
+ return;
+ }
+ header("X-MagicSmoke-Status: Ok");
+ $xml=new DOMDocument;
+ $root=$xml->createElement("EventList");
+ if(count($all)>0)
+ foreach($all as $k => $ev){
+ $nod=$xml->createElement("Event",$ev["title"]);
+ $nod->setAttribute("id",$ev["eventid"]);
+ $nod->setAttribute("start",$ev["starttime"]);
+ $root->appendChild($nod);
+ }
+ $xml->appendChild($root);
+ echo $xml->saveXml();
+}
+
+?>
\ No newline at end of file
//check database
if(!$db->canUseDb())
die("Database is not correctly configured. Giving up.");
+//load class-files
+include('inc/event.php');
?>
\ No newline at end of file
die("You do not have the right to execute this transaction.");
}
+//get a list of events
+if($SMOKEREQUEST=="geteventlist"){
+ getAllEventsXml();
+ exit();
+}
+
//EOF
header("X-MagicSmoke-Status: Error");
die("Internal Error: unknown command, hiccup in code structure.");