remove move cruft
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 11:26:07 +0000 (11:26 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 11:26:07 +0000 (11:26 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@578 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Page.php [moved from include/platal/page.inc.php with 79% similarity]
classes/Session.php
include/platal/session.inc.php [deleted file]
include/platal/smarty.plugins.inc.php [deleted file]
include/xnet/page.inc.php
include/xnet/session.inc.php
include/xnet/smarty.plugins.inc.php [deleted file]
include/xorg.inc.php
include/xorg/session.inc.php

similarity index 79%
rename from include/platal/page.inc.php
rename to classes/Page.php
index f81f994..4b6b302 100644 (file)
@@ -20,7 +20,6 @@
  ***************************************************************************/
 
 require_once 'smarty/libs/Smarty.class.php';
-require_once 'platal/smarty.plugins.inc.php';
 
 class PlatalPage extends Smarty
 {
@@ -211,5 +210,76 @@ class PlatalPage extends Smarty
     // }}}
 }
 
+// {{{ function escape_html ()
+
+/**
+ * default smarty plugin, used to auto-escape dangerous html.
+ * 
+ * < --> &lt;
+ * > --> &gt;
+ * " --> &quot;
+ * & not followed by some entity --> &amp;
+ */
+function escape_html($string)
+{
+    if (is_string($string)) {
+       $transtbl = Array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;', '\'' => '&#39;');
+       return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/", "&amp;" , strtr($string, $transtbl));
+    } else {
+       return $string;
+    }
+}
+
+// }}}
+// {{{ function at_to_globals()
+
+/**
+ * helper
+ */
+
+function _to_globals($s) {
+    global $globals;
+    $t = explode('.',$s);
+    if (count($t) == 1) {
+        return var_export($globals->$t[0],true);
+    } else {
+        return var_export($globals->$t[0]->$t[1],true);
+    }
+}
+
+/**
+ * compilation plugin used to import $globals confing through #globals.foo.bar# directives
+ */
+
+function at_to_globals($tpl_source, &$smarty)
+{
+    return preg_replace('/#globals\.([a-zA-Z0-9_.]+?)#/e', '_to_globals(\'\\1\')', $tpl_source);
+}
+
+// }}}
+// {{{  function trimwhitespace
+
+function trimwhitespace($source, &$smarty)
+{
+    $tags = array('script', 'pre', 'textarea');
+
+    foreach ($tags as $tag) {
+        preg_match_all("!<{$tag}[^>]+>.*?</{$tag}>!is", $source, ${$tag});
+        $source = preg_replace("!<{$tag}[^>]+>.*?</{$tag}>!is", "&&&{$tag}&&&", $source);
+    }
+
+    // remove all leading spaces, tabs and carriage returns NOT
+    // preceeded by a php close tag.
+    $source = preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source);
+
+    foreach ($tags as $tag) {
+        $source = preg_replace("!&&&{$tag}&&&!e",  'array_shift(${$tag}[0])', $source);
+    }
+
+    return $source; 
+}
+
+// }}}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index 0a641a6..f87face 100644 (file)
@@ -19,6 +19,9 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+require_once 'diogenes/diogenes.misc.inc.php';
+require_once 'diogenes/diogenes.core.logger.inc.php';
+
 class Session
 {
     function init()
@@ -71,4 +74,23 @@ class Session
 
 class S extends Session { }
 
+// {{{ function check_perms()
+
+/** verifie si un utilisateur a les droits pour voir une page
+ ** si ce n'est pas le cas, on affiche une erreur
+ * @return void
+ */
+function check_perms()
+{
+    global $page;
+    if (!S::has_perms()) {
+        if ($_SESSION['log']) {
+            $_SESSION['log']->log("noperms",$_SERVER['PHP_SELF']);
+        }
+       $page->kill("Tu n'as pas les permissions nécessaires pour accéder à cette page.");
+    }
+}
+
+// }}}
+
 ?>
diff --git a/include/platal/session.inc.php b/include/platal/session.inc.php
deleted file mode 100644 (file)
index 6cd8dbf..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  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      *
- *  (at your option) 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.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once 'diogenes/diogenes.misc.inc.php';
-require_once 'diogenes/diogenes.core.logger.inc.php';
-
-require_once dirname(__FILE__).'/../../classes/Session.php';
-
-// {{{ function check_perms()
-
-/** verifie si un utilisateur a les droits pour voir une page
- ** si ce n'est pas le cas, on affiche une erreur
- * @return void
- */
-function check_perms()
-{
-    global $page;
-    if (!S::has_perms()) {
-        if ($_SESSION['log']) {
-            $_SESSION['log']->log("noperms",$_SERVER['PHP_SELF']);
-        }
-       $page->kill("Tu n'as pas les permissions nécessaires pour accéder à cette page.");
-    }
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/platal/smarty.plugins.inc.php b/include/platal/smarty.plugins.inc.php
deleted file mode 100644 (file)
index e3109e9..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  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      *
- *  (at your option) 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.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-// {{{ function escape_html ()
-
-/**
- * default smarty plugin, used to auto-escape dangerous html.
- * 
- * < --> &lt;
- * > --> &gt;
- * " --> &quot;
- * & not followed by some entity --> &amp;
- */
-function escape_html($string)
-{
-    if(is_string($string)) {
-       $transtbl = Array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;', '\'' => '&#39;');
-       return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/", "&amp;" , strtr($string, $transtbl));
-    } else {
-       return $string;
-    }
-}
-
-// }}}
-// {{{ function at_to_globals()
-
-/**
- * helper
- */
-
-function _to_globals($s) {
-    global $globals;
-    $t = explode('.',$s);
-    if (count($t) == 1) {
-        return var_export($globals->$t[0],true);
-    } else {
-        return var_export($globals->$t[0]->$t[1],true);
-    }
-}
-
-/**
- * compilation plugin used to import $globals confing through #globals.foo.bar# directives
- */
-
-function at_to_globals($tpl_source, &$smarty)
-{
-    return preg_replace('/#globals\.([a-zA-Z0-9_.]+?)#/e', '_to_globals(\'\\1\')', $tpl_source);
-}
-
-// }}}
-// {{{  function trimwhitespace
-
-function trimwhitespace($source, &$smarty)
-{
-    $tags = array('script', 'pre', 'textarea');
-
-    foreach ($tags as $tag) {
-        preg_match_all("!<{$tag}[^>]+>.*?</{$tag}>!is", $source, ${$tag});
-        $source = preg_replace("!<{$tag}[^>]+>.*?</{$tag}>!is", "&&&{$tag}&&&", $source);
-    }
-
-    // remove all leading spaces, tabs and carriage returns NOT
-    // preceeded by a php close tag.
-    $source = preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source);
-
-    foreach ($tags as $tag) {
-        $source = preg_replace("!&&&{$tag}&&&!e",  'array_shift(${$tag}[0])', $source);
-    }
-
-    return $source; 
-}
-
-// }}}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index 744711a..8d84f63 100644 (file)
@@ -19,8 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('platal/page.inc.php');
-require_once('xnet/smarty.plugins.inc.php');
+require_once dirname(__FILE__).'/../../classes/Page.php';
 
 class XnetPage extends PlatalPage
 {
@@ -113,5 +112,41 @@ class XnetPage extends PlatalPage
     // }}}
 }
 
