Пример #1
0
$request->valid(new Valid_String('post_changes'));
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vAccessFile = new Valid_Text('form_accessfile');
    $vAccessFile->setErrorMessage($Language->getText('svn_admin_access_control', 'upd_fail'));
    if ($request->valid($vAccessFile)) {
        $saf = new SVNAccessFile();
        $form_accessfile = null;
        //store the custom access file in db
        if ($request->exist('submit_new_version')) {
            $form_accessfile = trim($saf->parseGroupLines($project, $request->get('form_accessfile'), true));
            $dao->saveNewAccessFileVersionInProject($group_id, $form_accessfile);
        } else {
            $form_accessfile = $saf->parseGroupLines($project, $request->get('other_version_content'), true);
            $version_id = $request->get('version_selected');
            $dao->updateAccessFileVersionInProject($group_id, $version_id);
        }
        $buffer = svn_utils_read_svn_access_file_defaults($project_svnroot);
        $buffer .= $form_accessfile;
        $ret = svn_utils_write_svn_access_file($project_svnroot, $buffer);
        if ($ret) {
            $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_access_control', 'upd_success'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_access_control', 'upd_fail'));
        }
    }
    $GLOBALS['Response']->redirect('/svn/admin/?func=access_control&group_id=' . $group_id);
}
// Display the form
svn_header_admin(array('title' => $Language->getText('svn_admin_access_control', 'access_ctrl'), 'help' => 'svn.html#subversion-access-control'));
if (svn_utils_svn_repo_exists($project_svnroot)) {