コード例 #1
0
ファイル: message.php プロジェクト: roine/wawaw
 public function action_to($id = null)
 {
     // redirect if no id
     if ($id == null) {
         Response::redirect('message');
     }
     // redirect if no right access
     if (!Sentry::user()->has_access('message_send')) {
         Session::set_flash('error', "You are not allowed to send message");
         Response::redirect('');
     }
     $data['user'] = Sentry::user(intval($id));
     $data['messages'] = Model_Message::messageWith($data['user'], $this->current_user);
     if (Input::method() == 'POST') {
         $message = Model_Message::forge(array('subject' => Input::post('subject'), 'content' => Input::post('content'), 'to' => $data['user']->id, 'from' => $this->current_user->id, 'parent_id' => '', 'read' => 0, 'from_delete' => 0, 'to_delete' => 0));
         if ($message and $message->save()) {
             Session::set_flash('success', 'Message successfuly sent to ' . $data['user']->username);
             Response::redirect('message');
         } else {
             Session::set_flash('error', 'Could not send the message.');
         }
     }
     $this->template->h2 = 'Send Message to ' . $data['user']->username;
     $this->template->title = 'Message » to';
     $this->template->content = View::forge('message/to', $data);
 }
コード例 #2
0
ファイル: myauth.php プロジェクト: huglester/fuel-uploadify
 public function action_register()
 {
     if (\Auth::check()) {
         \Session::set_flash('error', 'FLASH: Can\'t register while logged in, log out first.');
         \Output::redirect('myauth');
     }
     // The same fields as the example above
     $val = \Validation::factory('myauth2');
     $val->add_field('username', 'Your username', 'required|min_length[3]|max_length[20]');
     //        $val->add_field('username', 'Your username', 'required|min_length[3]|max_length[20]|unique[simpleauth.username]');
     $val->add_field('password', 'Your password', 'required|min_length[3]|max_length[20]');
     $val->add_field('email', 'Email', 'required|valid_email');
     // run validation on just post
     if ($val->run()) {
         if (\Auth::instance()->create_user($val->validated('username'), $val->validated('password'), $val->validated('email'), '100')) {
             \Session::set_flash('notice', 'FLASH: User created.');
             \Output::redirect('myauth');
         } else {
             throw new Exception('Smth went wrong while registering');
         }
     } else {
         // validation failed
         if ($_POST) {
             $data['username'] = $val->validated('username');
             $data['login_error'] = 'All fields are required.';
         } else {
             $data['login_error'] = false;
         }
     }
     $this->template->title = 'Myauth &raquo Register';
     $this->template->login_error = @$data['login_error'];
     $this->template->content = \View::factory('register');
 }
コード例 #3
0
ファイル: vote.php プロジェクト: wxl2012/wx
 /**
  * 编辑保存被投票项目
  * @param int $id
  * @throws \Exception
  * @throws \FuelException
  */
 public function action_save($id = 0)
 {
     if (\Input::method() == 'POST') {
         $msg = ['status' => 'err', 'msg' => '', 'errcode' => 10];
         $data = \Input::post();
         $data['start_at'] = $data['start_at'] ? strtotime($data['start_at']) : 0;
         $data['end_at'] = $data['end_at'] ? strtotime($data['end_at']) : 0;
         $data['account_id'] = \Session::get('WXAccount')->id;
         $data['seller_id'] = \Session::get('WXAccount')->seller_id;
         $data['type'] = 'VOTE';
         $market = \Model_Marketing::find($id);
         if (!$market) {
             $market = \Model_Marketing::forge();
         }
         $market->set($data);
         if ($market->save()) {
             $limit = \Model_MarketingLimit::forge(['involved_total_num' => 1, 'marketing_id' => $market->id]);
             $limit->save();
             $msg = ['status' => 'succ', 'msg' => '', 'errcode' => 0, 'data' => $market->to_array()];
         }
         if (\Input::is_ajax()) {
             die(json_encode($msg));
         }
         \Session::set_flash('msg', $msg);
     }
 }
