get() public static method

gets/returns the value of a specific key of the session
public static get ( mixed $key ) : mixed
$key mixed Usually a string, right ?
return mixed the key's value or nothing
Example #1
2
    public function getHtml()
    {
        $transHtml = array();
        $request = $this->controller->getRequest();
        if ($this->controller instanceof CheckoutController && $request->getActionName() == 'completed') {
            $session = new Session();
            if ($orderID = $session->get('completedOrderID')) {
                $order = CustomerOrder::getInstanceByID((int) $session->get('completedOrderID'), CustomerOrder::LOAD_DATA);
                $order->loadAll();
                $orderArray = $order->toArray();
                $data = array($order->getID(), '', $orderArray['total'][$orderArray['Currency']['ID']], $order->getTaxAmount(), $orderArray['ShippingAddress']['city'], $orderArray['ShippingAddress']['stateName'], $orderArray['ShippingAddress']['countryID']);
                $transHtml[] = 'pageTracker._addTrans' . $this->getJSParams($data);
                foreach ($orderArray['cartItems'] as $item) {
                    $data = array($order->getID(), $item['Product']['sku'], $item['Product']['name'], $item['Product']['Category']['name'], $item['price'], $item['count']);
                    $transHtml[] = 'pageTracker._addItem' . $this->getJSParams($data);
                }
            }
            $transHtml[] = 'pageTracker._trackTrans();';
        }
        return '<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("' . $this->getValue('code') . '");
pageTracker._initData();
pageTracker._trackPageview();
' . implode("\n", $transHtml) . '
</script>';
    }
 /**
  * Returns an instance of this class
  *
  * @param Controller $controller
  * @param string $name
  */
 public function __construct($controller, $name)
 {
     $fields = new FieldList(array(new HiddenField('AuthenticationMethod', null, $this->authenticator_class)));
     $actions = new FieldList(array(FormAction::create('redirectToRealMe', _t('RealMeLoginForm.LOGINBUTTON', 'LoginAction'))->setUseButtonTag(true)->setButtonContent('<span class="realme_button_padding">Login or register with RealMe<span class="realme_icon_new_window"></span> <span class="realme_icon_padlock"></span>')->setAttribute('class', 'realme_button')));
     // Taken from MemberLoginForm
     if (isset($_REQUEST['BackURL'])) {
         $backURL = $_REQUEST['BackURL'];
     } elseif (Session::get('BackURL')) {
         $backURL = Session::get('BackURL');
     }
     if (isset($backURL)) {
         // Ensure that $backURL isn't redirecting us back to login form or a RealMe authentication page
         if (strpos($backURL, 'Security/login') === false && strpos($backURL, 'Security/realme') === false) {
             $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
         }
     }
     // optionally include requirements {@see /realme/_config/config.yml}
     if ($this->config()->include_jquery) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     if ($this->config()->include_javascript) {
         Requirements::javascript(REALME_MODULE_PATH . "/javascript/realme.js");
     }
     if ($this->config()->include_css) {
         Requirements::css(REALME_MODULE_PATH . "/css/realme.css");
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
 /**
  * @covers $this->object->get
  * @todo   Implement testGet().
  */
 public function testGet()
 {
     session_start();
     $_SESSION['test'] = 'TEST';
     $this->assertEquals($this->object->get('test'), 'TEST');
     $this->assertEquals($this->object->get('bogus', false), false);
 }
function printError($error, Session $session)
{
    if (isset($session->get("errors")[$error])) {
        echo $session->get("errors")[$error];
    } else {
        echo "";
    }
}
Example #5
0
File: set.php Project: anqqa/Anqh
 /**
  * Change country
  *
  * @param  string  $country
  */
 public function country($country)
 {
     if (in_array($country, Kohana::config('site.countries'))) {
         if ($this->session->get('country') == $country) {
             // Clear country if same as given
             $this->session->delete('country');
         } else {
             // Set country
             $this->session->set('country', $country);
         }
     }
     url::back();
 }
 function __construct()
 {
     parent::__construct();
     if (Session::get("logged_in")) {
         header("Location: " . URL . "index");
     }
 }
Example #7
0
 public function __construct()
 {
     // Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
     Asset::add('bootstrap', 'css/bootstrap.min.css');
     Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
     Asset::add('common', 'css/common.css');
     // Asset::add('style', 'css/style.css');
     Asset::add('fontawsome', 'css/fontawesome.css');
     Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
     Asset::add('jquery', 'js/jquery-1.9.1.js');
     Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
     Asset::add('bootstrap-js', 'js/bootstrap.js');
     Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
     Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
     Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
     // $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
     // foreach($files as $file)
     // {
     // 	Asset::add($file, substr($file, 7));
     // }
     if (Session::has('id') && Auth::check()) {
         $account = Account::find(Session::get('id'));
         if ($account->admin == 1) {
             Session::put('admin', '1');
         } else {
             Session::put('admin', '0');
         }
         if ($account->blocked == 1) {
             Session::put('alert', "Your account has been banned. Please contact the admin for more details");
             Session::forget('id');
             Auth::logout();
         } else {
         }
     }
 }
Example #8
0
 /**
  * Método que comprueba si existen errores en la sessión
  * @return Boolean True = cuando no hay errores, False = cuando hay errores
  */
 public static function comprobarErrores()
 {
     if (Session::get('feedback_negative')) {
         return false;
     }
     return true;
 }
 public function MarketPlaceReviewForm()
 {
     Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
     Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
     Requirements::combine_files('marketplace_review_form.js', array("themes/openstack/javascript/jquery.validate.custom.methods.js", "marketplace/code/ui/frontend/js/star-rating.min.js", "marketplace/code/ui/frontend/js/marketplace.review.js"));
     $css_files = array("marketplace/code/ui/frontend/css/star-rating.min.css", "marketplace/code/ui/frontend/css/marketplace-review.css");
     foreach ($css_files as $css_file) {
         Requirements::css($css_file);
     }
     $form = new MarketPlaceReviewForm($this, 'MarketPlaceReviewForm');
     $data = Session::get("FormInfo.Form_MarketPlaceReviewForm.data");
     $review = $this->review_repository->getReview($this->company_service_ID, Member::CurrentUserID());
     if (is_array($data)) {
         //get data from cache
         $form->loadDataFrom($data);
     } elseif ($review) {
         // get submitted review
         $form->loadDataFrom($review);
     }
     // Optional spam protection
     if (class_exists('SpamProtectorManager')) {
         SpamProtectorManager::update_form($form);
     }
     return $form;
 }
Example #10
0
 public function post_login()
 {
     $errors = new Laravel\Messages();
     $input = Input::get();
     try {
         $validator = new Services\Session\Login\Validator($input);
         $validator->publish();
     } catch (ValidateException $errors) {
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors->get());
     }
     try {
         $valid_login = Sentry::login(Input::get('email'), Input::get('password'), Input::get('remember-me'));
         if ($valid_login) {
             $url = null;
             if (Session::has('pre_login_url')) {
                 $url = Session::get('pre_login_url');
                 Session::forget('pre_login_url');
             } else {
                 $url = URL::to_route('dashboard.profile');
             }
             return Redirect::to($url);
         } else {
             $errors->add('errors', __('application.invalid_login'));
             return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
         }
     } catch (Sentry\SentryException $e) {
         $errors->add('errors', $e->getMessage());
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
     }
 }
 function __construct()
 {
     parent::__construct();
     if (Session::get('user_login')) {
         echo '<script type="text/javascript"> window.location.replace("' . URL . 'dashboard") </script>';
     }
 }
Example #12
0
 function exeCheck()
 {
     $id = Session::get('user')['id'];
     $userId = (int) Request::post('userId');
     $status = (int) Request::post('status');
     if ($id > 0 && $userId > 0) {
         $array = array();
         switch ($status) {
             case '-1':
                 if ($this->exeInsert($id, $userId) > 0) {
                     $array = array('status' => 1, 'text' => 'Đang gửi yêu cầu');
                 }
                 break;
             case '0':
                 if ($this->exeHandling($userId, $id, 1) > 0) {
                     $array = array('status' => 2, 'text' => 'Bạn bè');
                 }
                 break;
             case '1':
                 if ($this->exeDelete($userId, $id) > 0) {
                     $array = array('status' => -1, 'text' => 'Kết bạn');
                 }
                 break;
             case '2':
                 if ($this->exeDelete($userId, $id) > 0) {
                     $array = array('status' => -1, 'text' => 'Kết bạn');
                 }
                 break;
         }
         echo json_encode($array);
     } else {
         exit;
     }
 }
 /**
  * Allow this controller to be viewed when the site is in draft mode.
  */
 function init()
 {
     $draftsecurity = Session::get('unsecuredDraftSite');
     Session::set("unsecuredDraftSite", true);
     parent::init();
     Session::set("unsecuredDraftSite", $draftsecurity);
 }
Example #14
0
 /**
  * 动作:修改当前账号密码
  * @return Response
  */
 public function putChangePassword()
 {
     $response = array();
     // 获取所有表单数据
     $data = Input::all();
     $admin = Session::get("admin");
     // 验证旧密码
     if (!Hash::check($data['password_old'], $admin->pwd)) {
         $response['success'] = false;
         $response['message'] = '原始密码错误';
         return Response::json($response);
     }
     // 创建验证规则
     $rules = array('password' => 'alpha_dash|between:6,16|confirmed');
     // 自定义验证消息
     $messages = array('password.alpha_dash' => '密码格式不正确。', 'password.between' => '密码长度请保持在:min到:max位之间。', 'password.confirmed' => '两次输入的密码不一致。');
     // 开始验证
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         // 验证成功
         // 更新用户
         $admin->pwd = Hash::make(Input::get('password'));
         if ($admin->save()) {
             $response['success'] = true;
             $response['message'] = '密码修改成功';
         } else {
             $response['success'] = false;
             $response['message'] = '密码修改失败';
         }
     } else {
         $response['success'] = false;
         $response['message'] = $validator->errors->first();
     }
     return Response::json($response);
 }
