Code cleaning
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 12 Apr 2007 17:03:19 +0000 (17:03 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 12 Apr 2007 17:03:19 +0000 (17:03 +0000)
Move is_utf8 to platal.inc.php

 include/platal.inc.php         |    7 +++++++
 include/xorg.misc.inc.php      |    8 --------
 modules/search.php             |    2 --
 modules/search/classes.inc.php |   21 +--------------------
 templates/search/index.tpl     |   13 +------------
 5 files changed, 9 insertions(+), 42 deletions(-)

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

include/platal.inc.php
include/xorg.misc.inc.php
modules/search.php
modules/search/classes.inc.php
templates/search/index.tpl

index 8b0b211..802f9f1 100644 (file)
@@ -109,6 +109,13 @@ set_error_handler('pl_error_handler', E_ALL | E_STRICT);
 register_shutdown_function('pl_print_errors');
 // register_shutdown_function('pl_dump_env');
 
+/** Check if the string is utf8 
+ */
+function is_utf8($s)
+{
+    return @iconv('utf-8', 'utf-8', $s) == $s;
+}
+
 function pl_url($path, $query = null, $fragment = null)
 {
     global $platal;
index 24cad5c..49f9c00 100644 (file)
@@ -75,14 +75,6 @@ function isvalid_email_redirection($email)
         !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
 }
 
-/** Check if the string is utf8
- */
-function is_utf8($s)
-{
-    return @iconv('utf-8', 'utf-8', $s) == $s;
-}
-
-
 /** genere une chaine aleatoire de 22 caracteres ou moins
  * @param $len longueur souhaitée, 22 par défaut
  * @return la chaine aleatoire qui contient les caractères [A-Za-z0-9+/]
index 651fe8f..e54df37 100644 (file)
@@ -118,7 +118,6 @@ class SearchModule extends PLModule
         $page->changeTpl('search/index.tpl');            
         $page->assign('xorg_title','Polytechnique.org - Annuaire');
         $page->assign('baseurl', $globals->baseurl);
-        $page->register_modifier('display_lines', 'display_lines');
     }
 
     function handler_advanced(&$page, $action = null, $subaction = null)
@@ -151,7 +150,6 @@ class SearchModule extends PLModule
         $page->changeTpl('search/index.tpl', $action == 'mini' ? SIMPLE : SKINNED);
         $page->addJsLink('ajax.js');
         $page->assign('public_directory',0);
-        $page->register_modifier('display_lines', 'display_lines');
     }
 
     function handler_autocomplete(&$page, $type = null)
index 9be8cc4..d4405c0 100644 (file)
@@ -69,24 +69,6 @@ else
     LEFT JOIN  emails         AS em  ON (em.uid = u.user_id AND em.flags = \'active\')';
 
 // }}}
-// {{{ function display_lines()
-
-/**
- * This function is a heuristic that approximatively tells
- * how many lines of output the contact list will use.
- */
-function display_lines($text)
-{
-    $n = 0;
-    $tokens = Array('<tr>', '<div class="nom">');
-    foreach ($tokens as $t) {
-        $i = -1;
-        while ( ($i = strpos($text,$t,$i+1))!==false) { $n++; }
-    }
-    return $n;
-}
-
-// }}}
 // {{{ class ThrowError
 
 /** handle errors for end-users queries
@@ -99,13 +81,12 @@ class ThrowError
     /** constuctor
      * @param  $explain string  the error (in natural language)
      */
-    function ThrowError($explain)
+    public function __construct($explain)
     {
         global $page, $globals;
         $page->changeTpl('search/index.tpl');
         $page->assign('xorg_title','Polytechnique.org - Annuaire');
         $page->assign('baseurl', $globals->baseurl);
-        $page->register_modifier('display_lines', 'display_lines');
         $page->trig('Erreur : '.$explain);
         $page->run();
     }
index 9a4457c..93c4649 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 
-{if $formulaire==0 and !$xorg_errors|count}
+{if $formulaire eq 0 and !$xorg_errors|count}
   {if !$simple}
     {if !$advanced}
     {include file=search/quick.form.tpl show_js=1}
   {/if}
 
   {if $smarty.session.auth ge AUTH_COOKIE}
-  <br />
-  {if $smarty.capture.list|smarty:nodefaults|display_lines > 20}
-  <div class="noprint">
-  {if $advanced}
-  {include file=search/adv.links.tpl do_title=1}
-  {else}
-  {include file=search/quick.form.tpl}
-  {/if}
-  </div>
-  {/if}
   <p class="noprint">
     <strong>{icon name=lightbulb title=Astruce}Astuce&nbsp;:</strong>
     {if $search_results_nb}