Example #1
0
 /**
  * Constructs the object
  * @param string $query The query
  * @param string $query The query before the redirect (e.g. oprobiu before the automatic redirect to oprobriu)
  * @param int $searchType The seach type
  * @param boolean $redirect If true, then the result is a redirect [OPTIONAL]
  * @param Definition[] $results The results [OPTIONAL]
  * @access public
  * @return void
  **/
 public function __construct($query, $queryBeforeRedirect, $searchType, $redirect = false, &$results = null)
 {
     if (!Config::get('global.logSearch') || lcg_value() > Config::get('global.logSampling')) {
         $this->query = null;
         return false;
     }
     $this->query = $query;
     $this->queryBeforeRedirect = $queryBeforeRedirect;
     $this->searchType = $searchType;
     if (session_variableExists('user')) {
         $this->registeredUser = '******';
         $this->preferences = $_SESSION['user']->preferences;
     } else {
         $this->registeredUser = '******';
         $this->preferences = session_getCookieSetting('anonymousPrefs');
     }
     $this->skin = session_getSkin();
     $this->resultCount = count($results);
     $this->redirect = $redirect ? 'y' : 'n';
     $this->resultList = '';
     if ($results != null) {
         $numResultsToLog = min(count($results), Config::get('global.logResults'));
         $this->resultList = '';
         for ($i = 0; $i < $numResultsToLog; $i++) {
             $this->resultList .= ($this->resultList ? ',' : '') . $results[$i]->id;
         }
     }
 }
Example #2
0
function session_getUserId()
{
    return session_variableExists('user') && isset($_SESSION['user']->id) ? $_SESSION['user']->id : 0;
}