public function action_change() { //トークンの生成 $this->action_csrf(); //バリデーション定義 $val = Validation::forge(); $val->add('password', '「現在のパスワード」')->add_rule('required')->add_rule('min_length', 8)->add_rule('max_length', 12); $val->add('newpassword', '「新しいパスワード」または、「(新)パスワード再入力」')->add_rule('required')->add_rule('min_length', 8)->add_rule('max_length', 12); $this->action_category(); if (Input::post()) { if (Security::check_token()) { if ($val->run()) { $username = Auth::get_screen_name(); //現在のパスワード $old_password = Input::post('password'); //新しいパスワード $new_password = Input::post('newpassword'); //パスワードを変更するメソッド Auth::change_password($old_password, $new_password, $username); $this->message = 'パスワードが変更されました。'; $view = View::forge('changepass/ChangePass', $this->data); $view->set_global('message', $this->message, false); $view->set_global('error', $this->error, false); } else { $this->error = $val->error(); $view = View::forge('changepass/ChangePass', $this->data); $view->set_global('message', $this->message, false); $view->set_global('error', $this->error, false); } } else { Profiler::mark('CSRF攻撃'); } } return $view; }
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); }
public function action_testemail() { // Create an instance if (Auth::check()) { $data['user_link'] = 'logout'; $email = Auth::get_screen_name(); $data['email'] = $email; } else { $data['user_link'] = 'login'; } $email = Email::forge(); // Set the from address $email->from('*****@*****.**', 'pscms.local'); // Set the to address $email->to('*****@*****.**', 'You'); // Set a subject $email->subject('This is the subject'); // Set multiple to addresses /*$email->to(array( '*****@*****.**', '*****@*****.**' => 'With a Name', ));*/ // And set the body. $email->body('This is my message'); try { $email->send(); } catch (\EmailValidationFailedException $e) { // The validation failed } catch (\EmailSendingFailedException $e) { // The driver could not send the email exit('driver cant send mail'); } }
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); }
public function before() { parent::before(); !Auth::check() and Response::redirect('/auth/login'); $this->current_user = Model_User::find_by_username(Auth::get_screen_name()); $this->template->set_global('current_user', $this->current_user); }
/** * Действие для авторизации пользователя */ 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); }
public function before() { parent::before(); // Assign current_user to the instance so controllers can use it $this->current_user = Auth::check() ? Model_User::find_by_username(Auth::get_screen_name()) : null; // Set a global variable so views can use it View::set_global('current_user', $this->current_user); }
public function before() { parent::before(); // Without this line, templating won't work! if (\Auth::check()) { # Set user info list(, $userid) = \Auth::get_user_id(); $this->template->set_global('auth', ['user' => ['screen_name' => \Auth::get_screen_name(), 'group' => \Auth::group()->get_name()]], false); } }
public function action_registered() { $auth = Auth::instance(); $user_id = Session::get_flash('ninjauth.user_id'); if (isset($user_id)) { Auth::instance()->force_login($user_id); return Response::redirect('/user/' . Auth::get_screen_name()); } return $this->response; }
public function action_Delete() { $check = Input::post('check'); if ($check == '') { //何もしないで元に戻る } else { foreach ($check as $ck) { $query = DB::update('Galtuka')->set(array('df' => '1', 'luID' => Auth::get_screen_name()))->where('Did', '=', $ck)->execute(); } } Response::redirect('department'); }
/** * setComment Method * * @brief add comment by ajax */ public function post_setComment() { $comment = Input::post('comment'); $status = false; if (!empty($comment)) { $mongodb = \Mongo_Db::instance(); $username = Auth::get_screen_name() ? Auth::get_screen_name() : 'guest'; $insert_id = $mongodb->insert('comments', array('timestamp' => time(), 'name' => $username, 'comment' => $comment)); $status = true; } $this->response(array('status' => $status, 'data' => $comment)); }
public function before() { parent::before(); $this->viewer_info = array(); if (!Auth::check()) { Response::redirect('members'); // login画面に戻る。 } else { $this->viewer_info['name'] = Auth::get_screen_name(); $this->viewer_info['uid'] = Auth::get_user_id(); } }
public function before() { parent::before(); // Assign current_user to the instance so controllers can use it if (Config::get('auth.driver', 'Simpleauth') == 'Ormauth') { $this->current_user = Auth::check() ? Model\Auth_User::find_by_username(Auth::get_screen_name()) : null; } else { $this->current_user = Auth::check() ? Model_User::find_by_username(Auth::get_screen_name()) : null; } // Set a global variable so views can use it View::set_global('current_user', $this->current_user); }
public function before() { parent::before(); // Assign current_user to the instance so controllers can use it $this->current_user = Auth::check() ? Model_User::find_by_username(Auth::get_screen_name()) : null; // Set a global variable so views can use it View::set_global('current_user', $this->current_user); if ($this->current_user) { $this->status_where = array(array('status', '!=', null)); } else { $this->status_where = array(array('status', self::STATUS_DISP)); } }
public function before() { parent::before(); // Without this line, templating won't work! if (\Auth::check()) { // Check if the current user is an administrator if (!\Auth::member(100)) { \Session::set_flash('error', 'You don\'t have the required access'); \Response::redirect('auth'); } # Set user info $this->template->set_global('auth', ['user' => ['screen_name' => \Auth::get_screen_name(), 'group' => \Auth::group()->get_name()]], false); } else { \Response::redirect('auth'); } }
public function action_index() { $data = array(); $message = ''; $username = Auth::get_screen_name(); $class = Auth::get('classID'); $data['posts'] = Model_Post::query()->where('username', '=', $username)->order_by('Ptime', 'desc')->get(); $data['users'] = Model_Users::query()->where('username', '=', $username)->get(); //同じクラスのユーザを取得 $data['classname'] = Model_Class::query()->where('classID', '=', $class)->get(); $data['classuser'] = Model_Users::query()->where('classID', '=', $class)->get(); $data['categorize'] = Model_Category::query()->where('df', '=', '0')->get(); $view = View::forge('mypage/mypage', $data); $view->username = $username; $view->set_global('message', $message, false); return $view; }
public function action_send($Pid = 0) { $this->action_csrf(); $val = Validation::forge(); $val->add('sentence', '通報内容')->add_rule('required'); $username = Auth::get_screen_name(); $address = Auth::get_email(); $problem = Input::post('problem'); $email = Email::forge(); $email->from('*****@*****.**'); $email->to($address); $email->subject('投稿ID ' . $Pid . '番に対する「' . $problem . '」の通報がありました。'); $body = Input::post('sentence'); $email->body($body); if ($val->run()) { if (Security::check_token()) { try { $email->send(); $view = View::forge('problemreport/success'); return $view; } catch (\EmailValidationFailedException $e) { $view = View::forge('welcome/404'); return $view; } catch (\EmailSendingFailedException $e) { } } else { $this->error['csrf'] = '「CSRFエラー」です。<br>もう一度最初からアクセスし直してください。。'; $this->action_csrf(); $this->action_post($Pid); $this->data['categorize'] = Model_Category::query()->where('df', '=', '0')->get(); $view = View::forge('problemreport/ProblemReport', $this->data); $view->set_global('error', $this->error, false); return $view; } } else { $this->error = $val->error(); $this->action_csrf(); $this->action_post($Pid); $this->data['categorize'] = Model_Category::query()->where('df', '=', '0')->get(); $view = View::forge('problemreport/ProblemReport', $this->data); $view->set_global('error', $this->error, false); return $view; } }
public function action_index() { //ユーザ情報の取得 $username = Auth::get_screen_name(); $class = Auth::get('classID'); //カテゴリ取得 $this->action_categorise(); //ログイン中のユーザのテーブルを取得 $this->data['users'] = Model_Users::query()->where('username', '=', $username)->get(); $this->data['classname'] = Model_Class::query()->where('classID', '=', $class)->get(); if (!$this->data) { Response::redirect('welcome/404'); } //テンプレート取得 $this->template->header = View::forge('layout/header'); $this->template->sidebar = View::forge('layout/sidebar'); $this->template->rightsidebar = View::forge('layout/rightsidebar'); $this->template->footer = View::forge('layout/footer'); //ビューの生成 $view = View::forge('changeregistration/ChangeRegistration', $this->data); $view->set_global('error', $this->error, false); $view->set_global('message', $this->message, false); return $view; }
public function action_good($Pid) { if (Input::post()) { $good = Model_Good::forge(); $good->Pid = $Pid; $good->username = Auth::get_screen_name(); $good->save(); $view = View::forge('post/success'); return $view; } }
<?php return array('_root_' => 'blog/post/index', '_404_' => '', 'admin' => 'blog/admin/post/index/' . Auth::get_screen_name(), 'admin/comment' => 'comment/admin/comment/index');
})(window,document,'script','dataLayer','GTM-KWFSV9');</script> <!-- End Google Tag Manager --> <!-- header --> <div id="header"> <!-- headerBar --> <div id="headerBarWrap"> <div id="headerBar" class="container"> <div id="headerDescription" class="hidden-xs"> <p>フリーマーケット楽市楽座の情報サイト</p> </div> <ul> <?php if (Auth::check()) { ?> <li class="user">ようこそ、<?php echo e(Auth::get_screen_name()); ?> さん</li> <li class="login"><a href="/login/out"><i></i>ログアウト</a></li> <?php } else { ?> <li class="user">ようこそ、ゲストさん</li> <li class="login"><a href="/login"><i></i>ログイン</a></li> <li class="regist"><a href="/signup"><i></i>会員登録</a></li> <?php } ?> <li class="guide hidden-xs"><a href="/info/visitor"><i></i>初めての方へ</a></li> <li class="inquiry hidden-xs"><a href="/inquiry"><i></i>お問い合せ</a></li> </ul>
<?php $user = Model_User::userdata(); $group = Model_Admin::config_groups(); ?> <div class="row"> <h3><?php echo Session::get_flash('success', 'ようこそ' . Auth::get_screen_name() . 'さん'); ?> </h3> </div> <div class="row"> <div class="span8"> </div> </div> <div class="row"> <table class="table table-bordered table-striped"> <thead> <tr> <th>項目</th> <th>内容</th> </tr> </thead> <tbody> <tr> <th>ID</th> <td><?php echo $user['id']; ?> </td> </tr>
public function action_save() { //ページネーションの設定 $count = Model_Post::count(); $config = array('pagination_url' => 'noteshare/home', 'uri_segment' => 2, 'num_links' => 3, 'per_page' => $this->per_page, 'total_items' => $count, 'show_first' => true, 'show_last' => true); //ページネーションオブジェクトの作成 $pagination = Pagination::forge('post_pagination', $config); $this->data['rows'] = Model_Post::query()->order_by('Ptime', 'desc')->limit($this->per_page)->offset($pagination->offset)->get(); //postでデータが送信されたか? if (Input::post()) { //CSRF対策用のトークンを生成 $this->data['token_key'] = Config::get('security.csrf_token_key'); $this->data['token'] = Security::fetch_token(); //CSRF対策 if (Security::check_token()) { //バリデーション定義の読み込み $val = Model_Post::validate(); if ($val->run()) { $form = array(); $form['username'] = Auth::get_screen_name(); $form['Kid'] = input::post('category'); $form['class'] = "【" . Input::post('cla') . "】"; $form['Title'] = Input::post('title'); $form['Pcontent'] = Input::post('Pcontent'); //アップロードファイルがバリデーション通りなら投稿内容保存 if (Upload::is_valid()) { //設定を元に保存をする Upload::save(); foreach (Upload::get_files() as $file) { $form['image'] = $file['saved_as']; } } //モデルの呼び出し $post = Model_Post::forge(); $post->set($form); $post->save(); //home/homeに遷移 Response::redirect('home'); //バリデーションエラー } else { $this->error = $val->error(); $this->action_categorize(); $view = View::forge('home/home', $this->data); $view->set_safe('pagination', $pagination); $view->set_global('error', $this->error, false); $view->set_global('csrmsg', $this->csrmsg, false); $view->set_global('msg', $this->msg, false); } //CSRFエラー } else { $this->csrmsg = '不正なリクエストです。<br>もう一度home画面にアクセスし、投稿をやり直してください。'; $this->action_categorize(); $view = View::forge('home/home', $this->data); $view->set_safe('pagination', $pagination); $view->set_global('error', $this->error, false); $view->set_global('csrmsg', $this->csrmsg, false); $view->set_global('msg', $this->msg, false); Profiler::mark('CSRFです'); } //postエラー } else { } return $view; }
/** * Show a specific referral to the user. * * @access public * @param mixed $clientID * @return void */ public function action_referral($referalID, $clientID) { list($driver, $user_id) = \Auth::get_user_id(); $referral = Referrals_class::forge($referalID); $debtList = \Crm\Ppi\Ppi_class::getDebtList(); if ($referral->isValid === false) { \Log::error('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which does not exist!', 'Crm_Ppi'); \Session::set_flash('fail', "The referral ID you entered does not exist!"); \Response::redirect('crm/ppi/referrals'); } // Check through dispositions switch ($referral->disposition_id) { case 5: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which has been Packed Out as a PPI!', 'Crm_Ppi'); \Session::set_flash('success', "Referral with ID of " . $referalID . " has been Packed Out as a PPI."); \Response::redirect('crm/ppi/referrals/' . $clientID); break; case 6: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which has been set to Not Interested!', 'Crm_Ppi'); \Session::set_flash('fail', "Referral with ID of " . $referalID . " is set to 'Not Interested' and should not be contacted."); \Response::redirect('crm/ppi/referrals'); break; case 23: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which has been set to Does Not Qualify!', 'Crm_Ppi'); \Session::set_flash('fail', "Referral with ID of " . $referalID . " is set to 'Does Not Qualify' and should not be contacted."); \Response::redirect('crm/ppi/referrals'); break; case 24: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which has upsold to Debt Reduction!', 'Crm_Ppi'); \Session::set_flash('success', "Referral with ID of " . $referalID . " has been upsold to Debt Reduction!"); \Response::redirect('crm/ppi/referrals'); break; case 25: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which was referred as Debt Reduction!', 'Crm_Ppi'); \Session::set_flash('fail', "Referral with ID of " . $referalID . " was sent as Debt Reduction. If you feel this is an error please contact the IT department!"); \Response::redirect('crm/ppi/referrals'); break; case 27: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ', this referral has already claimed PPI!', 'Crm_Ppi'); \Session::set_flash('fail', "Referral with ID of " . $referalID . " has already claimed PPI!"); \Response::redirect('crm/ppi/referrals'); break; case 28: \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ', this referral DNQ for PPI and not interested in DR!', 'Crm_Ppi'); \Session::set_flash('fail', "Referral with ID of " . $referalID . " DNQ for PPI and not interested in DR!"); \Response::redirect('crm/ppi/referrals'); break; } if ($referral->user_id == 0 || $referral->user_id == $user_id) { $thisUser = \Model_User::find($user_id); $referral->user_id = $user_id; $referral->consolidation_centre = $thisUser->call_center_id; $referral->save(); } else { $thisUser = \Model_User::find($referral->user_id)->username; \Log::warning('Consolidator ' . Auth::get_screen_name() . ' tried to access referral ' . $referalID . ' which was locked to ' . $thisUser . '!', 'Crm_Ppi'); \Session::set_flash('fail', "The referral you requested is locked to another user. If you feel this is an error please contact the IT department."); \Response::redirect('crm/ppi/referrals'); } // -- Log that the Agent opened up the Referral Type ID = 3 Referral Open // ---------------------------------------------------------------------- Referral_log::create($referalID, 3); $creditorLoad = $referral->loadData(); $creditorList = Creditor_class::loadCreditorList(); \Log::write('Info', 'Consolidator ' . Auth::get_screen_name() . ' viewed referral with ID of ' . $referalID . '.', 'Crm_Ppi'); $this->template->title = "Client View"; $this->template->content = View::forge(static::$_viewPath . '/referral.php', array('creditors' => isset($creditorLoad['creditors']) ? $creditorLoad['creditors'] : null, 'creditorList' => $creditorList, 'debtList' => $debtList, 'client' => array('id' => $referalID, 'title' => $referral->title, 'forename' => $referral->forename, 'surname' => $referral->surname, 'street_and_number' => $referral->street_and_number, 'area' => $referral->area, 'district' => $referral->district, 'town' => $referral->town, 'county' => $referral->county, 'post_code' => $referral->post_code, 'date_of_birth' => $referral->date_of_birth, 'tel_home' => $referral->tel_home, 'tel_work' => $referral->tel_work, 'tel_mobile' => $referral->tel_mobile, 'email' => $referral->email, 'notes' => $referral->notes))); }
<img class="nav-user-photo" src="<?php echo \Auth::check() && $people && $people->photo ? $people->photo : '/assets/admin/ace/avatars/user.jpg'; ?> " alt="Jason's Photo" /> <span class="user-info"> <small>欢迎,</small> <?php $display_name = ''; if (\Auth::check()) { if ($people && $people->first_name) { $display_name = $people->first_name . ($people->gender == '男' ? '先生' : '女士'); } else { if ($people && $people->nickname) { $display_name = $people->nickname; } else { $display_name = \Auth::get_screen_name(); } } } echo $display_name; ?> </span> <i class="ace-icon fa fa-caret-down"></i> </a> <ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close"> <li> <a href="#"> <i class="ace-icon fa fa-cog"></i> 设置
<html> <head> <title>TwitterClone</title> <?php echo Asset::css('bootstrap.css'); ?> </head> <body> <div class="container"> <h1>ようこそ <?php echo Auth::get_screen_name(); ?> さん</h1> <h2>ついーと</h2> <?php echo Form::open(array('action' => '/top')); ?> tweet : <?php echo Form::input('content', ''); ?> <?php echo Form::submit('tweet', 'ツイートする', ['class' => 'btn btn-primary']); ?> <?php echo Form::close(); ?> <h2>いちらん</h2> <?php