Esempio n. 1
0
// the form values are therefore not updated.
//
$request->valid(new Valid_String('post_changes'));
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vTracked = new Valid_WhiteList('form_tracked', array('0', '1'));
    $vTracked->required();
    $vMandatoryRef = new Valid_WhiteList('form_mandatory_ref', array('0', '1'));
    $vMandatoryRef->required();
    $vPreamble = new Valid_Text('form_preamble');
    if ($request->valid($vTracked) && $request->valid($vPreamble) && $request->valid($vMandatoryRef)) {
        // group_id was validated in index.
        $form_tracked = $request->get('form_tracked');
        $form_preamble = $request->get('form_preamble');
        $form_mandatory_ref = $request->get('form_mandatory_ref');
        $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref);
        if ($ret) {
            $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
        }
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
    }
}
// Note: no need to purify the output since the svn preamble is stored
// htmlcharized and displayed with the entities.
// Display the form
svn_header_admin(array('title' => $Language->getText('svn_admin_general_settings', 'gen_settings'), 'help' => 'SubversionAdministrationInterface.html#SubversionGeneralSettings'));
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
Esempio n. 2
0
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vTracked = new Valid_WhiteList('form_tracked', array('0', '1'));
    $vTracked->required();
    $vMandatoryRef = new Valid_WhiteList('form_mandatory_ref', array('0', '1'));
    $vMandatoryRef->required();
    $vPreamble = new Valid_Text('form_preamble');
    $vCanChangeSVNLog = new Valid_WhiteList('form_can_change_svn_log', array('0', '1'));
    $vCanChangeSVNLog->required();
    if ($request->valid($vTracked) && $request->valid($vPreamble) && $request->valid($vMandatoryRef) && $request->valid($vCanChangeSVNLog)) {
        // group_id was validated in index.
        $form_tracked = $request->get('form_tracked');
        $form_preamble = $request->get('form_preamble');
        $form_mandatory_ref = $request->get('form_mandatory_ref');
        $form_can_change_svn_log = $request->get('form_can_change_svn_log');
        $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref, $form_can_change_svn_log);
        if ($ret) {
            EventManager::instance()->processEvent(Event::SVN_UPDATE_HOOKS, array('group_id' => $group_id));
            $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
        }
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
    }
    $GLOBALS['Response']->redirect('/svn/admin/?func=general_settings&group_id=' . $group_id);
}
// Note: no need to purify the output since the svn preamble is stored
// htmlcharized and displayed with the entities.
// Display the form
svn_header_admin(array('title' => $Language->getText('svn_admin_general_settings', 'gen_settings'), 'help' => 'svn.html#general-settings'));