Пример #1
0
function isModerator($id)
{
    global $USERINFO;
    static $modlist = NULL;
    # Not logged in
    if (empty($_SERVER['REMOTE_USER'])) {
        return false;
    }
    if (is_null($modlist)) {
        $modlist = parseModlist(loadModlist());
    }
    # Check nearest non-root parent namespace
    for ($ns = getNS($id); $ns; $ns = getNS($ns)) {
        $wildcard = $ns . ':*';
        if (!empty($modlist[$wildcard])) {
            return in_array($modlist[$wildcard], $USERINFO['grps']);
        }
    }
    # Check root namespace
    if (!empty($modlist['*'])) {
        return in_array($modlist['*'], $USERINFO['grps']);
    }
    # No moderator group set for any of parent namespaces
    return false;
}
Пример #2
0
 /**
  * remove acl-entry from conf/acl.auth.php
  *
  * @author  Frank Schubert <*****@*****.**>
  */
 function _acl_del($acl_scope)
 {
     $acl_config = loadModlist();
     $acl_pattern = '^' . preg_quote($acl_scope, '/') . '\\s+.*$';
     // save all non!-matching
     $new_config = preg_grep("/{$acl_pattern}/", $acl_config, PREG_GREP_INVERT);
     return io_saveFile(DOKUTRANSLATE_MODLIST, join('', $new_config));
 }