function CheckTables() { if (!config_get('check-database')) { return; } if (!db_table_exists('tester')) { db_create_table_safe('tester', array('security' => 'TEXT DEFAULT ""', 'content' => 'TEXT DEFAULT ""')); db_insert('tester', array('security' => '"' . serialize(array()) . '"', 'content' => '"' . serialize(array()) . '"')); } if (!db_table_exists('tester_problems')) { db_create_table_safe('tester_problems', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'lid' => 'INT', 'name' => 'TEXT DEFAULT ""', 'description' => 'LONGTEXT DEFAULT ""', 'settings' => 'LONGTEXT DEFAULT ""', 'uploaded' => 'INT DEFAULT 0')); manage_settings_create('Количество задач на странице редактирования', 'Олимпиады', 'WT_problems_per_page', 'CSCNumber'); manage_settings_create('Количество задач на странице браузера', 'Олимпиады', 'WT_problems_per_browser_page', 'CSCNumber'); manage_settings_create('Количество записей на странице статуса', 'Олимпиады', 'WT_items_per_status_page', 'CSCNumber'); opt_set('WT_problems_per_page', 15); opt_set('WT_problems_per_browser_page', 10); opt_set('WT_items_per_status_page', 15); manage_setting_use('WT_problems_per_page'); manage_setting_use('WT_items_per_status_page'); manage_setting_use('WT_problems_per_browser_page'); } if (!db_table_exists('tester_tasks')) { db_create_table_safe('tester_tasks', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'contest_id' => 'INT', 'problem_id' => 'INT', 'letter' => 'INT', 'catid' => 'INT DEFAULT 0', 'settings' => 'LONGTEXT DEFAULT ""')); } if (!db_table_exists('tester_checkers')) { db_create_table_safe('tester_checkers', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'name' => 'LONGTEXT', 'uploaded' => 'BOOL DEFAULT 0', 'settings' => 'LONGTEXT DEFAULT ""')); } if (!db_table_exists('tester_solutions')) { db_create_table_safe('tester_solutions', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'lid' => 'INT', 'contest_id' => 'INT', 'problem_id' => 'INT', 'user_id' => 'INT', 'timestamp' => 'INT', 'status' => 'INT', 'parameters' => 'LONGTEXT DEFAULT ""', 'errors' => 'TEXT', 'points' => 'INT', 'ignored' => 'BOOL DEFAULT 0')); } if (!db_table_exists('tester_contestgroup')) { db_create_table_safe('tester_contestgroup', array('contest_id' => 'INT', 'group_id' => 'INT')); } if (!db_table_exists('tester_judgegroup')) { db_create_table_safe('tester_judgegroup', array('contest_id' => 'INT', 'group_id' => 'INT')); } if (!db_table_exists('tester_disabled_problems')) { db_create_table_safe('tester_disabled_problems', array('contest_id' => 'INT', 'problem_id' => 'INT')); } if (!db_table_exists('tester_tags_dict')) { db_create_table_safe('tester_tags_dict', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'tag' => 'TEXT')); } if (!db_table_exists('tester_problem_tags')) { db_create_table_safe('tester_problem_tags', array('problem_id' => 'INT', 'tag_id' => 'INT')); } }
function CreateSettings() { global $XPFS; $cfg = db_unpack($XPFS->readFile('/tester/wt.cfg')); if ($cfg['initialized']) { return; } manage_settings_create('Имя хоста основного сервера WebTester', 'WebTester', 'WT_server_host', 'CSCText'); manage_settings_create('IPC-порт основного сервера WebTester', 'WebTester', 'WT_server_port', 'CSCNumber'); manage_settings_create('Логин на основной сервер WebTester', 'WebTester', 'WT_server_login', 'CSCText'); manage_settings_create('Пароль на основной сервер WebTester', 'WebTester', 'WT_server_pass', 'CSCPassword'); manage_setting_use('WT_server_host'); manage_setting_use('WT_server_port'); manage_setting_use('WT_server_login'); manage_setting_use('WT_server_pass'); $cfg['initialized'] = 1; $XPFS->createDirectory('/', 'tester'); $XPFS->createFile('/tester', 'wt.cfg'); $XPFS->writeBlock('/tester/wt.cfg', db_pack($cfg)); }
function ReceiveSettings($formname = '') { $this->dataset = manage_receive_dataset_from_selector($formname); if ($this->dataset == null) { return false; } if ($this->dataset->GetID() < 0) { add_info('Не указан набор данных'); return false; } $this->dataset->Ref(); $fields = array('uid' => 'INT', 'order' => 'INT'); $arr = $this->dataset->GenCreateFields(); foreach ($arr as $k => $v) { $fields[$k] = $v; } $this->settings['dataset'] = array('id' => $this->dataset->GetID(), 'settings' => $this->dataset->GetSettings()); $this->settings['content'] = content_create_support_table($this->content_id, $this->dataset->GetID(), $fields); $this->settings['script'] = -1; $this->settings['itemScript'] = -1; $this->settings['fullScript'] = -1; $this->settings['detailed'] = $_POST[$formname . '_detailed'] ? 1 : 0; $this->UpdateScripts(); $s = 'content_' . $this->content_id . '_count'; manage_settings_create('Количество элементов на странице для раздела ' . '«' . htmlspecialchars($this->GetName()) . '»', 'Разделы', $s, 'CSCSignedNumber'); opt_set($s, '10'); return true; }
function Create() { manage_settings_create('Количество записей в RSS для одного раздела', 'Сервисы', 'rss_items_per_content', 'CSCNumber'); opt_set('rss_items_per_content', 7); manage_setting_use('rss_items_per_content'); }
function manage_settings_create_received() { if (manage_settings_create(stripslashes($_POST['name']), stripslashes($_POST['section']), $_POST['ident'], $_POST['classname'])) { $_POST = array(); } }