Example #15
0
 public static function get($var)
 {
     if (!Session::has($var)) {
         return false;
     }
     return Session::get($var);
 }
Example #16
0
 public function login()
 {
     if (Session::get('isLoggedIn')) {
         Messages::addMessage("info", "You are already logged in.");
         return;
     } else {
         $response = array();
         // params have to be there
         $user_name = $this->params->getValue('user_name');
         $user_password = $this->params->getValue('password');
         if ($user_name != null && $user_password != null) {
             // check if user name and password are correct
             $usr = $this->userManager->findUser($user_name, $user_password);
             if ($usr != null) {
                 // log user in
                 Session::set("user_name", $usr['user_name']);
                 Session::set("id", $usr['ID']);
                 Session::set("isLoggedIn", true);
                 return $usr;
             } else {
                 Messages::addMessage("info", "Log in user and/or password incorrect.");
                 return null;
             }
         } else {
             Messages::addMessage("warning", "'user_name' and/or 'password' parameters missing.");
             return null;
         }
     }
 }
 /**
  * Displays a tabular list of registrations.
  */
 public function index()
 {
     $this->layout->with('subtitle', 'Registrations');
     $registrations = Registration::orderBy('registrations.created_at', 'desc')->join('bookings', 'registrations.booking_id', '=', 'bookings.id', 'left outer')->addSelect('registrations.*')->addSelect('bookings.first')->addSelect('bookings.last')->addSelect('bookings.email');
     $filtered = false;
     $filter_name = Session::get('registrations_filter_name', '');
     $filter_email = Session::get('registrations_filter_email', '');
     $filter_friday = Session::get('registrations_filter_friday', '');
     $filter_saturday = Session::get('registrations_filter_saturday', '');
     if (!empty($filter_name)) {
         $registrations = $registrations->where(function ($query) use($filter_name) {
             $query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%")->orWhere('registrations.name', 'LIKE', "%{$filter_name}%");
         });
         $filtered = true;
     }
     if (!empty($filter_email)) {
         $registrations = $registrations->where(function ($query) use($filter_email) {
             $query->where('bookings.email', 'LIKE', "%{$filter_email}%")->orWhere('registrations.email_address', 'LIKE', "%{$filter_email}%");
         });
         $filtered = true;
     }
     if (!empty($filter_friday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6);
         $filtered = true;
     }
     if (!empty($filter_saturday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7);
         $filtered = true;
     }
     $registrations = $registrations->paginate(25);
     $this->layout->content = View::make('registrations.index')->with('registrations', $registrations)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_email', $filter_email)->with('filter_friday', $filter_friday)->with('filter_saturday', $filter_saturday);
 }
 public static function changeProfileLang($lang)
 {
     $user = User::whereId(Session::get('id'))->first();
     $user->language = $lang;
     $user->save();
     return;
 }
