예제 #1
0
 public function generalAction()
 {
     $model = new SettingsModel();
     if (isPost()) {
         $data['realname'] = post('realname');
         $data['country'] = post('country');
         $data['city'] = post('city');
         $data['sex'] = post('sex', 'int');
         $data['mm'] = post('mm', 'int');
         $data['dd'] = post('dd', 'int');
         $data['yyyy'] = post('yyyy', 'int');
         $data['about'] = post('about');
         $tradelink = urldecode(post('tradelink'));
         if (preg_match('/' . preg_quote('/?partner=', '/') . '(.*)' . preg_quote('&token=', '/') . '/Us', $tradelink, $match)) {
             $partner = $match[1];
         }
         if (preg_match('/' . preg_quote('&amp;token=', '/') . '(.*)' . preg_quote('<<<eof', '/') . '/Us', $tradelink . '<<<eof', $match)) {
             $token = $match[1];
         }
         if ($partner && $token) {
             $data['partner'] = $partner;
             $data['token'] = $token;
         }
         $model->setSettings(Request::getParam('user')->id, $data);
         $path = 'public/users/' . Request::getParam('user')->id . '/';
         remkdir($path);
         File::LoadImage($_FILES['file'], $path, 'avatar', 'jpg', null, 0, 2, 184, 184);
         File::LoadImage($_FILES['file'], $path, 'avatar_m', 'jpg', null, 0, 2, 64, 64);
         File::LoadImage($_FILES['file'], $path, 'avatar_s', 'jpg', null, 0, 2, 32, 32);
         redirect(url('settings', 'general'));
     }
     $this->view->countrysList = $model->getCountryList();
     $this->view->title = Lang::translate('GENERAL_TITLE');
 }