make mmlist be a derived class from xlmrpcclient, that's way more pretty,
[platal.git] / include / search.inc.php
index a337031..c3601a2 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   *
@@ -23,6 +23,9 @@ require_once('xorg.plugin.inc.php');
 require_once("search/classes.inc.php");
 
 // {{{ function advancedSearchFromInput
+function getadr_join($table) {
+    return 'u.user_id='.$table.'.uid'.(Env::v('only_current',false)?' AND FIND_IN_SET(\'active\','.$table.'.statut)':'');
+}
 function advancedSearchFromInput()
 {
     if ($with_soundex = Env::has('with_soundex')) {
@@ -40,10 +43,6 @@ function advancedSearchFromInput()
     $subscriberField = new RefSField('subscriber',array('!(u.perms IN (\'admin\',\'user\'))+1'),'','','');
     $aliveField      = new RefSField('alive',array('(u.deces!=0)+1'),'','','');
 
-    function getadr_join($table) {
-        return 'u.user_id='.$table.'.uid'.(Env::get('only_current',false)?' AND FIND_IN_SET(\'active\','.$table.'.statut)':'');
-    }
-
     $townField      = new RefSField('city',array('ac.city'),'adresses','ac',getadr_join('ac'),false);
     $cityIdField    = new RefSField('cityid',array('av.cityid'),'adresses','av',getadr_join('av'));
     $countryField   = new RefSField('country',array('ap.country'),'adresses','ap',getadr_join('ap'));
@@ -105,11 +104,11 @@ class XOrgSearch extends XOrgPlugin
     {
         foreach ($this->orders as $key=>$o) {
             if ($o[3] == AUTH_COOKIE) {
-                $this->orders[$key][3] = logged();
+                $this->orders[$key][3] = S::logged();
             } elseif ($o[3] == AUTH_PUBLIC) {
                 $this->orders[$key][3] = true;
             } else {
-                $this->orders[$key][3] = identified();
+                $this->orders[$key][3] = S::identified();
             }
         }
     }
@@ -138,7 +137,7 @@ class XOrgSearch extends XOrgPlugin
        global $page;
 
         $offset = intval($this->get_value('offset'));
-        $tab    = $this->orders[$this->get_value('order')];
+        $tab    = @$this->orders[$this->get_value('order')];
         if (!$tab || !$tab[3]) {
             $tab = $this->orders[$this->order_defaut];
         }
@@ -152,7 +151,7 @@ class XOrgSearch extends XOrgPlugin
         list($list, $total) = call_user_func($this->_callback, $offset, $this->limit, $sql_order);
         
        $page_max = intval(($total-1)/$this->limit);
-        if(!logged() && $page_max > $globals->search->public_max)
+        if(!S::logged() && $page_max > $globals->search->public_max)
             $page_max = $globals->search->public_max;
 
        $links = Array();