Continue #448: fix search and order with PlSet
[platal.git] / include / xorg.inc.php
index 8f548f9..62bfbe8 100644 (file)
@@ -29,16 +29,16 @@ XorgSession::init();
 
 class XorgPage extends PlatalPage
 {
-    function XorgPage($tpl, $type = SKINNED)
+    public function __construct($tpl, $type = SKINNED)
     {
-        $this->PlatalPage($tpl, $type);
+        parent::__construct($tpl, $type);
     }
 
-    function run()
+    public function run()
     {
         global $globals, $platal;
         $this->assign('globals', $globals);
-        if ($platal->path == 'register') {
+        if (isset($platal) && $platal->path == 'register') {
             $skin = 'register.tpl';
         } else {
             $skin = S::v('skin', 'default.tpl');
@@ -47,54 +47,17 @@ class XorgPage extends PlatalPage
     }
 }
 
-// }}}
-// {{{ class XorgAdmin
-
-/** Une classe pour les pages réservées aux admins (authentifiés!).
- */
-class XorgAdmin extends XorgPage
-{
-    // {{{ function XorgAdmin()
-
-    function XorgAdmin($tpl, $type = SKINNED)
-    {
-        $this->XorgPage($tpl, $type);
-        check_perms();
-    }
-
-    // }}}
-}
-
-// }}}
+// {{{ function new_skinned_page()
 
-function _new_page($type, $tpl_name, $admin=false)
+function new_skinned_page($tpl_name)
 {
     global $page;
-    if (!empty($admin)) {
-        $page = new XorgAdmin($tpl_name, $type);
+    if (!$page instanceof XorgPage) {
+        $page = new XorgPage($tpl_name);
     } else {
-        $page = new XorgPage($tpl_name, $type);
+        $page->changeTpl($tpl_name);
     }
-
-    $page->assign('xorg_tpl', $tpl_name);
 }
 
-// {{{ function new_skinned_page()
-
-function new_skinned_page($tpl_name)
-{
-    _new_page(SKINNED, $tpl_name);
-}
-
-// }}}
-// {{{ function new_admin_page()
-
-function new_admin_page($tpl_name)
-{
-    _new_page(SKINNED, $tpl_name, true);
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>