smarter and smarter
authorx2000habouzit <x2000habouzit>
Tue, 23 Nov 2004 20:56:42 +0000 (20:56 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 23 Nov 2004 20:56:42 +0000 (20:56 +0000)
include/conf.d/skin.globals.inc.php [moved from include/xorg.globals/skin.inc.php with 95% similarity]
include/conf.d/tmp.menu.inc.php [new file with mode: 0644]
include/xorg.globals.inc.php.in
include/xorg.inc.php
include/xorg/menu.inc.php

similarity index 95%
rename from include/xorg.globals/skin.inc.php
rename to include/conf.d/skin.globals.inc.php
index 4a69407..e74c350 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: skin.inc.php,v 1.1 2004-11-23 11:38:45 x2000habouzit Exp $
+    $Id: skin.globals.inc.php,v 1.1 2004-11-23 20:56:43 x2000habouzit Exp $
  ***************************************************************************/
 
 // {{{ class SkinConfig
diff --git a/include/conf.d/tmp.menu.inc.php b/include/conf.d/tmp.menu.inc.php
new file mode 100644 (file)
index 0000000..0f3ae17
--- /dev/null
@@ -0,0 +1,43 @@
+<?
+$this->addPrivateEntry(XOM_NO,       10, 'Page d\'accueil',       'login.php');
+
+$this->addPrivateEntry(XOM_CUSTOM,   00, 'Mes emails',            'emails.php');
+$this->addPrivateEntry(XOM_CUSTOM,   10, 'Mon profil',            'profil.php');
+$this->addPrivateEntry(XOM_CUSTOM,   20, 'Mes contacts',          'profil.php');
+$this->addPrivateEntry(XOM_CUSTOM,   30, 'Mon carnet',            'carnet/');
+$this->addPrivateEntry(XOM_CUSTOM,   40, 'Mon mot de passe',      'motdepassemd5.php');
+$this->addPrivateEntry(XOM_CUSTOM,   50, 'Mes préférences',       'preferences.php');
+
+$this->addPrivateEntry(XOM_SERVICES, 00, 'Envoyer un mail',       'sendmail.php');
+$this->addPrivateEntry(XOM_SERVICES, 10, 'Forums & PA',           'banana/');
+$this->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion',   'listes/');
+$this->addPrivateEntry(XOM_SERVICES, 30, 'Envoyer un mail',       'sendmail.php');
+$this->addPrivateEntry(XOM_SERVICES, 40, 'Patte cassée',          'pattecassee.php');
+       
+$this->addPrivateEntry(XOM_GROUPS,   00, 'Annuaire',              'search.php');
+$this->addPrivateEntry(XOM_GROUPS,   10, 'Trombi promo',          'trombipromo.php');
+$this->addPrivateEntry(XOM_GROUPS,   20, 'Conseil Professionnel', 'referent.php');
+$this->addPrivateEntry(XOM_GROUPS,   30, 'Groupes X',             'http://www.polytechnique.net/plan.php');
+$this->addPrivateEntry(XOM_GROUPS,   40, 'Sites Polytechniciens', 'http://www.polytechnique.net/');
+
+$this->addPrivateEntry(XOM_INFOS,    00, 'Lettres mensuelles',    'newsletter/');
+$this->addPrivateEntry(XOM_INFOS,    10, 'Documentations',        'docs/');
+$this->addPrivateEntry(XOM_INFOS,    20, 'Nous contacter',        'docs/contacts.php');
+$this->addPrivateEntry(XOM_INFOS,    30, 'Emploi',                'http://www.manageurs.com/');
+
+$this->addPrivateEntry(XOM_ADMIN,    00, 'Marketing',           'marketing/');
+$this->addPrivateEntry(XOM_ADMIN,    10, 'Administration',      'admin/');
+$this->addPrivateEntry(XOM_ADMIN,    20, 'Clear cache',         'clear_all_cache.php');
+
+$this->addPublicEntry(XOM_US,    00, 'Me connecter !',         'login.php');
+$this->addPublicEntry(XOM_US,    10, 'M\'inscrire',            'inscription/');
+$this->addPublicEntry(XOM_US,    20, 'Pourquoi m\'inscrire ?', 'docs/services.php');
+
+$this->addPublicEntry(XOM_EXT,   00, 'Annuaire de l\'X',       'search.php');
+$this->addPublicEntry(XOM_EXT,   10, 'Associations X',         'http://www.polytechnique.net/');
+$this->addPublicEntry(XOM_EXT,   20, 'Recrutement',            'http://www.manageurs.com/');
+
+$this->addPublicEntry(XOM_INFOS, 00, 'A propos du site',       'docs/apropos.php');
+$this->addPublicEntry(XOM_INFOS, 10, 'Nous contacter',         'docs/contacts.php');
+$this->addPublicEntry(XOM_INFOS, 20, 'FAQ',                    'docs/faq.php');
+?>
index be192e3..6e305c7 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: xorg.globals.inc.php.in,v 1.6 2004-11-23 11:32:34 x2000habouzit Exp $
+    $Id: xorg.globals.inc.php.in,v 1.7 2004-11-23 20:56:42 x2000habouzit Exp $
  ***************************************************************************/
 
 require_once("diogenes.core.globals.inc.php");
@@ -63,7 +63,7 @@ class XorgGlobals extends DiogenesCoreGlobals
     function XorgGlobals() {
         $this->root = dirname(dirname(__FILE__));
 
-        foreach(glob($this->root.'/include/xorg.globals/*.inc.php') as $inc) {
+        foreach(glob($this->root.'/include/conf.d/*.globals.inc.php') as $inc) {
             require_once($inc);
         }
         
@@ -85,6 +85,8 @@ class XorgGlobals extends DiogenesCoreGlobals
                 }
             }
         }
