예제 #1
0
파일: wiki.php 프로젝트: Nazg-Gul/gate
 function wiki_get_page($url)
 {
     global $wiki, $history, $oldid, $uid;
     $tabacts = array('edit' => 1, 'history' => 1, 'admin' => 1);
     if ($url == '') {
         $url = '/';
     }
     if ($url[strlen($url) - 1] != '') {
         $url .= '/';
     }
     content_url_var_push('wiki', $wiki);
     redirector_add_skipvar('oldid');
     $error = false;
     $src = wiki_eval_page($url, $wiki, &$error);
     if ($error) {
         return $src;
         return;
     }
     $cur = prepare_arg(get_redirection(false, true));
     $items = array();
     $uidurl = $uid != '' ? 'uid\\=' . $uid : '';
     $dir = $url;
     if ($url[strlen($url) - 1] == '/') {
         $url .= '?';
     } else {
         $url .= '&';
     }
     if ($uidurl != '') {
         $uidurl = '&' . $uidurl;
     }
     $items[] = 'title=Статья;hint=Чтение статьи;url=' . (isset($tabacts[$wiki]) ? $url . $uidurl : 'JavaScript:refreshPage (\'' . urlencode(urlencode($cur)) . '\');') . ';active=' . (!isset($tabacts[$wiki]) ? '1' : '0') . ';';
     if (content_get_allowed('EDIT') || content_get_allowed('EDITINFO')) {
         $items[] = 'separator=1;';
         if (file_exists(config_get('site-root') . $dir . 'edit.php')) {
             $items[] = 'title=Редактирование;hint=Редактирование ' . 'содержимого страницы;url=' . ($wiki != 'edit' ? $url . 'wiki\\=edit' . $uidurl : $cur) . ';active=' . ($wiki == 'edit' ? '1' : '0');
         }
         if (file_exists(config_get('site-root') . $dir . 'history.php')) {
             $items[] = 'title=История;hint=История изменения документа;url=' . ($wiki != 'history' ? $url . 'wiki\\=history' . $uidurl : $cur) . ';active=' . ($wiki == 'history' ? '1' : ($oldid != '' ? 'shaded' : '0'));
         }
     }
     $static_rules = config_get('static-privacy-rules');
     if (user_access_root() || $static_rules[strtolower(user_login())][$dir . 'admin.php']) {
         if (file_exists(config_get('site-root') . $dir . 'admin.php')) {
             $items[] = 'title=Администрирование;hint=Администрирование ' . 'раздела;url=' . ($wiki != 'admin' ? $url . 'wiki\\=admin' . $uidurl : $cur) . ';active=' . ($wiki == 'admin' ? '1' : '0');
         }
     }
     return stencil_wiki_page($src, $items);
 }
예제 #2
0
 function Contest_Manager($id, $clear = false)
 {
     content_url_var_push_global('action');
     content_url_var_push('id', $id);
     content_url_var_push_global('cman');
     content_url_var_push_global('pbrows');
     content_url_var_push_global('prpage');
     $this->Contest_ActionHandler();
     $contest = WT_contest_by_id($id);
     $this->InsertTemplate('contest.edit', array('data' => $contest, 'lib' => $this));
 }
예제 #3
0
 function GetItemEditorLink($id)
 {
     $wiki = content_url_var_pop('wiki');
     $url = content_url_get_full();
     $data = $this->data[$this->idlink[$id]];
     $redirect = get_redirection();
     if ($this->IsDated()) {
         $y = preg_replace('/([0-9]+)\\-([0-9]+)\\-([0-9]+)/si', '\\1', $data['date']);
         $m = preg_replace('/([0-9]+)\\-([0-9]+)\\-([0-9]+)/si', '\\2', $data['date']);
         $d = preg_replace('/([0-9]+)\\-([0-9]+)\\-([0-9]+)/si', '\\3', $data['date']);
         return $url . '&wiki=edit&action=edit&year=' . $y . '&month=' . $m . '&day=' . $d . '&uid=' . $data['uid'] . '&redirect=' . $redirect;
     } else {
         return $url . '&wiki=edit&action=edit&uid=' . $data['uid'] . '&redirect=' . $redirect;
     }
     content_url_var_push('wiki', $wiki);
 }
예제 #4
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));
     }
 }