コード例 #1
0
 /**
  * Magic method to set user info
  * @param string $detail
  * @returns string
  */
 public function __set($detail, $value)
 {
     parent::__set($detail, $value);
     switch ($detail) {
         case 'password':
             $this->user->setPassword($value);
             break;
         case 'role':
             if (is_string($value)) {
                 $value = array_pad(explode('|', $value, 2), 2, '');
             }
             if (!is_array($value) || count($value) != 2 || $value[0] != 'role') {
                 I2CE::raiseError("Invalid role " . print_r($role, true));
                 break;
             }
             $this->user->role = $value[1];
             break;
         case 'username':
             $this->user->username = $value;
             break;
         default:
             if (!in_array($detail, $this->allowedDetails)) {
                 break;
             }
             if ($detail == 'locale') {
                 $value = I2CE_Locales::ensureSelectableLocale($value);
             }
             $this->user->{$detail} = $value;
     }
 }