本文整理汇总了PHP中auth_ismanager函数的典型用法代码示例。如果您正苦于以下问题:PHP auth_ismanager函数的具体用法?PHP auth_ismanager怎么用?PHP auth_ismanager使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth_ismanager函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: siteexport_add_page_export
function siteexport_add_page_export(&$event)
{
global $ID;
if ($this->getConf('allowallusers') || auth_isadmin() || auth_ismanager()) {
$event->data['items'][] = '<li>' . tpl_link(wl($ID, array('do' => 'siteexport_addpage')), '<span>Export Page</span>', 'class="action siteexport_addpage" title="Add page"', 1) . '</li>';
}
}
示例2: handle_ajax
/**
* Step up
*
* @param Doku_Event $event
*/
public function handle_ajax(Doku_Event $event)
{
if ($event->data != 'plugin_move_progress') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $INPUT;
global $USERINFO;
if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
http_status(403);
exit;
}
$return = array('error' => '', 'complete' => false, 'progress' => 0);
/** @var helper_plugin_move_plan $plan */
$plan = plugin_load('helper', 'move_plan');
if (!$plan->isCommited()) {
// There is no plan. Something went wrong
$return['complete'] = true;
} else {
$todo = $plan->nextStep($INPUT->bool('skip'));
$return['progress'] = $plan->getProgress();
$return['error'] = $plan->getLastError();
if ($todo === 0) {
$return['complete'] = true;
}
}
$json = new JSON();
header('Content-Type: application/json');
echo $json->encode($return);
}
示例3: test_isadmin
function test_isadmin()
{
global $conf;
$conf['superuser'] = 'john,@admin,doe,@roots';
// anonymous user
$this->assertEqual(auth_ismanager('jill', '', true), false);
// admin user
$this->assertEqual(auth_ismanager('john', '', true), true);
$this->assertEqual(auth_ismanager('doe', '', true), true);
// admin groups
$this->assertEqual(auth_ismanager('jill', array('admin'), true), true);
$this->assertEqual(auth_ismanager('jill', array('roots'), true), true);
$this->assertEqual(auth_ismanager('john', array('admin'), true), true);
$this->assertEqual(auth_ismanager('doe', array('admin'), true), true);
}
示例4: handle_ajax_call
/**
* Render a subtree
*
* @param Doku_Event $event
* @param $params
*/
public function handle_ajax_call(Doku_Event $event, $params)
{
if ($event->data != 'plugin_move_tree') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $INPUT;
global $USERINFO;
if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
http_status(403);
exit;
}
/** @var admin_plugin_move_tree $plugin */
$plugin = plugin_load('admin', 'move_tree');
$ns = cleanID($INPUT->str('ns'));
if ($INPUT->bool('is_media')) {
$type = admin_plugin_move_tree::TYPE_MEDIA;
} else {
$type = admin_plugin_move_tree::TYPE_PAGES;
}
$data = $plugin->tree($type, $ns, $ns);
echo html_buildlist($data, 'tree_list', array($plugin, 'html_list'), array($plugin, 'html_li'));
}
示例5: auth_isadmin
/**
* Check if a user is admin
*
* Alias to auth_ismanager with adminonly=true
*
* The info is available through $INFO['isadmin'], too
*
* @author Andreas Gohr <andi@splitbrain.org>
* @see auth_ismanager()
* @param string $user Username
* @param array $groups List of groups the user is in
* @return bool
*/
function auth_isadmin($user = null, $groups = null)
{
return auth_ismanager($user, $groups, true);
}
示例6: html_diff_head
function html_diff_head($l_rev, $r_rev, $id = null, $media = false)
{
global $lang;
if ($id === null) {
global $ID;
$id = $ID;
}
$media_or_wikiFN = $media ? 'mediaFN' : 'wikiFN';
$ml_or_wl = $media ? 'ml' : 'wl';
$l_minor = $r_minor = '';
if (!$l_rev) {
$l_head = '—';
} else {
$l_info = getRevisionInfo($id, $l_rev, true, $media);
if ($l_info['user']) {
$l_user = editorinfo($l_info['user']);
if (auth_ismanager()) {
$l_user .= ' (' . $l_info['ip'] . ')';
}
} else {
$l_user = $l_info['ip'];
}
$l_user = '<span class="user">' . $l_user . '</span>';
$l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$l_minor = 'class="minor"';
}
$l_head_title = $media ? dformat($l_rev) : $id . ' [' . dformat($l_rev) . ']';
$l_head = '<a class="wikilink1" href="' . $ml_or_wl($id, "rev={$l_rev}") . '">' . $l_head_title . '</a>' . '<br />' . $l_user . ' ' . $l_sum;
}
if ($r_rev) {
$r_info = getRevisionInfo($id, $r_rev, true, $media);
if ($r_info['user']) {
$r_user = editorinfo($r_info['user']);
if (auth_ismanager()) {
$r_user .= ' (' . $r_info['ip'] . ')';
}
} else {
$r_user = $r_info['ip'];
}
$r_user = '<span class="user">' . $r_user . '</span>';
$r_sum = $r_info['sum'] ? '<span class="sum">' . hsc($r_info['sum']) . '</span>' : '';
if ($r_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$r_minor = 'class="minor"';
}
$r_head_title = $media ? dformat($r_rev) : $id . ' [' . dformat($r_rev) . ']';
$r_head = '<a class="wikilink1" href="' . $ml_or_wl($id, "rev={$r_rev}") . '">' . $r_head_title . '</a>' . '<br />' . $r_user . ' ' . $r_sum;
} elseif ($_rev = @filemtime($media_or_wikiFN($id))) {
$_info = getRevisionInfo($id, $_rev, true, $media);
if ($_info['user']) {
$_user = editorinfo($_info['user']);
if (auth_ismanager()) {
$_user .= ' (' . $_info['ip'] . ')';
}
} else {
$_user = $_info['ip'];
}
$_user = '<span class="user">' . $_user . '</span>';
$_sum = $_info['sum'] ? '<span class="sum">' . hsc($_info['sum']) . '</span>' : '';
if ($_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$r_minor = 'class="minor"';
}
$r_head_title = $media ? dformat($_rev) : $id . ' [' . dformat($_rev) . ']';
$r_head = '<a class="wikilink1" href="' . $ml_or_wl($id) . '">' . $r_head_title . '</a> ' . '(' . $lang['current'] . ')' . '<br />' . $_user . ' ' . $_sum;
} else {
$r_head = '— (' . $lang['current'] . ')';
}
return array($l_head, $r_head, $l_minor, $r_minor);
}
示例7: pageinfo
/**
* Return info about the current document as associative
* array.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function pageinfo()
{
global $ID;
global $REV;
global $RANGE;
global $USERINFO;
global $lang;
// include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
// FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
$info['id'] = $ID;
$info['rev'] = $REV;
// set info about manager/admin status.
$info['isadmin'] = false;
$info['ismanager'] = false;
if (isset($_SERVER['REMOTE_USER'])) {
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($ID);
$info['subscribed'] = get_info_subscribed();
$info['client'] = $_SERVER['REMOTE_USER'];
if ($info['perm'] == AUTH_ADMIN) {
$info['isadmin'] = true;
$info['ismanager'] = true;
} elseif (auth_ismanager()) {
$info['ismanager'] = true;
}
// if some outside auth were used only REMOTE_USER is set
if (!$info['userinfo']['name']) {
$info['userinfo']['name'] = $_SERVER['REMOTE_USER'];
}
} else {
$info['perm'] = auth_aclcheck($ID, '', null);
$info['subscribed'] = false;
$info['client'] = clientIP(true);
}
$info['namespace'] = getNS($ID);
$info['locked'] = checklock($ID);
$info['filepath'] = fullpath(wikiFN($ID));
$info['exists'] = @file_exists($info['filepath']);
if ($REV) {
//check if current revision was meant
if ($info['exists'] && @filemtime($info['filepath']) == $REV) {
$REV = '';
} elseif ($RANGE) {
//section editing does not work with old revisions!
$REV = '';
$RANGE = '';
msg($lang['nosecedit'], 0);
} else {
//really use old revision
$info['filepath'] = fullpath(wikiFN($ID, $REV));
$info['exists'] = @file_exists($info['filepath']);
}
}
$info['rev'] = $REV;
if ($info['exists']) {
$info['writable'] = is_writable($info['filepath']) && $info['perm'] >= AUTH_EDIT;
} else {
$info['writable'] = $info['perm'] >= AUTH_CREATE;
}
$info['editable'] = $info['writable'] && empty($info['locked']);
$info['lastmod'] = @filemtime($info['filepath']);
//load page meta data
$info['meta'] = p_get_metadata($ID);
//who's the editor
if ($REV) {
$revinfo = getRevisionInfo($ID, $REV, 1024);
} else {
if (is_array($info['meta']['last_change'])) {
$revinfo = $info['meta']['last_change'];
} else {
$revinfo = getRevisionInfo($ID, $info['lastmod'], 1024);
// cache most recent changelog line in metadata if missing and still valid
if ($revinfo !== false) {
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
}
}
//and check for an external edit
if ($revinfo !== false && $revinfo['date'] != $info['lastmod']) {
// cached changelog line no longer valid
$revinfo = false;
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
// See also $INFO['meta']['last_change'] which is the most recent log line for page $ID.
// Use $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT in place of $info['minor'].
if ($revinfo['user']) {
$info['editor'] = $revinfo['user'];
} else {
$info['editor'] = $revinfo['ip'];
//.........这里部分代码省略.........
示例8: basicinfo
/**
* Determine basic information for a request of $id
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Chris Smith <chris@jalakai.co.uk>
*
* @param string $id pageid
* @param bool $htmlClient add info about whether is mobile browser
* @return array with info for a request of $id
*
*/
function basicinfo($id, $htmlClient = true)
{
global $USERINFO;
/* @var Input $INPUT */
global $INPUT;
// set info about manager/admin status.
$info = array();
$info['isadmin'] = false;
$info['ismanager'] = false;
if ($INPUT->server->has('REMOTE_USER')) {
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($id);
$info['client'] = $INPUT->server->str('REMOTE_USER');
if ($info['perm'] == AUTH_ADMIN) {
$info['isadmin'] = true;
$info['ismanager'] = true;
} elseif (auth_ismanager()) {
$info['ismanager'] = true;
}
// if some outside auth were used only REMOTE_USER is set
if (!$info['userinfo']['name']) {
$info['userinfo']['name'] = $INPUT->server->str('REMOTE_USER');
}
} else {
$info['perm'] = auth_aclcheck($id, '', null);
$info['client'] = clientIP(true);
}
$info['namespace'] = getNS($id);
// mobile detection
if ($htmlClient) {
$info['ismobile'] = clientismobile();
}
return $info;
}
示例9: test_isadmin_sensitive
function test_isadmin_sensitive()
{
$this->setSensitive();
global $conf;
$conf['superuser'] = 'john,@admin,doe,@roots';
// anonymous user
$this->assertEquals(auth_ismanager('jill', null, true), false);
// admin user
$this->assertEquals(auth_ismanager('john', null, true), true);
$this->assertEquals(auth_ismanager('Doe', null, true), false);
// admin groups
$this->assertEquals(auth_ismanager('jill', array('admin'), true), true);
$this->assertEquals(auth_ismanager('jill', array('roots'), true), true);
$this->assertEquals(auth_ismanager('john', array('admin'), true), true);
$this->assertEquals(auth_ismanager('doe', array('admin'), true), true);
$this->assertEquals(auth_ismanager('Doe', array('admin'), true), true);
}
示例10: isDiscussionMod
/**
* @return bool
*/
function isDiscussionMod()
{
global $USERINFO;
$groups = trim($this->getConf('moderatorgroups'));
if (auth_ismanager()) {
return true;
}
// Check if user is member of the moderator groups
if (!empty($groups) && auth_isMember($groups, $_SERVER['REMOTE_USER'], (array) $USERINFO['grps'])) {
return true;
}
return false;
}
示例11: html_diff
/**
* show diff
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_diff($text = '', $intro = true)
{
require_once DOKU_INC . 'inc/DifferenceEngine.php';
global $ID;
global $REV;
global $lang;
global $conf;
// we're trying to be clever here, revisions to compare can be either
// given as rev and rev2 parameters, with rev2 being optional. Or in an
// array in rev2.
$rev1 = $REV;
if (is_array($_REQUEST['rev2'])) {
$rev1 = (int) $_REQUEST['rev2'][0];
$rev2 = (int) $_REQUEST['rev2'][1];
if (!$rev1) {
$rev1 = $rev2;
unset($rev2);
}
} else {
$rev2 = (int) $_REQUEST['rev2'];
}
if ($text) {
// compare text to the most current revision
$l_rev = '';
$l_text = rawWiki($ID, '');
$l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . strftime($conf['dformat'], @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
$r_rev = '';
$r_text = cleanText($text);
$r_head = $lang['yours'];
} else {
if ($rev1 && $rev2) {
// two specific revisions wanted
// make sure order is correct (older on the left)
if ($rev1 < $rev2) {
$l_rev = $rev1;
$r_rev = $rev2;
} else {
$l_rev = $rev2;
$r_rev = $rev1;
}
} elseif ($rev1) {
// single revision given, compare to current
$r_rev = '';
$l_rev = $rev1;
} else {
// no revision was given, compare previous to current
$r_rev = '';
$revs = getRevisions($ID, 0, 1);
$l_rev = $revs[0];
}
// when both revisions are empty then the page was created just now
if (!$l_rev && !$r_rev) {
$l_text = '';
} else {
$l_text = rawWiki($ID, $l_rev);
}
$r_text = rawWiki($ID, $r_rev);
if (!$l_rev) {
$l_head = '—';
} else {
$l_info = getRevisionInfo($ID, $l_rev, true);
if ($l_info['user']) {
$l_user = editorinfo($l_info['user']);
if (auth_ismanager()) {
$l_user .= ' (' . $l_info['ip'] . ')';
}
} else {
$l_user = $l_info['ip'];
}
$l_user = '<span class="user">' . $l_user . '</span>';
$l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$l_minor = 'class="minor"';
}
$l_head = '<a class="wikilink1" href="' . wl($ID, "rev={$l_rev}") . '">' . $ID . ' [' . strftime($conf['dformat'], $l_rev) . ']</a>' . '<br />' . $l_user . ' ' . $l_sum;
}
if ($r_rev) {
$r_info = getRevisionInfo($ID, $r_rev, true);
if ($r_info['user']) {
$r_user = editorinfo($r_info['user']);
if (auth_ismanager()) {
$r_user .= ' (' . $r_info['ip'] . ')';
}
} else {
$r_user = $r_info['ip'];
}
$r_user = '<span class="user">' . $r_user . '</span>';
$r_sum = $r_info['sum'] ? '<span class="sum">' . hsc($r_info['sum']) . '</span>' : '';
if ($r_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$r_minor = 'class="minor"';
}
$r_head = '<a class="wikilink1" href="' . wl($ID, "rev={$r_rev}") . '">' . $ID . ' [' . strftime($conf['dformat'], $r_rev) . ']</a>' . '<br />' . $r_user . ' ' . $r_sum;
} elseif ($_rev = @filemtime(wikiFN($ID))) {
$_info = getRevisionInfo($ID, $_rev, true);
if ($_info['user']) {
//.........这里部分代码省略.........
示例12: _form
/**
* Outputs the comment form
*/
function _form($raw = '', $act = 'add', $cid = NULL)
{
global $lang;
global $conf;
global $ID;
global $INFO;
// not for unregistered users when guest comments aren't allowed
if (!$_SERVER['REMOTE_USER'] && !$this->getConf('allowguests')) {
?>
<div class="comment_form">
<?php
echo $this->getLang('noguests');
?>
</div>
<?php
return false;
}
// fill $raw with $_REQUEST['text'] if it's empty (for failed CAPTCHA check)
if (!$raw && $_REQUEST['comment'] == 'show') {
$raw = $_REQUEST['text'];
}
?>
<div class="comment_form">
<form id="discussion__comment_form" method="post" action="<?php
echo script();
?>
" accept-charset="<?php
echo $lang['encoding'];
?>
">
<div class="no">
<input type="hidden" name="id" value="<?php
echo $ID;
?>
" />
<input type="hidden" name="do" value="show" />
<input type="hidden" name="comment" value="<?php
echo $act;
?>
" />
<?php
// for adding a comment
if ($act == 'add') {
?>
<input type="hidden" name="reply" value="<?php
echo $cid;
?>
" />
<?php
// for guest/adminimport: show name, e-mail and subscribe to comments fields
if (!$_SERVER['REMOTE_USER'] or $this->getConf('adminimport') && auth_ismanager()) {
?>
<input type="hidden" name="user" value="<?php
echo clientIP();
?>
" />
<div class="comment_name">
<label class="block" for="discussion__comment_name">
<span><?php
echo $lang['fullname'];
?>
:</span>
<input type="text" class="edit<?php
if ($_REQUEST['comment'] == 'add' && empty($_REQUEST['name'])) {
echo ' error';
}
?>
" name="name" id="discussion__comment_name" size="50" tabindex="1" value="<?php
echo hsc($_REQUEST['name']);
?>
" />
</label>
</div>
<div class="comment_mail">
<label class="block" for="discussion__comment_mail">
<span><?php
echo $lang['email'];
?>
:</span>
<input type="text" class="edit<?php
if ($_REQUEST['comment'] == 'add' && empty($_REQUEST['mail'])) {
echo ' error';
}
?>
" name="mail" id="discussion__comment_mail" size="50" tabindex="2" value="<?php
echo hsc($_REQUEST['mail']);
?>
" />
</label>
</div>
<?php
}
// allow entering an URL
if ($this->getConf('urlfield')) {
?>
<div class="comment_url">
//.........这里部分代码省略.........
示例13: html_diff
/**
* show diff
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $text - compare with this text with most current version
* @param bool $intr - display the intro text
*/
function html_diff($text = '', $intro = true, $type = null)
{
global $ID;
global $REV;
global $lang;
global $conf;
if (!$type) {
$type = $_REQUEST['difftype'];
}
if ($type != 'inline') {
$type = 'sidebyside';
}
// we're trying to be clever here, revisions to compare can be either
// given as rev and rev2 parameters, with rev2 being optional. Or in an
// array in rev2.
$rev1 = $REV;
if (is_array($_REQUEST['rev2'])) {
$rev1 = (int) $_REQUEST['rev2'][0];
$rev2 = (int) $_REQUEST['rev2'][1];
if (!$rev1) {
$rev1 = $rev2;
unset($rev2);
}
} else {
$rev2 = (int) $_REQUEST['rev2'];
}
$r_minor = '';
$l_minor = '';
if ($text) {
// compare text to the most current revision
$l_rev = '';
$l_text = rawWiki($ID, '');
$l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
$r_rev = '';
$r_text = cleanText($text);
$r_head = $lang['yours'];
} else {
if ($rev1 && $rev2) {
// two specific revisions wanted
// make sure order is correct (older on the left)
if ($rev1 < $rev2) {
$l_rev = $rev1;
$r_rev = $rev2;
} else {
$l_rev = $rev2;
$r_rev = $rev1;
}
} elseif ($rev1) {
// single revision given, compare to current
$r_rev = '';
$l_rev = $rev1;
} else {
// no revision was given, compare previous to current
$r_rev = '';
$revs = getRevisions($ID, 0, 1);
$l_rev = $revs[0];
$REV = $l_rev;
// store revision back in $REV
}
// when both revisions are empty then the page was created just now
if (!$l_rev && !$r_rev) {
$l_text = '';
} else {
$l_text = rawWiki($ID, $l_rev);
}
$r_text = rawWiki($ID, $r_rev);
if (!$l_rev) {
$l_head = '—';
} else {
$l_info = getRevisionInfo($ID, $l_rev, true);
if ($l_info['user']) {
$l_user = editorinfo($l_info['user']);
if (auth_ismanager()) {
$l_user .= ' (' . $l_info['ip'] . ')';
}
} else {
$l_user = $l_info['ip'];
}
$l_user = '<span class="user">' . $l_user . '</span>';
$l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$l_minor = 'class="minor"';
}
$l_head = '<a class="wikilink1" href="' . wl($ID, "rev={$l_rev}") . '">' . $ID . ' [' . dformat($l_rev) . ']</a>' . '<br />' . $l_user . ' ' . $l_sum;
}
if ($r_rev) {
$r_info = getRevisionInfo($ID, $r_rev, true);
if ($r_info['user']) {
$r_user = editorinfo($r_info['user']);
if (auth_ismanager()) {
$r_user .= ' (' . $r_info['ip'] . ')';
}
} else {
//.........这里部分代码省略.........
示例14: getSchema
/**
* Get info about existing schemas columns
*
* Returns only current, enabled columns
*
* @param string $schema the schema to query, empty for all
* @return array
* @throws RemoteAccessDeniedException
* @throws RemoteException
*/
public function getSchema($schema)
{
if (!auth_ismanager()) {
throw new RemoteAccessDeniedException('you need to be manager to access schema info');
}
if (!$schema) {
$schema = null;
}
try {
$result = array();
$schemas = $this->hlp->getSchema($schema);
foreach ($schemas as $name => $schema) {
$result[$name] = array();
foreach ($schema->getColumns(false) as $column) {
$result[$name][] = array('name' => $column->getLabel(), 'type' => array_pop(explode('\\', get_class($column->getType()))), 'ismulti' => $column->isMulti());
}
}
return $result;
} catch (StructException $e) {
throw new RemoteException($e->getMessage(), 0, $e);
}
}
示例15: oauth_isadmin
private function oauth_isadmin()
{
/*{{{*/
if (auth_isadmin() || $this->getConf('manager_admin') && auth_ismanager()) {
return true;
}
return false;
}