rm -rf pack/qtbase/.ctmp pack/qtbase/libqwbase* pack/qtbase/Makefile*
rm -rf doc/source-php doc/source-cpp
+distclean: clean
+
#tell Make that the rules above are symbolic:
-.PHONY: woc wob server client sdoc zip wbase
+.PHONY: woc wob server client sdoc zip wbase clean distclean
<Property name="cancelreason" type="string"/>
<Property name="amountSold" type="int"/>
<Property name="amountReserved" type="int"/>
+ <Property name="amountFree" type="int"/>
<Property name="description" type="string"/>
<Property name="comment" type="string"/>
<Property name="tax" type="int"/>
<Map property="amountReserved">
<Call lang="php" method="$data->getAmountReservedFromDB()"/>
</Map>
+ <Map property="amountFree">
+ <Call lang="php" method="$data->getcapacity()-$data->getamountSold()-$data->getamountReserved()"/>
+ </Map>
<Map property="canuse">
<Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
</Map>
//how long the stuff in a shopping cart is stored
$CartTimeout=3600;
+
//Authenticated web session timeout - how long an authenticated web session lasts
// this should usually be a few hours (3600s per hour)
$WebSessionTimeout=1800;
+
+//whether to show errors in the web client - usually turned off in production mode
+$WebShowErrors=false;
+
?>
public function __construct($fname="")
{
global $_SERVER;
- $this->vars["SCRIPT"]=$_SERVER[SCRIPT_NAME];
- $this->vars["FULLURL"]=$_SERVER[REQUEST_URI];
+ $this->vars["SCRIPT"]=$_SERVER['SCRIPT_NAME'];
+ $this->vars["FULLURL"]=$_SERVER['REQUEST_URI'];
if($fname!="")
$this->parseFile($fname);
}
return ereg("^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+$", $value);
}
+/**redirects the browser to index.php*/
+function redirectHome(array $query=array())
+{
+ global $_SERVER;
+ $url=$_SERVER["SCRIPT_NAME"];
+ $i=0;
+ foreach($query as $k => $v){
+ //character signalling next parameter
+ if($i)$url.="&";
+ else $url.="?";//first one...
+ $i++;
+ //append
+ $url.=urlencode($k)."=".urlencode($v);
+ }
+ Header("Location: ".$url);
+}
?>
--- /dev/null
+<?php
+// +----------------------------------------------------------------------
+// | PHP Source
+// +----------------------------------------------------------------------
+// | Copyright (C) 2010 by Konrad Rosenbaum <konrad@silmor.de>
+// +----------------------------------------------------------------------
+// |
+// | Copyright: See COPYING file that comes with this distribution
+// +----------------------------------------------------------------------
+//
+$d=dirname(__FILE__);
+$AUTOCLASS["EventRender"]=$d.'/event_listing.php';
+
+?>
// | PHP Source
// +----------------------------------------------------------------------
// | Copyright (C) 2007 by Peter Keller <peter@silmor.de>
+// | (c) 2010 by Konrad Rosenbaum <konrad@silmor.de>
// +----------------------------------------------------------------------
// |
// | Copyright: See COPYING file that comes with this distribution
// +----------------------------------------------------------------------
//
+
+class EventRender {
+
/** creates an list of events */
-function createEventList()
+public static function createEventList()
{
global $parser;
$p=new Parser("index.html");
$list="";
$eventTmpl=$p->getVar("EVENT");
- $events = getAllEventsForListing();
+ $trn=WTrGetAllEvents::execute();
+ $events = $trn->resultevents();
foreach ($events as $event)
{
- $eventID = $event["eventid"];
- $event = new Event($eventID);
$p->setVars($event->getParserData());
$list .= $p->parse($eventTmpl);
}
}
/** creates the details of an event */
-function createEventDetails()
+public static function createEventDetails()
{
global $parser;
$parser->setVAR("PAGE", $p->parseFile("eventdetails.html"));
}
+//end of class
+};
?>
// if email not available and no error, then it must be an intrusion
if (empty($email) && !$error->exists()) {
- header("Location:index.php");
+ redirectHome();
exit();
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
// forward to order login when order button in cart is pressed
if (isset($_POST["ms_goToOrder"])) {
if ($_POST["ms_isOrder"] == "true")
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
else
- Header("Location: index.php?mode=orderLogin");
+ redirectHome(array("mode"=>"orderLogin"));
exit();
}
$cartTicket->changeAmount($cartTicket->getAmount() + $_POST["ms_amount"]);
}
- Header("Location: index.php?mode=cart");
+ redirectHome(array("mode"=>"cart"));
exit();
}
}
}
// go to user registration
- Header("Location: index.php?mode=customerRegistration&email=".$_POST["ms_email"]);
+ redirectHome(array("mode"=>"customerRegistration","email"=>$_POST["ms_email"]));
exit();
// if user is registered
$session->createSession($customer->getID());
// go to order overview
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
exit();
} else {
$error->add(i18n("eMail or Password wrong"));
$session->createSession($customer->getID());
// redirect to overview page
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
exit();
}
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
$cart->addShippingAddress($_POST["ms_shippingAddress"]);
}
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
} else if (isset($_POST["ms_cancelShippingAddress"])) {
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
exit();
}
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
$cart->addOrderComments($_POST["ms_comments"]);
}
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
} else if (isset($_POST["ms_cancelComments"])) {
- Header("Location: index.php?mode=orderOverview");
+ redirectHome(array("mode"=>"orderOverview"));
exit();
}
}
// check if loggedin
$session = new WebSession();
if (!$session->isAuthorized()) {
- Header("Location: index.php");
+ redirectHome();
exit();
}
global $db;
$trans->setevents(WOEvent::fromTableArrayevent(WTevent::selectFromDB("starttime<=".$db->escapeInt($start)." AND endtime>=".$db->escapeInt($end))));
}
+
+ /**returns the data in an array suitable for the web-page-renderer*/
+ public function getParserData()
+ {
+ $lang = LanguageManager::singleton();
+ return array(
+ "DATE"=>$lang->getDate($this->getstart()),
+ "TIME"=>$lang->getTime($this->getstart()),
+ "PLACE"=>$this->getroom(),
+ "EVENTNAME"=>$this->gettitle(),
+ "ARTIST"=>$this->getartist()->getname(),
+ //TODO: do something about prices
+// "PRICE"=>$lang->getPrice($this->getDefaultPrice()),
+ "ID"=>$this->getid(),
+ "DESCRIPTION"=>$this->getdescription(),
+ "AVAILABLETICKETS"=>$this->getamountFree()
+ );;
+ }
};
?>
\ No newline at end of file
include('inc/loader_nonadmin.php');
include('inc/global_variables.php');
include('inc/global_functions.php');
+include("inc/rendering/autoload.php");
//include process script
include('inc/rendering/submit.php');
//include display scripts
-include('inc/rendering/event_listing.php');
+// include('inc/rendering/event_listing.php');
include('inc/rendering/cart_listing.php');
include('inc/rendering/order_listing.php');
$mode=$_GET["mode"];
}
+//TODO: set this to something more sensible
$lang->setLanguage("de");
+//set internal session to virtual "_web" user for use by transactions
Session::setWebSession();
-//get page template and process it
-switch($mode){
- case "eventDetails":
- addEventToCart();
- createEventDetails();
- break;
- case "cart":
- deleteEventFromCart();
- changeTicketAmountInCart();
- createCartOverview();
- break;
- case "orderLogin":
- checkOrderLogin();
- createOrderLogin();
- break;
- case "customerRegistration":
- registerUser();
- createCustomerRegistration();
- break;
- case "orderOverview":
- orderTickets();
- createOrderOverview();
- break;
- case "editShippingAddress":
- saveShippingAddress();
- editShippingAddress();
- break;
- case "editOrderComments":
- saveOrderComments();
- editOrderComments();
- break;
- default:
- createEventList();
- break;
+try{
+ //get page template and process it
+ switch($mode){
+ case "eventDetails":
+ addEventToCart();
+ EventRender::createEventDetails();
+ break;
+ case "cart":
+ deleteEventFromCart();
+ changeTicketAmountInCart();
+ createCartOverview();
+ break;
+ case "orderLogin":
+ checkOrderLogin();
+ createOrderLogin();
+ break;
+ case "customerRegistration":
+ registerUser();
+ createCustomerRegistration();
+ break;
+ case "orderOverview":
+ orderTickets();
+ createOrderOverview();
+ break;
+ case "editShippingAddress":
+ saveShippingAddress();
+ editShippingAddress();
+ break;
+ case "editOrderComments":
+ saveOrderComments();
+ editOrderComments();
+ break;
+ default:
+ EventRender::createEventList();
+ break;
+ }
+}catch(Exception $ex){
+ error_log($ex->getMessage());
+ $p=new Parser("error.html");
+ if($WebShowErrors)
+ $p->setVar("ErrorText",$ex->getMessage());
+ else
+ $p->setVar("ErrorText","An error occured, contact the server admin for details.");
+ $parser->setVar("PAGE",$p->parseFile("error.html"));
}
//spit out completed page
header("Content-Type: text/html; charset=utf-8");
print($parser->parseFile("layout.html"));
+
?>
\ No newline at end of file
--- /dev/null
+<h1>Error</h1>
+
+@ErrorText@
+
+<hr/>
+<a href="@SCRIPT@">Back to Index</a>