예제 #1
0
function plugin_dump_action()
{
    global $vars, $auth_users, $realm;
    // if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this');
    if (Auth::check_role('readonly')) {
        die_message(T_("PKWK_READONLY prohibits this"));
    }
    $msg = PLUGIN_DUMP_ALLOW_RESTORE ? T_("dump & restore") : T_("dump");
    $body = '';
    while (Auth::check_role('role_adm')) {
        unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
        if (!Auth::auth_pw($auth_users)) {
            $body = "<p><strong>" . T_("The password is different.") . "</strong></p>\n";
            return array('msg' => $msg, 'body' => $body, 'http_code' => 401);
        }
    }
    // メニューを表示する必要があるか?
    if (!isset($vars['menu'])) {
        // 入力フォームを表示
        $body = plugin_dump_disp_form();
        return array('msg' => $msg, 'body' => $body);
    }
    $act = isset($vars['act']) ? $vars['act'] : NULL;
    set_time_limit(0);
    switch ($act) {
        case PLUGIN_DUMP_DUMP:
            $body = plugin_dump_download();
            break;
        case PLUGIN_DUMP_RESTORE:
            $retcode = plugin_dump_upload();
            $msg = $retcode['code'] == TRUE ? T_("Up-loading was completed.") : T_("It failed in up-loading.");
            $body = $retcode['msg'];
            break;
        default:
            // 無効な命令です。
            $body = T_("It is an invalid instruction.");
    }
    return array('msg' => $msg, 'body' => $body);
}
예제 #2
0
function dav_login($is_admin = false)
{
    global $auth_type, $auth_users;
    if ($is_admin && Auth::is_temp_admin()) {
        return true;
    }
    switch ($auth_type) {
        case 1:
            return Auth::auth_pw($auth_users);
        case 2:
            return Auth::auth_digest($auth_users);
    }
    return false;
}