Exemplo n.º 1
0
function digest_auth($page, $auth_flag, $exit_flag, $auth_pages, $title_cannot)
{
    global $auth_users, $auth_method_type, $auth_type;
    global $realm;
    if (auth::is_page_auth($page, $auth_flag, $auth_pages, '', '')) {
        return true;
    }
    // No limit
    //$user_list = get_auth_page_users($page, $auth_pages);
    //if (empty($user_list)) return true; // No limit
    if (!auth::check_role('role_adm_contents')) {
        return true;
    }
    // 既にコンテンツ管理者
    if (auth::auth_digest($auth_users)) {
        return true;
    }
    // Auth failed
    if ($auth_flag || $exit_flag) {
        pkwk_common_headers();
    }
    if ($auth_flag) {
        header('HTTP/1.1 401 Unauthorized');
        header('WWW-Authenticate: Digest realm="' . $realm . '", qop="auth", nonce="' . uniqid() . '", opaque="' . md5($realm) . '"');
    }
    if ($exit_flag) {
        $body = $title = str_replace('$1', htmlspecialchars(strip_bracket($page)), $title_cannot);
        $page = str_replace('$1', make_search($page), $title_cannot);
        catbody($title, $page, $body);
        exit;
    }
    return false;
}
Exemplo n.º 2
0
 function is_page_editable($page, $uname, $gname = '')
 {
     global $edit_auth, $edit_auth_pages;
     global $read_auth, $read_auth_pages;
     if (!auth::is_page_auth($page, $read_auth, $read_auth_pages, $uname, $gname)) {
         return false;
     }
     return auth::is_page_auth($page, $edit_auth, $edit_auth_pages, $uname, $gname);
 }