Example #1
0
 function InitInstance($id = -1, $virtual = false)
 {
     $this->id = $id;
     $this->_virtual = $virtual;
     $q = db_select('service', array('*'), "`id` = {$id}");
     if (db_affected() <= 0) {
         $this->id = 0;
     } else {
         $r = db_row($q);
         $this->UnserializeSettings($r['settings']);
     }
     if (!$virtual) {
         content_url_var_push_global('action');
         content_url_var_push_global('id');
         editor_add_function('Управление сервисом', 'Editor_RSSManage');
         editor_add_function('Разделы', 'Editor_ContentManage');
     }
     if ($this->id > 0) {
         // Id>0 so the service has been created
         $url = content_url_get_full();
         if (preg_match('/^' . prepare_pattern(config_get('document-root')) . '[(\\/)|(\\/index.php)]?(\\?(.*))?$/si', $url)) {
             global $CORE;
             $CORE->PAGE->SetRSS($this->settings['title'], config_get('http-document-root') . '/rss.php');
         }
     }
 }
Example #2
0
 function InitInstance($id = -1, $virtual = false)
 {
     $this->id = $id;
     $this->_virtual = $virtual;
     if (!$virtual) {
         content_url_var_push_global('action');
         content_url_var_push_global('id');
         editor_add_function('Управление сервисом', 'Editor_LogManage');
         editor_add_function('Просмотр журналов', 'Editor_LogView');
     }
 }
Example #3
0
 function PAGE_ProblemsManager()
 {
     global $action, $redirect, $id, $pageid;
     content_url_var_push_global('pageid');
     if (!$this->GetAllowed('PROBLEMS.MANAGE')) {
         return;
     }
     if (!$this->GetAllowed('CHECKERS.MANAGE') && $action == 'checkers') {
         $action = '';
     }
     $this->gateway->AppendNavigation('Управление задачами', '?page=prbmanager' . ($pageid != '' ? '&pageid=' . $pageid : ''));
     if ($action != 'checkers') {
         $this->PAGE_ProblemsManager_ProblemsHandler();
         if ($this->GetAllowed('CHECKERS.MANAGE') && $action != 'showcreate') {
             $this->AppendQuickLink('Управление чекерами', '?page=prbmanager&action=checkers');
         }
     } else {
         $this->PAGE_ProblemsManager_CheckersHandler();
         $this->AppendQuickLink('Управление задачами', '?page=prbmanager');
     }
 }
Example #4
0
 function Editor_EditForm_EditItem($id, $formname = '')
 {
     global $iid;
     if (!$this->GetAllowed('EDITINFO')) {
         return;
     }
     content_url_var_push_global('action');
     content_url_var_push_global('id');
     content_url_var_push_global('iid');
     $full = content_url_get_full();
     $cat_id = $this->Editor_EditForm_CurCatId();
     $data = $this->GetCatItemHistory($cat_id, $id);
     if ($iid == '') {
         println('<span class="contentSub2 arr"><a href="' . $full . '&iid=' . $data[0]['id'] . '">Редактировать</a> последнюю версию</span><br><br>');
         println('<span class="contentSub2">История элемента:</span>');
         $this->DrawCatItemHistory($cat_id, $id);
     } else {
         $depth = $this->Editor_EditForm_CurCatDepth();
         $data = $this->GetCatalogueItem($depth, $id, $iid, false);
         $dataset = $this->GetCatDataset($cat_id);
         $dataset->SetFieldValues($data);
         $dataset->DrawEditorForm($formname, $full);
     }
 }
Example #5
0
 function DrawPublicationEditor($uid, $formname = '', $id = '')
 {
     $tmp = '';
     if ($id == '') {
         $id = $this->dbids[$this->uids[$uid]];
     }
     if (!$this->GetAllowed('EDITINFO')) {
         return;
     }
     content_url_var_push_global('redirect');
     content_url_var_push_global('function');
     content_url_var_push_global('uid');
     $r = db_row_value($this->settings['content'], '`id`=' . $id);
     $c = $this->SpawnDataset();
     $c->SetFieldValues($r);
     if ($tmp != '') {
         println('<span class="contentSub">Редактирование публикации за <b>' . format_ltime($r['timestamp']) . '</b></span>');
     }
     $c->DrawEditorForm($formname, content_url_get_full() . '&id=' . $id);
 }
Example #6
0
 function Contest_Manager($id, $clear = false)
 {
     global $CORE;
     if (!$this->GetAllowed('CONTEST.MANAGE')) {
         return;
     }
     $CORE->AddStyle('testing');
     content_url_var_push_global('action');
     content_url_var_push('id', $id);
     content_url_var_push_global('cman');
     $this->Contest_ActionHandler();
     $contest = WT_contest_by_id($id);
     if ($clear) {
         global $act;
         if ($act == 'showaddproblem') {
             $this->InsertTemplate('problem.form', array('data' => array(), 'lib' => $this, 'act' => 'createproblem'));
         } else {
             if ($act == 'editproblem') {
                 global $uid;
                 $r = db_row_value('tester_problems', '`id`=' . $uid);
                 $r['settings'] = unserialize($r['settings']);
                 $this->InsertTemplate('problem.form', array('data' => $r, 'lib' => $this, 'act' => 'saveproblem'));
             }
         }
     } else {
         $this->InsertTemplate('contest.edit', array('data' => $contest, 'lib' => $this));
     }
 }
Example #7
0
 function Handle()
 {
     global $WT_main_menu;
     content_url_var_push_global('page');
     if (wiki_admin_page()) {
         return false;
     }
     // Local handlers
     $handler = '';
     $n = count($WT_main_menu);
     for ($i = 0; $i < $n; $i++) {
         if ($WT_main_menu[$i][2] == $this->page) {
             $handler = $WT_main_menu[$i][3];
             break;
         }
     }
     if ($handler) {
         $this->{$handler}();
         return true;
     }
     // Library handlers
     $handler = $this->LIB_Handlers[$this->current_contest['lid']][$this->page];
     if (isset($handler)) {
         $lib = WT_spawn_new_library($this->current_contest['lid']);
         $lib->{$handler}();
     }
 }
Example #8
0
 function Editor_ManageEditForm()
 {
     content_url_var_push_global('action');
     content_url_var_push_global('function');
     content_url_var_push_global('id');
     $f = editor_get_function();
     if ($f != '') {
         $this->service->{$f}();
     }
 }