Example #19
0
 /**
  * Retrieve a user by their unique idenetifier.
  *
  * @param  mixed  $identifier
  * @return Illuminate\Auth\UserInterface|null
  */
 public function retrieveByID($identifier)
 {
     $user = \Session::get('valid_user');
     if ($user->getAuthIdentifier() == $identifier) {
         return $user;
     }
 }
Example #20
0
 /**
  * Gets the instance in the session
  *
  * @param string $instance
  *
  * @return $this cart instance
  */
 public function get($instance = 'default')
 {
     if (empty($this->cart = \Session::get(config('laracart.cache_prefix', 'laracart') . '.' . $instance))) {
         $this->cart = new Cart($instance);
     }
     return $this;
 }
Example #21
0
 public function renderizar($nome, $item = FALSE)
 {
     if (Session::get('autenticado')) {
         $menu[] = array("id" => "", "titulo" => "", "link" => URL . "");
     } else {
         $menu[] = array("id" => "login", "titulo" => "Inciar Sessão", "link" => URL . "login");
     }
     if (strcasecmp(Session::get('nivel'), 'administrador') == 0) {
         $admin = array(array("id" => "matricula", "titulo" => "Matricula", "link" => URL . "matricula"), array("id" => "docente", "titulo" => "Docente", "link" => URL . "docente"), array("id" => "curso", "titulo" => "Curso", "link" => URL . "curso"), array("id" => "nota", "titulo" => "Nota", "link" => URL . "nota"), array("id" => "programa", "titulo" => "Programa", "link" => URL . "programa"), array("id" => "relatorio", "titulo" => "Relatorio", "link" => URL . "relatorio"));
     } else {
         $admin = "";
     }
     $js = array();
     if (count($this->_js)) {
         $js = $this->_js;
     }
     $css = array();
     if (count($this->_css)) {
         $css = $this->_css;
     }
     $_layoutParam = array("caminho_css" => URL . "views/layout" . DS1 . DEFAULT_LAYOUT . "/bootstrap" . DS1 . "css/", "caminho_js" => URL . "views/layout" . DS1 . DEFAULT_LAYOUT . "/bootstrap" . DS1 . "js/", "caminho_images" => URL . "views/layout" . DS1 . DEFAULT_LAYOUT . "/images/", "caminho_vendores" => URL . "views/layout" . DS1 . DEFAULT_LAYOUT . "/vendors/", "caminho_assets" => URL . "views/layout" . DS1 . DEFAULT_LAYOUT . "/assets/", "menu" => $menu, "admin" => $admin, "js" => $js, "css" => $css);
     $caminho = ROOT . "views" . DS1 . $this->_controller . DS1 . $nome . ".phtml";
     //ou phtml
     $header = ROOT . "views" . DS1 . "layout" . DS1 . DEFAULT_LAYOUT . DS1 . "header.php";
     $footer = ROOT . "views" . DS1 . "layout" . DS1 . DEFAULT_LAYOUT . DS1 . "footer.php";
     if (is_readable($caminho)) {
         require $header;
         //$this->assign("conteudo",$caminho);
         require $caminho;
         require $footer;
     } else {
         throw new Exception("Erro ao incluir a view, verifique o arquivo View");
     }
 }
 public function postTerminal()
 {
     if (\Request::ajax()) {
         $terminal_password = \Config::get('laraedit::laraedit.terminal.password');
         $command = '';
         if (!empty($_POST['command'])) {
             $command = $_POST['command'];
         }
         if (strtolower($command == 'exit')) {
             \Session::put('term_auth', false);
             $output = '[CLOSED]';
         } else {
             if (\Session::get('term_auth') !== true) {
                 if ($command == $terminal_password) {
                     \Session::put('term_auth', true);
                     $output = '[AUTHENTICATED]';
                 } else {
                     $output = 'Enter Password:'******'';
                 $command = explode("&&", $command);
                 foreach ($command as $c) {
                     $Terminal->command = $c;
                     $output .= $Terminal->Process();
                 }
             }
         }
         return \Response::json(htmlentities($output));
     }
 }
Example #23
0
 public function create()
 {
     Session::init();
     if (Session::get('username')) {
         if (Session::get('admin')) {
             Url::redirect('exec');
         }
     } else {
         Url::redirect('');
     }
     $data['title'] = 'Wishlist';
     $tripId = \helpers\Session::get("tripId");
     $data['applicants'] = $this->mab->get_wishlist($tripId);
     $data['roster'] = $this->mab->get_official_roster($tripId);
     foreach ($data['applicants'] as $applicants_info) {
         $applicants_info->age = $this->mab->get_age_at_time($applicants_info->dateOfBirth, date('Y-m-d', time()));
     }
     if (isset($_POST['draft'])) {
         $trip_id = $this->mab->verify_applicant($_POST['applicationId']);
         if ($trip_id == NULL) {
             $this->mab->add_to_trip($_POST['applicationId'], $tripId);
             $this->mab->applicant_becomes_person($_POST['applicationId']);
             $this->mab->person_becomes_trip_member($_POST['applicationId'], $tripId);
         } else {
             if ($trip_id == $tripId) {
                 echo 'This is your participant';
             } else {
                 echo 'Application has already been drafted.';
             }
         }
     }
     View::rendertemplate('header', $data);
     View::render('wishlist/wishlist', $data, $error);
     View::rendertemplate('footer', $data);
 }
 public function fim()
 {
     $nomeColecao = Session::get('nome-colecao');
     Colecao::setNomeColecaoAtual($nomeColecao);
     $data = IndiceInvertido::parametros('fim');
     return View::make('template.empty', $data);
 }
Example #25
0
 /**
  * @param Controller $controller
  * @param String $name
  * @param array $arguments
  */
 public function __construct($controller, $name, $arguments = array())
 {
     /** =========================================
          * @var EmailField $emailField
          * @var TextField $nameField
          * @var FormAction $submit
          * @var Form $form
         ===========================================*/
     /** -----------------------------------------
      * Fields
      * ----------------------------------------*/
     $emailField = EmailField::create('Email', 'Email Address');
     $emailField->addExtraClass('form-control')->setAttribute('placeholder', 'Email')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
     $nameField = TextField::create('Name', 'Name');
     $nameField->setAttribute('placeholder', 'Name')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Name</strong>')->setCustomValidationMessage('Please enter your <strong>Name</strong>');
     $fields = FieldList::create($nameField, $emailField);
     /** -----------------------------------------
      * Actions
      * ----------------------------------------*/
     $submit = FormAction::create('Subscribe');
     $submit->setTitle('SIGN UP')->addExtraClass('button');
     $actions = FieldList::create($submit);
     /** -----------------------------------------
      * Validation
      * ----------------------------------------*/
     $required = RequiredFields::create('Name', 'Email');
     $form = Form::create($this, $name, $fields, $actions, $required);
     if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
         $form->loadDataFrom($formData);
     }
     parent::__construct($controller, $name, $fields, $actions, $required);
     $this->setAttribute('data-parsley-validate', true);
     $this->addExtraClass('form');
 }
