Ejemplo n.º 1
0
 public function action_result()
 {
     $data = array();
     if ($_POST) {
         $id_brand = arr::get($_POST, 'id_brand');
         $id_model = arr::get($_POST, 'id_model');
         $id_series = arr::get($_POST, 'series');
         $year = arr::get($_POST, 'year');
         $to_number = arr::get($_POST, 'to_number');
         $millage_val = arr::get($_POST, 'millage_val');
         //$brands = ORM::factory('labor')->find_all();
         $brand = ORM::factory('brand', $id_brand)->name;
         $model = ORM::factory('model', $id_model)->name;
         $series = ORM::factory('series', $id_series)->as_array();
         $price = ORM::factory('price');
         $modification = new Model_Modification();
         $result = $modification->getModification($year, $id_series, $to_number);
         $labors = new Model_Labor();
         foreach ($result as $mod) {
             $labors_val[$mod['id']] = $labors->getLabors($mod['id'], $to_number)->as_array();
         }
         $calc_view = View::factory('forms/form.calculator')->set('id_brand', $id_brand)->set('id_model', $id_model)->set('id_series', $id_series)->set('year', $year)->set('millage_val', $millage_val)->set('modification', $result)->set('test', $modification)->set('to_number', $to_number);
         $this->template->content = View::factory('calculator.result')->set('brand', $brand)->set('model', $model)->set('year', $year)->set('series', $series)->set('millage_val', $millage_val)->set('modification', $result)->set('to_number', $to_number)->set('labors', $labors_val)->set('price', $price)->set('calculator_form', $calc_view->render());
     } else {
         HTTP::redirect('calculator');
     }
 }
Ejemplo n.º 2
0
 protected function do_login()
 {
     if ($this->request->is_ajax() && $_POST) {
         $this->do_auth();
     }
     $this->template->set_layout('layout/admin/login');
     $this->template->email = '';
     $this->template->remember = false;
     $this->template->error = '';
     $this->template->return = arr::get($_GET, 'return', arr::get($_POST, 'return', FALSE));
     if (isset($_POST['login'])) {
         $email = $_POST['email'];
         $password = $_POST['password'];
         $remember = $_POST['remember'];
         $this->template->email = $email;
         $this->template->remember = $remember;
         if (Auth::instance()->login($email, $password, (bool) $remember)) {
             if ($this->template->return) {
                 HTTP::redirect($this->template->return);
             } else {
                 return TRUE;
             }
         }
         if (Auth::instance()->is_banned()) {
             $banned_to = Auth::instance()->get_banned_to();
             $this->template->error = 'Аккаунт заблокирован до ' . date('Y-m-d H:i', $banned_to) . ' (до разблокировки ' . ceil(($banned_to - time()) / 3600) . ' ч ' . date('i мин', $banned_to - time()) . ')';
         } else {
             $this->template->error = 'Неверные e-mail или пароль';
         }
         return FALSE;
     }
 }
Ejemplo n.º 3
0
 public function action_eliminar()
 {
     $contra = $_GET['contra'];
     $estadoprocesos = ORM::factory('estadoprocesos', $contra);
     $estadoprocesos->delete();
     HTTP::redirect('estadoprocesos');
 }
Ejemplo n.º 4
0
 protected function on_auth_error()
 {
     if (!is_null($this->_login_route) and !Auth::instance()->logged_in()) {
         HTTP::redirect(Extasy_Url::url_to_route($this->_login_route) . '?return=' . $this->request->uri());
     }
     $this->forward_403();
 }
Ejemplo n.º 5
0
 public function before()
 {
     parent::before();
     if (!Auth::instance()->get_user()) {
         HTTP::redirect('Auth');
     }
 }
Ejemplo n.º 6
0
 /**
  *
  */
 public function action_logout()
 {
     if (!\Registry::getCurrentUser()->isGuest()) {
         \Auth\Base::destroy();
     }
     \HTTP::redirect(\Route::get('SystemRoute')->uri(['controller' => 'Main', 'action' => 'Login']), 302);
 }
