#663 (link to xnet/plan from xorg/groupes-x)
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 10 May 2007 15:03:19 +0000 (15:03 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 10 May 2007 15:03:19 +0000 (15:03 +0000)
A lot of small speed improvements

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1815 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
classes/platal.php
classes/platalpage.php
classes/plmodule.php
include/platal.inc.php
templates/profile/groupesx.tpl

index d352a74..68a2bb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 ================================================================================
 VERSION 0.9.15                                                        XX XX 2007
 
+Bug/Wish:
+
+    * Profile:
+        - #663: Link to Xnet's map from the "My groups" page               -FRU
+
 From 0.9.14 branch:
 
     * Payment:
index ce21fbc..55e9ada 100644 (file)
@@ -45,6 +45,7 @@ class Platal
 
         array_unshift($modules, 'core');
         foreach ($modules as $module) {
+            $module = strtolower($module);
             $this->__mods[$module] = $m = PLModule::factory($module);
             $this->__hooks += $m->handlers();
         }
index 31ab6d7..cfe745e 100644 (file)
@@ -285,10 +285,9 @@ function escape_xorgDB(&$item, $key)
 function escape_html($string)
 {
     if (is_string($string)) {
-       $transtbl = Array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;', '\'' => '&#39;');
-           return strtr($string, $transtbl);
+       return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
     } else {
-           return $string;
+       return $string;
     }
 }
 