Example #26
0
 /**
  * Will return location data given a user's ip address.
  * @param string $ip The ip address to backtrace.
  * @return array
  */
 public static function lookupIp($ip = null)
 {
     // Log whether the ip was null
     $wasNull = false;
     // Let's see if we've done this recently for this session
     if ($ip == null && Session::exists('backtrace_ip')) {
         return Session::get('backtrace_ip');
     }
     // Choose the ip to use
     if ($ip == null) {
         $wasNull = true;
         $ip = Session::getIpAddress();
     }
     // Format the host string for the api
     $host = sprintf(self::IP_BACKTRACE_HOST, $ip);
     // Get the response from the api
     $response = Utils::curl_get_contents($host);
     $data = unserialize($response);
     // Return the info in an array
     $result = array('ip' => $ip, 'city' => $data['geoplugin_city'], 'state' => $data['geoplugin_region'], 'state_full' => $data['geoplugin_regionName'], 'area_code' => $data['geoplugin_areaCode'], 'dma' => $data['geoplugin_dmaCode'], 'country_code' => $data['geoplugin_countryCode'], 'country_name' => $data['geoplugin_countryName'], 'continent_code' => $data['geoplugin_continentCode'], 'latitude' => $data['geoplugin_latitude'], 'longitude' => $data['geoplugin_longitude'], 'currency_code' => $data['geoplugin_currencyCode'], 'currency_symbol' => $data['geoplugin_currencySymbol']);
     // Now let's get the zip code
     $latLongLookup = self::lookupLatLong($result['latitude'], $result['longitude']);
     $result['zip'] = $latLongLookup['zip'];
     // Save this for future reference, if this was the current user's ip
     if ($wasNull) {
         Session::set('backtrace_ip', $result);
     }
     // Now let's return the result
     return $result;
 }
