function Contest_Save($id, $clear = false) { global $noarchive; $contest = WT_contest_by_id($id); $name = FormPOSTValue('name', 'ContestSettings'); if (trim($name) == '') { add_info('Название контеста не может быть пустым.'); return false; } $settings = $contest['settings']; $settings['rules'] = atoi(FormPOSTValue('rules', 'ContestSettings')); $settings['duration'] = atoi(FormPOSTValue('duration', 'ContestSettings')); $settings['freezetime'] = atoi(FormPOSTValue('freezetime', 'ContestSettings')); $settings['penalty'] = atoi(FormPOSTValue('penalty', 'ContestSettings')); $settings['trycount'] = atoi(FormPOSTValue('trycount', 'ContestSettings')); $settings['unfrozen'] = atoi(FormPOSTValue('unfrozen', 'ContestSettings')); $settings['viewdetail'] = atoi(FormPOSTValue('viewdetail', 'ContestSettings')); $settings['show_last_accepted'] = atoi(FormPOSTValue('show_last_accepted', 'ContestSettings')); $settings['ignore_ce'] = atoi(FormPOSTValue('ignore_ce', 'ContestSettings')); $settings['autostart'] = $_POST['contest_autostart']; if ($settings['autostart']) { $date = new CDCDate(); $date->Init(); $date->ReceiveValue('contest_autostart_date'); $settings['autostart.date'] = $date->GetValue(); $time = new CDCDate(); $time->Init(); $time->ReceiveValue('contest_autostart_time'); $settings['autostart.time'] = $time->GetValue(); } if (!$noarchive) { if ($_FILES['archive']['name'] != '') { file_unlink_encrypted($settings['archive']); $data = $_FILES['archive']; if (WT_contest_running($id) || WT_contest_finished($id)) { $blocked = 0; } else { $blocked = 1; } $settings['archive'] = file_store_encrypted($data, 1, $blocked); } } else { file_unlink_encrypted($settings['archive']); $settings['archive'] = ''; } $update = array('name' => db_html_string($name), 'settings' => db_string(serialize($settings))); db_update('tester_contests', $update, "`id`={$id}"); return true; }
function CreateReceived() { return $this->Create(stripslashes(FormPOSTValue('name', 'ContestData')), FormPOSTValue('module', 'ContestData')); }
function Problems_Save($id) { global $anstype, $anscount; if (!$this->GetAllowed('CONTEST.MANAGE')) { return; } $name = stripslashes(FormPOSTValue('name', 'ProblemSettings')); $r = db_row_value('tester_problems', '`id`=' . $id); $desc = iframe_accept_content('desc', $r['description']); $s = array(); $s['anstype'] = $anstype; $s['anscount'] = $anscount; $ans = array(); for ($i = 0; $i < $anscount; $i++) { $ans[$i] = array('text' => htmlspecialchars(stripslashes($_POST['ans_text_' . $i])), 'correct' => $_POST['ans_correct_' . $i] ? 1 : 0, 'static' => $_POST['ans_static_' . $i] ? 1 : 0); } $s['ans'] = $ans; db_update('tester_problems', array('name' => db_string($name), 'description' => db_string($desc), 'settings' => db_string(serialize($s))), '`id`=' . $id); }