Пример #1
0
 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'));
     }
 }
Пример #2
0
 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));
 }
Пример #3
0
 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');
 }