コード例 #1
0
ファイル: userprofile.php プロジェクト: revcozmo/dating
 public static function get()
 {
     $vars = self::get_path_variables();
     if (count($vars) == 1) {
         $user_profile = \lib\user_profile::get(reset($vars));
         // data massaging for frontend
         $user_profile['birthday_year'] = $user_profile['birthday_month'] = $user_profile['birthday_day'] = '';
         if (isset($user_profile['birthday'])) {
             $birthday_parsed = date_parse($user_profile['birthday']);
             $user_profile['birthday_year'] = $birthday_parsed['year'] ? $birthday_parsed['year'] : '';
             $user_profile['birthday_month'] = $birthday_parsed['month'] ? $birthday_parsed['month'] : '';
             $user_profile['birthday_day'] = $birthday_parsed['day'] ? $birthday_parsed['day'] : '';
             unset($user_profile['birthday']);
         }
         return $user_profile;
     }
 }
コード例 #2
0
ファイル: user_profile.php プロジェクト: revcozmo/dating
 public static function set($data)
 {
     $user_profile = \lib\user_profile::get($data['id']);
     foreach ($data as $key => $value) {
         if (!isset($user_profile[$key])) {
             // add it
             \lib\user_profile::add($data['id'], $key, $value);
         } else {
             if ($user_profile[$key] != $value) {
                 // change it
                 \lib\user_profile::update($data['id'], $key, $value);
             } else {
                 // do nothing
             }
         }
     }
 }