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); }
function redirect($url = '', $skipvars = array()) { global $redirect; foreach ($skipvars as $k => $v) { redirector_add_skipvar($k, $v); } if ($url == 'SELF') { $url = get_redirection(false); } if ($url != '') { $redirect = $url; } if ($redirect == '') { $redirect = config_get('document-root'); } header("Location: {$redirect}"); }
function PAGE_Solutions() { global $pageid; redirector_add_skipvar('action'); redirector_add_skipvar('id'); redirector_add_skipvar('detail'); if (!$this->GetAllowed('SOLUTIONS.MANAGE')) { return; } $this->Solutions_ActionHandler(); $this->gateway->AppendNavigation('Список решений участников олимпиады', '?page=solutions' . ($pageid != '' ? '&pageid=' . $pageid : '')); $this->CPrintLn(stencil_formo()); $this->InsertTemplate('solutions_form', array('lib' => $this, 'accDel' => $this->GetAllowed('SOLUTIONS.DELETE'))); $this->CPrintLn(stencil_formc()); }
function Editor_EditForm($formname = '') { global $action, $id; if (!$this->GetAllowed('EDIT')) { return; } if ($this->MaxDepth() <= 0) { println('<span class="contentSub2">Структура католока пуста</span>'); return; } if ($action != 'edit') { redirector_add_skipvar('id'); redirector_add_skipvar('iid'); } $this->Editor_EditForm_ActionHandler($formname); $this->Editor_EditForm_DrawNavigator($formname); if ($action != 'edit') { // Draw items at current catalogue $this->Editor_EditForm_DrawItems($formname); // Create form $this->Editor_EditForm_CreateForm($formname); } else { $this->Editor_EditForm_EditItem($id, $formname); } }
function PAGE_Solutions() { global $CORE; global $pageid; if (!$this->GetAllowed('SOLUTIONS.MANAGE')) { return; } $CORE->AddStyle('testing'); redirector_add_skipvar('action'); redirector_add_skipvar('id'); redirector_add_skipvar('detail'); $this->Solutions_ActionHandler(); $this->gateway->AppendNavigation('Список решений', '?page=solutions' . ($pageid != '' ? '&pageid=' . $pageid : '')); $this->CPrintLn(stencil_formo()); $this->InsertTemplate('solutions', array('lib' => $this)); $this->CPrintLn(stencil_formc()); }
function Page_Contest() { global $action, $id, $changeto, $clear; $this->AppendNavigation('Список контестов', '/?page=contest'); redirector_add_skipvar('action', 'restart'); redirector_add_skipvar('action', 'start'); redirector_add_skipvar('action', 'delete'); if ($action != 'manage') { redirector_add_skipvar('id'); } $ccnt = $this->SpawnContestContainer(); $create = $this->GetAllowed('CONTEST.CREATE'); $del = $this->GetAllowed('CONTEST.DELETE'); $manage = $this->GetAllowed('CONTEST.MANAGE'); $pageManage = $action == 'manage' && $manage; if (!isset($clear)) { if (isset($changeto)) { $this->SwitchToContest($changeto); if ($manage) { redirect('.?page=contest&action=manage&id=' . $changeto); } } if ($action == 'create' && $create) { $ccnt->CreateReceived(); redirect('SELF', array('action' => '')); } if ($action == 'delete' && $del) { $ccnt->Delete($id); redirect('SELF', array('action' => '', 'id' => '')); } if ($manage) { if ($action == 'stop' || $action == 'start' || $action == 'restart') { $ccnt->{$action}($id); } if ($action == 'save' && $manage) { $cnt = WT_spawn_new_contest_container(0); $action = 'manage'; $cnt->Save($id); } } if ($action == 'manage' && !$manage) { unset($action); unset($id); } if ($pageManage) { $this->CPrintLn('<table width="100%"><tr valign="top">' . '<td width="50%" style="padding-right: 2px;">'); } $this->CPrintLn(stencil_formo('title=Список доступных контестов;' . (!$this->GetAllowed('CONTEST.CREATE') ? 'smb=true;' : ''))); $this->InsertTemplate('contest.list', array('data' => $ccnt->GetAccessibleList(user_id()), 'current_contest' => $this->current_contest, 'accManage' => $manage, 'accDel' => $del)); $this->CPrintLn(stencil_formc()); if ($pageManage) { $this->CPrintLn('</td><td style="padding-left: 2px;">'); $this->Page_ContestManager($id); $this->CPrintLn('</td></tr></table>'); } if ($this->GetAllowed('CONTEST.CREATE')) { $this->Page_DrawContentCreate(); } } else { if ($pageManage) { $this->Page_ContestManager($id, true); } } }
function Editor_LogManage() { global $active, $act, $CORE; $CORE->AddStyle('log'); if (isset($active)) { if ($active == '0') { $this->settings['active'] = false; } else { $this->settings['active'] = true; } $this->UpdateSettings(); } if ($act == 'free') { $this->FreeLogs(); } redirector_add_skipvar('act', 'free'); $url = content_url_get_full(); $update_active = 'nav (\'' . $url . '&active=' . ($this->settings['active'] ? '0' : '1') . '\');'; $free_logs = 'cnav (\'Вы уверены что хотите очистить все файлы журналов?\', \'' . $url . '&act=free\');'; formo('title=Управление сервисом'); ?> <input type="checkbox" class="cb" onclick="<?php echo $update_active; ?> " value="1"<?php echo $this->settings['active'] ? ' checked' : ''; ?> > Вести журналирование <i>(если данная опция неактивна, то сервис журналирования продолжит существовать, однако все журналирование будет отключено)</i><div id="hr"></div> <button class="block" onclick="<?php echo $free_logs; ?> ">Очистить файлы журналов</button> <?php formc(); }
function Editor_DrawHistory() { global $action, $id; $del = $this->GetAllowed('DELETE'); $edit = $this->GetAllowed('EDIT'); if ($action == 'delete') { redirector_add_skipvar('id'); if ($del) { $this->DeleteContentById($id); } } else { if ($action == 'rollback') { redirector_add_skipvar('action', 'rollback'); redirector_add_skipvar('id'); if ($edit) { $this->Rollback($id); } } } $q = db_select($this->settings['content'], array('*'), '', 'ORDER BY `timestamp` DESC'); if (db_affected() > 0) { println('<ul id="history">'); $i = 0; while ($r = db_row($q)) { $time = format_ltime($r['timestamp']); $time = '<a href=".?oldid=' . $r['id'] . '">' . $time . '</a>'; $user = user_generate_info_string($r['user_id']); $actions = ''; if ($edit) { $actions .= '[<a href=".?wiki=history&action=rollback&id=' . $r['id'] . '">Вернуться к этой версии</a>]'; } if ($del) { $actions .= stencil_ibtnav('minus_s.gif', content_url_get_full() . '&action=delete&id=' . $r['id'], 'Удалить', 'Удалить эту версию статьи?'); } if ($actions != '') { $actions = ' | ' . $actions; } if ($i < 2) { println(' <li><div class="top">' . $time . ' | ' . $user . ' ' . $actions . '</div></li>'); } else { println(' <li><div>' . $time . ' | ' . $user . ' ' . $actions . '</div></li>'); } $i++; } println('</ul>'); } else { println('<span class="contentSub2">' . '<i>Журнал изменений пуст</i></span>'); } }
ibtnav($i != count($list) - 1 ? 'arrdown_blue.gif' : 'arrdown_d.gif', $i != count($list) - 1 ? '?action=edit&id=' . $id . '&act=down&eid=' . $r['id'] : '', 'Опустить'); ?> <?php ibtnav($i != 0 ? 'arrup_blue.gif' : 'arrup_d.gif', $i != 0 ? '?action=edit&id=' . $id . '&act=up&eid=' . $r['id'] : '', 'Поднять'); ?> <?php ibtnav($imp ? 'info_d.gif' : 'info.gif', '?action=edit&id=' . $id . '&act=togimp&eid=' . $r['id'], $imp ? 'Обязательное' : 'Необязательное'); ?> <?php ibtnav($invis ? 'show_d.gif' : 'show.gif', '?action=edit&id=' . $id . '&act=togvis&eid=' . $r['id'], $invis ? 'Невидимое' : 'Видимое'); ?> <?php ibtnav('edit.gif', '?action=edit&id=' . $id . '&viewelement=' . $r['id'], 'Редактировать элемент'); if ($d == 0) { ibtnav('cross.gif', '?action=edit&id=' . $id . '&act=delete&eid=' . $r['id'], 'Удалить элемент', 'Удалить этот элемент?'); } else { ibtnav('cross_d.gif', '', 'Удалить элемент', 'Удалить этот элемент?'); } ?> </td> </tr> <?php } ?> </table> <?php formc(); redirector_add_skipvar('act', 'down'); redirector_add_skipvar('act', 'up');
function Draw() { global $CORE; if ($_GET['action'] != 'edit') { redirector_add_skipvar('file'); } $CORE->AddStyle('xpfs-browser'); $volumes = ''; for ($i = 0, $n = count($this->volumes); $i < $n; ++$i) { $volumes .= prepare_arg('<option value="' . htmlspecialchars($this->volumes[$i]) . '"' . ($this->volume == $this->volumes[$i] ? ' selected' : '') . '>' . htmlspecialchars($this->volumes[$i]) . '</option>'); } formo('title=<table width\\="100%"><tr><td>Браузер файловой системы' . '</td><td width\\="150px">Том:' . '<select style\\="margin-left: 6px\\; width: 100px" ' . 'onchange\\="nav (\'./?volume\\=\'+this.value)">' . $volumes . '</select></td></tr></table>'); if ($this->volume == '') { println('<i>Нет томов для просмотра</i>'); } else { if ($_GET['action'] == 'edit') { $this->drawEditForm($_GET['file']); } else { if ($_GET['action'] == 'save') { $this->XPFS->writeVolumeBlock($this->volume, $this->getFullPath($_GET['file']), stripslashes($_POST['xpfs_content'])); } } println('<table class="list xpfs_browser" width="100%">' . '<tr class="h"><th class="first">Путь: ' . htmlspecialchars($this->path) . '</th><th width="90">' . 'Время</th><th width="80">Доступ</th>' . '<th width="80" class="last">Атрибут</th></tr>' . "\n"); $listing = $this->XPFS->lsVolumeDir($this->volume, $this->path); $this->drawUpLink(count($listing) == 0); for ($i = 0, $n = count($listing); $i < $n; ++$i) { $this->drawNode($listing[$i], $i == $n - 1); } println('</table>'); println('<form action="' . $this->prepareURL() . '" method="post">'); println('<div class="xpfs_cmdline"><table class="clear" ' . 'width="100%"><tr><td width="120px"><b>Командная строка:</b>' . '</td><td><input type="text" class="txt block" ' . 'name="xpfs_command"></td><td width="80px">' . '<button style="margin-left: 8px; width: 24px" ' . 'type="submit">»</button></td></tr></table></div>'); println('</form>'); } formc(); }