本文整理汇总了PHP中Authentication::is_admin方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::is_admin方法的具体用法?PHP Authentication::is_admin怎么用?PHP Authentication::is_admin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::is_admin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write_rejudge_all
function write_rejudge_all()
{
if (Authentication::is_admin() and $this->entity->submitable()) {
$this->write_block_begin('Rejudge submissions');
$this->write_form_begin($this->nav_script(null) . $this->entity->path() . "?rejudge_all=1", 'post');
$this->write_form_end('Rejudge all submissions for this entity');
$this->write_block_end();
}
}
示例2: is_allowed_file
function is_allowed_file($subm, $entity, $user, $dir, $filename)
{
if (strpos($dir, '..') !== false) {
return false;
// security
}
if (!$user->is_admin && !$subm->is_made_by($user)) {
return false;
// other user's submission
}
if ($dir == 'code') {
// the file send by the user
return array(true, $subm->code_filename($filename));
} else {
if ($dir == 'out') {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$base = pathinfo($filename, PATHINFO_FILENAME);
if ($filename == 'compiler.err') {
$ok = $entity->show_compile_errors() || Authentication::is_admin();
} else {
if ($ext == 'err') {
$ok = $entity->show_runtime_errors_for($base) || Authentication::is_admin();
} else {
if ($ext == 'out' || $ext == 'diff') {
$ok = $entity->show_input_output_for($base) || Authentication::is_admin();
} else {
$ok = false;
}
}
}
if ($ok) {
return array(true, $subm->output_filename($filename));
}
} else {
if ($dir == 'in') {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$base = pathinfo($filename, PATHINFO_FILENAME);
if ($ext == 'desc') {
$ok = true;
} else {
if ($ext == 'in' || $ext == 'out') {
$ok = $entity->show_input_output_for($base) || Authentication::is_admin();
} else {
$ok = false;
}
}
if ($ok) {
return array(false, $subm->input_filename($filename));
}
}
}
}
return false;
// unknown file
}
示例3: write_body
function write_body()
{
if (Authentication::is_admin()) {
$this->write_error_log();
}
if ($this->entity->submitable()) {
$this->write_submitable_page();
} else {
$this->write_overview_page();
}
}
示例4: write_tabbar
function write_tabbar()
{
// documentation.php paths are not the same as entity paths
$is_doc = Util::current_script_is('documentation.php');
if (Authentication::current_user()) {
$this->write_tabbar_link('index.php', 'Courses', !$is_doc);
} else {
$this->write_tabbar_link('login.php', 'Log in', !$is_doc);
}
if (Authentication::is_admin()) {
$this->write_tabbar_link('admin_submissions.php', 'Latest submissions', !$is_doc);
$this->write_tabbar_link('admin_results.php', 'Results table', !$is_doc);
$this->write_tabbar_link('admin_print.php', 'Print submissions', !$is_doc);
$this->write_tabbar_link('admin_user.php', 'Users', !$is_doc);
$this->write_tabbar_link('admin_judge_daemons.php', 'Judges', !$is_doc);
$this->write_tabbar_link('admin_view_log.php', 'Error log', !$is_doc);
}
$this->write_tabbar_link('documentation.php', 'Documentation', $is_doc);
}
示例5: 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");
}
}