/** * @covers $this->object->remove * @todo Implement testRemove(). */ public function testRemove() { session_start(); $_SESSION['test'] = 'TEST'; $this->object->remove('test'); $this->assertEquals(false, isset($_SESSION['test'])); }
/** * Add apartment page * @return \Illuminate\View\View */ public function home() { $apartment = new ListApartment(); //Hard code $apartment->username = Auth::user()->username; // Get all district $district = ListDistrict::lists('name_district', 'id_district'); // Get all province $province = ListProvice::lists('name_province', 'id_province'); // Get all project $projects = ListProject::lists('name', 'ID'); //Get project $project_id = Input::get('project'); $apartment->project = $project_id; // Get all furniture $furnitures = Furniture::lists('name', 'ID'); // Get all management company $directions = Direction::lists('name', 'ID'); // Get all floor material $floor_materials = FloorMaterial::lists('name', 'ID'); // Clear Session for ($i = -2; $i < 8; $i++) { if (Session::has("image[{$i}]")) { Session::remove("image[{$i}]"); } } return View::make('pages.apartment', compact('apartment', 'district', 'province', 'projects', 'project_id', 'furnitures', 'directions', 'floor_materials')); }
public function manager() { if (Request::segment(2) == 'search') { $input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword')); switch ($input['search_category']) { case '0': return Redirect::to('managers'); break; case 'owner': $users = User::where('status', 3)->whereHas('domain', function ($q) { $q->whereHas('user', function ($q) { $q->where('username', 'like', '%' . Input::get('search_keyword') . '%'); }); })->get(); break; case 'name': $users = User::where('status', 3)->whereHas('profile', function ($q) { $q->where(function ($q) { $q->where('first_name', 'like', '%' . Input::get('search_keyword') . '%'); $q->orWhere('last_name', 'like', '%' . Input::get('search_keyword') . '%'); }); })->get(); break; default: $users = User::where('status', 3)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); break; } Session::set('search', $input); } else { Session::remove('search'); $input = array('search_category' => '', 'search_keyword' => ''); $users = User::where('status', 3)->get(); } return View::make('user_management.index')->with('users', $users)->with('selected', $input); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { if (Request::segment(2) == 'search') { $input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword')); switch ($input['search_category']) { case '0': return Redirect::to('gateway'); break; case 'owner': $gateways = Gateway::whereHas('user', function ($q) { $q->where('username', 'LIKE', '%' . Input::get('search_keyword') . '%'); })->get(); break; default: if (Auth::user()->status == 2) { $gateways = Gateway::where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); } else { $gateways = Gateway::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); } break; } Session::set('search', $input); } else { Session::remove('search'); $input = array('search_category' => '', 'search_keyword' => ''); $gateways = Auth::user()->status == 2 ? Gateway::all() : Gateway::where('user_id', Auth::user()->id)->get(); } return View::make('gateway.index')->with('gateways', $gateways)->with('selected', $input); }
public function logoutAction($key = 'user') { Session::remove($key); Session::destroy(); Session::setFlash(__t('you_logout')); $this->redirect("/"); }
/** * tokenチェック */ protected function tokenValidate($name = 'token') { $request = Request::getInstance(); $value = $request->get($name, ''); $value = mb_convert_kana($value, 'n'); return Session::remove($name) == $value ? null : __('Token authentication is invalid'); }
function LA_Session_Clear($key) { // clear persisted value for the given string key if (\Session::has($key)) { \Session::remove($key); } }
function remove($key = null) { if ($key == null) { $key = get_class($this); } else { $key = get_class($this).".$key"; } Session::remove(ACTION_SCOPE, $key); }
public static function verify($key = null, $debug = false) { global $global; $result = Session::get('_token.' . $global['name']) === ($key == null ? Form::get('token', 'no') : $key); if (!$debug) { Session::remove('_token.' . $global['name']); } return $result; }
public static function get($key) { $prefixkey = self::$prefix . $key; if (Session::exists($prefixkey)) { $value = Session::get($prefixkey); Session::remove($prefixkey); return '<div class="alert alert-' . $key . '">' . $value . '</div>'; } }
protected function _validation_error($obj) { $validationErrors = is_subclass_of($obj, 'LaravelBook\\Ardent\\Ardent') ? $obj->validationErrors : $obj; if (Request::ajax()) { return Response::json($validationErrors, 400); } Session::remove('_old_input'); return Redirect::back()->withErrors($validationErrors)->with('notification:danger', $this->validation_error_message); }
public static function tryLogout() { if (Session::has("user")) { Session::remove("user"); return true; } else { return false; } }
public function authenticate() { //@todo sanitize post input $post = $this->post(); $this->__ldap_connect(); if (empty($post['uName']) || empty($post['uPassword'])) { throw new Exception(t('Please provide both username and password.')); } $domain = trim(Config::get('auth.ldap.ldapdomain')); $uName = $post['uName']; if (strlen($domain)) { $ldapLoginuName = Config::get('auth.ldap.ldapdomain') . '\\' . $uName; } $uPassword = $post['uPassword']; if (!@ldap_bind($this->connection, $ldapLoginuName, $uPassword)) { throw new \Exception(t('Invalid username or password.')); } else { \Session::remove('accessEntities'); $uID = $this->getUserByLdapUser($uName); if ($uID) { // ldap user has been bound to a c5 user $ui = UserInfo::getByID($uID); } if (!is_object($ui) || !$ui instanceof UserInfo || $ui->isError()) { // user needs to be created $user = $this->createUser($uName, $uName . "@" . $domain . '.us'); // @TODO email is a total hack right now - fix it. } else { $user = \User::loginByUserID($ui->getUserID()); } if (is_object($user) && $user->isError()) { switch ($user->getError()) { case USER_SESSION_EXPIRED: throw new \Exception(t('Your session has expired. Please sign in again.')); break; case USER_NON_VALIDATED: throw new \Exception(t('This account has not yet been validated. Please check the email associated with this account and follow the link it contains.')); break; case USER_INVALID: if (Config::get('concrete.user.registration.email_registration')) { throw new \Exception(t('Invalid email address or password.')); } else { throw new \Exception(t('Invalid username or password.')); } break; case USER_INACTIVE: throw new \Exception(t('This user is inactive. Please contact the helpdesk regarding this account.')); break; } } } if ($post['uMaintainLogin']) { $user->setAuthTypeCookie('ldap'); } $this->completeAuthentication($user); }
public function isValid() { $validator = Validator::make($this->attributesToArray(), $this->rules); if ($validator->fails()) { Session::remove('messages'); foreach ($validator->getMessageBag()->getMessages() as $message) { Session::push('messages', $message[0]); } // debug(Session::get('messages')); exit; return false; } return true; }
/** * This will save the access story to the database */ public function saveStory() { // set the end time $this->getSessionManager()->setEndTime(); // calculate the memory usage $this->getSessionManager()->setMemoryUsage(); // get the collected data $aData = $this->getSessionManager()->getCollectedData(); $aData = array_merge($aData, ['response_time' => $this->getSessionManager()->getTimeTaken(), 'memory_usage' => $this->getSessionManager()->getMemoryUsage()]); // save the access history now AccessStoryModel::create($aData); // remove the session, so that it would always be unique across each request \Session::remove(Reader::getSessionKeyName()); }
/** * Decode multipass token and log user */ public function decodeMultipass() { $token = Input::get('multipass'); $signature = Input::get('signature'); $iv = 'OpenSSL for Node'; $subdomain = getenv('SITE_KEY'); $api_key = getenv('API_KEY'); $salted = $api_key . $subdomain; $digest = hash('sha1', $salted, true); $key = substr($digest, 0, 16); $blocksize = 16; Log::info('Token: ' . $token); // Signature Verification $hash = base64_encode(hash_hmac("sha1", $token, $api_key, true)); if ($hash == $signature) { Log::info('Signature OK'); // Replace _ with / and - with + $token = preg_replace('/_/', '/', $token); $token = preg_replace('/\\-/', '+', $token); $token = base64_decode($token); // Decrypt Token $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); mcrypt_generic_init($cipher, $key, $iv); $decrypted = mdecrypt_generic($cipher, $token); // Remove invisble character $decrypted = trim($decrypted, ".."); $userToken = json_decode($decrypted); Log::debug('Decoded Multipass: '******'uid' => $userToken->uid, 'name' => $userToken->user_name, 'email' => $userToken->user_email, 'principal' => 'openmrs_id:' . $userToken->uid, 'role' => NULL)); $role = DB::table('admin')->where('token', '=', $user->uid)->first(); if ($role != null) { $user->role = 'ADMIN'; } Log::info('User stored in session: ' . $user->uid); Log::info('User Rolen: ' . $user->role); // Log User Auth::login($user); Session::put('user', $user); if (Session::has('module')) { Session::remove('module'); return Response::view('close'); } return Redirect::to('/'); } Log::info('Signature and Hashed Token mismatch/n'); Log::debug('Hash/n' . $hash); Log::debug('Signature/n' . $signature); }
public function indexAction() { $session = new Session(); $session->add('name', 'php'); $session->add('type', 'web'); var_dump($_SESSION); $session->remove('name'); var_dump($_SESSION); // 移去所有session变量 $session->clear(); // 移去存储在服务器端的数据 $session->destroy(); // $session->close(); var_dump($_SESSION); }
function init() { $lang = Locale::lang(); if ($GLOBALS["CFG_APU"]->DEBUG) { Session::remove(MSG_SCOPE, "lang"); } if (Session::load(MSG_SCOPE, "lang") != $lang) { reset($GLOBALS["CFG_MSG"]->NS); while (list(,$value) = each($GLOBALS["CFG_MSG"]->NS)) { try { Apu::dispatch($value.".php"); } catch (Exception $e) {} try { Apu::dispatch($value.'_'.strtolower($lang).".php"); } catch (Exception $e) {} } Session::save(MSG_SCOPE, $lang, "lang"); //Session::save(MSG_SCOPE, $GLOBALS[MSG_SCOPE], "msgList"); } }
public function manage() { if (Request::segment(2) == 'search') { $input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword')); if ($input['search_category'] == '0') { return Redirect::to('phone_number'); } $phone_number = PhoneNumber::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); Session::set('search', $input); } else { Session::remove('search'); $input = array('search_category' => '', 'search_keyword' => ''); $phone_number = PhoneNumber::whereHas('user', function ($q) { $q->where('domain_id', Request::segment(3)); })->get(); } return View::make('phone_number.index')->with('phone_numbers', $phone_number)->with('selected', $input); }
public function show() { $id = Session::remove("blinkId"); if ($id != null) { $blink = Blink::find($id); $blink->time_viewed; if ($blink != null && $blink->view_time > $blink->time_viewed) { $path = $blink->file_location; $file = new Symfony\Component\HttpFoundation\File\File($path); $response = Response::make(File::get($path), 200); // Modify our output's header. // Set the content type to the mime of the file. // In the case of a .jpeg this would be image/jpeg $response->header('Content-type', $file->getMimeType()); // We return our image here. return $response; } } }
public function setActiveGroup($groupId) { try { if (!Auth::check()) { return Redirect::back()->with('error', 'You must be logged in to set a group'); } if ($groupId == 0) { Session::remove('activeGroupId'); return Redirect::back()->with('message', 'Active Group has been removed'); } if (!Group::isValidUserForGroup(Auth::user()->id, $groupId)) { return Redirect::back()->with('error', 'Invalid Group'); } Session::put('activeGroupId', $groupId); return Redirect::back()->with('message', "Active Group Changed"); } catch (\Exception $e) { return Redirect::back()->with('error', 'There was an error processing your request'); } }
public function check($uid, $data = null, $force = null) { $q = $this->dbLogin->duplicate(); if ($force) { $q->andWhere(array('uid' => $uid)); } else { $q->andWhere(array('uid' => $uid, 'status' => 1)); } $q->selectColumn('uid,status,time'); if ($mfa = $q->getAssoc()) { if (is_array($data)) { $data = array_merge($data, $mfa); } return $this->auth_proceed($mfa['uid'], $mfa); } // pas de check on délog $data['session_key'] = null; $this->session->remove('loginData'); $this->uid = null; }
/** * Add project page * @return \Illuminate\View\View */ public function home() { $project = new ListProject(); // Get all district $district = ListDistrict::lists('name_district', 'id_district'); // Get all province $province = ListProvice::lists('name_province', 'id_province'); // Get all management company $management_company = ManagementComapny::lists('name', 'ID'); // Get all investor $investor = Investor::lists('name', 'ID'); // Get all management company $design_company = DesignCompany::lists('name', 'ID'); // Get all utilities $utilities = ListUtilities::all(); // Clear Session for ($i = -2; $i < 8; $i++) { if (Session::has("image[{$i}]")) { Session::remove("image[{$i}]"); } } return View::make('pages.project', compact('project', 'district', 'province', 'management_company', 'investor', 'design_company', 'utilities')); }
Log::info('Unknow user'); return View::make('index'); })); Route::delete('ping.php', array('before' => 'secret', 'uses' => 'PingController@pingDelete')); //This handles create and update of marker site. Could not separate create and update for backward compatibility (especially with Atlas Module) Route::post('ping.php/atlas', array('before' => 'validateAtlasJson', 'uses' => 'MarkerSiteController@save')); Route::delete('ping.php/atlas', array('before' => 'validateAtlasDelete', 'uses' => 'MarkerSiteController@delete')); Route::post('ping.php', array('before' => 'validateJson', 'uses' => 'PingController@pingPost')); Route::get('markerSites', array('uses' => 'DataController@getData')); Route::get('distributions', array('uses' => 'DataController@getDistributions')); Route::get('auth/multipass/callback', array('before' => 'multipass', 'uses' => 'AuthController@decodeMultipass')); Route::get('logout', array('as' => 'logout', function () { $idServer = getenv('ID_HOST'); Auth::logout(); Log::info('User logged out'); Session::remove('user'); if (Session::has('module')) { $url = urlencode(route('close')); } else { $url = urlencode(route('home')); } return Redirect::to($idServer . '/disconnect?destination=' . $url); })); Route::get('login', array('as' => 'login', function () { $idServer = getenv('ID_HOST'); return Redirect::to($idServer . '/authenticate/atlas'); })); Route::get('capture', array('as' => 'capture', 'before' => 'isAdmin', 'uses' => 'AtlasController@takeCapture')); Route::get('rss/{updates?}', array('as' => 'rss', 'uses' => 'AtlasController@rssGenerator'))->where('updates', 'updates|all'); Route::get('screenshot', array('as' => 'download', 'uses' => 'AtlasController@cronCapture')); Route::get('download', array('as' => 'cron', 'uses' => 'AtlasController@downloadCapture'));
/** * Logout by removing the Session and Cookies. * * @access public * @param integer $userId * @param bool $keepSession * */ public function logOut($userId, $keepSession = false) { Session::remove($keepSession); Cookie::remove($userId); }
/** * Flush all user preference for given user Id * * @param int $userId */ private function flushAll($userId) { $query = 'DELETE FROM ' . UserPreferences_DBTable::DB_TABLE_NAME . ' WHERE '; $query .= UserPreferences_DBTable::USER_ID . '=?'; if (DBManager::executeQuery($query, array($userId))) { Session::remove(Session::SESS_USER_PREF_KEY); } }
/** * Update the specified reportgrouping in storage. * * @param int $id * @return Response */ public function update($report_id, $id) { $reportgrouping = ReportGrouping::findOrFail($id); ReportGrouping::setRules('update'); $data = Input::all(); if (!$reportgrouping->canUpdate()) { return $this->_access_denied(); } if (!$reportgrouping->update($data)) { return $this->_validation_error($reportgrouping); } if (Request::ajax()) { return $reportgrouping; } Session::remove('_old_input'); return Redirect::action('ReportGroupingsController@edit', [$report_id, $id])->with('notification:success', $this->updated_message); }
function logout() { Session::remove("/session"); return Redirect::success(); }
/** * {@inheritdoc} */ public function remove($key) { $this->session->remove($this->getKey($key)); return $this; }
public function logoutAction(Request $request) { Session::remove('user'); header('Location: /?route=security/login'); }