本文整理汇总了PHP中checkAuthority函数的典型用法代码示例。如果您正苦于以下问题:PHP checkAuthority函数的具体用法?PHP checkAuthority怎么用?PHP checkAuthority使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkAuthority函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listData
public function listData($notice = false)
{
$conditionStr = '';
if ($notice == true) {
$conditionStr = 'WHERE `notice` = "1"';
}
if (($sqlArticle = @mysql_query('SELECT `aid`, `title`, `content`, `visibility`, `notice`
FROM `article` ' . $conditionStr . ' ORDER BY `aid` DESC;')) === false) {
return false;
}
$response = [];
while (($item = @mysql_fetch_assoc($sqlArticle)) !== false) {
$item['aid'] = (int) $item['aid'];
$item['title'] = urldecode($item['title']);
$item['content'] = urldecode($item['content']);
$item['visibility'] = (bool) $item['visibility'];
$item['notice'] = (bool) $item['notice'];
if (!checkAuthority(9) && !$item['visibility']) {
continue;
}
array_push($response, $item);
}
return json_encode($response);
}
示例2: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('second', 'delete')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('second', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$sql = "select * from " . FDB::table("second_goods") . " where gid = " . $id;
$goods = FDB::fetchFirst($sql);
if (empty($goods)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
$result['msg'] = lang('manage', 'manage_delete_success');
createManageLog('second', 'delete', $id, $result['msg']);
FS('Second')->deleteGoods($id);
deleteManageLock('second', $id);
outputJson($result);
示例3: intval
<?php
$share_id = intval($_FANWE['request']['id']);
if ($share_id == 0) {
exit;
}
if (!checkAuthority('share', 'edit')) {
exit;
}
$share = FS("Share")->getShareById($share_id);
if (empty($share)) {
deleteManageLock('share', $share_id);
exit;
}
$manage_lock = checkIsManageLock('share', $share_id);
if ($manage_lock === false) {
createManageLock('share', $share_id);
} else {
exit;
}
$share['share_tags'] = FDB::resultFirst("select group_concat(tag_name SEPARATOR ' ') from " . FDB::table("share_tags") . " where share_id = " . $share['share_id']);
$share_category = FDB::fetchAll("select c.cate_id,c.cate_name from " . FDB::table("share_category") . " as sc left join " . FDB::table("goods_category") . " as c on sc.cate_id = c.cate_id where sc.share_id = " . $share['share_id']);
$fanwe->cache->loadCache("goods_category");
include template('manage/share/edit');
display();
示例4: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('share', 'index')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('share', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$share = FS("Share")->getShareById($id);
if (empty($share)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
$update = array();
if ($share['is_index'] == 0) {
$result['msg'] = lang('manage', 'manage_index_success');
$update['is_index'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_unindex_success');
$update['is_index'] = 0;
示例5: intval
<?php
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
exit;
}
if (!checkAuthority('share', 'edit') && FDB::resultFirst("select uid from " . FDB::table("share") . " where share_id = " . $id) != $_FANWE['uid']) {
exit;
}
$manage_lock = checkIsManageLock('share', $id);
if ($manage_lock === false) {
createManageLock('share', $id);
}
$share = FDB::fetchFirst("select share_id,title,content from " . FDB::table("share") . " where share_id =" . $id);
if (empty($share)) {
deleteManageLock('share', $id);
exit;
}
include template('manage/share/edit');
display();
示例6: listData
public function listData($uid = "")
{
if (($sqlPlugin = @mysql_query('SELECT `pid`, `uid`, `folder`, `cover`, `name`, `author`, `git`, `gitStatus`, `available`
FROM `plugin`
WHERE `uid` LIKE "%' . $uid . '%";')) === false) {
return false;
}
$response = [];
while (($item = @mysql_fetch_assoc($sqlPlugin)) !== false) {
$item['pid'] = (int) $item['pid'];
$item['uid'] = (int) $item['uid'];
$item['folder'] = urldecode($item['folder']);
$item['cover'] = urldecode($item['cover']);
$item['name'] = urldecode($item['name']);
$item['author'] = urldecode($item['author']);
$item['git'] = urldecode($item['git']);
$item['gitStatus'] = (int) $item['gitStatus'];
$item['available'] = (bool) $item['available'];
if (!$item['available'] && !checkAuthority(9)) {
continue;
}
array_push($response, $item);
}
return json_encode($response);
}
示例7: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('event', 'hot')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('event', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$event = FDB::fetchFirst("select * from " . FDB::table("event") . " where id =" . $id);
if (empty($event)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
if ($event['is_hot'] == 0) {
$result['msg'] = lang('manage', 'manage_top_success');
$event['is_hot'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_untop_success');
$event['is_top'] = 0;
}
示例8: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('club', 'top')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('club', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$topic = FS('Topic')->getTopicById($id);
if (empty($topic)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
if ($topic['is_top'] == 0) {
$result['msg'] = lang('manage', 'manage_top_success');
$topic['is_top'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_untop_success');
$topic['is_top'] = 0;
}
示例9: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('share', 'share_best')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('share', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$share = FS("Share")->getShareById($id);
if (empty($share)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
if ($share['is_best'] == 0) {
$result['msg'] = lang('manage', 'manage_share_best_success');
$share['is_best'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_unshare_best_success');
$share['is_best'] = 0;
}
示例10: intval
<?php
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
exit;
}
if (!checkAuthority('album', 'edit')) {
exit;
}
$manage_lock = checkIsManageLock('album', $id);
if ($manage_lock !== false) {
exit;
}
$old = FS('Album')->getAlbumById($id);
if (empty($old)) {
deleteManageLock('album', $id);
exit;
}
$is_flash = (int) $_FANWE['request']['is_flash'];
$is_best = (int) $_FANWE['request']['is_best'];
if ($is_flash == 0) {
if (!empty($old['flash_img'])) {
@unlink(FANWE_ROOT . $old['flash_img']);
}
}
if ($is_best == 0) {
if (!empty($old['best_img'])) {
@unlink(FANWE_ROOT . $old['best_img']);
}
}
$share_id = $old['share_id'];
示例11: fimport
<?php
require fimport('service/share');
$result = array();
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
exit;
}
$share = FS('Share')->getShareById($id);
if (empty($share)) {
$result['status'] = 1;
outputJson($result);
}
if (checkAuthority('share', 'delete')) {
$authoritys = 3;
} else {
$authoritys = FS('Share')->getIsEditShare($share);
}
if ($authoritys == 0) {
$result['status'] = 0;
outputJson($result);
}
$type = intval($_FANWE['request']['type']);
if ($type == 0) {
if ($share['type'] == 'bar_post') {
FS('Topic')->deletePost($id);
} elseif ($share['type'] == 'ask_post') {
FS('Ask')->deletePost($id);
} elseif ($share['type'] == 'album') {
FS('Album')->deleteAlbum($share['rec_id']);
} elseif ($share['type'] == 'album_item') {
示例12: handle
break;
case 'changeLevel':
if (!checkAuthority(9)) {
handle(ERROR_PERMISSION . '01');
}
$uid = getRequest('uid');
$level = max(0, min(9, (int) getRequest('level')));
if (($sqlUser = @mysql_query('UPDATE `user`
SET `level` = "' . $level . '"
WHERE `uid` = "' . $uid . '";')) === false) {
handle(ERROR_SYSTEM . '01');
}
handle('0000');
break;
case 'resetPassword':
if (!checkAuthority(9)) {
handle(ERROR_PERMISSION . '01');
}
$_p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$currentUser = new User();
$currentUser->uid = $uid = getRequest('uid');
$username = json_decode($currentUser->getData(), true)['username'];
$pwd = '';
for ($_i = 0; $_i < 10; $_i++) {
$pwd .= $_p[mt_rand(0, strlen($_p) - 1)];
}
$password = password_hash(md5($username . md5($pwd) . '.cc'), PASSWORD_BCRYPT);
if (($sqlUser = @mysql_query('UPDATE `user`
SET `password` = "' . $password . '"
WHERE `uid` = "' . $uid . '";')) === false) {
handle(ERROR_SYSTEM . '01');
示例13: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('daren', 'is_daren')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('daren', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$daren = FDB::fetchFirst("select * from " . FDB::table("user") . " where is_daren = 1 and uid =" . $id);
if (empty($daren)) {
$result['status'] = 0;
outputJson($result);
}
if (FS("Daren")->removeDaren($id)) {
$result['status'] = 1;
} else {
$result['status'] = 0;
outputJson($result);
}
$result['msg'] = lang('manage', 'manage_is_daren_success');
createManageLog('daren', 'is_daren', $id, $result['msg']);
示例14: handle
handle('0000{"cid":' . $response . '}');
break;
case 'renew':
$currentCalculation = new Calculation();
$currentCalculation->cid = getRequest('cid');
$response = json_decode($currentCalculation->getData(), true);
require_once 'site.class.php';
$uid = Site::getSessionUid();
if ($uid == 0) {
handle(ERROR_PERMISSION . '00' . '请先登陆!');
}
if ($response['uid'] !== $uid && !checkAuthority(9)) {
handle(ERROR_PERMISSION . '00');
}
$priority = $response['priority'];
if (checkAuthority(9) && getRequest('priority') !== '') {
$priority = getRequest('priority');
}
$currentCalculation->init($response['pid'], $response['uid'], $priority, (int) getRequest('public'), getRequest('password'), $response['status'], $response['input']);
if (!$currentCalculation->checkVariables()) {
handle(ERROR_INPUT . '01');
}
$response = $currentCalculation->modify();
if ($response === false) {
handle(ERROR_SYSTEM . '00');
} else {
handle('0000');
}
break;
default:
ERROR(ERROR_INPUT . '02', 'Request Error.');
示例15: array
<?php
$result = array('status' => 1, 'msg' => '');
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
$result['status'] = 0;
outputJson($result);
}
if (!checkAuthority('album', 'flash')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('album', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$album = FS('Album')->getAlbumById($id, false);
if (empty($album)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
if ($album['is_flash'] == 0) {
$result['msg'] = lang('manage', 'manage_flash_success');
$album['is_flash'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_unflash_success');
$album['is_flash'] = 0;
}