Example #27
0
 public function __construct($user = null)
 {
     $this->_db = DB::getInstance();
     $this->_sessionName = Config::get('session/session_name');
     $this->_cookieName = Config::get('remember/cookie_name');
     $this->_admSessionName = Config::get('session/admin_name');
     if (!$user) {
         if (Session::exists($this->_sessionName)) {
             $user = Session::get($this->_sessionName);
             if ($this->find($user)) {
                 $this->_isLoggedIn = true;
             } else {
                 // process logout
             }
         }
         if (Session::exists($this->_admSessionName)) {
             $user = Session::get($this->_admSessionName);
             if ($this->find($user)) {
                 $this->_isAdmLoggedIn = true;
             } else {
                 // process logout
             }
         }
     } else {
         $this->find($user);
     }
 }
 /**
  * @param array $data
  * @return SS_HTTPResponse|void
  */
 function doChangePassword(array $data)
 {
     try {
         $token = Session::get('AutoLoginHash');
         $member = $this->password_manager->changePassword($token, @$data['NewPassword1'], @$data['NewPassword2']);
         Session::clear('AutoLoginHash');
         $back_url = isset($_REQUEST['BackURL']) ? $_REQUEST['BackURL'] : '/';
         return OpenStackIdCommon::loginMember($member, $back_url);
     } catch (InvalidResetPasswordTokenException $ex1) {
         Session::clear('AutoLoginHash');
         Controller::curr()->redirect('login');
     } catch (EmptyPasswordException $ex2) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.EMPTYNEWPASSWORD', "The new password can't be empty, please try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (PasswordMismatchException $ex3) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.ERRORNEWPASSWORD', "You have entered your new password differently, try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (InvalidPasswordException $ex4) {
         $this->clearMessage();
         $this->sessionMessage(sprintf(_t('Member.INVALIDNEWPASSWORD', "We couldn't accept that password: %s"), nl2br("\n" . $ex4->getMessage())), "bad");
         Controller::curr()->redirectBack();
     }
 }
