<?php /********************************************************************** * Copyright (C) 2006 L'équipe Wikigraphe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * See also http://www.fsf.org *********************************************************************/ //require_once("lib/ErrorHandler.php"); //$error =& new ErrorHandler(); error_reporting(E_ALL ^ E_NOTICE); define('DEFAULT_VIEW', 'display'); /** * Helper function to encapsulate the way we find out which view to * run from the broker * * @returns string the name of the view (require-safe) */ function get_view() { if (isset($_SERVER["PATH_INFO"])) { $view = $_SERVER["PATH_INFO"]; } else { $view = (isset($_GET['view']) ? $_GET['view'] : DEFAULT_VIEW); } // make view safe for path requires $view = preg_replace('/[\.\/]/', '', $view); return $view; } $view = get_view(); require_once("Savant2.php"); /* Create Template engine */ $tpl =& new Savant2(); $tpl->setpath('template', 'tpl'); // template directory is tpl if (!include_once("view/$view.php")) { trigger_error("broker could not find view $view", E_USER_ERROR); } //print "<div class=\"error\">\n"; //foreach ($error->getMessages() as $msg) { // print "<div>$msg</div>"; //} //print "</div>"; ?>