--- nfo/site/htdocs/index.php 2004/08/30 01:48:30 1.3 +++ nfo/site/htdocs/index.php 2004/09/03 22:43:17 1.10 @@ -4,31 +4,79 @@ --- Main index and content access page. -------------------------------------------------------------------------------- --- rabit, 01:28 24.08.2004 ---- $Id: index.php,v 1.3 2004/08/30 01:48:30 rabit Exp $ +--- $Id: index.php,v 1.10 2004/09/03 22:43:17 joko Exp $ ------------------------------------------------------------------------------*/ include('inc/common/common.php.inc'); +common_benchmark_addstep('start'); + //------------------------------------------------------------------------------ -//- GET/POST variable encapsulation: +//- Web authorisation: + +if(isset($_POST['un'])) { + + $common_sessiondata['userdata']['name'] = $_POST['un']; + + if(isset($_POST['pw'])) { + + $common_sessiondata['userdata']['password'] = $_POST['pw']; + + common_checkauthorisation(); -$contentkeyname = (isset($_GET['ck']) ? $_GET['ck'] : ''); + } -$outputtype = (isset($_GET['ot']) ? $_GET['ot'] : ''); +} + +common_benchmark_addstep('authorisation test'); //------------------------------------------------------------------------------ +//- GET/POST variable encapsulation: + +$request_contentkey = (isset($_GET['ck']) ? $_GET['ck'] : ''); +$request_outputtype = (isset($_GET['ot']) ? $_GET['ot'] : ''); -if(!$contentkeyname) $contentkeyname = 'Home'; +if(isset($_GET['li'])) + $common_sessiondata['userdata']['language_id'] = intval($_GET['li']); -if(!$outputtype) $outputtype = 'html'; //------------------------------------------------------------------------------ +//- User Agent <-> Output Type: +$common['client']['session_enabled'] = 1; +if ($_SERVER['HTTP_USER_AGENT'] == 'M3Gate/1.2') { + $common['client']['session_enabled'] = 0; + $request_outputtype = 'wml'; +} + +//------------------------------------------------------------------------------ +//- Variable defaults: +if(!$request_contentkey) $request_contentkey = 'Home'; + +if(!$request_outputtype) $request_outputtype = 'html'; + +if(isset($common_sessiondata['userdata']['language_id'])) { + + // Set language ID from the users session data. + $language_id = $common_sessiondata['userdata']['language_id']; + +} else { + + $language_id = 1; // Default language ID. + +} + +common_benchmark_addstep('GET/POST variable processing'); + +//------------------------------------------------------------------------------ // Dispatching the output content type: -switch($outputtype) { +switch($request_outputtype) { + + case 'wml': // WML output - case 'xml': // XML output + include($common['site']['incroot'] . 'otdef/otd_wml1.php.inc'); + common_benchmark_addstep('OTD_WML1 included'); break; @@ -38,11 +86,16 @@ default: - // Generate a HTML page: - common_page($contentkeyname); + include($common['site']['incroot'] . 'otdef/otd_html1.php.inc'); + common_benchmark_addstep('OTD_HTML1 included'); } //------------------------------------------------------------------------------ +// Render output: + +if(isset($otd_render)) $otd_render($request_contentkey, $language_id); + +//------------------------------------------------------------------------------ ?>