Esempio n. 1
0
} else {
    if (preg_match("/^[a-f0-9]{32}\$/", $section_id) && in_array($domain_handle, ProjectInfo::$mDomainList)) {
        $db = Loader::db();
        $section_info = DocSectionManager::getSectionInfo($domain_handle, $section_id);
        if (count($section_info) == 0) {
            $error_info = t('No such section ID!');
        } else {
            if ($current_ver_code > $section_info['max_ver_code']) {
                $error_info = t('Bad request!');
            } else {
                $project_id = $section_info['project_id'];
                $project_info = ProjectInfo::getBasicInfo($project_id);
                if ($project_info == false) {
                    $error_info = t('Bad project');
                } else {
                    if (($user_right = ProjectInfo::getUserEditRight($project_id, $domain_handle, $section_info['volume_handle'], $section_info['part_handle'], $section_info['chapter_handle'], $_SESSION['FSEInfo']['fse_id'])) != 0) {
                        switch ($user_right) {
                            case ProjectInfo::EDIT_PAGE_USER_BANNED:
                                $error_info = t('You are banned currently due to the violation against the site policy!');
                                break;
                            case ProjectInfo::EDIT_PAGE_USER_NO_RIGHT:
                                $error_info = t('You have no right to edit this section!');
                                break;
                            default:
                                $error_info = t('Bad request!');
                                break;
                        }
                    } else {
                        $filename = DocSectionManager::getSectionContentPath($section_id, $current_ver_code, 'org');
                        $fp = fopen($filename, "r");
                        if ($fp) {
Esempio n. 2
0
} else {
    if (!in_array($domain_handle, ProjectInfo::$mDomainList)) {
        $error_info = t('Bad request.');
    } else {
        $project_info = ProjectInfo::getBasicInfo($project_id);
        if ($project_info == false) {
            $error_info = t('Bad project');
        } else {
            $fse_id = $_SESSION['FSEInfo']['fse_id'];
            $user_rights = ProjectInfo::getUserRights($project_id, $fse_id);
            $c = Page::getByID($page_id);
            $a = Area::get($c, $_REQUEST['areaHandle']);
            if (!is_object($a)) {
                $error_info = t('Bad request!');
            } else {
                if (($user_right = ProjectInfo::getUserEditRight($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle, $fse_id)) != 0) {
                    switch ($user_right) {
                        case ProjectInfo::EDIT_PAGE_USER_BANNED:
                            $error_info = t('You are banned currently due to the violation against the site policy!');
                            break;
                        case ProjectInfo::EDIT_PAGE_USER_NO_RIGHT:
                            $error_info = t('You have no right to edit this blog!');
                            break;
                        default:
                            $error_info = t('Bad request!');
                            break;
                    }
                }
            }
        }
    }