public $path;
public $argv;
+ static private $_page = null;
+
public function __construct()
{
+ global $platal, $globals, $session;
+ $platal =& $this;
+ $globalclass = PL_GLOBALS_CLASS;
+ $globals = new $globalclass();
+ $sessionclass = PL_SESSION_CLASS;
+ $session = new $sessionclass();
+
$modules = func_get_args();
if (is_array($modules[0])) {
$modules = $modules[0];
if (empty($hook)) {
return PL_NOT_FOUND;
}
- global $globals;
+ global $globals, $session;
if ($this->https && !$_SERVER['HTTPS'] && $globals->core->secure_domain) {
http_redirect('https://' . $globals->core->secure_domain . $_SERVER['REQUEST_URI']);
}
if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
if ($hook['type'] & DO_AUTH) {
- if (!call_user_func(array($globals->session, 'doAuth'))) {
+ if (!$session->doAuth()) {
$this->force_login($page);
}
} else {
$val = call_user_func_array($hook['hook'], $args);
if ($val == PL_DO_AUTH) {
// The handler need a better auth with the current args
- if (!call_user_func(array($globals->session, 'doAuth'))) {
+ if (!$session->doAuth()) {
$this->force_login($page);
}
$val = call_user_func_array($hook['hook'], $args);
public function run()
{
- global $page;
-
- new_skinned_page('platal/index.tpl');
+ $page =& self::page();
if (empty($this->path)) {
$this->path = 'index';
call_user_func_array(array($mod, 'on_subscribe'), $args);
}
}
+
+ static public function &page()
+ {
+ global $platal, $page;
+ if (is_null(self::$_page)) {
+ $pageclass = PL_PAGE_CLASS;
+ $page = new $pageclass();
+ self::$_page =& $page;
+ }
+ return self::$_page;
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
// {{{ function PlPage()
- public function __construct($tpl, $type = SKINNED)
+ public function __construct()
{
parent::Smarty();
$this->compile_check = !empty($globals->debug);
- $this->changeTpl($tpl, $type);
$this->_errors = array('errors' => array());
$this->_jsonVars = array();
$this->_failure = false;
***************************************************************************/
require_once dirname(__FILE__).'/../include/xorg.inc.php';
-global $globals, $platal, $page;
if (!($path = Env::v('n')) || ($path{0} < 'A' || $path{0} > 'Z')) {
-
$platal = new Platal('auth', 'carnet', 'email', 'events', 'forums',
'geoloc', 'lists', 'marketing', 'payment', 'platal',
'profile', 'register', 'search', 'stats', 'admin',
'newsletter', 'axletter', 'bandeau', 'survey',
'gadgets', 'googleapps');
$platal->run();
-
exit;
}
public function __construct($sess)
{
- $this->session = $sess; /* XXX Remove references to session from $globals */
parent::__construct(array('platal.ini', 'platal.conf'));
+ $globals->bootstrap(array('NbIns'), 'update_NbIns');i
+ $globals->bootstrap(array('NbValid'), 'update_NbValid');
}
public function asso($key=null)
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
+define('PL_GLOBALS_CLASS', 'PlatalGlobals');
+define('PL_SESSION_CLASS', 'XorgSession');
+define('PL_PAGE_CLASS', 'XorgPage');
+
require_once('platal.inc.php');
require_once('globals.inc.php');
require_once('xorg/session.inc.php');
-$globals = new PlatalGlobals('XorgSession');
-$globals->bootstrap(array('NbIns'), 'update_NbIns');
-$globals->bootstrap(array('NbValid'), 'update_NbValid');
+$globals = new PlatalGlobals();
// {{{ class XorgPage
class XorgPage extends PlPage
{
- public function __construct($tpl, $type = SKINNED)
+ public function __construct()
{
- parent::__construct($tpl, $type);
+ parent::__construct();
+
+ // Set the default page
+ $this->changeTpl('platal/index.tpl');
}
public function run()
{
global $globals, $platal;
- $this->assign('globals', $globals);
+ $this->assign_by_ref('globals', $globals);
if (isset($platal) && $platal->path == 'register') {
$skin = $globals->register_skin . ".tpl";
} else {
}
}
-// {{{ function new_skinned_page()
-
-function new_skinned_page($tpl_name)
-{
- global $page;
- if (!$page instanceof XorgPage) {
- $page = new XorgPage($tpl_name);
- } else {
- $page->changeTpl($tpl_name);
- }
-}
-
-XorgSession::init();
-
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
class XorgSession
{
+ public function __construct() {
+ XorgSession::init();
+ }
+
// {{{ public static function init
public static function init()