Ejemplo n.º 7
0
 public function action_index()
 {
     $category = new Model_Category('tree');
     $data['categories'] = $category->getTree();
     if (isset($_POST['btnsubmit'])) {
         $categoryName = Arr::get($_POST, 'categoryName', '');
         $parentId = Arr::get($_POST, 'parentId', '');
         $url = Arr::get($_POST, 'url', '');
         $categoryimage = Arr::get($_POST, 'categoryimage', '');
         $res = $category->catInsert($parentId, array('name' => $categoryName, 'url' => $url, 'icon_url' => $categoryimage));
         if ($res) {
             //Request::initial()->redirect('admin');
             HTTP::redirect('admin');
         } else {
             $data['errors'] = $category->getErrors();
         }
     }
     if (isset($_POST['materialsavebtn'])) {
         $categoryId = Arr::get($_POST, 'categoryId', '');
         $content = Arr::get($_POST, 'content', '');
         $name = Arr::get($_POST, 'name');
         $material_image = Arr::get($_POST, 'material_image');
         $material = ORM::factory('Material');
         $material->addMaterial($categoryId, $content, $name, $material_image);
         HTTP::redirect('admin');
     }
     $this->template->content = View::factory('adminview', $data);
 }
Ejemplo n.º 8
0
 public function action_create()
 {
     // Enter a new user manually
     $user = ORM::factory('User');
     $user->username = $this->request->post('username');
     $user->password = $this->request->post('password');
     $user->email = $this->request->post('email');
     try {
         $user->save();
         $user->add('roles', ORM::factory('Role')->where('name', '=', $this->request->post('role'))->find());
     } catch (ORM_Validation_Exception $e) {
         $errors = $e->errors();
     }
     if (isset($errors)) {
         // $this->response->body(var_dump($errors));
         HTTP::redirect('/');
     } else {
         // Login with this user
         $success = Auth::instance()->login($this->request->post('username'), $this->request->post('password'));
         if ($success) {
             HTTP::redirect('/');
         } else {
             HTTP::redirect('/login');
         }
     }
 }
Ejemplo n.º 9
0
 public function on_page_load()
 {
     $email_ctx_id = $this->get('email_id_ctx', 'email');
     $email = $this->_ctx->get($email_ctx_id);
     $referrer_page = Request::current()->referrer();
     $next_page = $this->get('next_url', Request::current()->referrer());
     if (!Valid::email($email)) {
         Messages::errors(__('Use a valid e-mail address.'));
         HTTP::redirect($referrer_page);
     }
     $user = ORM::factory('user', array('email' => $email));
     if (!$user->loaded()) {
         Messages::errors(__('No user found!'));
         HTTP::redirect($referrer_page);
     }
     $reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
     if (!$reflink) {
         Messages::errors(__('Reflink generate error'));
         HTTP::redirect($referrer_page);
     }
     Observer::notify('admin_login_forgot_before', $user);
     try {
         Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
         Messages::success(__('Email with reflink send to address set in your profile'));
     } catch (Exception $e) {
         Messages::error(__('Something went wrong'));
     }
     HTTP::redirect($next_page);
 }
Ejemplo n.º 10
0
 public static function bounceToLogin()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'GET') {
         throw new \Exception('not logged in');
     }
     HTTP::redirect('login?return=' . urlencode(Env::get('request_url')));
 }
Ejemplo n.º 11
0
 /**
  * Edit
  */
 public function action_edit()
 {
     $this->title = __('home.page_edit');
     // Fields for save
     $for_extract = ['text', 'meta_t', 'meta_d', 'meta_k'];
     $config = Config::get('home');
     $data = Arr::extract($_POST, $for_extract);
     if ($this->request->is_post()) {
         $data = Validation::factory(array_map('trim', $data))->rule('meta_t', 'not_empty')->rule('meta_d', 'not_empty')->rule('meta_k', 'not_empty');
         if ($data->check()) {
             foreach ($for_extract as $field) {
                 $config[$field] = $data[$field];
             }
             $config->save();
             Message::success(__('settings.changes_saved'));
             HTTP::redirect(Route::url('b_home'));
         } else {
             Message::error(__('settings.error_saving'));
             $errors = $data->errors('validation');
         }
     } else {
         $data = $config;
     }
     $this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
 }
