Exemple #1
0
 function getPreferences()
 {
     // override the generic slow method here for efficiency
     _AnonUser::getPreferences();
     $this->getAuthDbh();
     if (isset($this->_prefs->_select)) {
         $dbh =& $this->_auth_dbi;
         $rs = $dbh->Execute(sprintf($this->_prefs->_select, $dbh->qstr($this->_userid)));
         if ($rs->EOF) {
             $rs->Close();
         } else {
             $prefs_blob = @$rs->fields['prefs'];
             $rs->Close();
             if ($restored_from_db = $this->_prefs->retrieve($prefs_blob)) {
                 $updated = $this->_prefs->updatePrefs($restored_from_db);
                 //$this->_prefs = new UserPreferences($restored_from_db);
                 return $this->_prefs;
             }
         }
     }
     if (!empty($this->_HomePagehandle)) {
         if ($restored_from_page = $this->_prefs->retrieve($this->_HomePagehandle->get('pref'))) {
             $updated = $this->_prefs->updatePrefs($restored_from_page);
             //$this->_prefs = new UserPreferences($restored_from_page);
             return $this->_prefs;
         }
     }
     return $this->_prefs;
 }
Exemple #2
0
 function getPreferences()
 {
     // override the generic slow method here for efficiency and not to
     // clutter the homepage metadata with prefs.
     _AnonUser::getPreferences();
     $this->getAuthDbh();
     if (isset($this->_prefs->_select)) {
         $dbh =& $this->_auth_dbi;
         $db_result = $dbh->query(sprintf($this->_prefs->_select, $dbh->quote($this->_userid)));
         // patched by frederik@pandora.be
         $prefs = $db_result->fetchRow();
         $prefs_blob = @$prefs["prefs"];
         if ($restored_from_db = $this->_prefs->retrieve($prefs_blob)) {
             $updated = $this->_prefs->updatePrefs($restored_from_db);
             //$this->_prefs = new UserPreferences($restored_from_db);
             return $this->_prefs;
         }
     }
     if (isset($this->_HomePagehandle) && $this->_HomePagehandle) {
         if ($restored_from_page = $this->_prefs->retrieve($this->_HomePagehandle->get('pref'))) {
             $updated = $this->_prefs->updatePrefs($restored_from_page);
             //$this->_prefs = new UserPreferences($restored_from_page);
             return $this->_prefs;
         }
     }
     return $this->_prefs;
 }
Exemple #3
0
 function getPreferences()
 {
     if (!empty($this->_prefs->_method)) {
         if ($this->_prefs->_method == 'ADODB') {
             // FIXME: strange why this should be needed...
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/AdoDb.php";
             return _AdoDbPassUser::getPreferences();
         } elseif ($this->_prefs->_method == 'SQL') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PearDb.php";
             return _PearDbPassUser::getPreferences();
         } elseif ($this->_prefs->_method == 'PDO') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PdoDb.php";
             return _PdoDbPassUser::getPreferences();
         }
     }
     // We don't necessarily have to read the cookie first. Since
     // the user has a password, the prefs stored in the homepage
     // cannot be arbitrarily altered by other Bogo users.
     _AnonUser::getPreferences();
     // User may have deleted cookie, retrieve from his
     // PersonalPage if there is one.
     if (!empty($this->_HomePagehandle)) {
         if ($restored_from_page = $this->_prefs->retrieve($this->_HomePagehandle->get('pref'))) {
             $updated = $this->_prefs->updatePrefs($restored_from_page, 'init');
             //$this->_prefs = new UserPreferences($restored_from_page);
             return $this->_prefs;
         }
     }
     return $this->_prefs;
 }