本文整理汇总了PHP中Session::get_flash方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::get_flash方法的具体用法?PHP Session::get_flash怎么用?PHP Session::get_flash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::get_flash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
public function action_index()
{
// clear redirect referrer
\Session::delete('submitted_redirect');
// load language
\Lang::load('index');
// read flash message for display errors.
$form_status = \Session::get_flash('form_status');
if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
$output['form_status'] = $form_status['form_status'];
$output['form_status_message'] = $form_status['form_status_message'];
}
unset($form_status);
// get total accounts
$output['total_accounts'] = \Model_Accounts::count();
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('admin_administrator_dashbord'));
// <head> output ----------------------------------------------------------------------------------------------
// breadcrumb -------------------------------------------------------------------------------------------------
$page_breadcrumb = [];
$page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
$output['page_breadcrumb'] = $page_breadcrumb;
unset($page_breadcrumb);
// breadcrumb -------------------------------------------------------------------------------------------------
// the admin views or theme should follow this structure. (admin/templates/controller/method) and follow with _v in the end.
return $this->generatePage('admin/templates/index/index_v', $output, false);
}
示例2: action_index
public function action_index()
{
// clear redirect referrer
\Session::delete('submitted_redirect');
// read flash message for display errors.
$form_status = \Session::get_flash('form_status');
if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
$output['form_status'] = $form_status['form_status'];
$output['form_status_message'] = $form_status['form_status_message'];
}
unset($form_status);
// list tables
$output['list_tables'] = \DB::list_tables();
// if form submitted
if (\Input::method() == 'POST') {
$table_name = trim(\Input::post('table_name'));
$output['table_name'] = $table_name;
if (!\Extension\NoCsrf::check()) {
// validate token failed
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
} elseif ($table_name == null) {
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('dbhelper_please_select_db_table');
} else {
$output['list_columns'] = \DB::list_columns(\DB::expr('`' . $table_name . '`'));
}
}
// endif; form submitted
// <head> output ---------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('dbhelper'));
// <head> output ---------------------------------------------------------------------
return $this->generatePage('admin/templates/index/index_v', $output, false);
}
示例3: action_submit
public function action_submit()
{
if (!Security::check_token()) {
Response::redirect('_404_');
}
if (Session::get_flash('name')) {
$contact = Model_Contact::forge();
$contact->title = Session::get_flash("title");
$contact->body = Session::get_flash("body");
$body = View::forge("email/contact");
$body->set("name", Session::get_flash('name'));
$body->set("email", Session::get_flash('email'));
$body->set("body", Session::get_flash('body'));
$sendmail = Email::forge("JIS");
$sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
$sendmail->to(Config::get("statics.info_email"));
$sendmail->subject("We got contact/ Game-bootcamp");
$sendmail->body($body);
$sendmail->send();
}
$this->template->title = "Contact";
$this->template->sub = "How can we help you?";
$view = View::forge("contacts/send");
$this->template->content = $view;
}
示例4: action_login
public function action_login()
{
if ($this->is_validated) {
return Response::redirect("/");
}
$data = array('username' => Session::get_flash('username'), 'message' => Session::get_flash('message'));
return Response::forge(View::forge("authenticate/login.tpl", $data));
}
示例5: createFieldset
/**
* ログイン用のFieldsetをレスポンスします
*
* @access public
* @return Fieldset fieldset
* @author shimma
*/
public function createFieldset()
{
$fieldset = Session::get_flash('login.fieldset');
if (!$fieldset) {
$fieldset = \Fieldset::forge('login');
$fieldset->add('email', 'Email')->add_rule('required')->add_rule('valid_email');
$fieldset->add('password', 'Password')->add_rule('required');
}
return $fieldset;
}
示例6: action_registered
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;
}
示例7: load
/**
* loads alerts from session
*
* @param void
* @access public
* @return void
*/
public static function load()
{
foreach (self::$types as $type) {
$session_key = self::$namespace . '.' . $type;
$type_alerts = \Session::get_flash($type);
if (!empty($type_alerts)) {
self::$alerts[$type][] = $type_alerts;
}
}
}
示例8: start
/**
* Runs on 'controller_started' event
*/
public static function start()
{
$controller = \Request::active()->controller_instance;
$nocache = \Input::param('nocache', \Session::get_flash('nocache', false, true));
$controller_nocache = !is_null($controller) && method_exists($controller, 'cache') && $controller->cache() === false;
// Don't run if it's already started, if we have a POST or if the controller says not to
if ($nocache !== false || strtolower(\Input::method()) == 'post' || $controller_nocache) {
if (static::$started === true) {
static::stop();
}
return false;
}
$config = \Config::get('cmf.cache');
if ($config['enabled'] !== true) {
return;
}
// Check for excluded URLS
$uri = '/' . str_replace(array('?debug', '&debug'), '', trim($_SERVER['REQUEST_URI'], '/'));
if ($uriPath = parse_url($uri, PHP_URL_PATH)) {
$uri = $uriPath;
}
$jq = \Input::get('_', null);
if ($jq !== null) {
$uri = str_replace(array("?_={$jq}", "&_={$jq}"), '', $uri);
}
$excluded_urls = $config['excluded_urls'];
foreach ($excluded_urls as $url) {
$url = \Uri::create($url);
if ($urlPath = parse_url($url, PHP_URL_PATH)) {
$url = $urlPath;
}
if (strpos($url, '*') !== false && strpos($uri . '/', str_replace('*', '', $url)) === 0) {
return;
}
if ($uri == $url) {
return;
}
}
// Create the driver and try to get cached content from it
$driver = static::driver();
static::$started = true;
// Add any extra files to check
$files = \Arr::get($config, 'check_files', array());
foreach ($files as $file) {
$driver->addFile($file);
}
// Try and get the cached content
$content = $driver->get($uri);
// Serve the cached content if found, or continue and add the finish listener
if (static::$active = $content !== false) {
$driver->serve($content, static::$modified);
} else {
\Event::register('request_finished', 'CMF\\Cache::finish');
}
}
示例9: action_orderDetails
public function action_orderDetails($order_id)
{
$order_info = [];
$order_details = Model_OrderProduct::find('all', array('where' => array(['order_id', $order_id])));
foreach ($order_details as $order_detail) {
$product = Model_Product::find($order_detail->product_id);
$order_info[] = (object) ['id' => $product->id, 'name' => $product->name, 'price' => $product->price, 'quantity' => $order_detail->quantity];
}
$data = ['order_info' => $order_info, 'order_id' => $order_id, 'message' => Session::get_flash('message'), 'remove_sure' => Session::get_flash('remove_sure')];
return Response::forge(View::forge('user/orderDetails.tpl', $data));
}
示例10: alerts
/**
* Prints an alert list for the given type.
*
* @param array $type The type of alerts to show.
* @param array $options Options to use for alerts.
*
* @return View
*/
public static function alerts($type = 'all', array $options = array())
{
$alerts = array();
if ($type == 'all') {
$alerts['success'] = Session::get_flash('alert.success');
$alerts['info'] = Session::get_flash('alert.info');
$alerts['error'] = Session::get_flash('alert.error');
} else {
$alerts[$type] = Session::get_flash('alert.' . $type);
}
Session::delete_flash('alert');
return View::forge('common/alerts', array('type' => $type, 'alerts' => $alerts, 'options' => $options));
}
示例11: before
public function before()
{
// load the template
$this->template = \View::factory('template');
// init CRUD controller
if (\Request::active()->controller == 'crud') {
// redirect to crud/error if errors were found
if (!Init::all() and \Request::active()->action != 'error') {
\Response::redirect('crude/crud/error');
}
}
$this->template->set('modal_msg', \Session::get_flash('modal_msg'));
$this->template->set('site_name', $this->site_name);
return parent::before();
}
示例12: action_submit
public function action_submit()
{
if (!Security::check_token()) {
Response::redirect('_404_');
}
if (Session::get_flash('title')) {
$contact = Model_Contact::forge();
$contact->title = Session::get_flash("title");
$contact->body = Session::get_flash("body");
$contact->user_id = $this->user->id;
$contact->save();
} else {
Response::redirect('_404_');
}
$this->template->content = View::forge('teachers/contact/finish');
}
示例13: action_submit
public function action_submit()
{
if (!Security::check_token()) {
Response::redirect('_404_');
}
if (Session::get_flash('email')) {
$email = Session::get_flash("email");
try {
Auth::create_user($email, Session::get_flash("password"), $email, 10);
$user = Model_User::find("first", ["where" => [["email", $email]]]);
if ($user != null) {
$user->sex = Session::get_flash("sex");
$user->firstname = Session::get_flash("firstname");
$user->middlename = Session::get_flash("middlename");
$user->lastname = Session::get_flash("lastname");
$user->birthday = Session::get_flash("year") . "-" . Session::get_flash("month") . "-" . Session::get_flash("day");
$user->google_account = Session::get_flash("google_account");
$user->need_reservation_email = Session::get_flash("need_reservation_email");
$user->need_news_email = Session::get_flash("need_news_email");
$user->timezone = Session::get_flash("timezone");
$user->pr = Session::get_flash("pr");
$user->educational_background = Session::get_flash("educational_background");
$user->trial = Session::get_flash("trial");
$user->enchantJS = Session::get_flash("enchantJS");
$user->save();
// send mail
$body = View::forge("email/teachers/signup");
$body->set("name", $user->firstname);
$body->set("user", $user);
$body->set("ymd", explode("-", $user->birthday));
$sendmail = Email::forge("JIS");
$sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
$sendmail->to($user->email);
$sendmail->subject("Welcome Aboard! / Game-bootcamp");
$sendmail->html_body(htmlspecialchars_decode($body));
$sendmail->send();
} else {
Response::redirect('_404_');
}
} catch (Exception $e) {
Response::redirect('_404_');
}
} else {
Response::redirect('_404_');
}
$this->template->content = View::forge('teachers/signup/finish');
}
示例14: action_viewAllOrders
public function action_viewAllOrders()
{
$validator = $this->addModifyValidator();
$final_orders = [];
$qualifiers = ['order_by' => 'created_at'];
$orders = Model_Order::find('all', $qualifiers);
foreach ($orders as $order) {
$user_id = $order->user_id;
$user = Model_User::find($user_id);
$final_orders[] = (object) ['id' => $order->id, 'created_at' => $order->created_at, 'name' => $user->name, 'email' => $user->email];
}
$data = ['final_orders' => $final_orders, 'user' => $user, 'message' => Session::get_flash('message'), 'remove_sure' => Session::get_flash('remove_sure')];
// return View::forge('admin/viewAllOrders.tpl', $data);
$view = View::forge('admin/viewAllOrders.tpl', $data);
$view->set('helper', new Helper(), false);
// pass validator
return Response::forge($view);
}
示例15: action_login
/**
* The login.
*
* @access public
* @return Response or void
*/
public function action_login($_provider = null, $method = null)
{
// Already logged in
Auth::check() and Response::redirect('member');
if ($_provider) {
return $this->opauth_login_start($_provider, $method);
}
$destination = Session::get_flash('destination') ?: Input::post('destination', '');
if (Input::method() == 'POST') {
try {
Util_security::check_csrf();
if (!$this->login_val->run()) {
throw new FuelException($this->login_val->show_errors());
}
$post = $this->login_val->validated();
$posted_email = Arr::get($post, \Config::get('uzuraauth.username_post_key'));
$posted_password = Arr::get($post, \Config::get('uzuraauth.password_post_key'));
$auth = Auth::instance();
// account lock check.
if ($auth->check_is_account_locked($posted_email)) {
throw new FuelException('アカウントがロックされています');
}
// login check.
if (!Auth::check() && !$auth->login($posted_email, $posted_password)) {
throw new FuelException();
}
// does the user want to be remembered?
if (Input::param('rememberme', false)) {
// create the remember-me cookie
Auth::remember_me();
} else {
// delete the remember-me cookie if present
Auth::dont_remember_me();
}
// credentials ok, go right in
return $this->login_succeeded($destination);
} catch (FuelException $e) {
$this->login_failed(false, $e->getMessage());
}
}
$this->set_title_and_breadcrumbs('ログイン');
$this->template->content = View::forge('auth/_parts/login', array('destination' => $destination));
}