예제 #1
0
 function setPreferences($prefs, $id_only = false)
 {
     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";
             _AdoDbPassUser::_AdoDbPassUser($this->_userid, $prefs);
             return _AdoDbPassUser::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'SQL') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PearDb.php";
             _PearDbPassUser::_PearDbPassUser($this->_userid, $prefs);
             return _PearDbPassUser::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'PDO') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PdoDb.php";
             _PdoDbPassUser::_PdoDbPassUser($this->_userid, $prefs);
             return _PdoDbPassUser::setPreferences($prefs, $id_only);
         }
     }
     if ($updated = _AnonUser::setPreferences($prefs, $id_only)) {
         // Encode only the _prefs array of the UserPreference object
         if (!empty($this->_HomePagehandle) and !$id_only) {
             $this->_HomePagehandle->set('pref', $this->_prefs->store());
         }
     }
     return $updated;
 }
예제 #2
0
 function setPreferences($prefs, $id_only = false)
 {
     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::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'SQL') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PearDb.php";
             return _PearDbPassUser::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'PDO') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PdoDb.php";
             return _PdoDbPassUser::setPreferences($prefs, $id_only);
         }
     }
     if ($updated = _AnonUser::setPreferences($prefs, $id_only)) {
         // Encode only the _prefs array of the UserPreference object
         // If no DB method exists to store the prefs we must store it in the page, not in the cookies.
         if (empty($this->_HomePagehandle)) {
             $this->_HomePagehandle = $GLOBALS['request']->getPage($this->_userid);
         }
         if (!$this->_HomePagehandle->exists()) {
             $this->createHomePage();
         }
         if (!empty($this->_HomePagehandle) and !$id_only) {
             $this->_HomePagehandle->set('pref', $this->_prefs->store());
         }
     }
     return $updated;
 }
예제 #3
0
 function setPreferences($prefs, $id_only = false)
 {
     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";
             _AdoDbPassUser::_AdoDbPassUser($this->_userid, $prefs);
             return _AdoDbPassUser::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'SQL') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PearDb.php";
             _PearDbPassUser::_PearDbPassUser($this->_userid, $prefs);
             return _PearDbPassUser::setPreferences($prefs, $id_only);
         } elseif ($this->_prefs->_method == 'PDO') {
             include_once "lib/WikiUser/Db.php";
             include_once "lib/WikiUser/PdoDb.php";
             _PdoDbPassUser::_PdoDbPassUser($this->_userid, $prefs);
             return _PdoDbPassUser::setPreferences($prefs, $id_only);
         }
     }
     if ($num = _AnonUser::setPreferences($prefs, $id_only)) {
         // Codendi specific: We have to load the home page here because since
         // the user page is not systematicaly created, the home page handle
         // is not passed as user argument on _PassUser call. BTW, this
         // method is called without test because it's only used because it
         // load the '$this->_HomePagehandle' param.
         $this->hasHomePage();
         // Encode only the _prefs array of the UserPreference object
         if (!empty($this->_HomePagehandle) and !$id_only) {
             $this->_HomePagehandle->set('pref', $this->_prefs->store());
         }
     }
     return $num;
 }