当前位置: 首页>>代码示例>>PHP>>正文


PHP auth_aclcheck函数代码示例

本文整理汇总了PHP中auth_aclcheck函数的典型用法代码示例。如果您正苦于以下问题:PHP auth_aclcheck函数的具体用法?PHP auth_aclcheck怎么用?PHP auth_aclcheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了auth_aclcheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_randompage

 function action_randompage(&$event, $args)
 {
     global $conf;
     global $ID;
     $data = array();
     $dir = $conf['savedir'];
     $data = file($dir . '/index/page.idx');
     //We loops through ten random page...
     $i = 1;
     while ($i <= 10 & $i != "ok") {
         //echo $i;
         $i++;
         $id = rtrim($data[array_rand($data, 1)]);
         $testACL = auth_aclcheck($id, $_SERVER['REMOTE_USER'], $USERINFO['grps']);
         if ($testACL > 1 and file_exists(wikiFN($id))) {
             $i = "ok";
             //echo $id;
         }
     }
     if ($testACL < 1) {
         $id = $ID;
     }
     header("Location: " . wl($id, '', true));
     //echo wl($page,'',true);
     exit;
 }
开发者ID:raster,项目名称:DokuWiki-randompage,代码行数:26,代码来源:action.php

示例2: generate

 /**
  * Builds a Google Sitemap of all public pages known to the indexer
  *
  * The map is placed in the cache directory named sitemap.xml.gz - This
  * file needs to be writable!
  *
  * @author Michael Hamann
  * @author Andreas Gohr
  * @link   https://www.google.com/webmasters/sitemaps/docs/en/about.html
  * @link   http://www.sitemaps.org/
  */
 public function generate()
 {
     global $conf;
     if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) {
         return false;
     }
     $sitemap = Sitemapper::getFilePath();
     if (@file_exists($sitemap)) {
         if (!is_writable($sitemap)) {
             return false;
         }
     } else {
         if (!is_writable(dirname($sitemap))) {
             return false;
         }
     }
     if (@filesize($sitemap) && @filemtime($sitemap) > time() - $conf['sitemap'] * 86400) {
         // 60*60*24=86400
         dbglog('Sitemapper::generate(): Sitemap up to date');
         // FIXME: only in debug mode
         return false;
     }
     dbglog("Sitemapper::generate(): using {$sitemap}");
     // FIXME: Only in debug mode
     $pages = idx_getIndex('page', '');
     dbglog('Sitemapper::generate(): creating sitemap using ' . count($pages) . ' pages');
     $items = array();
     // build the sitemap items
     foreach ($pages as $id) {
         //skip hidden, non existing and restricted files
         if (isHiddenPage($id)) {
             continue;
         }
         if (auth_aclcheck($id, '', '') < AUTH_READ) {
             continue;
         }
         $item = SitemapItem::createFromID($id);
         if ($item !== NULL) {
             $items[] = $item;
         }
     }
     $eventData = array('items' => &$items, 'sitemap' => &$sitemap);
     $event = new Doku_Event('SITEMAP_GENERATE', $eventData);
     if ($event->advise_before(true)) {
         //save the new sitemap
         $result = io_saveFile($sitemap, Sitemapper::getXML($items));
     }
     $event->advise_after();
     return $result;
 }
开发者ID:ryankask,项目名称:dokuwiki,代码行数:61,代码来源:Sitemapper.php