Ejemplo n.º 12
0
 /**
  * Update new forum
  */
 public function action_update()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic')));
     $topic = new Model_Topic($this->request->param('id'));
     $get_all = Model_Forum::get_all();
     //get all forums to build forum parents in select
     $forum_parents = array();
     foreach ($get_all[0] as $parent) {
         $forum_parents[$parent['id']] = $parent['name'];
     }
     $this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents));
     if ($_POST) {
         $topic->title = core::post('title');
         $topic->id_forum = core::post('id_forum');
         $topic->description = core::post('description');
         if (core::post('seotitle') != $topic->seotitle) {
             $topic->seotitle = $topic->gen_seotitle(core::post('seotitle'));
         }
         if (core::post('status') == 'on') {
             $topic->status = 1;
         } else {
             $topic->status = 0;
         }
         try {
             $topic->save();
             Alert::set(Alert::SUCCESS, __('Topic is updated.'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index')));
     }
 }
Ejemplo n.º 13
0
 public function index_action()
 {
     if (is_digits($_GET['id'])) {
         $feature_info = $this->model('feature')->get_feature_by_id($_GET['id']);
     } else {
         $feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']);
     }
     if (!$feature_info) {
         header('HTTP/1.1 404 Not Found');
         H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
     }
     if (!$feature_info['enabled']) {
         H::redirect_msg(AWS_APP::lang()->_t('专题未启用'), '/');
     }
     if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) {
         HTTP::redirect('/feature/' . $feature_info['url_token']);
     }
     if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) {
         H::redirect_msg(AWS_APP::lang()->_t('专题下必须包含一个以上话题'), '/');
     }
     if ($feature_info['seo_title']) {
         TPL::assign('page_title', $feature_info['seo_title']);
     } else {
         $this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']);
     }
     TPL::assign('sidebar_hot_topics', $topic_list);
     TPL::assign('feature_info', $feature_info);
     TPL::import_js('js/app/feature.js');
     TPL::output('feature/detail');
 }
