本文整理汇总了PHP中Time::next_year方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::next_year方法的具体用法?PHP Time::next_year怎么用?PHP Time::next_year使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::next_year方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @fn set
* @short Action method to set the user's home language.
*/
public function set()
{
$lang = isset($_REQUEST['id']) ? $_REQUEST['id'] : 'en';
Cookie::set('hl', $lang, Time::next_year(), '/');
$this->redirect_to_referrer();
$this->redirect_to(array('controller' => 'home'));
}
示例2: login
/**
* @fn login
* @short Action method to perform a login.
*/
function login()
{
if ($this->request->is_post()) {
$conn = Db::get_connection();
$user_factory = new User();
$users = $user_factory->find_all(array('where_clause' => "`username` = '{$conn->escape($_POST['username'])}' AND `password` = '" . md5($_POST['password']) . "'", 'limit' => 1));
if (count($users) > 0) {
$user = $users[0];
$expires = $_POST['leave_me_registered'] ? Time::next_year() : Time::tomorrow();
Cookie::set('_u', $user->username, $expires, "/", FALSE);
Cookie::set('_uid', md5(Login::magic_phrase . $user->password), $expires, "/", FALSE);
// Annotates the login in the database
$user_login = new UserLogin();
$user_login->user_id = $user->id;
$user_login->performed_at = date("Y-m-d H:i:s");
$user_login->save();
$this->flash(sprintf(l('Welcome, %s'), $user->first), 'info');
// When login is required to access a particular action, we may store controller & action in a session,
// perform login, then redirect to the action requested in the first place
if (isset($_SESSION['redirect_to'])) {
$this->redirect_to(array('controller' => $_SESSION['redirect_to']['controller'], 'action' => $_SESSION['redirect_to']['action']));
} else {
$this->redirect_to(array('controller' => 'home'));
}
Db::close_connection($conn);
} else {
$this->flash(l('Bad username / password'), 'error');
}
}
$this->redirect_to(array('action' => 'index'));
}
示例3: set_credentials
/**
* @fn set_credentials($realname, $email, $website)
* @short Stores a set of credentials into a cookie using Base64 encoding.
* @param realname The user's real name.
* @param email The user's email address.
* @param url The user's website URL.
*/
protected function set_credentials($realname = '', $email = '', $url = '')
{
$credentials = $realname . '%%' . $email . '%%' . $url;
$encoded = Base64::encode($credentials);
Cookie::set('_vc', $encoded, Time::next_year());
}
示例4: dirname
<?php
require_once dirname(__FILE__) . "/../include/db.inc.php";
require_once dirname(__FILE__) . "/../include/" . DB_ADAPTER . "_adapter.php";
require_once dirname(__FILE__) . "/../models/user.php";
require_once dirname(__FILE__) . "/../models/titlebar_message.php";
require_once dirname(__FILE__) . "/cookie.php";
require_once dirname(__FILE__) . "/time.php";
require_once dirname(__FILE__) . "/login.php";
require_once dirname(__FILE__) . "/localization.php";
error_reporting(E_ALL | E_NOTICE);
session_name('_eme_sid');
session_set_cookie_params(Time::next_year(), '/');
//session_save_path(dirname(__FILE__) . "/../session");
session_start();
if (isset($_COOKIE['hl'])) {
setlocale(LC_TIME, $_COOKIE['hl']);
}
class ApplicationHelper
{
}