Show
Ignore:
Timestamp:
11/07/06 07:34:01 (2 years ago)
Author:
mdodoo
Message:

Trunk sync up until [1613]. To tell the truth, I do not like doing these syncs.

Location:
branches/multiuser/cls
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/multiuser/cls/l10n.php

    r1606 r1628  
    8080       if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && ($_REQUEST['lang'] == 'en' || file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang']))) { 
    8181            $this -> __setLocaleCookie($_REQUEST['lang']); 
     82            rss_invalidate_cache(); 
    8283            return  $_REQUEST['lang']; 
    8384        } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { 
  • branches/multiuser/cls/search.php

    r1604 r1628  
    4343define ('QUERY_MATCH_EXACT','exact'); 
    4444 
     45// This is needed for some constants 
     46rss_require('cls/wrappers/toolkit.php'); 
    4547 
    4648class SearchItemList extends ItemList { 
     
    5153 
    5254    var $currentPage; 
    53     var $resultsPerPage; 
     55    var $resultsPerPage = 0; 
    5456    var $startItem; 
    5557    var $endItem; 
     
    5860    var $logicSep; 
    5961 
    60     function SearchItemList() { 
     62    function SearchItemList($query=null,$results=0) { 
    6163        parent::ItemList(); 
     64        if ($query) { 
     65            $this -> query=$query; 
     66        } elseif(isset($_REQUEST[QUERY_PRM])) { 
     67            $this->query = $_REQUEST[QUERY_PRM]; 
     68        }else{ 
     69            $this -> query = null; 
     70        } 
     71         
     72         
     73        // Sanitize the query parameters: 
     74        // fixme: this probably breaks on queries with weird characters, depending 
     75        // on the locale.  
     76        // see: http://php.benscom.com/manual/en/reference.pcre.pattern.syntax.php 
     77        if ($this -> query) { 
     78            $this -> query = trim(preg_replace('#[^\w\s\x80-\xff]#','',$this -> query)); 
     79        } 
     80         
     81        $this->resultsPerPage = (int) $results; 
     82         
    6283        $this -> populate(); 
    6384 
     
    101122 
    102123    function populate() { 
    103         if (!isset($_REQUEST[QUERY_PRM])) { 
    104             return; 
    105         } 
    106  
    107                 // fixme: this probably breaks on queries with weird characters, depending 
    108                 // on the locale.  
    109                 // see: http://php.benscom.com/manual/en/reference.pcre.pattern.syntax.php 
    110         $this->query = trim(preg_replace('#[^\w\s\x80-\xff]#','',$_REQUEST[QUERY_PRM])); 
    111124         
    112125        if (!$this->query) { 
     
    122135            RSS_SANITIZER_NUMERIC); 
    123136 
    124         $this->resultsPerPage = sanitize( 
    125             ((array_key_exists(QUERY_RESULTS, $_REQUEST)) ? $_REQUEST[QUERY_RESULTS] : INFINE_RESULTS), 
    126             RSS_SANITIZER_NUMERIC); 
    127          
     137        if (!$this->resultsPerPage) { 
     138            $this->resultsPerPage = sanitize( 
     139                ((array_key_exists(QUERY_RESULTS, $_REQUEST)) ? $_REQUEST[QUERY_RESULTS] : INFINE_RESULTS), 
     140                RSS_SANITIZER_NUMERIC); 
     141        } 
     142 
    128143        $this->currentPage = sanitize( 
    129144            (array_key_exists(QUERY_CURRENT_PAGE, $_REQUEST) ? $_REQUEST[QUERY_CURRENT_PAGE] : 0),