Exemplo n.º 1
0
 function doPost()
 {
     $osp = Old_school_prefs::getKV('user_id', $this->scoped->getID());
     $orig = null;
     if (!empty($osp)) {
         $orig = clone $osp;
     } else {
         $osp = new Old_school_prefs();
         $osp->user_id = $this->scoped->getID();
         $osp->created = common_sql_now();
     }
     $osp->stream_mode_only = $this->boolean('stream_mode_only');
     $osp->stream_nicknames = $this->boolean('stream_nicknames');
     $osp->modified = common_sql_now();
     if ($orig instanceof Old_school_prefs) {
         $osp->update($orig);
     } else {
         $osp->insert();
     }
     // TRANS: Confirmation shown when user profile settings are saved.
     return _('Settings saved.');
 }
Exemplo n.º 2
0
 function streamNicknames()
 {
     if (common_config('oldschool', 'enabled')) {
         $osp = Old_school_prefs::staticGet('user_id', $this->id);
         if (!empty($osp)) {
             return $osp->stream_nicknames;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handlePost()
 {
     $user = common_current_user();
     $osp = Old_school_prefs::getKV('user_id', $user->id);
     $orig = null;
     if (!empty($osp)) {
         $orig = clone $osp;
     } else {
         $osp = new Old_school_prefs();
         $osp->user_id = $user->id;
         $osp->created = common_sql_now();
     }
     $osp->stream_mode_only = $this->boolean('stream_mode_only');
     $osp->stream_nicknames = $this->boolean('stream_nicknames');
     $osp->modified = common_sql_now();
     if (!empty($orig)) {
         $osp->update($orig);
     } else {
         $osp->insert();
     }
     // TRANS: Confirmation shown when user profile settings are saved.
     $this->showForm(_('Settings saved.'), true);
     return;
 }