本文整理汇总了PHP中fAuthorization类的典型用法代码示例。如果您正苦于以下问题:PHP fAuthorization类的具体用法?PHP fAuthorization怎么用?PHP fAuthorization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fAuthorization类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: submit
public function submit($problem_id)
{
try {
$problem = new Problem($problem_id);
$language = fRequest::get('language', 'integer');
if (!array_key_exists($language, static::$languages)) {
throw new fValidationException('Invalid language.');
}
fSession::set('last_language', $language);
$code = trim(fRequest::get('code', 'string'));
if (strlen($code) == 0) {
throw new fValidationException('Code cannot be empty.');
}
if ($problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
}
}
$record = new Record();
$record->setOwner(fAuthorization::getUserToken());
$record->setProblemId($problem->getId());
$record->setSubmitCode($code);
$record->setCodeLanguage($language);
$record->setSubmitDatetime(Util::currentTime());
$record->setJudgeStatus(JudgeStatus::PENDING);
$record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
$record->setVerdict(Verdict::UNKNOWN);
$record->store();
Util::redirect('/status');
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
Util::redirect("/submit?problem={$problem_id}");
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:35,代码来源:SubmitController.php
示例2: login_authenticate
function login_authenticate($db, $username, $password)
{
if ($row = login_check_credential($db, $username, $password)) {
fAuthorization::setUserToken(array('id' => $row['id'], 'name' => $username, 'email' => $row['email'], 'display_name' => $row['display_name']));
return true;
}
return false;
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:8,代码来源:core.php
示例3: requireEmailVerified
public static function requireEmailVerified()
{
if (!fAuthorization::checkLoggedIn()) {
return;
}
if (User::hasEmailVerified()) {
return;
}
fMessaging::create('warning', 'You are required to verify your email address before doing this action.');
Util::redirect('/email/verify');
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:11,代码来源:User.php
示例4: render
protected function render($name)
{
// before output page
// if the visitor is anonymous
// do NOT send Set-Cookie to enable caching of Varnish
if (!fAuthorization::checkLoggedIn()) {
header_remove('Set-Cookie');
}
// then output page
profiler_render_begin();
include __DIR__ . '/../views/' . $name . '.php';
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:12,代码来源:ApplicationController.php
示例5: index
public function index()
{
if (fAuthorization::checkLoggedIn()) {
$this->cache_control('private', 2);
} else {
$this->cache_control('private', 5);
}
$top = fRequest::get('top', 'integer');
$this->owner = trim(fRequest::get('owner'));
$this->problem_id = trim(fRequest::get('problem'));
$this->language = trim(fRequest::get('language'));
$this->verdict = trim(fRequest::get('verdict'));
$this->page = fRequest::get('page', 'integer', 1);
$this->records = Record::find($top, $this->owner, $this->problem_id, $this->language, $this->verdict, $this->page);
$this->page_records = $this->records;
$common_url = SITE_BASE . "/status?owner={$this->owner}&problem={$this->problem_id}&language={$this->language}&verdict={$this->verdict}";
$this->top_url = "{$common_url}&top=";
$this->page_url = "{$common_url}&page=";
$this->nav_class = 'status';
$this->render('record/index');
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:21,代码来源:RecordController.php
示例6: show
public function show($id)
{
if (fAuthorization::checkLoggedIn()) {
$this->cache_control('private', 30);
} else {
$this->cache_control('private', 60);
}
try {
$this->problem = new Problem($id);
if ($this->problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now.');
}
}
$this->nav_class = 'problems';
$this->render('problem/show');
} catch (fExpectedException $e) {
fMessaging::create('warning', $e->getMessage());
fURL::redirect(Util::getReferer());
} catch (fUnexpectedException $e) {
fMessaging::create('error', $e->getMessage());
fURL::redirect(Util::getReferer());
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:24,代码来源:ProblemController.php
示例7: dirname
<?php
include dirname(__FILE__) . '/../inc/init.php';
fAuthorization::requireLoggedIn();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$debug = fRequest::get('debug', 'boolean');
if (!$debug) {
header('Content-type: application/json');
}
$check_id = fRequest::get('check_id', 'integer');
$check = new Check($check_id);
$url = GRAPHITE_URL . '/graphlot/rawdata?&from=-24hour&until=-0hour' . '&target=' . $check->prepareTarget() . '&target=keepLastValue(threshold(' . $check->prepareWarn() . '))';
// '&target=threshold(' . $check->prepareError() . ')';
$contents = file_get_contents($url);
//$contents = file_get_contents(GRAPHITE_URL . '/graphlot/rawdata?&from=-24hour&until=-0hour&target=' . $check->prepareTarget() . '&target=' . $check->prepareWarn() . '&target=' . $check->prepareError());
print $contents;
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:17,代码来源:get_rawdata.php
示例8: allowQuestion
public function allowQuestion()
{
return $this->isRunning() and (User::isSuper() or $this->checkRegistered(fAuthorization::getUserToken()));
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:4,代码来源:Report.php
示例9: count
<?php
$section = 'categories';
$section_id = 25;
$sub = 'listGcategory';
$typeOfUser = fAuthorization::checkAuthLevel('super');
$where = "";
if (!$typeOfUser) {
$where = " WHERE " . fSession::get('where_at');
}
?>
<?php
$limit = fRequest::encode('limit', 'integer');
$page = fRequest::encode('p', 'integer');
if ($page < 1) {
exit;
}
$start = ($page - 1) * $limit;
$categories = fRecordSet::buildFromSQL('EconomicUnitCategory', "SELECT * FROM economic_unit_categories {$where} LIMIT {$start},{$limit}", "SELECT count(*) FROM economic_unit_categories {$where}", $limit, $page);
if ($categories->count() == 0) {
echo '<div class="notification information" >
Por el momento no hay registros en <b> Categorías de Geolocalización</b>.
</div>';
} else {
$p = new Pagination($categories->getPages(), $categories->getPage(), 3);
$pagination = $p->getPaginationLinks();
?>
<center>
<table class="contenttoc" style="width:auto; float:left">
<tr>
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:31,代码来源:geolocation_category_list.php
示例10: Supplier
<?php
include './resources/init.php';
fAuthorization::requireAuthLevel('admin');
$tmpl->place('header');
?>
<script type="text/javascript" src="./js/admin-supplier-view.js"></script>
</head>
<body>
<div class = "container">
<div id="View" class = "view-frame span-23 last">
<?php
if (!isset($_GET['id'])) {
echo "<div class=\"ui-state-error ui-corner-all\">\n\t\t\t\t\t\t<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 30px;\"></span>\n\t\t\t\t\t\tYou arrived to this page in error</div>";
} else {
try {
$supplier = new Supplier($_GET['id']);
?>
<h2><span id="titleName"><?php
echo $supplier->prepareName();
?>
</span></h2>
<input id="key" type="hidden" value="<?php
echo $supplier->prepareId();
?>
" />
<table>
<tr>
<td width="100"><b>Name</b></td>
<td><span id="supName" class="varInput"><?php
echo $supplier->prepareName();
开发者ID:JhunCabas,项目名称:material-management,代码行数:31,代码来源:admin-supplier-view.php
示例11:
<?php
include './resources/init.php';
fAuthorization::requireAuthLevel('super');
$tmpl->place('header');
?>
<script type="text/javascript" src="./resources/library/jquery.autocomplete/jquery.autocomplete.min.js"></script>
<script type="text/javascript" src="./resources/library/jquery.autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="./resources/library/jquery.blockUI.js"></script>
<link media="screen, projection" href="./resources/library/jquery.autocomplete/jquery.autocomplete.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="./js/admin-stock.js"></script>
<?php
$tmpl->place('menu');
?>
<div id="content" class="span-24 last">
<?php
$tmpl->place('menuAdmin');
?>
<div id="main" class="span-24 last">
<h2>Administration</h2><h3>Stock</h3>
<br />
<form action = "admin-stock.php" method = "get">
<label for="inv_item">Choose Inventory Item: </label>
<span id="inv_item">
<input id="autocompleteItem" name="item"></input>
</span>
<input id="submitBTN" type="submit" value="Submit" />
</form>
<?php
if (isset($_GET['item'])) {
try {
开发者ID:JhunCabas,项目名称:material-management,代码行数:31,代码来源:admin-stock.php
示例12: define
fORM::mapClassToTable('Role', TBL_ROLE);
fORM::mapClassToTable('Permission', TBL_PERMISSION);
fORM::mapClassToTable('Category', TBL_CATEGORY);
fORM::mapClassToTable('UserPermission', TBL_USER_PERMISSION);
fORM::mapClassToTable('Log', 'log');
/* Public Directories & Files */
define('SITE', 'http:' . DS . DS . $_SERVER['HTTP_HOST'] . DS . 'adminv3' . DS);
define('CSS', SITE . 'css' . DS);
define('JS', SITE . 'js' . DS);
define('SCRIPT', JS . 'script' . DS);
define('HOME', SITE . 'home' . DS);
define('BANNER', SITE . 'banner' . DS);
define('GEOLOCATION', SITE . 'geolocation' . DS);
define('USER', SITE . 'user' . DS);
define('CATEGORIES', SITE . 'categories' . DS);
define('LOGOUT', SITE . 'logout' . DS);
define('LOGIN', SITE . 'login' . DS);
define('IMAGES', SITE . 'images' . DS);
define('ICON', IMAGES . 'icon' . DS);
/* Private Directories & Files */
define('INCLUDES', ROOT . 'includes' . DS);
define('LOAD', ROOT . 'load' . DS);
/* Session */
define('SESSION_ID_USER', 'idUser');
define('SESSION_REGIONS', 'regions');
define('SALT', '#^&(!)()');
$db = new fDatabase('mysql', 'adminv2n', 'root', 'tortoise');
fORMDatabase::attach($db);
fAuthorization::setLoginPage(SITE . 'login.php');
fAuthorization::setAuthLevels(array('super' => 100, 'admin' => 80, 'cliente' => 20, 'adminUsers' => 80, 'employee' => 50, 'guest' => 25));
$acceptedFiles = array('image/gif', 'image/bmp', 'image/jpeg', 'image/pjpeg', 'image/png', 'application/msword', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/plain', 'text/richtext', 'text/html', 'video/mpeg', 'video/x-mpeg2', 'video/msvideo', 'video/quicktime', 'video/vivo', 'video/wavelet', 'video/x-sgi-movie', 'video/x-flv', 'video/mp4', 'audio/x-wav', 'audio/x-mp3', 'audio/midi');
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:31,代码来源:config.php
示例13: elseif
<?php
if (fAuthorization::checkLoggedIn() and Registration::has(fAuthorization::getUserToken(), $this->report->getId())) {
?>
<button class="btn btn-mini btn-success disabled">已确认参赛</button>
<?php
} elseif ($this->report->isRegistrable()) {
?>
<form style="display:inline;margin:0" action="<?php
echo SITE_BASE;
?>
/contest/<?php
echo $this->report->getId();
?>
/register" method="POST">
<button type="submit" class="btn btn-mini btn-success">确认参赛</button>
</form>
<?php
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:19,代码来源:_register_btn.php
示例14: testGetLoginPage
public function testGetLoginPage()
{
fAuthorization::setLoginPage('/login/');
$this->assertEquals('/login/', fAuthorization::getLoginPage());
}
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:5,代码来源:fAuthorizationTest.php
示例15: if
<table class="zebra-striped">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Action</th>
</tr></thead><tbody>
<?php
$first = TRUE;
foreach ($users as $user) {
?>
<tr>
<td><?php echo $user->prepareUsername() ?></td>
<td><?php echo $user->prepareEmail() ?></td>
<td><?php if (fSession::get('user_id') == $user->getUserId() || fAuthorization::checkAuthLevel('admin')) { echo '<a href="' . User::makeUrl('edit',$user) . '">Edit</a>'; } ?>
<?php if (fAuthorization::checkAuthLevel('admin') || $user->getUserId() != 1) {
?> <a href="<?php echo User::makeUrl('delete',$user); ?>">Delete</a></td>
<?php } ?>
</tr>
<?php } ?>
</tbody></table>
<?
} catch (fEmptySetException $e) {
?>
<p class="info">There are currently no Tattle users? <a href="<?php echo '<a href="'. User::makeUrl('add'); ?>">Add one now</a></p>
<?php
}
?>
</div>
<?php $tmpl->place('footer') ?>
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:30,代码来源:list_users.php
示例16: foreach
<tr>
<td> <label for="type"> Asentamiento: </label> </td>
<td> <input type="text" size="80" name="reserve" id="reserve" /> </td>
</tr>
<tr>
<td> <label for="type"> Teléfono: </label> </td>
<td> <input type="text" size="80" name="phone" id="phone" /> </td>
</tr>
<?php
if (fAuthorization::checkAuthLevel('super')) {
?>
<tr class="regionRow">
<td><label>Región</label></td>
<td>
<select class="state" name="state">
<option value="0">Estado</option>
<?php
$r = Region::findAll(1);
foreach ($r as $item) {
?>
<option value="<?php
echo $item->prepareIdRegion();
?>
"><?php
echo $item->prepareName();
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:30,代码来源:add.php
示例17: header
<?php
fSession::open();
$idUser = fSession::get(SESSION_ID_USER);
if (empty($idUser) || !fAuthorization::checkACL('banner', 'add')) {
if (empty($idUser)) {
header('Location: ' . SITE);
exit("No se ha podido acceder a esta secci&oacite;n");
}
}
//echo fRequest::encode('id_zone','integer');
//echo fRequest::encode('id_section','integer');
/*
* Add Article
*/
$banner = new Banner();
$banner->setId_zone(fRequest::encode('id_zone', 'integer'));
$banner->setLink(fRequest::encode('link', 'string'));
$banner->setOrder(fRequest::encode('order', 'integer'));
$banner->setId_section(fRequest::encode('id_section', 'integer'));
/* Limited By User Permissions */
$banner->setStatus(fRequest::get('id_state', 'integer'));
try {
$banner->store();
} catch (Exception $e) {
exit("Ha ocurrido un error.");
}
$lastId = $banner->prepareIdBanner();
/*
* Add Region
* Limited By User Permissions
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:31,代码来源:banner_add.php
示例18: disableForAuthorized
/**
* Force disable all cache functions if the session is logged in as per
* fAuthorization::checkLoggedIn();
*/
public static function disableForAuthorized()
{
if (fAuthorization::checkLoggedIn()) {
static::$authorized_override = true;
}
}
开发者ID:rizqidjamaluddin,项目名称:Swoosh,代码行数:10,代码来源:sfPageCache.php
示例19:
<?php
require_once 'init.php';
fSession::close();
fSession::destroy();
fAuthorization::destroyUserInfo();
header('Location: ' . LOGIN);
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:7,代码来源:logout.php
示例20:
echo Profile::fetchGrade(fAuthorization::getUserToken());
?>
">
</div>
</div>
<div class="control-group">
<label class="control-label" for="phone">手机 (必填)</label>
<div class="controls">
<input type="text" class="input-medium" id="phone" name="phone" placeholder="手机" value="<?php
echo Profile::fetchPhoneNumber(fAuthorization::getUserToken());
?>
">
</div>
</div>
<div class="control-group">
<label class="control-label" for="qq">QQ</label>
<div class="controls">
<input type="text" class="input-medium" id="qq" name="qq" placeholder="QQ" value="<?php
echo Profile::fetchQQ(fAuthorization::getUserToken());
?>
">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-success">修改我的个人信息</button>
<a class="btn" href="javascript:history.go(-1);void(0);">取消</a>
</div>
</fieldset>
</form>
<?php
include __DIR__ . '/../layout/footer.php';
开发者ID:daerduoCarey,项目名称:oj,代码行数:31,代码来源:change_info.php
注:本文中的fAuthorization类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论