Ejemplo n.º 14
0
 /**
  * [action_buy] Pay for ad, and set new order 
  *
  */
 public function action_buy()
 {
     if (Core::config('general.subscriptions') == FALSE) {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
     //getting the user that wants to buy now
     if (!Auth::instance()->logged_in()) {
         Alert::set(Alert::INFO, __('To buy this product you need to register first.'));
         $this->redirect(Route::url('oc-panel'));
     }
     //check plan exists
     $plan = new Model_Plan();
     $plan->where('seoname', '=', $this->request->param('id'))->where('status', '=', 1)->find();
     //loaded published and with stock if we control the stock.
     if ($plan->loaded() and $plan->status == 1) {
         //free plan can not be renewed
         if ($plan->price == 0 and $this->user->subscription()->id_plan == $plan->id_plan) {
             Alert::set(Alert::WARNING, __('Free plan can not be renewed, before expired'));
             HTTP::redirect(Route::url('pricing'));
         }
         $order = Model_Order::new_order(NULL, $this->user, $plan->id_plan, $plan->price, core::config('payment.paypal_currency'), __('Subscription to ') . $plan->name);
         //free plan no checkout
         if ($plan->price == 0) {
             $order->confirm_payment('cash');
             $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
         } else {
             $this->redirect(Route::url('default', array('controller' => 'plan', 'action' => 'checkout', 'id' => $order->id_order)));
         }
     } else {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
Ejemplo n.º 15
0
 /**
  * Basic
  */
 public function action_edit()
 {
     $this->title = __('settings.settings_general');
     // Fields for save
     $for_extract = ['per_page_frontend', 'per_page_backend', 'sitename', 'siteslogan', 'copyright', 'year_creation_site', 'type_backend_menu'];
     $config = Config::get('settings');
     $data = Arr::extract($_POST, $for_extract);
     if ($this->request->is_post()) {
         $data = Validation::factory(array_map('trim', $data))->rules('per_page_frontend', [['not_empty'], ['digit']])->rules('per_page_backend', [['not_empty'], ['digit']])->rules('year_creation_site', [['not_empty'], ['digit']])->rule('sitename', 'not_empty');
         if ($data->check()) {
             foreach ($for_extract as $field) {
                 $config[$field] = $data[$field];
             }
             $config->save();
             Message::success(__('settings.changes_saved'));
             HTTP::redirect(Route::url('b_settings'));
         } else {
             Message::error(__('settings.error_saving'));
             $errors = $data->errors('validation');
         }
     } else {
         $data = $config;
     }
     $this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
 }
Ejemplo n.º 16
0
 public function action_index()
 {
     if (!Auth::instance()->logged_in() && isset($_POST['login'])) {
         $user = ORM::factory('User');
         $status = Auth::instance()->login($_POST['username'], $_POST['password'], true);
         if ($status) {
             HTTP::redirect('/');
         }
     }
     if (Auth::instance()->logged_in() && isset($_POST['logout'])) {
         Auth::instance()->logout();
     }
     if (!Auth::instance()->logged_in()) {
         Guestid::factory()->get_id();
     }
     $templateData['title'] = 'Главная.';
     $templateData['description'] = '';
     $template = View::factory('template')->set('templateData', $templateData);
     $content = View::factory("catalog");
     $content->get = $_GET;
     $content->shopArr = Model::factory('Shop')->getShop();
     $root_page = "index";
     $template->root_page = $root_page;
     $template->content = $content;
     $this->response->body($template);
 }
Ejemplo n.º 17
0
 public function on_page_load()
 {
     $username = Auth::get_username();
     Auth::instance()->logout(TRUE);
     Observer::notify('admin_after_logout', $username);
     HTTP::redirect($this->get('next_url', Request::current()->referrer()));
 }
Ejemplo n.º 18
0
 public function action_down()
 {
     $code = $this->request->param('id');
     $portfolio = new Model_Portfolio();
     $portfolio->setDown($code);
     HTTP::redirect($_SERVER['HTTP_REFERER']);
 }
Ejemplo n.º 19
0
 public function action_eliminar()
 {
     $contra = $_GET['contra'];
     $contextos = ORM::factory('contextos', $contra);
     //$data = $contextos->as_array();
     $contextos->delete();
     HTTP::redirect('contextos');
 }
Ejemplo n.º 20
0
 public function back($default_route)
 {
     $url = $this->_return_location;
     if (is_null($url)) {
         $url = Extasy_Url::url_to_route($default_route);
     }
     HTTP::redirect($url);
 }
Ejemplo n.º 21
0
 public static function cancel($localTrxID)
 {
     $trxid = Session::instance()->get_once(self::SESSION_TOKEN);
     $impl = new PayPal();
     $localTrxID = $impl->retrieveLocalTrx($localTrxID);
     $impl = new PayPal();
     HTTP::redirect($impl->cancelled($localTrxID));
 }
Ejemplo n.º 22
0
 public function action_eliminar()
 {
     $contra = $_GET['contra'];
     $adjudicaciones = ORM::factory('adjudicaciones', $contra);
     //$data = $adjudicaciones->as_array();
     $adjudicaciones->delete();
     HTTP::redirect('adjudicaciones');
 }
Ejemplo n.º 23
0
 /**
  * @throws Kohana_Exception
  *
  * delete news
  */
 public function action_del()
 {
     $id = $this->request->param('id');
     $id = Security::encode_php_tags(HTML::chars($id));
     $news = new Model_New();
     $news->delNew($id);
     HTTP::redirect($_SERVER['HTTP_REFERER']);
 }
Ejemplo n.º 24
0
 public function logout_service($request, $back_url)
 {
     $helper = $this->api()->getRedirectLoginHelper();
     $accessToken = $helper->getAccessToken();
     $logoutUrl = $helper->getLogoutUrl($accessToken, $back_url);
     HTTP::redirect($logoutUrl);
     return FALSE;
 }
 public function action_index()
 {
     $twig = Twig::factory('Public/register');
     if (Auth::instance()->logged_in()) {
         HTTP::redirect('admin/dashboard');
     }
     $settings = ORM::factory('Setting')->where('id', '=', 1)->where('registration_status', '=', 1)->find();
     if ($settings->loaded()) {
         $registration = true;
         $twig->registrationStatus = null;
     } else {
         $registration = false;
         $twig->registrationStatus = 'Registration is currently off.';
     }
     if ($this->request->method() == 'POST') {
         $post = $this->request->post();
         $twig->post = $post;
         $errorMessages = array();
         $controllerValidation = Validation::factory($post)->rule('terms', 'not_empty')->rule('password', 'not_empty')->rule('password', 'min_length', array(':value', 4))->rule('password', 'max_length', array(':value', 30));
         if ($registration) {
             if ($controllerValidation->check()) {
                 try {
                     $register = ORM::factory('User');
                     $register->username = $post['username'];
                     $register->email = $post['email'];
                     $register->password = $post['password'];
                     $register->save();
                     $adminRole = ORM::factory('Role', 1);
                     $register->add('roles', $adminRole);
                     $twig->success = 'You have successfully registered.';
                     $twig->post = null;
                 } catch (ORM_Validation_Exception $e) {
                     $errorMessages = $e->errors('models');
                 }
             } else {
                 $errors = $controllerValidation->errors();
                 foreach ($errors as $key => $value) {
                     if ($key == 'terms' and $value[0] == 'not_empty') {
                         $errorMessages[] = 'Please agree with terms and conditions to register.';
                     }
                     if ($key == 'password' and $value[0] == 'not_empty') {
                         $errorMessages[] = 'Please enter your password.';
                     }
                     if ($key == 'password' and $value[0] == 'min_length') {
                         $errorMessages[] = 'Password is too short.';
                     }
                     if ($key == 'password' and $value[0] == 'max_length') {
                         $errorMessages[] = 'Password is too long.';
                     }
                 }
             }
         } else {
             $errorMessages[] = 'Registration is currently off.';
         }
         $twig->errors = $errorMessages;
     }
     $this->response->body($twig);
 }
Ejemplo n.º 26
0
 public function before()
 {
     parent::before();
     $session = Session::instance();
     $session->set("auth_redirect", $_SERVER['REQUEST_URI']);
     if (!Auth::instance()->get_user()) {
         HTTP::redirect('Auth');
     }
 }
Ejemplo n.º 27
0
 public function delete_dialog_action()
 {
     $this->model('message')->delete_dialog($_GET['dialog_id'], $this->user_id);
     if ($_SERVER['HTTP_REFERER']) {
         HTTP::redirect($_SERVER['HTTP_REFERER']);
     } else {
         HTTP::redirect('/inbox/');
     }
 }
Ejemplo n.º 28
0
 public function before()
 {
     if (!Auth::instance()->logged_in('admin')) {
         HTTP::redirect('login');
     }
     parent::before();
     $this->template->styles = array('/media/css/admin.css', 'media/css/jquery.fancybox.css');
     $this->template->scripts = array('/media/js/jquery.js', '/media/js/MultiFile.pack.js', '/media/js/upload.js', '/media/js/jquery.fancybox.pack.js', '/media/js/demo.js');
 }
Ejemplo n.º 29
0
 public function index_action()
 {
     if (isset($_GET['notification_id'])) {
         $this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
     }
     if (is_digits($_GET['id'])) {
         if (!($user = $this->model('account')->get_user_info_by_uid($_GET['id'], TRUE))) {
             $user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE);
         }
     } else {
         if ($user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE)) {
         } else {
             $user = $this->model('account')->get_user_info_by_url_token($_GET['id'], TRUE);
         }
     }
     if (!$user) {
         H::redirect_msg(AWS_APP::lang()->_t('用户不存在'), '/');
     }
     if (urldecode($user['url_token']) != $_GET['id']) {
         HTTP::redirect('/people/' . $user['url_token']);
     }
     $this->model('people')->update_views($user['uid']);
     TPL::assign('user', $user);
     $job_info = $this->model('account')->get_jobs_by_id($user['job_id']);
     TPL::assign('job_name', $job_info['job_name']);
     if ($user['weibo_visit']) {
         if ($users_sina = $this->model('openid_weibo_oauth')->get_weibo_user_by_uid($user['uid'])) {
             TPL::assign('sina_weibo_url', 'http://www.weibo.com/' . $users_sina['id']);
         }
     }
     TPL::assign('education_experience_list', $this->model('education')->get_education_experience_list($user['uid']));
     $jobs_list = $this->model('work')->get_jobs_list();
     if ($work_experience_list = $this->model('work')->get_work_experience_list($user['uid'])) {
         foreach ($work_experience_list as $key => $val) {
             $work_experience_list[$key]['job_name'] = $jobs_list[$val['job_id']];
         }
     }
     TPL::assign('work_experience_list', $work_experience_list);
     TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $user['uid']));
     $this->crumb(AWS_APP::lang()->_t('%s 的个人主页', $user['user_name']), 'people/' . $user['url_token']);
     TPL::import_css('css/user.css');
     TPL::assign('reputation_topics', $this->model('people')->get_user_reputation_topic($user['uid'], $user['reputation'], 12));
     TPL::assign('fans_list', $this->model('follow')->get_user_fans($user['uid'], 1, 8));
     TPL::assign('friends_list', $this->model('follow')->get_user_friends($user['uid'], 1, 8));
     TPL::assign('focus_topics', $this->model('topic')->get_focus_topic_list($user['uid'], 1, 8));
     TPL::assign('user_actions_questions', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ADD_QUESTION, $this->user_id));
     TPL::assign('user_actions_answers', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ANSWER_QUESTION, $this->user_id));
     TPL::assign('user_actions', $this->model('actions')->get_user_actions($user['uid'], 5, implode(',', array(ACTION_LOG::ADD_QUESTION, ACTION_LOG::ANSWER_QUESTION, ACTION_LOG::ADD_REQUESTION_FOCUS, ACTION_LOG::ADD_AGREE, ACTION_LOG::ADD_TOPIC, ACTION_LOG::ADD_TOPIC_FOCUS, ACTION_LOG::ADD_ARTICLE)), $this->user_id));
     TPL::assign('user_question_list_publish', $this->model('question')->get_user_question_list_publish($user['uid'], 1, 5));
     TPL::assign('user_question_list_answered', $this->model('question')->get_user_question_list_answered($user['uid'], 1, 5));
     TPL::assign('user_answered_question_count', $this->model('quiz')->get_user_answerd_question_count($user['uid']));
     TPL::assign('user_question_list_failed', $this->model('question')->get_user_question_list_failed($user['uid'], 1, 5));
     TPL::assign('user_failed_question_count', $this->model('quiz')->get_user_failed_question_count($user['uid']));
     TPL::assign('user_answer_list', $this->model('answer')->get_user_answer_list($user['uid'], 1, 5));
     TPL::output('people/index');
 }