コード例 #4
0
ファイル: base.php プロジェクト: roine/wawaw
 public function before()
 {
     parent::before();
     // if user not connected and not on the login, 404 or session_up pages then redirect to login page
     if (Request::active()->action != 'login' && !Sentry::check() && Request::active()->action != '404' && Request::active()->action != 'session_up') {
         Session::set(array('redirect' => Request::active()->route->translation));
         Response::redirect('login');
     }
     $this->current_user = self::current_user();
     View::set_global('current_user', self::current_user());
     if (Sentry::check()) {
         // logout if banned
         if (Sentry::attempts($this->current_user->username)->get() == Sentry::attempts()->get_limit()) {
             Session::set_flash('Your account has been blocked');
             Sentry::logout();
             Response::redirect('login');
         }
     }
     View::set_global('site_title', 'IKON Backend');
     View::set_global('separator', '/');
     foreach (Model_Forms::find('all') as $k => $form) {
         $this->tables[$k]['cleanName'] = $form->cleanName;
         $this->tables[$k]['url'] = $form->url;
         $this->tables[$k]['table'] = $form->table;
     }
     View::set_global('tables', $this->tables);
 }
コード例 #5
0
ファイル: category.php プロジェクト: sajans/cms
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('category');
     if (!($category = Model_Category::find($id))) {
         Session::set_flash('error', 'Could not find category #' . $id);
         Response::redirect('category');
     }
     $val = Model_Category::validate('edit');
     if ($val->run()) {
         $category->name = Input::post('name');
         $category->keywords = Input::post('keywords');
         $category->meta = Input::post('meta');
         if ($category->save()) {
             Session::set_flash('success', 'Updated category #' . $id);
             Response::redirect('admin/category');
         } else {
             Session::set_flash('error', 'Could not update category #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $category->name = $val->validated('name');
             $category->keywords = $val->validated('keywords');
             $category->meta = $val->validated('meta');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('category', $category, false);
     }
     $this->template->title = "Categories";
     $this->template->content = View::forge('admin/category/create');
 }
コード例 #6
0
ファイル: auction.php プロジェクト: notfoundsam/yahooauc
 public function action_edit($id = null, $one = null, $two = null)
 {
     $redirect = $two ? $one . '/' . $two : $one;
     $auction = Model_Auction::find($id);
     $val = Model_Auction::validate_edit();
     if ($val->run()) {
         $auction->item_count = Input::post('item_count');
         $auction->price = Input::post('price');
         $auction->memo = Input::post('memo');
         if (\Security::check_token() && $auction->save()) {
             Session::set_flash('success', e('Updated auction #' . $auction->auc_id));
             Response::redirect('admin/' . $redirect);
         } else {
             Session::set_flash('error', e('Could not update auction #' . $auction->auc_id));
         }
     } else {
         if (Input::method() == 'POST') {
             $auction->item_count = $val->validated('item_count');
             $auction->price = $val->validated('price');
             $auction->memo = $val->validated('memo');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('auction', $auction, false);
     }
     $this->template->set_global('redirect', $redirect, false);
     $this->template->title = $auction->title;
     $this->template->content = View::forge('admin/auction/edit');
 }
コード例 #7
0
ファイル: setting.php プロジェクト: uzura8/flockbird
 /**
  * Mmeber setting viewtype
  * 
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     $page_name = term('notice', 'site.setting');
     $val = \Form_MemberConfig::get_validation($this->u->id, 'notice', 'Notice');
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             \Form_MemberConfig::save($this->u->id, $val, $post);
             \DB::commit_transaction();
             \Session::set_flash('message', $page_name . 'を変更しました。');
             \Response::redirect('member/setting');
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
     $this->template->content = \View::forge('member/setting/_parts/form', array('val' => $val, 'label_size' => 5, 'form_params' => array('common' => array('radio' => array('layout_type' => 'grid')))));
 }
コード例 #8
0
ファイル: profile.php プロジェクト: uzura8/flockbird
 /**
  * Mmeber_profile edit
  * 
  * @access  public
  * @return  Response
  */
 public function action_edit($type = null)
 {
     list($type, $is_regist) = self::validate_type($type, $this->u->id);
     $form_member_profile = new Form_MemberProfile($type == 'regist' ? 'regist-config' : 'config', $this->u);
     $form_member_profile->set_validation();
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             $form_member_profile->validate(true);
             \DB::start_transaction();
             $form_member_profile->seve();
             if ($is_regist) {
                 Model_MemberConfig::delete_value($this->u->id, 'terms_un_agreement');
             }
             \DB::commit_transaction();
             $message = $is_regist ? sprintf('%sが%sしました。', term('site.registration'), term('form.complete')) : term('profile') . 'を編集しました。';
             $redirect_uri = $is_regist ? $this->after_auth_uri : 'member/profile';
             \Session::set_flash('message', $message);
             \Response::redirect($redirect_uri);
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs(term('profile') . term($is_regist ? 'site.registration' : 'form.edit'), $is_regist ? array() : array('member/profile' => term('common.my', 'profile')), $is_regist ? null : $this->u);
     $this->template->content = View::forge('member/profile/edit', array('is_regist' => $is_regist, 'val' => $form_member_profile->get_validation(), 'member_public_flags' => $form_member_profile->get_member_public_flags(), 'profiles' => $form_member_profile->get_profiles(), 'member_profile_public_flags' => $form_member_profile->get_member_profile_public_flags()));
 }
コード例 #9
0
ファイル: wxcontroller.php プロジェクト: wxl2012/wx
 public function before()
 {
     parent::before();
     $flag = $this->getNotOpenidAllowed();
     if ($flag) {
         return;
     }
     if (!\Session::get('wechat', false) && !\Input::get('openid', false)) {
         //获取到openid之后跳转的参数列表
         //$params = \handler\mp\UrlTool::createLinkstring(\Input::get());
         //本站域名
         $baseUrl = \Config::get('base_url');
         $url = $baseUrl . \Input::server('REQUEST_URI');
         $toUrl = urlencode($url);
         $callback = "{$baseUrl}wxapi/oauth2_callback?to_url={$toUrl}";
         $account = \Session::get('WXAccount', \Model_WXAccount::find(1));
         $url = \handler\mp\Tool::createOauthUrlForCode($account->app_id, $callback);
         \Response::redirect($url);
     } else {
         if (!\Session::get('wechat', false)) {
             $wxopenid = \Model_WechatOpenid::query()->where(['openid' => \Input::get('openid')])->get_one();
             if (!$wxopenid) {
                 \Session::set_flash('msg', ['status' => 'err', 'msg' => '未找到您的微信信息,无法确认您的身份! 系统无法为您提供服务!', 'title' => '拒绝服务']);
                 return $this->show_mesage();
             }
             \Session::set('wechat', $wxopenid->wechat);
             \Session::set('OpenID', $wxopenid);
             \Auth::force_login($wxopenid->wechat->user_id);
         } else {
             if (!\Auth::check() && \Session::get('wechat')->user_id) {
                 \Auth::force_login(\Session::get('wechat')->user_id);
             }
         }
     }
 }
コード例 #10
0
ファイル: banks.php プロジェクト: cloudetm/payroll
 public function action_edit($id = null)
 {
     parent::has_access("create_employee");
     is_null($id) and Response::redirect('employees/view' . $id);
     if (!($bank = Model_Bank::find('first', array('where' => array('employee_id' => $id))))) {
         Session::set_flash('error', 'Could not find user #' . $id);
         Response::redirect('employees/view/' . $id);
     }
     if (Input::method() == 'POST') {
         $bank->account_no = Input::post('account_no');
         $bank->account_type = Input::post('account_type');
         $bank->branch = Input::post('branch');
         $bank->city = Input::post('city');
         $bank->state = Input::post('state');
         $bank->ifsc_code = Input::post('ifsc_code');
         $bank->payment_type = Input::post('payment_type');
         if ($bank->save()) {
             Session::set_flash('success', 'Updated bank details #' . $id);
             Response::redirect('employees/view/' . $id);
         } else {
             Session::set_flash('error', 'Could not update bank #' . $id);
         }
     }
     $this->template->title = "Banks";
     $this->template->content = View::forge('banks/edit');
 }
コード例 #11
0
ファイル: admin.php プロジェクト: sato5603/fuelphp1st-2nd
 public function action_login()
 {
     // Already logged in
     Auth::check() and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'ユーザ名')->add_rule('required');
         $val->add('password', 'パスワード')->add_rule('required');
         if ($val->run()) {
             $auth = Auth::instance();
             // check the credentials. This assumes that you have the previous table created
             if (Auth::check() or $auth->login(Input::post('email'), Input::post('password'))) {
                 // credentials ok, go right in
                 if (Config::get('auth.driver', 'Simpleauth') == 'Ormauth') {
                     $current_user = Model\Auth_User::find_by_username(Auth::get_screen_name());
                 } else {
                     $current_user = Model_User::find_by_username(Auth::get_screen_name());
                 }
                 Session::set_flash('success', e('ようこそ、' . $current_user->username . 'さん'));
                 Response::redirect('admin');
             } else {
                 $this->template->set_global('login_error', '失敗しました');
             }
         }
     }
     $this->template->title = 'ログイン';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
コード例 #12
0
 public function action_addtask($project_id)
 {
     if (!($project = Model_Project::find($project_id))) {
         \Fuel\Core\Session::set_flash('error', "Cannot find the selected project # {$project_id}");
         \Fuel\Core\Response::redirect_back('user/projects');
     }
     $val = Model_Projecttask::validate('create');
     if (\Fuel\Core\Input::method() == 'POST') {
         if ($val->run()) {
             $projecttask = Model_Projecttask::forge(array('project_id' => Input::post('project_id'), 'user_id' => Input::post('user_id'), 'project_task_name_id' => Input::post('project_task_name_id'), 'hourly_rate' => Input::post('hourly_rate'), 'task_status' => 0, 'task_due' => Input::post('task_due'), 'project_task_description' => Input::post('project_task_description'), 'comment' => Input::post('comment'), 'priority' => Input::post('priority')));
             if ($projecttask and $projecttask->save()) {
                 Session::set_flash('success', e('Added task #' . $projecttask->id . '.'));
                 Response::redirect('user/projects/view/' . $project_id);
             } else {
                 Session::set_flash('error', e('Could not save task.'));
             }
         } else {
             \Fuel\Core\Session::set_flash('error', $val->error());
         }
     }
     $this->load_presenter($project, Model_Projecttask::forge(array('id' => 0, 'project_id' => $project->id, 'user_id' => $this->current_user->id, 'task_status' => 0, 'hourly_rate' => 456, 'task_due' => date('Y-m-d'))));
     $this->template->set_global('project_task_names', Model_Projecttaskname::find('all', array('order_by' => array(array('name', 'asc')))));
     $this->template->set_global('users', array(Model_User::find($this->current_user->id)));
     $this->template->set_global('priorities', THelper::get_priorities());
     $this->template->title = 'My Projects';
     $this->template->content = Fuel\Core\View::forge('user/projects/addtask');
 }
コード例 #13
0
ファイル: account.php プロジェクト: daniel-rodas/rodasnet.com
 public function action_subscription($id = null)
 {
     is_null($id) and Response::redirect('');
     if (!($user = Model_User::find($id))) {
         Messages::error('Could not find user #' . $id);
         Response::redirect('');
     }
     $val = \Model_User::validate_subscription('edit');
     if ($val->run()) {
         $user->delivery_address = Input::post('delivery_address');
         $user->delivery_address_2 = Input::post('delivery_address_2');
         $user->delivery_city = Input::post('delivery_city');
         $user->delivery_state = Input::post('delivery_state');
         $user->delivery_zip_code = Input::post('delivery_zip_code');
         if ($user->save()) {
             Messages::success('Updated user #' . $id);
         } else {
             Messages::error('Could not update user #' . $id);
         }
         \Response::redirect('backend/account/index/subscription');
     } else {
         if (Input::method() == 'POST') {
             $user->delivery_address = $val->validated('delivery_address');
             $user->delivery_address_2 = $val->validated('delivery_address_2');
             $user->delivery_city = $val->validated('delivery_city');
             $user->delivery_state = $val->validated('delivery_state');
             Session::set_flash('error', $val->error());
         }
         $data['user'] = $this->_user;
         $this->template->content = View::forge('account/subscription/edit', $data);
     }
     $this->template->title = "Delivery Settings";
     $data['user'] = $this->_user;
     $this->template->content = View::forge('account/subscription/edit', $data);
 }
コード例 #14
0
ファイル: users.php プロジェクト: nirix-old/litepress
 public function action_usercp()
 {
     if (!$this->current_user->logged_in()) {
         Session::set_flash('error', 'You need to be logged in to access is page');
         Session::set_flash('login_redirect', Uri::current());
         Response::redirect('login');
     }
     $this->title('UserCP');
     $this->view = $this->theme->view('users/usercp');
     if (Input::param() != array()) {
         // Set name and email
         $this->current_user->name = Input::param('name');
         $this->current_user->email = Input::param('email');
         // Set new password
         if (Input::param('new_password')) {
             $this->current_user->password = Input::param('new_password');
         }
         // Check if the current password is valid...
         $auth = Model_User::authenticate_login($this->current_user->username, Input::param('current_password'));
         if ($this->current_user->is_valid() and $auth) {
             $this->current_user->save();
             Session::set_flash('success', 'Details saved');
             Response::redirect('usercp');
         } else {
             $errors = $this->current_user->errors();
             if (!$auth) {
                 $errors = array('Current password is invalid.') + $errors;
             }
         }
         $this->view->set('errors', isset($errors) ? $errors : array());
     }
 }
コード例 #15
0
ファイル: mgroups.php プロジェクト: huylv-hust/uosbo
 /**
  * @author Bui Dang <*****@*****.**>
  * action create and edit group
  * @return array
  */
 public function create_group($data = array())
 {
     if ($data['group_id'] and !\Model_Mgroups::find_by_pk($data['group_id'])) {
         Session::set_flash('error', '取引先グループは存在しません');
         return array('status' => \Constants::$_status_save['id_not_exist']);
     }
     if (isset($data['group_id'])) {
         $group = Model_Mgroups::find_by_pk($data['group_id']);
         $data['updated_at'] = date('Y-m-d H:i:s');
     } else {
         $group = new Model_Mgroups();
         $data['created_at'] = date('Y-m-d H:i:s');
         $data['updated_at'] = date('Y-m-d H:i:s');
     }
     $data['name'] = Utility::strip_tag_string($data['group_name']);
     $group->set($data);
     //Set data
     $is_name = self::check_name($data['group_id'], $data['group_name']);
     if ($is_name != 0) {
         return array('status' => \Constants::$_status_save['value_exist']);
     }
     if ($group and $group->save() >= 0) {
         Session::set_flash('success', '保存しました ');
         return array('group_id' => $group->m_group_id, 'status' => \Constants::$_status_save['save_success']);
     }
 }
コード例 #16
0
ファイル: users.php プロジェクト: nirix-old/litepress
 public function action_delete($user_id)
 {
     $user = Model_User::find($user_id);
     $user->delete();
     Session::set_flash('notice', "User {$user->username} deleted");
     Response::redirect('-admin/users');
 }
コード例 #17
0
 public function action_login()
 {
     // Already logged in
     Auth::check() and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'Email or Username')->add_rule('required');
         $val->add('password', 'Password')->add_rule('required');
         if ($val->run()) {
             if (!Auth::check()) {
                 if (Auth::login(Input::post('email'), Input::post('password'))) {
                     // assign the user id that lasted updated this record
                     foreach (\Auth::verified() as $driver) {
                         if (($id = $driver->get_user_id()) !== false) {
                             // credentials ok, go right in
                             $current_user = Model\Auth_User::find($id[1]);
                             Session::set_flash('success', e('Welcome, ' . $current_user->username));
                             Response::redirect_back('admin');
                         }
                     }
                 } else {
                     $this->template->set_global('login_error', 'Login failed!');
                 }
             } else {
                 $this->template->set_global('login_error', 'Already logged in!');
             }
         }
     }
     $this->template->title = 'ITNT Timesheets Login';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
