Пример #1
0
 public function set_user_theme($arr)
 {
     global $g5, $member, $is_member;
     // 테마정보 가져오기
     $theme = sql_fetch("select * from {$g5['eyoom_theme']} where tm_name='{$arr['theme']}' || tm_alias='{$arr['theme']}'", false);
     // 지정한 사용자 테마가 없다면 디폴트 테마로
     if ($theme['tm_name'] && is_dir($this->theme_path . '/' . $theme['tm_name'])) {
         $arr['theme'] = $theme['tm_name'];
     } else {
         if ($arr['theme'] != 'basic' && $arr['theme'] != 'pc_basic') {
             $arr['theme'] = '';
         }
     }
     // 유니크 아이디 쿠키 생성
     if (get_cookie('unique_theme_id')) {
         $unique_theme_id = get_cookie('unique_theme_id');
     } else {
         $unique_theme_id = date('YmdHis', time()) . str_pad((int) (microtime() * 100), 2, "0", STR_PAD_LEFT);
         set_cookie('unique_theme_id', $unique_theme_id, 3600);
     }
     $file = $this->tmp_path . '/' . $_SERVER['REMOTE_ADDR'] . '.' . $unique_theme_id . '.php';
     if (file_exists($file)) {
         include_once $file;
         $_user_config = $arr + $user_config;
     } else {
         $_user_config = $arr;
     }
     //파일 생성 및 갱신
     parent::save_file('user_config', $file, $_user_config);
     // 특정시간이 지난 파일은 자동 삭제
     parent::del_timeover_file($this->tmp_path);
     // 사용자 테마가 없다면 파일삭제
     if (!$_user_config['theme']) {
         parent::del_file($file);
         return false;
     } else {
         return $_user_config;
     }
 }