本文整理汇总了PHP中account::logged_in方法的典型用法代码示例。如果您正苦于以下问题:PHP account::logged_in方法的具体用法?PHP account::logged_in怎么用?PHP account::logged_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account
的用法示例。
在下文中一共展示了account::logged_in方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: not_logged_in_action
public function not_logged_in_action()
{
if (account::logged_in()) {
//y u lie tho?
page::redirect('/world');
}
}
示例2: __construct
public function __construct()
{
//the whole world needs both, valid account and character
if (!account::logged_in()) {
page::redirect('/account/not-logged-in');
}
if (!character::selected()) {
page::redirect('/character/select');
}
}
示例3: select_action
public function select_action($id)
{
character::unselect();
if (!account::logged_in()) {
page::redirect('/account/not-logged-in');
}
if ($id) {
$id = (int) $id;
$q = db::query('select count(*) from ' . character::table_name() . ' where id=? and account_id=?', $id, account::current()->id);
$count = $q->fetchColumn(0);
if (!$count) {
//character doesn't exist or this isn't your character, reload
//the character selection (AND DONT TRY TO FUCK WITH ME!)
page::redirect('/character/select');
}
character::select($id);
page::redirect('/world');
}
$characters = character::load(account::current()->id, 'account_id');
$this->set('characters', $characters->fetchAll());
}
示例4: info_action
public function info_action($id)
{
$char = null;
if (!$id) {
if (!account::logged_in()) {
return api::result(false, array('message' => 'Not_logged_in'));
}
if (!character::selected()) {
return api::result(false, array('message' => 'No_character_selected'));
}
$char = character::current();
} else {
if (is_numeric($id)) {
$char = character::load_one((int) $id);
} else {
$char = character::load_one($id, 'name');
}
if (!$char) {
//character doesn't exist
return api::result(false, array('message' => 'Character_not_found'));
}
}
return api::result(true, $char->info());
}
示例5: index_action
public function index_action()
{
if (account::logged_in()) {
page::redirect('/world');
}
}
示例6: create
public static function create($name, $gender = character::GENDER_MALE, $account = null)
{
$acc = null;
if ($acc instanceof account) {
$acc = $account;
} else {
if (is_numeric($account)) {
$acc = account::load_one($account);
} else {
if (is_string($account)) {
$acc = account::load_one($account, 'email');
} else {
if (!account::logged_in()) {
return false;
} else {
$acc = account::current();
}
}
}
}
$char = new static();
$char->name = $name;
$char->account_id = $acc->id;
$char->save();
//actually just for getting the ID and attach the real shit
$char->gender = $gender;
$char->save();
return $char;
}