コード例 #18
0
ファイル: user.php プロジェクト: vano00/jobs
 public function action_edit()
 {
     $data['user'] = \Auth::get_profile_fields();
     $data['user']['email'] = \Auth::get_email();
     if (\Input::post()) {
         $user = \Input::post();
         $val = \Validation::forge();
         $val->add_field('fullname', 'fullname', 'required');
         if (\Input::post('password')) {
             $val->add_field('password', 'new password', 'required|min_length[3]|max_length[10]');
             $val->add_field('old_password', 'old password', 'required|min_length[3]|max_length[10]');
         }
         $val->add_field('email', 'email', 'required|valid_email');
         if ($val->run()) {
             if ($user['password'] === '') {
                 \Auth::update_user(array('email' => $user['email'], 'fullname' => $user['fullname']));
             } else {
                 \Auth::update_user(array('email' => $user['email'], 'password' => $user['password'], 'old_password' => $user['old_password'], 'fullname' => $user['fullname']));
             }
             \Session::set_flash('success', 'The profile has been successfully updated');
             \Response::redirect('/user');
         } else {
             // repopulate the username field and give some error text back to the view.
             $data['user'] = ['fullname' => $user['fullname'], 'email' => $user['email'], 'password' => $user['password'], 'old_password' => $user['old_password']];
             \Session::set_flash('error', $val->error());
         }
     }
     $data['actions'] = ['back' => ['label' => 'Back', 'url' => '/user']];
     $this->template->title = "Edit profile";
     $this->template->content = View::forge('user/edit.twig', $data);
 }