+        
+        $this->menu = new XOrgMenu($this->root.'/include/conf.d/');
 
         session_start();
 
index 648bf24..46bed3c 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: xorg.inc.php,v 1.4 2004-11-23 11:32:34 x2000habouzit Exp $
+    $Id: xorg.inc.php,v 1.5 2004-11-23 20:56:42 x2000habouzit Exp $
  ***************************************************************************/
 
 function microtime_float() 
@@ -52,53 +52,6 @@ require_once("xorg/session.inc.php");
 $globals = new XorgGlobals;
 
 // }}}
-// {{{ Build Menu, TODO: move that into appropriates hooks
-
-$globals->menu = new XOrgMenu();
-
-$globals->menu->addPrivateEntry(XOM_NO,       10, 'Page d\'accueil',       'login.php');
-
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   00, 'Mes emails',            'emails.php');
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   10, 'Mon profil',            'profil.php');
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   20, 'Mes contacts',          'profil.php');
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   30, 'Mon carnet',            'carnet/');
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   40, 'Mon mot de passe',      'motdepassemd5.php');
-$globals->menu->addPrivateEntry(XOM_CUSTOM,   50, 'Mes préférences',       'preferences.php');
-
-$globals->menu->addPrivateEntry(XOM_SERVICES, 00, 'Envoyer un mail',       'sendmail.php');
-$globals->menu->addPrivateEntry(XOM_SERVICES, 10, 'Forums & PA',           'banana/');
-$globals->menu->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion',   'listes/');
-$globals->menu->addPrivateEntry(XOM_SERVICES, 30, 'Envoyer un mail',       'sendmail.php');
-$globals->menu->addPrivateEntry(XOM_SERVICES, 40, 'Patte cassée',          'pattecassee.php');
-       
-$globals->menu->addPrivateEntry(XOM_GROUPS,   00, 'Annuaire',              'search.php');
-$globals->menu->addPrivateEntry(XOM_GROUPS,   10, 'Trombi promo',          'trombipromo.php');
-$globals->menu->addPrivateEntry(XOM_GROUPS,   20, 'Conseil Professionnel', 'referent.php');
-$globals->menu->addPrivateEntry(XOM_GROUPS,   30, 'Groupes X',             'http://www.polytechnique.net/plan.php');
-$globals->menu->addPrivateEntry(XOM_GROUPS,   40, 'Sites Polytechniciens', 'http://www.polytechnique.net/');
-
-$globals->menu->addPrivateEntry(XOM_INFOS,    00, 'Lettres mensuelles',    'newsletter/');
-$globals->menu->addPrivateEntry(XOM_INFOS,    10, 'Documentations',        'docs/');
-$globals->menu->addPrivateEntry(XOM_INFOS,    20, 'Nous contacter',        'docs/contacts.php');
-$globals->menu->addPrivateEntry(XOM_INFOS,    30, 'Emploi',                'http://www.manageurs.com/');
-
-$globals->menu->addPrivateEntry(XOM_ADMIN,    00, 'Marketing',           'marketing/');
-$globals->menu->addPrivateEntry(XOM_ADMIN,    10, 'Administration',      'admin/');
-$globals->menu->addPrivateEntry(XOM_ADMIN,    20, 'Clear cache',         'clear_all_cache.php');
-
-$globals->menu->addPublicEntry(XOM_US,    00, 'Me connecter !',         'login.php');
-$globals->menu->addPublicEntry(XOM_US,    10, 'M\'inscrire',            'inscription/');
-$globals->menu->addPublicEntry(XOM_US,    20, 'Pourquoi m\'inscrire ?', 'docs/services.php');
-
-$globals->menu->addPublicEntry(XOM_EXT,   00, 'Annuaire de l\'X',       'search.php');
-$globals->menu->addPublicEntry(XOM_EXT,   10, 'Associations X',         'http://www.polytechnique.net/');
-$globals->menu->addPublicEntry(XOM_EXT,   20, 'Recrutement',            'http://www.manageurs.com/');
-
-$globals->menu->addPublicEntry(XOM_INFOS, 00, 'A propos du site',       'docs/apropos.php');
-$globals->menu->addPublicEntry(XOM_INFOS, 10, 'Nous contacter',         'docs/contacts.php');
-$globals->menu->addPublicEntry(XOM_INFOS, 20, 'FAQ',                    'docs/faq.php');
-
-// }}}
 // {{{ function _new_page()
 
 function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false)
