本文整理汇总了PHP中authorize函数的典型用法代码示例。如果您正苦于以下问题:PHP authorize函数的具体用法?PHP authorize怎么用?PHP authorize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authorize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(HotelInterface $hotel, TaxInterface $tax, CountryInterface $country)
{
$this->hotel = $hotel;
$this->tax = $tax;
$this->country = $country;
authorize('manage_hotels');
}
开发者ID:huudo,项目名称:bds1,代码行数:7,代码来源:HotelController.php
示例2: __construct
public function __construct(RoomInterface $room, TaxInterface $tax, HotelInterface $hotel)
{
$this->room = $room;
$this->roomtype = $tax;
$this->hotel = $hotel;
authorize('manage_rooms');
}
开发者ID:huudo,项目名称:bds1,代码行数:7,代码来源:RoomController.php
示例3: request_token
function request_token($tmhOAuth)
{
$code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''), array('oauth_callback' => tmhUtilities::php_self()));
if ($code == 200) {
$_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
authorize($tmhOAuth);
} else {
outputError($tmhOAuth);
}
}
开发者ID:nvdnkpr,项目名称:Tampon,代码行数:10,代码来源:oauth.php
示例4: massdel
public function massdel(Request $request)
{
authorize('delete_users');
try {
$this->user->massdel($request);
return redirect()->back()->with('Mess', 'Đã xóa!');
} catch (NullException $e) {
return redirect()->back()->with('errorMess', $e->getErrors());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:10,代码来源:UserController.php
示例5: createAccount
function createAccount($email, $name)
{
$query = "INSERT INTO accounts (`email`, `fullname`) VALUES (" . sqlSafe($email) . ", " . sqlSafe($name) . ")";
if (writeQuery($query)) {
authorize($email);
return true;
} else {
var_dump(getSQLerrors());
return false;
}
}
开发者ID:CMP-Studio,项目名称:EmuObjectMover,代码行数:11,代码来源:auth.php
示例6: store
public function store(Request $request)
{
authorize('create_services');
DB::beginTransaction();
try {
$this->services->create($request);
DB::commit();
return redirect()->route('admin.services.index')->with('Mess', 'Thêm thành công');
} catch (ValidateException $e) {
DB::rollBack();
return redirect()->back()->withInput()->withErrors($e->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:13,代码来源:ServicesController.php
示例7: massdel
public function massdel(Request $request)
{
authorize('delete_tags');
DB::beginTransaction();
try {
$this->tag->massdel($request);
DB::commit();
return redirect()->back()->with('Mess', 'Đã xóa!');
} catch (ExcuteNullException $e) {
DB::rollBack();
return redirect()->back()->with('errorMess', $e->getErrors());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:13,代码来源:TagController.php
示例8: request_token
function request_token($tmhOAuth)
{
$code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''), array('oauth_callback' => tmhUtilities::php_self()));
if ($code == 200) {
$_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
if (isset($_SESSION['account']['id'])) {
// We already have a logged in user account
authorize($tmhOAuth);
} else {
authenticate($tmhOAuth);
}
} else {
outputError($tmhOAuth);
}
}
开发者ID:rlucia,项目名称:Circular,代码行数:15,代码来源:oauth.php
示例9: source
function source($submitid)
{
global $is_admin;
global $mysqli_;
if (1 != $is_admin) {
authorize();
}
// параметры
if (!isset($submitid)) {
fail(_error_no_submit_id_code);
}
// читаем данные
$query = $mysqli_->prepare('select S.source, S.contestid, S.userid, U.nickname, L.desc, S.submittime, S.message from ((select Si.contestId, Si.userid, Si.langId, Si.source, Si.submittime, Si.message from `submit` Si where Si.submitID=?) S inner join `user` U on S.userid=U.id) inner join Lang L on S.langId=L.langId');
$query->bind_param('i', $submitid);
$query->bind_result($source, $contestid, $userid, $nickname, $language, $submitdate, $submitmessage);
if (!$query->execute()) {
fail(_error_mysql_query_error_code);
}
// auto-close of query
$query->store_result();
if (0 == $query->num_rows) {
fail(_error_no_submit_found_code);
}
// auto-close of quert
$query->fetch();
if ('' == $source) {
fail(_error_submit_source_is_empty_code);
}
// auto-close of query
$query->close();
// конец считывания данных
data('source', $source);
data('submitid', $submitid);
data('contestid', $contestid);
data('nickname', $nickname);
data('userid', $userid);
data('language', $language);
data('submitdate', $submitdate);
data('submitmessage', $submitmessage);
data('top', isset($_GET['top']) ? $_GET['top'] : -1);
data('topuserid', isset($_GET['userid']) ? $_GET['userid'] : -1);
}
开发者ID:bearf,项目名称:xicl-web-interface,代码行数:42,代码来源:source.php
示例10: set_access
function set_access($allModules, $userRights)
{
$data = array();
for ($i = 0, $c = count($allModules); $i < $c; $i++) {
$row = array();
for ($j = 0, $c2 = count($userRights); $j < $c2; $j++) {
if ($userRights[$j]["rr_modulecode"] == $allModules[$i]["mod_modulecode"]) {
if (authorize($userRights[$j]["rr_create"]) || authorize($userRights[$j]["rr_edit"]) || authorize($userRights[$j]["rr_delete"]) || authorize($userRights[$j]["rr_view"])) {
$row["menu"] = $allModules[$i]["mod_modulegroupcode"];
$row["menu_name"] = $allModules[$i]["mod_modulename"];
$row["page_name"] = $allModules[$i]["mod_modulepagename"];
$row["create"] = $userRights[$j]["rr_create"];
$row["edit"] = $userRights[$j]["rr_edit"];
$row["delete"] = $userRights[$j]["rr_delete"];
$row["view"] = $userRights[$j]["rr_view"];
$data[$allModules[$i]["mod_modulegroupcode"]][$userRights[$j]["rr_modulecode"]] = $row;
$data[$allModules[$i]["mod_modulegroupcode"]]["top_menu_name"] = $allModules[$i]["mod_modulegroupname"];
}
}
}
}
return $data;
}
开发者ID:jangraravik,项目名称:scripts,代码行数:23,代码来源:user.php
示例11: task_data
function task_data($db_id)
{
global $dv_conf;
$dd = get_dd($db_id);
if (!authorize($dd)) {
print '<br /><p class="error">Sorry, you are not authorized to view this page.</p>';
return;
}
$filter = strtolower(Request::getVar('type', 'json'));
$file = JPATH_COMPONENT . DS . "filter/{$filter}.php";
if (file_exists($file)) {
require_once $file;
}
if ($dd) {
$link = get_db();
$sql = query_gen($dd);
$res = get_results($sql, $dd);
print filter($res, $dd);
exit(0);
} else {
print print "<p class=\"error\">Invalid Request</p>";
exit(1);
}
}
开发者ID:zooley,项目名称:hubzero-cms,代码行数:24,代码来源:controller.php
示例12: authorize
<?
// управление заказчиками
include_once $GLOBALS["DOCUMENT_ROOT"]."/lib/sql.php";
authorize(); // вызов авторизации
if (isset($edit) || isset($add) ) {
if (!isset($accept)) {
if ($edit) {
$sql = "SELECT * FROM customers WHERE id='".$edit."'";
$res = mysql_query($sql);
$rs=mysql_fetch_array($res);
}
echo "<form method=post id=editform action='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."'>";
echo "<input type='hidden' value='".(isset($edit)?$edit:"0")."' name='edit'>";
echo "<input type=hidden name=tid value=$tid>";
if (isset($order)) echo "<input type=hidden name=order value=$order>";
if (isset($idstr)) echo "<input type=hidden name=idstr value=$idstr>";
if (isset($find))echo "<input type=hidden name=find value=$find>";
if (isset($all)) echo "<input type=hidden name=all value=$all>";
echo "<input type=hidden name=accept value='yes'>";
echo "Краткое название (имя каталога):<input type=text name=customer size=20 value='".$rs["customer"]."'><br>";
echo "Полное название (для теззаданий): <input type=text name=fullname size=50 value='".$rs["fullname"]."'><br>";
echo "Каталог на диске К (для сверловок): <input type=text name=kdir size=50 value='".$rs["kdir"]."'><br>";
echo "<input type=button value='Сохранить' onclick=\"editrecord('customers',$('#editform').serialize())\"><input type=button value='Отмена' onclick='closeedit()'>";
} else {
// сохрнение
if ($edit) {
// редактирование
$sql = "UPDATE customers SET customer='$customer', fullname='$fullname', kdir='$kdir' WHERE id='$edit'";
开发者ID:GGF,项目名称:oldbaza,代码行数:31,代码来源:customers.php
示例13: authorize
require_once './config/require.php';
if (isset($firstattempt)) {
authorize();
}
// попытка войти
if (isset($login) && isset($password)) {
if (time() - $login_lastaccess < antiSpamTimeOut) {
$header = 'Не удалось войти в систему';
$message = 'В целях защиты от спама не разрешается делать попытки входа в систему с интервалом между ними менее ' . antiSpamTimeOut . ' секунд. Попробуйте повторить запрос позже.';
} else {
$q = $mysqli_->prepare('SELECT id,nickname,is_admin FROM `user` WHERE login=? AND `password`=password(?)');
$q->bind_param('ss', $login, $password);
$q->bind_result($curuserid, $curnickname, $is_admin);
if ($q->execute() && $q->fetch()) {
$authorized = 1;
$curlogin = $login;
$curpass = $password;
$message = 'Вход в систему произведен успешно';
} else {
$message = 'Не удалось выполнить операцию сверки имени пользователя и пароля. Возможно, login или пароль введены неверно. Попробуйте повторить запрос позже.';
}
$q->close();
}
$login_lastaccess = time();
} else {
$message = "Не указаны все необходимые параметры. Попробуйте повторить запрос позже.";
}
// конец попытки войти
data('message', $message);
authorize($data);
开发者ID:bearf,项目名称:xicl-web-interface,代码行数:30,代码来源:login.php
示例14: exit
<?php
if (!defined('REST')) {
exit('Access Denied');
}
include_once "class_pwd.php";
include_once "config_common.php";
include_once "config_sql.php";
include_once "class_response.php";
$restID = $_POST["rest_id"];
$restKey = $_POST["rest_key"];
$restName = $_POST["rest_name"];
if (!authorize($restID, $restKey, $restName)) {
$response = new Response();
$response->status = 0;
$response->msg = "authorize failed";
} else {
$pwd = new PWD();
$response = $pwd->get();
}
echo $response;
开发者ID:riidt,项目名称:rest,代码行数:21,代码来源:read.php
示例15: dupe_comments
function dupe_comments($GroupID, $Comments)
{
global $DB, $LoggedUser;
authorize();
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($GroupID)) {
error(403);
}
$DB->query("\n\t\tSELECT SHA1(Comments) AS CommentHash\n\t\tFROM dupe_groups\n\t\tWHERE ID = {$GroupID}");
list($OldCommentHash) = $DB->next_record();
if ($OldCommentHash != sha1($Comments)) {
$AdminComment = sqltime() . " - Linked accounts updated: Comments updated by " . $LoggedUser['Username'];
if ($_POST['form_comment_hash'] == $OldCommentHash) {
$DB->query("\n\t\t\t\tUPDATE dupe_groups\n\t\t\t\tSET Comments = '" . db_string($Comments) . "'\n\t\t\t\tWHERE ID = '{$GroupID}'");
} else {
$DB->query("\n\t\t\t\tUPDATE dupe_groups\n\t\t\t\tSET Comments = CONCAT('" . db_string($Comments) . "\n\n',Comments)\n\t\t\t\tWHERE ID = '{$GroupID}'");
}
$DB->query("\n\t\t\tUPDATE users_info AS i\n\t\t\t\tJOIN users_dupes AS d ON d.UserID = i.UserID\n\t\t\tSET i.AdminComment = CONCAT('" . db_string($AdminComment) . "\n\n', i.AdminComment)\n\t\t\tWHERE d.GroupID = {$GroupID}");
}
}
开发者ID:Kufirc,项目名称:Gazelle,代码行数:22,代码来源:linkedfunctions.php
示例16: invite
function invite($teamid, $mode)
{
global $is_admin;
global $mysqli_;
if (1 != $is_admin) {
authorize();
}
// параметры
if (!isset($teamid)) {
return _error_no_team_id_code;
}
// запрос на проверку существования команды
if (-1 < $teamid) {
$query = $mysqli_->prepare('select count(*) from `teams` T where T.teamID=?');
$query->bind_param('i', $teamid);
$query->bind_result($count);
if (!$query->execute()) {
fail(_error_mysql_query_error_code);
}
// auto-close of query
$query->fetch();
if (0 == $count) {
return _error_no_team_found_code;
}
// auto-close of query
$query->close();
}
// конец проверки существования команды
// проверяем, что команда еще не приглашена
$query = $mysqli_->prepare('select count(*) from `teams` T where T.teamID=? and T.invited=1-?');
$query->bind_param('ii', $teamid, $mode);
$query->bind_result($count);
if (!$query->execute()) {
fail(_error_mysql_query_error_code);
}
// auto-close of query
$query->fetch();
if (0 == $count && 1 == $mode) {
return _error_team_already_invited_code;
}
// auto-close of query
if (0 == $count && 0 == $mode) {
return _error_team_not_invited_code;
}
// auto-close of query
$query->close();
// проставляем галочку
$query = $mysqli_->prepare('update `teams` set invited=? where teamid=?');
$query->bind_param('ii', $mode, $teamid);
if (!$query->execute() || 0 == $query->affected_rows) {
fail(_error_mysql_query_error_code);
}
// auto-close of query
$query->close();
// пытаемся отправить уведомление
global $messages;
$code = notify(-1, $teamid, 1 == $mode ? $messages[_header_you_are_invited_code] : $messages[_header_you_are_fired_code], 1 == $mode ? $messages[_message_you_are_invited_code] : $messages[_message_you_are_fired_code]);
if (_success_notify_added_code != $code) {
return $code;
}
// конец попытки отправить уведомление
return 1 == $mode ? _success_team_invited_code : _success_team_declined_code;
}
开发者ID:bearf,项目名称:xicl-web-interface,代码行数:63,代码来源:invite.php
示例17: strlen
* Please bear in mind, that this software was written for _fun_ =)
*************************/
/************************
* Usersnew - add new users to the station admin panel
*----------------------------------------
* This page will allow the registration of new users to the station. This simply
* inludes the creation of a new account.
*
* 2DO - Tie to XMLRPC Interface
************************/
include("init.inc.php"); # include the global framwork
include("classes/sendMail.class.php"); # include the mail sender
$myNav->add($SECTION[USERS],'users.php'); # add entry to Navigation Bar Stack
$myNav->add($SECTION[USERSNEW],'usersnew.php'); # add entry to Navigation Bar Stack
authorize('edit_users'); # check access rights
/**
* random_char() - will return a random charachter
*
* @param $string -- string to pick a random charachter from
* @return char
*
* Alexey Koulikov - 12.01.2001
*/
function random_char($string){
$length = strlen($string);
$position = mt_rand(0, $length - 1);
return($string[$position]);
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:30,代码来源:usersnew.php
示例18: json_encode
echo json_encode($fotosDAO->selectAll(), JSON_NUMERIC_CHECK);
exit;
});
$app->get('/fotos/:id/?', authorize(), function ($id) use($fotosDAO) {
header("Content-Type: application/json");
echo json_encode($fotosDAO->selectById($id), JSON_NUMERIC_CHECK);
exit;
});
$app->post('/fotos/?', authorize(), function () use($app, $fotosDAO) {
header("Content-Type: application/json");
$post = $app->request->post();
if (empty($post)) {
$post = (array) json_decode($app->request()->getBody());
}
echo json_encode($fotosDAO->insert($post), JSON_NUMERIC_CHECK);
exit;
});
$app->delete('/fotos/:id/?', authorize(), function () use($fotosDAO) {
header("Content-Type: application/json");
echo json_encode($fotosDAO->delete());
exit;
});
$app->put('/fotos/:id/?', authorize(), function () use($app, $fotosDAO) {
header("Content-Type: application/json");
$post = $app->request->post();
if (empty($post)) {
$post = (array) json_decode($app->request()->getBody());
}
echo json_encode($fotosDAO->update($id, $post), JSON_NUMERIC_CHECK);
exit;
});
开发者ID:jessjoanna,项目名称:Photochallenge,代码行数:31,代码来源:fotos.php
示例19: __construct
public function __construct(TaxInterface $tax, BannerInterface $banner)
{
$this->bannergroup = $tax;
$this->banner = $banner;
authorize('manage_bannergroups');
}
开发者ID:huudo,项目名称:bds1,代码行数:6,代码来源:BannerGroupController.php
示例20:
<?php
if (authorize($_SESSION["access_module"]["INVT"]["PURCHASES"]["edit"])) {
?>
<button class="btn btn-sm btn-info" type="button"><i class="fa fa-edit"></i> EDIT</button>
<?php
}
?>
<?php
if (authorize($_SESSION["access_module"]["INVT"]["PURCHASES"]["view"])) {
?>
<button class="btn btn-sm btn-warning" type="button"><i class="fa fa-search-plus"></i> VIEW</button>
<?php
}
?>
<?php
if (authorize($_SESSION["access_module"]["INVT"]["PURCHASES"]["delete"])) {
?>
<button class="btn btn-sm btn-danger" type="button"><i class="fa fa-trash-o"></i> DELETE</button>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody></table>
</div>
</div>
开发者ID:jangraravik,项目名称:scripts,代码行数:31,代码来源:purchases.php
注:本文中的authorize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论