コード例 #19
0
ファイル: admin.php プロジェクト: gilyaev/framework-bench
 public function action_login()
 {
     if (Auth::check()) {
         Response::redirect('admin');
     }
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'Email or Username')->add_rule('required');
         $val->add('password', 'Password')->add_rule('required');
         if ($val->run()) {
             $auth = Auth::instance();
             // check the credentials. This assumes that you have the previous table created
             if (Auth::check() or $auth->login(Input::post('email'), Input::post('password'))) {
                 // credentials ok, go right in
                 $current_user = Model_User::find_by_username(Auth::get_screen_name());
                 Session::set_flash('success', e('Welcome, ' . $current_user->username));
                 Response::redirect('admin');
             } else {
                 $this->template->set_global('login_error', 'Fail');
             }
         }
     }
     $this->template->title = 'Login';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
コード例 #20
0
ファイル: admin.php プロジェクト: alexmon1989/fcssadon.ru
 /**
  * Действие для авторизации пользователя
  */
 public function action_login()
 {
     // Already logged in
     \Auth::check() and \Response::redirect('admin/articles');
     $val = \Validation::forge();
     if (\Input::method() == 'POST') {
         $val->add('email', 'Логин')->add_rule('required');
         $val->add('password', 'Пароль')->add_rule('required');
         if ($val->run()) {
             $auth = \Auth::instance();
             // check the credentials. This assumes that you have the previous table created
             if (\Auth::check() or $auth->login(\Input::post('email'), \Input::post('password'))) {
                 // credentials ok, go right in
                 if (\Config::get('auth.driver', 'Simpleauth') == 'Ormauth') {
                     $current_user = \Model\Auth_User::find_by_username(\Auth::get_screen_name());
                 } else {
                     $current_user = \Model_User::find_by_username(\Auth::get_screen_name());
                 }
                 \Session::set_flash('success', 'Добро пожаловать, <b>' . $current_user->username . '</b>');
                 \Response::redirect('admin/articles');
             } else {
                 \Session::set_flash('error', 'Неверная комбинация логина и пароля.');
             }
         }
     }
     $this->template->title = 'Авторизация';
     $this->template->content = \View::forge('login', array('val' => $val), false);
 }
