本文整理汇总了PHP中Messages::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::info方法的具体用法?PHP Messages::info怎么用?PHP Messages::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::info方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$q = trim(Input::get('q'));
if (empty($q) || !Input::has('q')) {
return Redirect::home();
}
if (!Input::has('guess') || Input::get('guess') != 'no') {
$regex = array('pilot' => '[0-9]+', 'airport' => '[A-Z0-9]{4}', 'airline' => '[A-Z0-9]{3}', 'airportIata' => '[A-Z0-9]{3}', 'citypair' => '([A-Z0-9]{3,4})(?:(?:\\s*?[-|>]\\s*?)|\\s+to\\s+|\\s+)([A-Z0-9]{3,4})', 'callsign' => '.*');
$search = new Search($q);
foreach ($regex as $type => $pattern) {
if (preg_match('/^' . $pattern . '$/i', $q, $matches) && ($match = $search->quick($type, $matches))) {
Messages::info('You were redirected here by a best guess of the search system. <a href="' . URL::route('search', array('q' => $q, 'guess' => 'no')) . '" class="alert-link">Return to search results.</a>');
return $match;
}
}
}
$pilots = Pilot::where(function ($search) use($q) {
$search->where('vatsim_id', '=', $q);
$search->orWhere(function ($name) use($q) {
$name->where('name', 'LIKE', '%' . $q . '%');
$name->where('anonymous', '=', false);
});
})->where('vatsim_id', '!=', 0)->get();
$flights = Flight::where('callsign', '=', $q)->orderBy('departure_time', 'desc')->get();
$airlines = Airline::where('icao', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->get();
$airports = Airport::where('icao', '=', $q)->orWhere('iata', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->orWhere('city', 'LIKE', '%' . $q . '%')->get();
$this->autoRender(compact('q', 'flights', 'pilots', 'airlines', 'airports'), 'Search');
}
示例2: action_login
/**
* User login
*
* @access public
* @return void
*/
public function action_login()
{
if ($this->check_logged_type() == 'guest') {
\Sentry::logout();
}
if (!(\Sentry::check() && !\Sentry::user()->is_admin())) {
\View::set_global('title', 'Login');
if (\Input::post('login')) {
$val = \User\Controller_Validate::forge('login');
if ($val->run()) {
try {
if (\Sentry::user_exists(\Input::param('identity')) && !\Sentry::user(\Input::param('identity'))->is_admin()) {
// check the credentials.
$valid_login = \Sentry::login(\Input::param('identity'), \Input::param('password'), true);
if ($valid_login) {
if ($this->check_logged_type() == 'guest') {
\Messages::info('You cannot log on to with a guest account.');
\Response::redirect(\Uri::front_create('user/account/login'));
}
\Messages::success('You have logged in successfully');
// \Response::redirect(\Input::referrer(\Uri::front_create('user/account/dashboard')));
\Response::redirect(\Uri::front_create('user/account/dashboard'));
} else {
\Messages::error('Email and/or password is incorrect');
}
} else {
\Messages::error('Email and/or password is incorrect');
}
} catch (\Sentry\SentryAuthException $e) {
// show validation errors
//\Messages::error('<h4>There was an error while trying to login</h4>');
$errors = $e->getMessage();
\Messages::error($errors);
} catch (\Sentry\SentryException $e) {
// show validation errors
//\Messages::error('<h4>There was an error while trying to login</h4>');
$errors = $e->getMessage();
\Messages::error($errors);
}
} else {
if ($val->error() != array()) {
// show validation errors
foreach ($val->error() as $e) {
\Messages::error($e->get_message());
}
}
}
}
if (\Input::is_ajax()) {
echo \Theme::instance()->view($this->view_dir . 'login');
} else {
\Theme::instance()->set_partial('content', $this->view_dir . 'single_login');
}
} else {
//Keep existing messages
\Messages::instance()->shutdown();
\Response::redirect(\Uri::front_create('/'));
}
}
示例3: before
public function before()
{
parent::before();
// Check if the current user is an administrator
if (!\Auth::member(6)) {
\Messages::info(__('user.login.permission-denied'));
\Response::redirect();
}
}
示例4: action_callback
public function action_callback()
{
// Opauth can throw all kinds of nasty bits, so be prepared
try {
// get the Opauth object
$opauth = \Auth_Opauth::forge(false);
// and process the callback
$status = $opauth->login_or_register();
// fetch the provider name from the opauth response so we can display a message
$provider = $opauth->get('auth.provider', '?');
// deal with the result of the callback process
switch ($status) {
// a local user was logged-in, the provider has been linked to this user
case 'linked':
// inform the user the link was succesfully made
\Messages::success(sprintf(__('login.provider-linked'), ucfirst($provider)));
// and set the redirect url for this status
$url = 'dashboard';
break;
// the provider was known and linked, the linked account as logged-in
// the provider was known and linked, the linked account as logged-in
case 'logged_in':
// inform the user the login using the provider was succesful
\Messages::success(sprintf(__('login.logged_in_using_provider'), ucfirst($provider)));
// and set the redirect url for this status
$url = 'dashboard';
break;
// we don't know this provider login, ask the user to create a local account first
// we don't know this provider login, ask the user to create a local account first
case 'register':
// inform the user the login using the provider was succesful, but we need a local account to continue
\Messages::info(sprintf(__('login.register-first'), ucfirst($provider)));
// and set the redirect url for this status
$url = 'user/register';
break;
// we didn't know this provider login, but enough info was returned to auto-register the user
// we didn't know this provider login, but enough info was returned to auto-register the user
case 'registered':
// inform the user the login using the provider was succesful, and we created a local account
\Messages::success(__('login.auto-registered'));
// and set the redirect url for this status
$url = 'dashboard';
break;
default:
throw new \FuelException('Auth_Opauth::login_or_register() has come up with a result that we dont know how to handle.');
}
$url = str_replace('#_=_', '', $url);
// redirect to the url set
\Response::redirect($url);
} catch (\OpauthException $e) {
\Messages::error($e->getMessage());
\Response::redirect_back();
} catch (\OpauthCancelException $e) {
// you should probably do something a bit more clean here...
exit('It looks like you canceled your authorisation.' . \Html::anchor('users/oath/' . $provider, 'Click here') . ' to try again.');
}
}
示例5: before
public function before()
{
// already logged in?
if (\Sentry::check() && \Sentry::user()->is_admin()) {
\Messages::info('You are already logged in');
\Response::redirect('admin');
}
parent::before();
\Theme::instance()->active('admin');
\Theme::instance()->set_template($this->template);
}
示例6: before
public function before()
{
parent::before();
// Get action, module and controller name
$this->actionName = \Request::active()->action;
$this->moduleName = \Request::active()->module;
$this->controllerName = strtolower(str_replace('Controller_', '', \Request::active()->controller));
$this->controllerName = str_replace($this->moduleName . '\\', '', $this->controllerName);
// Check Auth Access
if (!\Auth::check()) {
\Messages::info(__('user.login.not-logged'));
\Response::redirect(\Router::get('login'));
}
// Set global
$this->dataGlobal['title'] = \Config::get('application.seo.backend.title');
}
示例7: action_login
public function action_login()
{
// already logged in?
if (\Auth::check()) {
// yes, so go back to the page the user came from, or the
// application dashboard if no previous page can be detected
\Messages::info(__('user.login.already-logged-in'));
\Response::redirect_back(\Router::get('admin'));
}
// was the login form posted?
if (\Input::method() == 'POST') {
// check the credentials.
if (\Auth::instance()->login(\Input::param('username'), \Input::param('password'))) {
// logged in, go back to the page the user came from, or the
// application dashboard if no previous page can be detected
\Response::redirect_back(\Router::get('admin'));
} else {
// login failed, show an error message
\Messages::error(__('user.login.failure'));
}
}
// display the login page
$this->theme->set_partial('content', 'user/login');
}
示例8: action_recover
public function action_recover($hash = null)
{
/*
* https://myturbotax.intuit.com/account-recovery?offering_id=Intuit.cg.myturbotax&username=daniel.rodas1&locale=en-Us&offering_env=prd&confirmation_id=910855&namespace_id=50000003
*/
//email use a link
// was the lostpassword form posted?
if (\Input::method() == 'POST') {
// do we have a posted email address?
if ($email = \Input::post('email')) {
// do we know this user?
if ($user = \Model\Auth_User::find_by_email($email)) {
// generate a recovery hash
$hash = \Auth::instance()->hash_password(\Str::random()) . $user->id;
// and store it in the user profile
\Auth::update_user(array('lostpassword_hash' => $hash, 'lostpassword_created' => time()), $user->username);
\Package::load('email');
$email = \Email::forge();
$data = array();
$hash = Crypt::encode($hash, 'R@nd0mK~Y');
$data['url'] = \Uri::create('user/password/recover/' . $hash);
$data['user'] = $user;
// use a view file to generate the email message
$email->html_body(View::forge('user/password/email', $data));
// give it a subject
$email->subject('RN | WJS Password Recovery');
// $email->subject(__('user.login.password-recovery'));
// add from- and to address
// $from = \Config::get('application.email-addresses.from.website');
// $from = array('email' => 'daniel.rodas1@yahoo.com', 'name' => 'RN | Wall Street Journal');
// $email->from($from['email']);
$email->from('daniel.rodas1@yahoo.com');
$email->to($user->email);
// and off it goes (if all goes well)!
try {
// send the email
// $email->send();
\Messages::success('Please check your email for instructions to reset your password');
// \Messages::success(__('user.login.recovery-email-send'));
\Response::redirect('user/password/confirm/' . $user->id);
} catch (\EmailValidationFailedException $e) {
\Messages::error('INVALID EMAIL !');
\Messages::error($e->getMessage());
// \Messages::error(__('user.login.invalid-email-address'));
\Response::redirect_back();
} catch (\Exception $e) {
// log the error so an administrator can have a look
logger(\Fuel::L_ERROR, '*** Error sending email (' . __FILE__ . '#' . __LINE__ . '): ' . $e->getMessage());
// \Messages::error($e->getMessage());
\Messages::error('ERROR SENDING EMAIL !');
// \Messages::error(__('user.login.error-sending-email'));
}
}
} else {
// inform the user and fall through to the form
\Messages::error(__('user.login.error-missing-email'));
}
// inform the user an email is on the way (or not ;-))
\Messages::info(__('user.login.recovery-email-send'));
\Response::redirect_back();
} elseif ($hash !== null) {
$hash = Crypt::decode($hash, 'R@nd0mK~Y');
// get the userid from the hash
$user = substr($hash, 44);
// and find the user with this id
if ($user = \Model\Auth_User::find_by_id($user)) {
// do we have this hash for this user, and hasn't it expired yet (we allow for 24 hours response)?
if (isset($user->lostpassword_hash) and $user->lostpassword_hash == $hash and time() - $user->lostpassword_created < 86400) {
// invalidate the hash
\Auth::update_user(array('lostpassword_hash' => null, 'lostpassword_created' => null), $user->username);
// log the user in and go to the profile to change the password
if (\Auth::instance()->force_login($user->id)) {
// \Messages::info('LOGGED IN');
$tempPass = \Auth::instance()->reset_password($user->username);
if ($tempPass) {
// \Messages::info(__('user.login.password-recovery-accepted'));
\Messages::info("Your temporary password is : {$tempPass} ");
\Response::redirect('backend/account/index/password');
} else {
return 'Something went wrong resetting password';
// something wrong with the hash
// \Messages::error(__('user.login.recovery-hash-invalid'));
// \Response::redirect_back();
}
}
}
}
// something wrong with the hash
\Messages::error(__('user.login.recovery-hash-invalid'));
\Response::redirect_back();
} else {
// display the login page
$this->template->content = View::forge('user/password/recover');
}
}
示例9: action_final_response
public function action_final_response($param = false)
{
$post = \Input::post();
if (isset($post['payment_status']) && $post['payment_status'] != '') {
\Messages::info(__('Thank you for your order. The current status of your payment is :status. You can check your order and payment status at My Pluris page.', array('status' => $post['payment_status'])));
\Response::redirect(\Uri::front_create('order/checkout/final'));
}
}
示例10: action_paypal
/**
* Checkout step - Payment
*
* @access public
*/
public function action_paypal()
{
if (\Session::get('payment_key', false)) {
\View::set_global('title', 'Redirecting to Pay Pal...');
$purchase_page = \Page\Model_Page::get_locked_pages('purchase_page', true);
// Check if we have selected products to purchase
\Session::get('checkout.products', false) or \Response::redirect(\Uri::front_create('page/' . $purchase_page->seo->slug));
if (\Input::post('save')) {
$form = $this->save_order();
}
// Expire session key
\Session::delete('payment_key');
$this->page_theme = \Theme::instance()->set_partial('content', $this->view_dir . 'paypal');
isset($form) and $this->page_theme->set('payment_form', $form, false);
} else {
\Messages::info('Your payment session key has expired. Please return to checkout process and try again.');
\Response::redirect(\Uri::front_create());
}
}
示例11: action_video
public function action_video()
{
$url = \Input::post('url', false);
$return['response'] = false;
if ($url) {
$youtube = \App\Youtube::forge();
$video = $youtube->parse($url)->get();
if (isset($video) && $video) {
$return['response'] = $video;
\Messages::success('Video found! Please check found data');
} else {
\Messages::error('Please check video URL and try again.');
}
} else {
\Messages::info('Please insert video URL');
}
$return['message'] = \Messages::display('left', false);
echo json_encode($return);
exit;
}
示例12: action_clear_cart
public function action_clear_cart()
{
$items = \Cart::items();
$order = null;
if (is_numeric(\Session::get('order.id'))) {
$order = \Order\Model_Order::find_one_by_id(\Session::get('order.id'));
}
if ($order) {
$order->delete();
}
if ($items) {
foreach ($items as $item) {
// Find artworks
if ($unique_id = $item->get('unique_id')) {
if ($artworks = \Order\Model_Artwork::find(array('where' => array('unique_id' => $unique_id, 'order_id' => \Session::get('order.id'))))) {
$ysi = \Yousendit\Base::forge();
// Artworks (update, delete)
foreach ($artworks as $artwork) {
// Remove deleted artwork
if ($artwork->file_id) {
$ysi->delete_artwork($artwork->file_id);
}
}
}
}
}
}
// Delete order & cart session
\Session::delete('order.id');
\Cart::clear();
\Messages::info('Your cart is empty.');
if (\Input::is_ajax()) {
echo \Messages::display();
exit;
} else {
\Response::redirect(\Input::referrer(\Uri::create('order/checkout/address')));
}
}
示例13: action_link
public function action_link()
{
// fetch the oauth provider from the session (if present)
$provider = \Session::get('auth-strategy.authentication.provider', false);
if ($provider) {
# code...
// get the auth-strategy data from the session (created by the callback)
$user_hash = \Session::get('auth-strategy.user', array());
// populate the registration form with the data from the provider callback
$fullname = \Arr::get($user_hash, 'name');
$email = \Arr::get($user_hash, 'email');
// Check if Provider user has a local account.
$userExists = Model_User::find('first', array('where' => array(array('email', $email)), 'select' => array('id')));
if ($userExists) {
\Auth::force_login($userExists->id);
$this->link_provider($userExists->id);
\Response::redirect();
}
$serial = time() . '' . rand(55, time());
$password = $serial . '' . $fullname . '' . time();
$user = \Auth::create_user($email, $password, $email, 1, array('serial' => $serial, 'fullname' => $fullname));
\Auth::force_login($user);
$this->link_provider($user);
\Messages::info("5 articles left to read for {$email}");
\Response::redirect('/');
}
}