@@ -368,6 +367,10 @@ function _hide_email($source)
 
 function hide_emails($source, &$smarty)
 {
+    if (!strpos($source, '@')) {
+        return $source;
+    }
+
     //prevent email replacement in <script> and <textarea>
     $tags = '(script|textarea|select)';
     preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
index 4cd113c..9f31cbe 100644 (file)
@@ -49,8 +49,8 @@ abstract class PLModule
 
     public static function factory($modname)
     {
-        $mod_path = dirname(__FILE__).'/../modules/'.strtolower($modname).'.php';
-        $class    = ucfirst($modname).'Module';
+        $mod_path = dirname(__FILE__) . '/../modules/' . $modname . '.php';
+        $class    = ucfirst($modname) . 'Module';
 
         require_once $mod_path;
         return new $class();
index c630913..f70a778 100644 (file)
@@ -56,27 +56,30 @@ __autoload('Env');
 
 function pl_error_handler($errno, $errstr, $errfile, $errline)
 {
+    static $errortype;
     if (!error_reporting())
         return;
 
-    $errortype = array (
-        E_ERROR           => "Error",
-        E_WARNING         => "Warning",
-        E_PARSE           => "Parsing Error",
-        E_NOTICE          => "Notice",
-        E_CORE_ERROR      => "Core Error",
-        E_CORE_WARNING    => "Core Warning",
-        E_COMPILE_ERROR   => "Compile Error",
-        E_COMPILE_WARNING => "Compile Warning",
-        E_USER_ERROR      => "User Error",
-        E_USER_WARNING    => "User Warning",
-        E_USER_NOTICE     => "User Notice",
-        E_STRICT          => "Runtime Notice"
-    );
+    if (!isset($errortype)) {
+        $errortype = array (
+            E_ERROR           => "Error",
+            E_WARNING         => "Warning",
+            E_PARSE           => "Parsing Error",
+            E_NOTICE          => "Notice",
+            E_CORE_ERROR      => "Core Error",
+            E_CORE_WARNING    => "Core Warning",
+            E_COMPILE_ERROR   => "Compile Error",
+            E_COMPILE_WARNING => "Compile Warning",
+            E_USER_ERROR      => "User Error",
+            E_USER_WARNING    => "User Warning",
+            E_USER_NOTICE     => "User Notice",
+            E_STRICT          => "Runtime Notice"
+        );
+    }
 
     global $globals;
     if (isset($globals) && !$globals->debug) {
-        if (strpos($errortype[$errno], 'Notice') !== false) {
+        if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) {
             return;
         }
     }
@@ -106,7 +109,9 @@ function pl_dump_env()
 
 function pl_print_errors()
 {
-    print join("\n", $GLOBALS['pl_errors']);
+    if (!empty($GLOBALS['pl_errors'])) {
+        print join("\n", $GLOBALS['pl_errors']);
+    }
 }
 
 set_error_handler('pl_error_handler', E_ALL | E_STRICT);
index 9eb0e96..2e25072 100644 (file)
@@ -1,59 +1,59 @@
-{**************************************************************************}\r
-{*                                                                        *}\r
-{*  Copyright (C) 2003-2007 Polytechnique.org                             *}\r
-{*  http://opensource.polytechnique.org/                                  *}\r
-{*                                                                        *}\r
-{*  This program is free software; you can redistribute it and/or modify  *}\r
-{*  it under the terms of the GNU General Public License as published by  *}\r
-{*  the Free Software Foundation; either version 2 of the License, or     *}\r
-{*  (at your option) any later version.                                   *}\r
-{*                                                                        *}\r
-{*  This program is distributed in the hope that it will be useful,       *}\r
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}\r
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}\r
-{*  GNU General Public License for more details.                          *}\r
-{*                                                                        *}\r
-{*  You should have received a copy of the GNU General Public License     *}\r
-{*  along with this program; if not, write to the Free Software           *}\r
-{*  Foundation, Inc.,                                                     *}\r
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}\r
-{*                                                                        *}\r
-{**************************************************************************}\r
-\r
-<h1>Mes groupes X sur Polytechnique.net</h1>\r
-\r
-{foreach from=$assos item="asso"}\r
-<div style="width:48%;float:left" >\r
-<fieldset style="margin:0.6em">\r
-    <legend style="padding:4px"><strong><a href="http://www.polytechnique.net/login/{$asso.diminutif}">{$asso.nom}</a></strong></legend>\r
-    {if $asso.has_logo}\r
-    <img alt="[ LOGO ]" src="http://www.polytechnique.net/{$asso.diminutif}/logo"\r
-         style="width: 30%; display: block; float: right;" />\r
-    {/if}\r
-    <ul style="padding-top:0px;padding-bottom:0px">\r
-        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/annuaire">annuaire</a></li>\r
-        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/trombi">trombino</a></li>\r
-        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/geoloc">carte</a></li>\r
-        {if $asso.lists}\r
-            <li><a href="http://www.polytechnique.net/{$asso.diminutif}/lists">listes mails</a></li>\r
-        {/if}\r
-        {if $asso.events}\r
-            <li><a href="http://www.polytechnique.net/{$asso.diminutif}/events">{$asso.events} événement{if $asso.events > 1}s{/if}</a></li>\r
-        {/if}\r
-        {if !$asso.lists}\r
-            <li style="display:block">&nbsp;</li>\r
-        {/if}\r
-        {if !$asso.events}\r
-            <li style="display:block">&nbsp;</li>\r
-        {/if}\r
-    </ul>\r
-</fieldset>\r
-</div>\r
-{/foreach}\r
-\r
-<div class="spacer"></div>\r
-\r
-<p class="center">\r
-[<a href="http://www.polytechnique.net/login">Tous les groupes X</a>]\r
-</p>\r
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2007 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h1>Mes groupes X sur Polytechnique.net</h1>
+
+<p class="center"> 
+[<a href="http://www.polytechnique.net/login/plan">Tous les groupes X</a>] 
+</p> 
+
+{foreach from=$assos item="asso"}
+<div style="width:48%;float:left" >
+<fieldset style="margin:0.6em">
+    <legend style="padding:4px"><strong><a href="http://www.polytechnique.net/login/{$asso.diminutif}">{$asso.nom}</a></strong></legend>
+    {if $asso.has_logo}
+    <a href="http://www.polytechnique.net/login/{$asso.diminutif}" style="width: 30%; display: block; float: right; ">
+      <img alt="[ LOGO ]" src="http://www.polytechnique.net/{$asso.diminutif}/logo" style="width: 100%" />
+    </a>
+    {/if}
+    <ul style="padding-top:0px;padding-bottom:0px">
+        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/annuaire">annuaire</a></li>
+        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/trombi">trombino</a></li>
+        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/geoloc">carte</a></li>
+        {if $asso.lists}
+            <li><a href="http://www.polytechnique.net/{$asso.diminutif}/lists">listes mails</a></li>
+        {/if}
+        {if $asso.events}
+            <li><a href="http://www.polytechnique.net/{$asso.diminutif}/events">{$asso.events} événement{if $asso.events > 1}s{/if}</a></li>
+        {/if}
+        {if !$asso.lists}
+            <li style="display:block">&nbsp;</li>
+        {/if}
+        {if !$asso.events}
+            <li style="display:block">&nbsp;</li>
+        {/if}
+    </ul>
+</fieldset>
+</div>
+{/foreach}
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}