本文整理汇总了PHP中authorize函数的典型用法代码示例。如果您正苦于以下问题:PHP authorize函数的具体用法?PHP authorize怎么用?PHP authorize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authorize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(HotelInterface $hotel, TaxInterface $tax, CountryInterface $country)
{
$this->hotel = $hotel;
$this->tax = $tax;
$this->country = $country;
authorize('manage_hotels');
}
示例2: __construct
public function __construct(RoomInterface $room, TaxInterface $tax, HotelInterface $hotel)
{
$this->room = $room;
$this->roomtype = $tax;
$this->hotel = $hotel;
authorize('manage_rooms');
}
示例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);
}
}
示例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());
}
}
示例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;
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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'";
示例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);
示例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;
示例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}");
}
}