Example #29
0
 public function getPaymentCart()
 {
     $values = Session::get('payment');
     foreach ($values as $key => $value) {
         $product[$key]['name'] = $value['name'];
         $price = round((int) $value['price'] / 21270);
         $product[$key]['price'] = $price;
         $product[$key]['quantity'] = 1;
         $product[$key]['product_id'] = $value['id'];
     }
     $tmpTransaction = new TmpTransaction();
     $st = Str::random(16);
     $baseUrl = URL::to('/product/payment/return?order_id=' . $st);
     // $value[1]['name'] = "sản phẩm 1";
     // $value[1]['price'] = "20000";
     // $value[1]['quantity'] = "1";
     // $value[1]['product_id'] = "3";
     // $value[2]['name'] = "sản phẩm 2";
     // $value[2]['price'] = "20000";
     // $value[2]['quantity'] = "1";
     // $value[2]['product_id'] = "3";
     $payment = $this->makePaymentUsingPayPalCart($product, 'USD', "{$baseUrl}&success=true", "{$baseUrl}&success=false");
     $tmpTransaction->order_id = $st;
     $tmpTransaction->payment_id = $payment->getId();
     $tmpTransaction->save();
     header("Location: " . $this->getLink($payment->getLinks(), "approval_url"));
     exit;
     return "index";
 }
Example #30
0
 public function getTaskListHtml($filter_str, $done_num)
 {
     $recent_done_num = $done_num;
     $tasks = $this->getTasks($filter_str, $done_num);
     $layout = Session::get('layout', 'default');
     return View::make('tasks.layouts.' . $layout, compact('tasks', 'recent_done_num'))->render();
 }