index 4f8087f..d09eefc 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: menu.inc.php,v 1.1 2004-11-22 10:42:52 x2000habouzit Exp $
+    $Id: menu.inc.php,v 1.2 2004-11-23 20:56:43 x2000habouzit Exp $
  ***************************************************************************/
 
 // {{{ defines
@@ -43,7 +43,7 @@ define('XOM_INFOS',    "Informations");
  * @category XOrgCore
  * @package  XOrgCore
  * @author   Pierre Habouzit <pierre.habouzit@m4x.org>
- * @version  $Id: menu.inc.php,v 1.1 2004-11-22 10:42:52 x2000habouzit Exp $
+ * @version  $Id: menu.inc.php,v 1.2 2004-11-23 20:56:43 x2000habouzit Exp $
  * @access   public
  */
 
@@ -57,8 +57,10 @@ class XOrgMenu
     // }}}
     // {{{ constructor
 
-    function XOrgMenu()
+    function XOrgMenu($path)
     {
+        global $globals;
+        
         $this->_int[XOM_NO]       = Array();
         $this->_int[XOM_CUSTOM]   = Array();
         $this->_int[XOM_SERVICES] = Array();
@@ -69,6 +71,10 @@ class XOrgMenu
         $this->_ext[XOM_US]       = Array();
         $this->_ext[XOM_EXT]      = Array();
         $this->_ext[XOM_INFOS]    = Array();
+        
+        foreach (glob($path.'*.menu.inc.php') as $inc) {
+            require_once($inc);
+        }
     }
 
     // }}}