本文整理汇总了PHP中checkperm函数的典型用法代码示例。如果您正苦于以下问题:PHP checkperm函数的具体用法?PHP checkperm怎么用?PHP checkperm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkperm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitcheck
public static function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0)
{
if (!getgpc($var)) {
return FALSE;
} else {
global $_G;
if ($allowget || $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST']))) {
if (empty($_GET['phone_reg'])) {
if (checkperm('seccode')) {
if ($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['sechash'])) {
showmessage('submit_secqaa_invalid');
}
if ($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['sechash'])) {
showmessage('submit_seccode_invalid');
}
}
}
return TRUE;
// For ios reg modify by heavenK
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && !empty($_GET['phone_reg']) && empty($_SERVER['HTTP_X_FLASH_VERSION']) && empty($_SERVER['HTTP_REFERER'])) {
return TRUE;
} else {
//add by zh
if ($_GET['mod'] == 'sms' && $_GET['flag'] == 1) {
exit(lang('message', 'submit_invalid'));
} else {
showmessage('submit_invalid');
}
}
}
}
示例2: showcategoryrowpush
function showcategoryrowpush($key, $level = 0, $last = '')
{
global $category, $permissioncategory, $permission;
$value = $category[$key];
$return = '';
$op = '';
if (checkperm('allowmanagearticle') || checkperm('allpublish') || $permission[$key]['allowpublish'] || checkperm('allowmanage') || $permission[$key]['allowmanage']) {
$value['pushurl'] = '<a href="portal.php?mod=portalcp&ac=article&catid=' . $key . '&from_idtype=' . $_GET['idtype'] . '&from_id=' . $_GET['id'] . '" target="_blank" onclick="hideWindow(\'' . $_G[gp_handlekey] . '\\)">' . htmlspecialchars($value['catname']) . '</a>';
}
if ($level == 2) {
$class = $last ? 'lastchildcat' : 'childcat';
$return = '<tr class="hover"><td><div class="' . $class . '">' . $value['pushurl'] . '</div></td></tr>';
} elseif ($level == 1) {
$return = '<tr class="hover"><td><div class="cat">' . $value['pushurl'] . '</div></td></tr>';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
for ($i = 0, $L = count($children); $i < $L; $i++) {
$return .= showcategoryrowpush($children[$i], 2, $i == $L - 1);
}
} else {
$return = '<tr class="hover"><td><div class="parentcat">' . $value['pushurl'] . '</div></td></tr>';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
for ($i = 0, $L = count($children); $i < $L; $i++) {
$return .= showcategoryrowpush($children[$i], 1, '');
}
}
return $return;
}
示例3: _commentReply
private function _commentReply($res, $data)
{
global $_G;
require DISCUZ_ROOT . './source/function/function_home.php';
require_once libfile('function/portalcp');
// 在DISCUZ_ROOT/source/include/portalcp/portalcp_comment.php基础上二次开发
if (!checkperm('allowcommentarticle')) {
return $this->makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']), array('login' => 1));
}
switch ($data['idType']) {
case 'aid':
$_POST['aid'] = $data['id'];
break;
case 'tid':
$_POST['topicid'] = $data['id'];
break;
default:
return $this->makeErrorInfo($res, 'mobcent_error_params');
}
$id = 0;
$idtype = '';
if (!empty($_POST['aid'])) {
$id = intval($_POST['aid']);
$idtype = 'aid';
} elseif (!empty($_POST['topicid'])) {
$id = intval($_POST['topicid']);
$idtype = 'topicid';
}
// 获取评论内容
$_POST['message'] = $commentText = '';
foreach ($data['content'] as $line) {
$line['type'] = $this->_transCommentType($line['type']);
// 引用评论
if (isset($data['quoteCommentId']) && $data['quoteCommentId'] > 0) {
$quoteComment = DzPortalComment::getCommentById($data['quoteCommentId']);
if (!empty($quoteComment)) {
$commentText .= $this->_getCommentMessage($quoteComment);
}
}
if ($line['type'] == 'text') {
$line['infor'] = rawurldecode($line['infor']);
$commentText .= WebUtils::t($line['infor']);
}
}
$_POST['message'] = $commentText;
$message = $_POST['message'];
require_once libfile('function/spacecp');
if (($checkMessage = mobcent_cknewuser()) != '') {
return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
}
$waittime = interval_check('post');
if ($waittime > 0) {
return $this->makeErrorInfo($res, 'operating_too_fast', array('{waittime}' => $waittime), array('return' => true));
}
$retmessage = addportalarticlecomment($id, $message, $idtype);
return $this->makeErrorInfo($res, $retmessage, array('noError' => $retmessage == 'do_success' ? 1 : 0));
}
示例4: HookFormat_chooserAllGetdownloadurl
function HookFormat_chooserAllGetdownloadurl($ref, $size, $ext, $page = 1, $alternative = -1)
{
global $baseurl_short;
$path = get_resource_path($ref, true, $size, false, $ext, -1, $page, $size == "scr" && checkperm("w") && $alternative == -1, '', $alternative);
if (file_exists($path)) {
return false;
}
return $baseurl_short . 'plugins/format_chooser/pages/convert.php?ref=' . $ref . '&size=' . $size . '&ext=' . $ext . '&page=' . $page . '&alt=' . $alternative;
}
示例5: HookGrant_editEditEditstatushide
function HookGrant_editEditEditstatushide()
{
// Needed to prevent user changing the archive state, otherwise a user with temporary edit access to an active resource could change it from active to pending submission
global $status, $resource;
if (!checkperm("e" . $resource["archive"])) {
return true;
}
return false;
}
示例6: HookLegacy_actionsCollection_publicRender_collections_public_list_tools
function HookLegacy_actionsCollection_publicRender_collections_public_list_tools($collection_data)
{
global $baseurl_short, $lang, $contact_sheet, $home_dash, $anonymous_login, $username;
?>
<a href="<?php
echo $baseurl_short;
?>
pages/search.php?search=<?php
echo urlencode('!collection' . $collection_data['ref']);
?>
" onClick="return CentralSpaceLoad(this, true);">> <?php
echo $lang['viewall'];
?>
</a>
<?php
if ($contact_sheet == true) {
?>
<a href="<?php
echo $baseurl_short;
?>
pages/contactsheet_settings.php?ref=<?php
echo urlencode($collection_data['ref']);
?>
" onClick="return CentralSpaceLoad(this);">> <?php
echo $lang['contactsheet'];
?>
</a>
<?php
}
if (!checkperm('b')) {
?>
<a href="#" onclick="document.getElementById('collectionadd').value='<?php
echo urlencode($collection_data['ref']);
?>
'; document.getElementById('collectionform').submit(); return false;">> <?php
echo $lang['addtomycollections'];
?>
</a>
<?php
}
if ($home_dash && checkPermission_dashcreate()) {
?>
<a href="<?php
echo $baseurl_short;
?>
pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php
echo urlencode($collection_data['ref']);
?>
&order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">> <?php
echo $lang['dashtile'];
?>
</a>
<?php
}
}
示例7: HookTransformAllRender_actions_add_collection_option
function HookTransformAllRender_actions_add_collection_option($top_actions, $options)
{
global $cropper_enable_batch, $count_result, $lang, $collection_data, $baseurl_short, $userref;
$c = count($options);
if ($cropper_enable_batch && $count_result > 0 && ($userref == $collection_data['user'] || $collection_data['allow_changes'] == 1 || checkperm('h'))) {
$data_attribute['url'] = sprintf('%splugins/transform/pages/collection_transform.php?collection=%s', $baseurl_short, urlencode($collection_data['ref']));
$options[$c]['value'] = 'transform';
$options[$c]['label'] = $lang["transform"];
$options[$c]['data_attr'] = $data_attribute;
return $options;
}
}
示例8: _space2user
function _space2user($space, $spaceInfos = array())
{
global $_SC, $_SGLOBAL;
if (!$space) {
return array();
}
$founders = explode(',', $_SC['founder']);
$adminLevel = 'none';
if (in_array($space['uid'], $founders)) {
$adminLevel = 'founder';
} else {
$_SGLOBAL['supe_uid'] = $space['uid'];
if (checkperm('manageconfig')) {
$adminLevel = 'manager';
}
}
// profile privacy
$profilePrivacy = array();
if (!$spaceInfos) {
$query = $_SGLOBAL['db']->query(sprintf('SELECT * FROM %s where uid = %d', tname('spaceinfo'), $space['uid']));
while ($row = $_SGLOBAL['db']->fetch_array($query)) {
$spaceInfos[] = $row;
}
}
foreach ($spaceInfos as $value) {
$_PP = array();
switch ($value['friend']) {
case 1:
$_PP = 'friends';
break;
case 3:
$_PP = 'me';
break;
case 0:
default:
$_PP = 'public';
}
$fields = array('marry' => 'relationshipStatus', 'birth' => 'birthday', 'blood' => 'bloodType', 'birthcity' => 'birthPlace', 'residecity' => 'residePlace', 'mobile' => 'mobile', 'qq' => 'qq', 'msn' => 'msn');
if (array_key_exists($value['subtype'], $fields)) {
$profilePrivacy[$fields[$value['subtype']]] = $_PP;
}
}
$privacy = unserialize($space['privacy']);
if (!$privacy) {
$privacy = array();
}
$user = array('uId' => $space['uid'], 'handle' => $space['username'], 'action' => $space['action'], 'realName' => $space['name'], 'realNameChecked' => $space['namestatus'] ? true : false, 'gender' => $space['sex'] == 1 ? 'male' : ($space['sex'] == 2 ? 'female' : 'unknown'), 'email' => $space['email'], 'qq' => $space['qq'], 'msn' => $space['msn'], 'birthday' => sprintf('%04d-%02d-%02d', $space['birthyear'], $space['birthmonth'], $space['birthday']), 'bloodType' => empty($space['blood']) ? 'unknown' : $space['blood'], 'relationshipStatus' => $space['marry'] == 1 ? 'single' : ($space['marry'] == 2 ? 'notSingle' : 'unknown'), 'birthProvince' => $space['birthprovince'], 'birthCity' => $space['birthcity'], 'resideProvince' => $space['resideprovince'], 'resideCity' => $space['residecity'], 'viewNum' => $space['viewnum'], 'friendNum' => $space['friendnum'], 'myStatus' => $space['note'], 'lastActivity' => $space['updatetime'], 'created' => $space['dateline'], 'credit' => $space['credit'], 'isUploadAvatar' => $space['avatar'] ? true : false, 'adminLevel' => $adminLevel, 'homepagePrivacy' => $privacy['view']['index'] == 1 ? 'friends' : ($privacy['view']['index'] == 2 ? 'me' : 'public'), 'profilePrivacyList' => $profilePrivacy, 'friendListPrivacy' => $privacy['view']['friend'] == 1 ? 'friends' : ($privacy['view']['friend'] == 2 ? 'me' : 'public'));
return $user;
}
示例9: HookCsv_uploadAllTopnavlinksafterhome
function HookCsv_uploadAllTopnavlinksafterhome()
{
global $baseurl, $lang;
if (checkperm("c")) {
?>
<li><a href="<?php
echo $baseurl;
?>
/plugins/csv_upload/pages/csv_upload.php" onClick="CentralSpaceLoad(this,true);return false;"><?php
echo $lang["csv_upload_nav_link"];
?>
</a></li>
<?php
}
}
示例10: _saveAttachment
/**
* 保存附件
*/
private function _saveAttachment($res, $type, $module = '', $albumId = '')
{
global $_G;
$allowFile = array();
foreach ($_FILES['uploadFile']['name'] as $key => $file) {
if ($this->_checkUploadFile($key)) {
$allowFile[] = $key;
}
}
if (!empty($allowFile)) {
if ($type == 'image' && !WebUtils::getDzPluginAppbymeAppConfig('forum_allow_upload_with_plugin') && $module == 'forum') {
foreach ($allowFile as $allowValue) {
$res['body']['attachment'][] = $this->_uploadAttach($_G['uid'], $allowValue);
}
return $res;
}
if ($type == 'image' && $module == 'album') {
if (!checkperm('allowupload') || !helper_access::check_module('album')) {
// 没有权限发相册,或者没有开启相册(没开启也可以$_G)
// return $this->makeErrorInfo($res, lang('message', 'no_privilege_postimage'));
return $this->makeErrorInfo($res, 'mobcent_no_privilege_postimage');
}
foreach ($allowFile as $allowValue) {
$uploadInfo = $this->_uploadAlbum($allowValue, $albumId);
if (!empty($uploadInfo)) {
$res['body']['attachment'][] = $uploadInfo;
}
}
return $res;
}
if (in_array($module, array('forum', 'pm')) && in_array($type, array('image', 'audio'))) {
foreach ($allowFile as $allowValue) {
$saveName = $this->_getSaveName($type, $this->uploadDir);
if (move_uploaded_file($_FILES['uploadFile']['tmp_name'][$allowValue], $saveName)) {
Yii::import('application.components.discuz.source.class.class_image', true);
$image = new Mobcent_Image();
if ($image->param['watermarkstatus']['forum'] > 0) {
$image->makeWatermark($saveName, '', 'forum');
}
$urlFileName = $this->_getUrlFileName($this->_getPathFileName($type), $saveName);
$type == 'image' && ImageUtils::getThumbImageEx($urlFileName, 10, false, false, true);
$res['body']['attachment'][] = array('id' => 0, 'urlName' => $urlFileName);
}
}
}
}
return $res;
}
示例11: checkperm
function checkperm($path)
{
echoperms($path, '0777');
if ($h = @opendir($path)) {
while (FALSE !== ($filename = @readdir($h))) {
if ($filename == '.' || $filename == '..' || $filename == '.svn') {
continue;
}
if (@is_dir($path . $filename)) {
checkperm($path . $filename . DIRECTORY_SEPARATOR);
} else {
echoperms($path . $filename, '0666');
}
}
@closedir($h);
}
}
示例12: HookNewsTeam_homeCustomteamfunction
function HookNewsTeam_homeCustomteamfunction()
{
global $baseurl, $lang;
if (checkperm("o")) {
?>
<li><a href="<?php
echo $baseurl;
?>
/plugins/news/pages/news_edit.php"><?php
echo $lang["news_manage"];
?>
</a></li>
<?php
}
?>
<?php
}
示例13: mobcent_cknewuser
/**
* 修改原cknewuser方法
*
* @author 谢建平 <jianping_xie@aliyun.com>
* @param int $return 1为返回bool, 0为返回错误message
* @return bool|string
*/
function mobcent_cknewuser($return = 0)
{
global $_G;
$result = true;
if (!$_G['uid']) {
return true;
}
if (checkperm('disablepostctrl')) {
return empty($return) ? '' : $result;
}
$ckuser = $_G['member'];
if ($_G['setting']['newbiespan'] && $_G['timestamp'] - $ckuser['regdate'] < $_G['setting']['newbiespan'] * 60) {
if (empty($return)) {
// showmessage('no_privilege_newbiespan', '', array('newbiespan' => $_G['setting']['newbiespan']), array());
return lang('message', 'no_privilege_newbiespan', array('newbiespan' => $_G['setting']['newbiespan']));
}
$result = false;
}
if ($_G['setting']['need_avatar'] && empty($ckuser['avatarstatus'])) {
if (empty($return)) {
// showmessage('no_privilege_avatar', '', array(), array());
return lang('message', 'no_privilege_avatar');
}
$result = false;
}
if ($_G['setting']['need_email'] && empty($ckuser['emailstatus'])) {
if (empty($return)) {
// showmessage('no_privilege_email', '', array(), array());
return lang('message', 'no_privilege_email');
}
$result = false;
}
if ($_G['setting']['need_friendnum']) {
space_merge($ckuser, 'count');
if ($ckuser['friends'] < $_G['setting']['need_friendnum']) {
if (empty($return)) {
// showmessage('no_privilege_friendnum', '', array('friendnum' => $_G['setting']['need_friendnum']), array());
return lang('message', 'no_privilege_friendnum', array('friendnum' => $_G['setting']['need_friendnum']));
}
$result = false;
}
}
return empty($return) ? '' : $result;
}
示例14: HookRemotedownloadAllGetdownloadurl
function HookRemotedownloadAllGetdownloadurl($ref, $size, $ext, $page = 1, $alternative = -1)
{
global $remotedownload_prepend, $remotedownload_append, $remotedownload_replace, $remotedownload_addquery;
global $storageurl;
$url = get_resource_path($ref, false, $size, false, $ext, -1, $page, $size == "scr" && checkperm("w") && $alternative == -1, "", $alternative);
if (!empty($remotedownload_prepend) && strpos($url, $storageurl) === 0) {
$storageurl_len = strlen($storageurl);
$url = substr($url, 0, $storageurl_len) . $remotedownload_prepend . substr($url, $storageurl_len);
}
if (!empty($remotedownload_append)) {
$url = $url . $remotedownload_append;
}
foreach ($remotedownload_replace as $replace) {
$url = str_replace($replace['match'], $replace['with'], $url);
}
foreach ($remotedownload_addquery as $query) {
$url = $url . (strpos($url, "?") !== FALSE ? "?" : "&") . $query;
}
return $url;
}
示例15: submitcheck
public static function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0)
{
if (!getgpc($var)) {
return FALSE;
} else {
global $_G;
if ($allowget || $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) || strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.qq.com', 24) === 0 || strncmp($_SERVER['HTTP_REFERER'], 'http://m.wsq.qq.com', 19) === 0 || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST']))) {
if (checkperm('seccode')) {
if ($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
showmessage('submit_secqaa_invalid');
}
if ($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
showmessage('submit_seccode_invalid');
}
}
return TRUE;
} else {
showmessage('submit_invalid');
}
}
}