google maps need a better icon
[platal.git] / include / xnet.inc.php
index e41b5f8..98275a3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  Copyright (C) 2003-2006 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -28,30 +28,35 @@ XnetSession::init();
 
 // {{{ function new_skinned_page()
 
-function new_page($tpl_name, $min_auth)
+function new_page($tpl_name, $type = SKINNED)
 {
-    global $page,$globals;
+    global $page, $globals;
     require_once("xnet/page.inc.php");
-    switch($min_auth) {
-        case AUTH_PUBLIC:
-            $page = new XnetPage($tpl_name, $type);
-            break;
-
-        default:
-            $page = new XnetAuth($tpl_name, $type);
-    }
+    $page = new XnetPage($tpl_name, $type);
     $page->assign('xorg_tpl', $tpl_name);
 }
 
+function new_skinned_page($tpl_name)
+{
+    return new_page($tpl_name);
+}
+
 // }}}
 // {{{ function new_group_page()
 
 function new_group_page($tpl_name)
 {
-    global $page,$globals;
-    require_once("xnet/page.inc.php");
-    $page = new XnetGroupPage($tpl_name);
-    $page->assign('xorg_tpl', $tpl_name);
+    global $page, $globals;
+
+    new_page($tpl_name);
+
+    if (!is_member() && !S::has_perms()) {
+        $page->kill("You have not sufficient credentials");
+    }
+
+    $page->useMenu();
+    $page->assign('asso', $globals->asso());
+    $page->setType($globals->asso('cat'));
 }
 
 // }}}
@@ -59,10 +64,17 @@ function new_group_page($tpl_name)
 
 function new_groupadmin_page($tpl_name)
 {
-    global $page,$globals;
-    require_once("xnet/page.inc.php");
-    $page = new XnetGroupAdmin($tpl_name);
-    $page->assign('xorg_tpl', $tpl_name);
+    global $page, $globals;
+
+    new_page($tpl_name);
+
+    if (!may_update()) {
+        $page->kill("You have not sufficient credentials");
+    }
+
+    $page->useMenu();
+    $page->assign('asso', $globals->asso());
+    $page->setType($globals->asso('cat'));
 }
 
 // }}}
@@ -70,21 +82,17 @@ function new_groupadmin_page($tpl_name)
 
 function new_admin_page($tpl_name)
 {
-    global $page,$globals;
-    require_once("xnet/page.inc.php");
-    $page = new XnetAdmin($tpl_name);
-    $page->assign('xorg_tpl', $tpl_name);
-}
+    global $page, $globals;
 
-// }}}
-// {{{ function new_nonhtml_page()
+    new_page($tpl_name);
 
-function new_nonhtml_page($tpl_name)
-{
-    global $page, $globals;
-    require_once("xnet/page.inc.php");
-    $page = new XnetGroupPage($tpl_name, NO_SKIN);
-    $page->assign('xorg_tpl', $tpl_name);
+    check_perms();
+
+    $page->useMenu();
+    if ($globals->asso('cat')) {
+        $page->assign('asso', $globals->asso());
+        $page->setType($globals->asso('cat'));
+    }
 }
 
 // }}}