Ejemplo n.º 30
0
 public function index_square_action()
 {
     if (is_mobile()) {
         HTTP::redirect('/m/people/');
     }
     if (!$_GET['page']) {
         $_GET['page'] = 1;
     }
     $this->crumb(AWS_APP::lang()->_t('用户列表'), '/people/');
     if ($_GET['topic_id']) {
         if ($helpful_users = $this->model('topic')->get_helpful_users_by_topic_ids($this->model('topic')->get_child_topic_ids($_GET['topic_id']), get_setting('contents_per_page'), 4)) {
             foreach ($helpful_users as $key => $val) {
                 $users_list[$key] = $val['user_info'];
                 $users_list[$key]['experience'] = $val['experience'];
                 foreach ($val['experience'] as $exp_key => $exp_val) {
                     $users_list[$key]['total_agree_count'] += $exp_val['agree_count'];
                 }
             }
         }
     } else {
         $where = array();
         if ($_GET['group_id']) {
             $where[] = 'group_id = ' . intval($_GET['group_id']);
         }
         $users_list = $this->model('account')->get_users_list(implode('', $where), calc_page_limit($_GET['page'], get_setting('contents_per_page')), true, false, 'reputation DESC');
         $where[] = 'forbidden = 0 AND group_id <> 3';
         TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/people/group_id-' . $_GET['group_id']), 'total_rows' => $this->model('account')->get_user_count(implode(' AND ', $where)), 'per_page' => get_setting('contents_per_page')))->create_links());
     }
     if ($users_list) {
         foreach ($users_list as $key => $val) {
             if ($val['reputation']) {
                 $reputation_users_ids[] = $val['uid'];
                 $users_reputations[$val['uid']] = $val['reputation'];
             }
             $uids[] = $val['uid'];
         }
         if (!$_GET['topic_id']) {
             $reputation_topics = $this->model('people')->get_users_reputation_topic($reputation_users_ids, $users_reputations, 5);
             foreach ($users_list as $key => $val) {
                 $users_list[$key]['reputation_topics'] = $reputation_topics[$val['uid']];
             }
         }
         if ($uids and $this->user_id) {
             $users_follow_check = $this->model('follow')->users_follow_check($this->user_id, $uids);
         }
         foreach ($users_list as $key => $val) {
             $users_list[$key]['focus'] = $users_follow_check[$val['uid']];
         }
         TPL::assign('users_list', array_values($users_list));
     }
     if (!$_GET['group_id']) {
         TPL::assign('parent_topics', $this->model('topic')->get_parent_topics());
     }
     TPL::assign('custom_group', $this->model('account')->get_user_group_list(0, 1));
     TPL::output('people/square');
 }