コード例 #21
0
ファイル: signup.php プロジェクト: Trd-vandolph/game-bootcamp
 public function action_index()
 {
     $errors = null;
     if (Input::post('confirm')) {
         foreach ($this->fields as $field) {
             Session::set_flash($field, Input::post($field));
         }
     }
     $val = Validation::forge();
     $val->add_callable('passwordvalidation');
     $val->add('firstname', 'Firstname')->add_rule('required');
     $val->add('lastname', 'Lastname')->add_rule('required');
     $val->add('email', 'Email address')->add_rule('required')->add_rule('valid_email');
     $val->add('sex', 'Gender')->add_rule('required');
     $val->add('password', 'password')->add_rule('required')->add_rule('password')->add_rule('min_length', 8);
     //$val->add('google_account','Gmail address')->add_rule('required');
     if (Security::check_token()) {
         if ($val->run()) {
             $user = Model_User::find("first", ["where" => [["email", Input::post("email", "")]]]);
             if ($user == null) {
                 Response::redirect("students/signup/confirm");
             } else {
                 $errors = ["This email is already in use."];
             }
         } else {
             $errors = $val->error();
         }
     }
     $data["errors"] = $errors;
     $view = View::forge("students/signup/index", $data);
     $this->template->content = $view;
 }
コード例 #22
0
ファイル: student.php プロジェクト: xXLXx/ddc
 public function action_edit($id = null)
 {
     $student = Model_Student::find('first', ['where' => ['user_id' => $id]]);
     if (!$student) {
         $student = Model_Student::forge(['user_id' => $id]);
     }
     $val = Model_Student::validate('edit');
     if ($val->run()) {
         $student->user_id = Input::post('user_id');
         $student->year_level = Input::post('year_level');
         $student->course_id = Input::post('course_id');
         if ($student->save()) {
             Session::set_flash('success', e('Updated student #' . $id));
             Response::redirect('site/student');
         } else {
             Session::set_flash('error', e('Could not update student #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $student->user_id = $val->validated('user_id');
             $student->year_level = $val->validated('year_level');
             $student->course_id = $val->validated('course_id');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('student', $student, false);
     }
     $this->template->title = "Students";
     $this->template->content = View::forge('site/student/edit');
 }
コード例 #23
0
ファイル: articles.php プロジェクト: nirix-old/litepress
 public function action_delete($article_id)
 {
     $article = Model_Article::find($article_id);
     $article->delete();
     Session::set_flash('notice', 'Article deleted');
     Response::redirect('-admin/articles');
 }
コード例 #24
0
ファイル: setting.php プロジェクト: uzura8/flockbird
 /**
  * Mmeber setting timeline_view
  * 
  * @access  public
  * @return  Response
  */
 public function action_viewtype()
 {
     $page_name = term('timeline', 'site.view', 'site.setting');
     $val = \Form_MemberConfig::get_validation($this->u->id, 'timeline_viewType');
     if (Input::method() == 'POST') {
         Util_security::check_csrf();
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             \Form_MemberConfig::save($this->u->id, $val, $post);
             \DB::commit_transaction();
             \Session::set_flash('message', $page_name . 'を変更しました。');
             \Response::redirect('member/setting');
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
     $this->template->content = \View::forge('member/setting/timeline_viewtype', array('val' => $val));
 }
コード例 #25
0
ファイル: facebook.php プロジェクト: uzura8/flockbird
 public function action_logout()
 {
     $url = $this->fb->getLogoutUrl(Config::get('facebook.logout'));
     $this->fb->destroySession();
     Auth::logout();
     Session::set_flash('message', 'ログアウトしました');
     Response::redirect($url);
 }
コード例 #26
0
ファイル: comment.php プロジェクト: uzura8/flockbird
 /**
  * Note delete
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_delete($id = null)
 {
     \Util_security::check_csrf(\Input::get(\Config::get('security.csrf_token_key')));
     $comment = Model_NoteComment::check_authority($id, $this->u->id);
     $comment->delete();
     \Session::set_flash('message', term('note') . 'を削除しました。');
     \Response::redirect('note/detail/' . $comment->note_id);
 }
コード例 #27
0
ファイル: ajax.php プロジェクト: roine/wawaw
 public function action_dashboard()
 {
     if (!Sentry::user()->has_access('ajax_dashboard')) {
         Session::set_flash('error', 'You do not have right acces there');
         Response::redirect('/');
     }
     $data['json'] = Model_Ajax::dashboard(Input::post('values'), $this->languages);
     $this->template->content = View::forge('ajax/view', $data);
 }
コード例 #28
0
ファイル: groups.php プロジェクト: ratiw/petro
 public function action_delete($id = null)
 {
     if (!is_null($id) and $gid = Model_Group::find($id)->delete()) {
         \Session::set_flash('success', 'Group #' . $id . ' has been deleted.');
     } else {
         \Session::set_flash('error', 'Could not delete group #' . $id);
     }
     \Response::redirect('groups');
 }
コード例 #29
0
ファイル: auth.php プロジェクト: soundintheory/fuel-cmf
 public function action_perform_login()
 {
     if (\CMF\Auth::authenticate(\Input::post('username'), \Input::post('password'))) {
         \Response::redirect('/' . ltrim(\Input::post('next', 'admin/' . \Config::get('cmf.admin.default_section')), '/'), 'location');
     } else {
         \Session::set_flash('main_alert', array('attributes' => array('class' => 'alert-danger'), 'msg' => \Lang::get('admin.errors.account.invalid')));
         return \View::forge('admin/auth/login.twig', array('next' => \Input::get('next')));
     }
 }
コード例 #30
0
ファイル: supplier.php プロジェクト: ClixLtd/pccupload
 public function action_delete($id = null)
 {
     if ($data_supplier = Model_Data_Supplier::find($id)) {
         $data_supplier->delete();
         Session::set_flash('success', 'Deleted data_supplier #' . $id);
     } else {
         Session::set_flash('error', 'Could not delete data_supplier #' . $id);
     }
     Response::redirect('data/supplier');
 }