示例3: render

 /**
  * Create output
  *
  * @param string $format Renderer mode (supported modes: xhtml)
  * @param Doku_Renderer $renderer The renderer
  * @param array $data The data from the handler() function
  * @return bool If rendering was successful.
  */
 function render($format, Doku_Renderer $renderer, $data)
 {
     if ($format == 'metadata') {
         return false;
     }
     if ($data[0] != DOKU_LEXER_SPECIAL) {
         return false;
     }
     $hlp = plugin_load('helper', 'rating');
     $list = $hlp->best($data[1]['lang'], $data[1]['startdate'], 20);
     if ($data[1]['tag'] == 'ol') {
         $renderer->listo_open();
     } else {
         $renderer->listu_open();
     }
     $num_items = 0;
     foreach ($list as $item) {
         if (auth_aclcheck($item['page'], '', null) < AUTH_READ) {
             continue;
         }
         if (!page_exists($item['page'])) {
             continue;
         }
         $num_items = $num_items + 1;
         $renderer->listitem_open(1);
         if (strpos($item['page'], ':') === false) {
             $item['page'] = ':' . $item['page'];
         }
         $renderer->internallink($item['page']);
         if ($data[1]['score'] === 'true') {
             $renderer->cdata(' (' . $item['val'] . ')');
         }
         $renderer->listitem_close();
         if ($num_items >= 10) {
             break;
         }
     }
     if ($data[1]['tag'] == 'ol') {
         $renderer->listo_close();
     } else {
         $renderer->listu_close();
     }
     return true;
 }
开发者ID:cosmocode,项目名称:dokuwiki-plugin-rating,代码行数:52,代码来源:syntax.php

示例4: RedirectToId

 /**
  * Handle the Redirection to an id or the search engine
  */
 function RedirectToId($Vl_Id)
 {
     global $ID;
     //If the user have right to see the page
     if ($_SERVER['REMOTE_USER']) {
         $perm = auth_quickaclcheck($Vl_Id);
     } else {
         $perm = auth_aclcheck($Vl_Id, '', null);
     }
     require_once dirname(__FILE__) . '/admin.php';
     $RedirectManager = new admin_plugin_404manager();
     $RedirectManager->SetRedirection($ID, $Vl_Id);
     if ($perm > AUTH_NONE) {
         $this->OldId = $ID;
         $ID = $Vl_Id;
     }
 }
开发者ID:houshuang,项目名称:folders2web,代码行数:20,代码来源:action.php