+// {{{  function list_all_my_groups
+
+function list_all_my_groups($params)
+{
+    if (!S::logged()) {
+        return;
+    }
+    $res = XDB::iterRow(
+            "SELECT  a.nom, a.diminutif
+               FROM  groupex.asso    AS a
+         INNER JOIN  groupex.membres AS m ON m.asso_id = a.id
+              WHERE  m.uid={?}", S::v('uid'));
+    $html = '<div>Mes groupes :</div>';
+    while (list($nom, $mini) = $res->next()) {
+        $html .= "<a class='gp' href='$mini/'>&bull; $nom</a>";
+    }
+    return $html;
+}
+
+// }}}
+// {{{ cat_pp
+
+function cat_pp($cat)
+{
+    $trans = array(
+        'groupesx' => 'Groupes X' ,
+        'binets'   => 'Binets' ,
+        'institutions' => 'Institutions' ,
+        'promotions' => 'Promotions'
+    );
+
+    return $trans[strtolower($cat)];
+}
+
+// }}}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index 8e00856..a85780a 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('platal/session.inc.php');
+require_once dirname(__FILE__).'/../../classes/Session.php';
 
 class XnetSession
 {
diff --git a/include/xnet/smarty.plugins.inc.php b/include/xnet/smarty.plugins.inc.php
deleted file mode 100644 (file)
index b0352a7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  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      *
- *  (at your option) 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.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-// {{{  function list_all_my_groups
-
-function list_all_my_groups($params)
-{
-    if (!S::logged()) {
-        return;
-    }
-    $res = XDB::iterRow(
-            "SELECT  a.nom, a.diminutif
-               FROM  groupex.asso    AS a
-         INNER JOIN  groupex.membres AS m ON m.asso_id = a.id
-              WHERE  m.uid={?}", S::v('uid'));
-    $html = '<div>Mes groupes :</div>';
-    while (list($nom, $mini) = $res->next()) {
-        $html .= "<a class='gp' href='$mini/'>&bull; $nom</a>";
-    }
-    return $html;
-}
-
-// }}}
-// {{{ cat_pp
-
-function cat_pp($cat)
-{
-    $trans = array(
-        'groupesx' => 'Groupes X' ,
-        'binets'   => 'Binets' ,
-        'institutions' => 'Institutions' ,
-        'promotions' => 'Promotions'
-    );
-
-    return $trans[strtolower($cat)];
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index e655036..3d84c05 100644 (file)
@@ -18,6 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
+
 require_once('platal.inc.php');
 require_once('xorg/globals.inc.php');
 require_once('xorg/session.inc.php');
@@ -25,7 +26,7 @@ XorgGlobals::init();
 XorgGlobals::setlocale();
 XorgSession::init();
 
-require_once('platal/page.inc.php');
+require_once dirname(__FILE__).'/../classes/Page.php';
 
 // {{{ class XorgPage
 
index 841bbd1..a9e751e 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once 'platal/session.inc.php';
+require_once dirname(__FILE__).'/../../classes/Session.php';
 
 // {{{ class XorgSession