本文整理汇总了PHP中Authentication::current_user方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::current_user方法的具体用法?PHP Authentication::current_user怎么用?PHP Authentication::current_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::current_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_nav_children
function get_nav_children($e)
{
$result = array();
foreach ($e->children() as $e) {
if (!$e->visible()) {
continue;
}
$class = '';
if ($e == $this->entity) {
$class .= 'current ';
if ($e->has_visible_children()) {
$class .= 'ancestor ';
}
} else {
if ($e->is_ancestor_of($this->entity)) {
$class .= 'ancestor ';
}
}
if ($e->submitable()) {
$subm = Authentication::current_user()->status_of_last_submission_to($e);
$class .= Status::to_css_class($subm) . ' ';
}
if (!$e->active()) {
$class .= 'inactive ';
}
$result[] = array('title' => $e->title(), 'url' => $this->nav_script($e) . $e->path(), 'class' => $class);
}
return $result;
}
示例2: init
private static function init()
{
// current user is always in group
$user = Authentication::current_user();
if (!$user) {
UserGroup::$current = array();
} else {
UserGroup::$current = array($user);
}
// get from session
UserGroup::start_session();
foreach ($_SESSION['usergroup'] as $extra_userid) {
UserGroup::$current[] = User::by_id($extra_userid);
}
}
示例3: app_name
function app_name()
{
static $app_name;
if (!$app_name) {
$user = Authentication::current_user();
if ($user && $user->login[0] != 's' && time() / 1000 % 10 == 0) {
// just for fun
$app_name = "Twanthena";
} else {
$app_name = "Justitia";
}
}
return $app_name;
}
示例4: array
<?php
require_once '../lib/bootstrap.inc';
// -----------------------------------------------------------------------------
// Ajax utility: return newest submissions
// -----------------------------------------------------------------------------
if (Authentication::current_user() == false) {
echo '{"logout":"true"}';
} else {
if (Authentication::is_admin() and isset($_GET['entity']) and isset($_GET['submissionid'])) {
try {
// get entity
$entity = Entity::get($_GET['entity'], false, true);
$submissions = $entity->submissions_after($_GET['submissionid']);
$arr = array();
foreach ($submissions as $s) {
$arr[] = $s->submissionid;
}
echo '{"new_ids":' . json_encode($arr) . '}';
} catch (NotFoundException $e) {
exit;
}
} else {
die("You have no rights to view this submission");
}
}
示例5: write_overview_item
function write_overview_item($e)
{
if (!$e->visible()) {
return;
}
$class = '';
if ($e->submitable()) {
$subm = Authentication::current_user()->status_of_last_submission_to($e);
$class .= Status::to_css_class($subm) . ' ';
}
if (!$e->active()) {
$class .= 'inactive ';
}
$this->write_block_begin($e->title(), 'collapsed linky block ' . $class, 'index.php' . $e->path());
$this->write_block_end();
}
示例6: is_admin
static function is_admin()
{
$user = Authentication::current_user();
return $user && $user->is_admin;
}