示例5: notifyaddresses

 /**
  * Default callback for COMMON_NOTIFY_ADDRESSLIST
  *
  * Aggregates all email addresses of user who have subscribed the given page with 'every' style
  *
  * @author Steven Danz <steven-danz@kc.rr.com>
  * @author Adrian Lang <lang@cosmocode.de>
  *
  * @todo move the whole functionality into this class, trigger SUBSCRIPTION_NOTIFY_ADDRESSLIST instead,
  *       use an array for the addresses within it
  *
  * @param array &$data Containing $id (the page id), $self (whether the author
  *                     should be notified, $addresslist (current email address
  *                     list)
  */
 public function notifyaddresses(&$data)
 {
     if (!$this->isenabled()) {
         return;
     }
     /** @var auth_basic $auth */
     global $auth;
     global $conf;
     $id = $data['id'];
     $self = $data['self'];
     $addresslist = $data['addresslist'];
     $subscriptions = $this->subscribers($id, null, 'every');
     $result = array();
     foreach ($subscriptions as $target => $users) {
         foreach ($users as $user => $info) {
             $userinfo = $auth->getUserData($user);
             if ($userinfo === false) {
                 continue;
             }
             if (!$userinfo['mail']) {
                 continue;
             }
             if (!$self && $user == $_SERVER['REMOTE_USER']) {
                 continue;
             }
             //skip our own changes
             $level = auth_aclcheck($id, $user, $userinfo['grps']);
             if ($level >= AUTH_READ) {
                 if (strcasecmp($userinfo['mail'], $conf['notify']) != 0) {
                     //skip user who get notified elsewhere
                     $result[$user] = $userinfo['mail'];
                 }
             }
         }
     }
     $data['addresslist'] = trim($addresslist . ',' . implode(',', $result), ',');
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:52,代码来源:subscription.php

示例6: auth_quickaclcheck

/**
 * Convinience function for auth_aclcheck()
 *
 * This checks the permissions for the current user
 *
 * @author  Andreas Gohr <andi@splitbrain.org>
 *
 * @param  string  $id  page ID (needs to be resolved and cleaned)
 * @return int          permission level
 */
function auth_quickaclcheck($id)
{
    global $conf;
    global $USERINFO;
    /* @var Input $INPUT */
    global $INPUT;
    # if no ACL is used always return upload rights
    if (!$conf['useacl']) {
        return AUTH_UPLOAD;
    }
    return auth_aclcheck($id, $INPUT->server->str('REMOTE_USER'), $USERINFO['grps']);
}
开发者ID:amondot,项目名称:dokuwiki_ynh,代码行数:22,代码来源:auth.php

示例7: subscriber_addresslist

/**
 * Return a string with the email addresses of all the
 * users subscribed to a page
 *
 * @author Steven Danz <steven-danz@kc.rr.com>
 */
function subscriber_addresslist($id)
{
    global $conf;
    global $auth;
    $emails = '';
    if (!$conf['subscribers']) {
        return;
    }
    $mlist = array();
    $file = metaFN($id, '.mlist');
    if (@file_exists($file)) {
        $mlist = file($file);
    }
    if (count($mlist) > 0) {
        foreach ($mlist as $who) {
            $who = rtrim($who);
            $info = $auth->getUserData($who);
            $level = auth_aclcheck($id, $who, $info['grps']);
            if ($level >= AUTH_READ) {
                if (strcasecmp($info['mail'], $conf['notify']) != 0) {
                    if (empty($emails)) {
                        $emails = $info['mail'];
                    } else {
                        $emails = "{$emails}," . $info['mail'];
                    }
                }
            }
        }
    }
    return $emails;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:37,代码来源:common.php

示例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;
}
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:45,代码来源:common.php

示例9: aclcheck

 /**
  * Returns ACL access level of the user or the (virtual) 'runas' user
  *
  * @param string $id pageid
  * @return int
  */
 protected function aclcheck($id)
 {
     $runas = $this->getConf('runas');
     if ($runas) {
         $auth = auth_aclcheck($id, $runas, array());
     } else {
         $auth = auth_quickaclcheck($id);
     }
     return $auth;
 }
开发者ID:rusidea,项目名称:analitika,代码行数:16,代码来源:action.php

示例10: handle_indexer

    /**
     * Handles the INDEXER_PAGE_ADD event, prevents indexing of metadata from included pages that aren't public if enabled
     *
     * @param Doku_Event $event  the event object
     * @param array      $params optional parameters (unused)
     */
    public function handle_indexer(Doku_Event $event, $params) {
        global $USERINFO;

        // check if the feature is enabled at all
        if (!$this->getConf('safeindex')) return;

        // is there a user logged in at all? If not everything is fine already
        if (is_null($USERINFO) && !isset($_SERVER['REMOTE_USER'])) return;

        // get the include metadata in order to see which pages were included
        $inclmeta = p_get_metadata($event->data['page'], 'plugin_include', METADATA_RENDER_UNLIMITED);
        $all_public = true; // are all included pages public?
        // check if the current metadata indicates that non-public pages were included
        if ($inclmeta !== null && isset($inclmeta['pages'])) {
            foreach ($inclmeta['pages'] as $page) {
                if (auth_aclcheck($page['id'], '', array()) < AUTH_READ) { // is $page public?
                    $all_public = false;
                    break;
                }
            }
        }

        if (!$all_public) { // there were non-public pages included - action required!
            // backup the user information
            $userinfo_backup = $USERINFO;
            $remote_user = $_SERVER['REMOTE_USER'];
            // unset user information - temporary logoff!
            $USERINFO = null;
            unset($_SERVER['REMOTE_USER']);

            // metadata is only rendered once for a page in one request - thus we need to render manually.
            $meta = p_read_metadata($event->data['page']); // load the original metdata
            $meta = p_render_metadata($event->data['page'], $meta); // render the metadata
            p_save_metadata($event->data['page'], $meta); // save the metadata so other event handlers get the public metadata, too

            $meta = $meta['current']; // we are only interested in current metadata.

            // check if the tag plugin handler has already been called before the include plugin
            $tag_called = isset($event->data['metadata']['subject']);

            // Reset the metadata in the renderer. This removes data from all other event handlers, but we need to be on the safe side here.
            $event->data['metadata'] = array('title' => $meta['title']);

            // restore the relation references metadata
            if (isset($meta['relation']['references'])) {
                $event->data['metadata']['relation_references'] = array_keys($meta['relation']['references']);
            } else {
                $event->data['metadata']['relation_references'] = array();
            }

            // restore the tag metadata if the tag plugin handler has been called before the include plugin handler.
            if ($tag_called) {
                $tag_helper = $this->loadHelper('tag', false);
                if ($tag_helper) {
                    if (isset($meta['subject']))  {
                        $event->data['metadata']['subject'] = $tag_helper->_cleanTagList($meta['subject']);
                    } else {
                        $event->data['metadata']['subject'] = array();
                    }
                }
            }

            // restore user information
            $USERINFO = $userinfo_backup;
            $_SERVER['REMOTE_USER'] = $remote_user;
        }
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:73,代码来源:action.php

示例11: aclCheck

 /**
  * Returns the permissions of a given wiki page for the current user or another user
  *
  * @param string $id page id
  * @param string|null $user username
  * @param array|null $groups array of groups
  * @return int permission level
  */
 public function aclCheck($id, $user = null, $groups = null)
 {
     /** @var DokuWiki_Auth_Plugin $auth */
     global $auth;
     $id = $this->resolvePageId($id);
     if ($user === null) {
         return auth_quickaclcheck($id);
     } else {
         if ($groups === null) {
             $userinfo = $auth->getUserData($user);
             if ($userinfo === false) {
                 $groups = array();
             } else {
                 $groups = $userinfo['grps'];
             }
         }
         return auth_aclcheck($id, $user, $groups);
     }
 }
开发者ID:janzoner,项目名称:dokuwiki,代码行数:27,代码来源:RemoteAPICore.php

示例12: subscriber_addresslist

/**
 * Return a string with the email addresses of all the
 * users subscribed to a page
 *
 * @author Steven Danz <steven-danz@kc.rr.com>
 */
function subscriber_addresslist($id, $self = true)
{
    global $conf;
    global $auth;
    if (!$conf['subscribers']) {
        return '';
    }
    $users = array();
    $emails = array();
    // load the page mlist file content
    $mlist = array();
    $file = metaFN($id, '.mlist');
    if (@file_exists($file)) {
        $mlist = file($file);
        foreach ($mlist as $who) {
            $who = rtrim($who);
            if (!$self && $who == $_SERVER['REMOTE_USER']) {
                continue;
            }
            $users[$who] = true;
        }
    }
    // load also the namespace mlist file content
    $ns = getNS($id);
    while ($ns) {
        $nsfile = metaFN($ns, '/.mlist');
        if (@file_exists($nsfile)) {
            $mlist = file($nsfile);
            foreach ($mlist as $who) {
                $who = rtrim($who);
                if (!$self && $who == $_SERVER['REMOTE_USER']) {
                    continue;
                }
                $users[$who] = true;
            }
        }
        $ns = getNS($ns);
    }
    // root namespace
    $nsfile = metaFN('', '.mlist');
    if (@file_exists($nsfile)) {
        $mlist = file($nsfile);
        foreach ($mlist as $who) {
            $who = rtrim($who);
            if (!$self && $who == $_SERVER['REMOTE_USER']) {
                continue;
            }
            $users[$who] = true;
        }
    }
    if (!empty($users)) {
        foreach (array_keys($users) as $who) {
            $info = $auth->getUserData($who);
            if ($info === false) {
                continue;
            }
            $level = auth_aclcheck($id, $who, $info['grps']);
            if ($level >= AUTH_READ) {
                if (strcasecmp($info['mail'], $conf['notify']) != 0) {
                    $emails[] = $info['mail'];
                }
            }
        }
    }
    return implode(',', $emails);
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:72,代码来源:common.php

示例13: _notifySubscribers

 /**
  * Notifies subscribers
  */
 function _notifySubscribers($updates)
 {
     global $auth;
     // acl required
     if (!$auth) {
         return;
     }
     $page_ids = $media_ids = array();
     $subs = array('page' => array(), 'media' => array(), 'ns' => array(), 'user' => array());
     // collect updated page and media IDs
     foreach ($updates as $entry) {
         if ($entry['class'] === 'page') {
             $page_ids[$entry['id']] = 1;
         } elseif ($entry['class'] === 'media') {
             $media_ids[$entry['id']] = 1;
         }
     }
     // load subscribers of each page/media and its parent namespaces
     foreach (array_keys($page_ids) as $id) {
         $this->_loadSubscribers($subs, $id, 'page');
     }
     foreach (array_keys($media_ids) as $id) {
         $ns = (string) getNS($id);
         $this->_loadSubscribers($subs, $ns);
         $subs['media'][$id] = $subs['ns'][$ns];
     }
     // notify for each user (not for each update entry)
     $mail_count = 0;
     foreach (array_keys($subs['user']) as $user) {
         // user exists?
         if (!($info = $auth->getUserData($user))) {
             continue;
         }
         // search subscribed pages and media with acl checking
         $subscribed = array();
         foreach (array('page', 'media') as $type) {
             foreach (array_keys($subs[$type]) as $id) {
                 if (!isset($subs[$type][$id][$user])) {
                     continue;
                 }
                 $checkid = $type === 'media' ? getNS($id) . ':dummyID' : $id;
                 if (auth_aclcheck($checkid, $user, $info['grps']) < AUTH_READ) {
                     continue;
                 }
                 $subscribed[$type][$id] = 1;
             }
         }
         if (empty($subscribed)) {
             continue;
         }
         // extract update log entries for the user
         $updates_for_user = array();
         foreach ($updates as $entry) {
             if (isset($this->_skip['sub_selfmod']) && $entry['user'] === $user) {
                 continue;
                 // skip selfmod
             }
             if (isset($subscribed[$entry['class']][$entry['id']])) {
                 $updates_for_user[] = $entry;
             }
         }
         if (empty($updates_for_user)) {
             continue;
         }
         // send email digest
         $successfully_sent = $this->_sendMail($info['mail'], $this->_buildMailSubject('subscribers'), $this->_buildMailBody('subscribers', $updates_for_user), $this->_buildFromAddress($info['mail']));
         if ($successfully_sent) {
             $mail_count++;
         }
     }
     if ($mail_count) {
         $this->_debug("Digest message sent (subscribers: {$mail_count} messages)");
     }
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-emaildigest,代码行数:77,代码来源:action.php

示例14: auth_quickaclcheck

/**
 * Convinience function for auth_aclcheck()
 *
 * This checks the permissions for the current user
 *
 * @author  Andreas Gohr <andi@splitbrain.org>
 *
 * @param  string  $id  page ID (needs to be resolved and cleaned)
 * @return int          permission level
 */
function auth_quickaclcheck($id)
{
    global $conf;
    global $USERINFO;
    # if no ACL is used always return upload rights
    if (!$conf['useacl']) {
        return AUTH_UPLOAD;
    }
    //error_log("DOKUWIKI: auth_quickaclcheck:".$_SERVER['REMOTE_USER'].":".$id.json_encode($USERINFO));
    return auth_aclcheck($id, $_SERVER['REMOTE_USER'], $USERINFO['grps']);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:21,代码来源:auth.php

示例15: checkTargetPageNames

 /**
  * @param $runas
  * @return mixed
  * @throws Exception
  */
 function checkTargetPageNames($runas)
 {
     foreach (array_keys($this->templates) as $pname) {
         // prevent overriding already existing pages
         if (page_exists($pname)) {
             throw new Exception(sprintf($this->getLang('e_pageexists'), html_wikilink($pname)));
         }
         // check auth
         if ($runas) {
             $auth = auth_aclcheck($pname, $runas, array());
         } else {
             $auth = auth_quickaclcheck($pname);
         }
         if ($auth < AUTH_CREATE) {
             throw new Exception($this->getLang('e_denied'));
         }
     }
     return $pname;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:24,代码来源:template.php


注:本文中的auth_aclcheck函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。