function wiki_menu_parse_item($src, $params) { global $wiki_menu_global_vars; if ($wiki_menu_global_vars == nil) { $wiki_menu_global_vars = array('anon_redirect' => !user_authorized() ? 'redirect=' . get_redirection() : '', 'document_root' => config_get('document-root')); } $vars = $wiki_menu_global_vars; foreach ($vars as $var => $val) { $src = preg_replace('/\\$' . $var . '/', $val, $src); } $params = array(); $modifers = preg_replace('/^([\\:lL]+)?(\\s*)(.*)/si', '\\1', $src); $data = preg_replace('/^([\\:lL]+)?(\\s*)(.*)/si', '\\3', $src); $parse = true; for ($i = 0; $i < count($modifers); $i++) { if ($modifers[$i] == ':') { $parse = false; } if ($modifers[$i] == 'l' && !user_authorized()) { return false; } if ($modifers[$i] == 'L' && user_authorized()) { return false; } } if (!$parse) { $src = $data; } else { global $wiki_menu_rules; $src = htmlspecialchars($data); $n = count($wiki_menu_rules); for ($i = 0; $i < $n; $i++) { $src = preg_replace($wiki_menu_rules[$i]['pattern'], $wiki_menu_rules[$i]['replace'], $src); } } return $src; }
/** * Gate - Wiki engine and web-interface for WebTester Server * * Handlers for profile page * * Copyright (c) 2008-2009 Sergey I. Sharybin <*****@*****.**> * * This program can be distributed under the terms of the GNU GPL. * See the file COPYING. */ if ($PHP_SELF != '') { print 'HACKERS?'; die; } if (!user_authorized()) { header('Location: ..?redirect=' . get_redirection()); } global $redirect, $action; if ($action == 'save') { global $email, $chpasswd_val; $email = stripslashes($email); $arr = array(); $u = user_get_by_id(user_id()); if ($u['email'] != '' && !check_email($email)) { add_info('Указанный E-Mail не выглядит корректным'); } else { if (user_registered_with_email($email, user_id())) { add_info('Такой E-Mail уже используется.'); } else { $arr['email'] = db_string($email);
/** * Gate - Wiki engine and web-interface for WebTester Server * * Main handlers for XPFS browser * * Copyright (c) 2008-2009 Sergey I. Sharybin <*****@*****.**> * * This program can be distributed under the terms of the GNU GPL. * See the file COPYING. */ if ($PHP_SELF != '') { print 'HACKERS?'; die; } if (!user_authorized() || !user_access_root()) { header('Location: ' . config_get('document-root') . '/admin'); } global $DOCUMENT_ROOT; include $DOCUMENT_ROOT . '/inc/xpfs_browser.php'; include $DOCUMENT_ROOT . '/admin/inc/menu.php'; include '../menu.php'; $manage_menu->SetActive('to-developer'); $mandev_menu->SetActive('xpfs'); // Printing da page print $manage_menu->InnerHTML(); print $mandev_menu->InnerHTML(); print '${information}'; $browser = new XPFSBrowser(); $browser->interact(); $browser->Draw();
//OTHER MODULES $modules = array(); foreach (glob("uses/*.php") as $module) { require_once $module; $module_name = str_replace("uses/", "", str_replace(".php", "", $module)); $modules[] = $module_name; $fname = $module_name . "_connect"; if (function_exists($fname)) { $fname(); } } //LOGIN - different menus generation for different user's $menu_logout = ""; $menu_user = ""; $menu_users = ""; if (user_authorized() && $_SESSION['userid'] == 1) { $menu_users = ":: <a href=?q=users>Users</a>"; } if (!isset($_GET['q']) || $_GET['q'] == '') { if (function_exists("def_q")) { $_GET['q'] = def_q(); } else { $_GET['q'] = 'home'; } } //converts /about link to /p/34 menu_check_by_name($_GET['q']); page_check_by_name($_GET['q']); $parts = explode('/', $_GET['q']); //CHECK FOR page_function $function = "page";
function page_user_login() { if (user_authorized()) { redir(""); } $output = ""; if (function_exists("on_user_login")) { on_user_login(); } //authorization if (form_post('username')) { $username = $_POST['username']; $pass = $_POST['password']; $res = db_result(db_query("SELECT id FROM users WHERE email='%s' AND password='******' LIMIT 1", $username, $pass)); if ($res) { $_SESSION['userid'] = $res; log_message("Loged in."); if (form_post("redir")) { redir(form_post("redir")); } else { redir(""); } //to refresh menu return; } else { $output .= errormsg("Login failed"); sleep(1); } } $GOBALS['log'] = " "; form_start("?q=user/login", "post", " name=user_login_form "); form_input("{~Email}", "username", form_post("username"), "", ""); form_password("{~Password}", "password", "", "", ""); global $form; $form .= "<input type=submit value='submit' style='width:0px;height:0px;visibility:hidden;'>"; if (form_post("redir")) { $form .= "<input type=hidden name=redir value='" . form_post("redir") . "'>"; } form_end(); $output .= form(); $output .= "<div style='position:absolute;' id=login_btn ><img style='padding-bottom:10px;cursor:pointer' onclick='document.user_login_form.submit()' alt='login' src=slice/login_all.png/835/667/146/46></div>"; $output .= "<div style='position:absolute;padding-bottom:10px;' id=forgot_btn ><a style='color:#999' href=?q=pass/recover><img alt='forgot' src=slice/login_all.png/363/761/147/47></a></div>"; return "{$output}"; }
function FillTopMenu() { if (!user_authorized()) { $this->topmenu->AppendItem('Представиться системе / Зарегистрироваться', config_get('document-root') . '/login?redirect=' . get_redirection(), 'logout', 'key.gif'); } if (!user_authorized() || user_access_root()) { if (nav_inside('/admin') >= 0) { $this->topmenu->AppendItem('Основной раздел', config_get('document-root') . '/', 'main', ''); } else { $this->topmenu->AppendItem('Административный интерфейс', config_get('document-root') . '/admin/?redirect=' . get_redirection(), 'main', ''); } } if (user_authorized()) { $this->topmenu->AppendItem('Выйти из системы', config_get('document-root') . '/?action=logout&redirect=' . get_redirection(), 'logout', 'lock.gif'); } }
function graph_view_tree_filter() { global $colors; load_current_session_value("tree_id", "sess_graph_view_tree_id", "-2"); $trees = db_fetch_assoc("SELECT * FROM graph_tree WHERE user_id=" . $_SESSION["sess_user_id"] . " OR user_id=0 ORDER BY user_id, name"); ?> <table class="startBoxHeader wp100 startBox0" cellspacing=0 cellpadding=0> <tr class="rowGraphFilter noprint"> <td class="noprint"> <form name="form_graph_tree" method="get" action="graph_view.php"> <table cellspacing="1" cellpadding="0"> <tr> <td class="w1"> <?php print __("Trees:");?> </td> <td class="w1"> <select id='tree' onchange='window.location.assign("graph_view.php?parent=true&tree_id="+document.getElementById("tree").value)' name='tree'> <option value='-2'<?php if ($_REQUEST["tree_id"] == "-2") {?> selected<?php }?>>System Trees</option><?php if (sizeof($trees)) { if (user_authorized("19")) { print "<option value='-1'" . ($_REQUEST["tree_id"] == "-1" ? " selected":"") . ">User Trees</option>"; } foreach($trees as $tree) { print "<option value='" . $tree["id"] . "'" . ($_REQUEST["tree_id"] == $tree["id"] ? " selected":"") . ">" . $tree["name"] . ($tree["user_id"] == 0 ? " (System)":" (User)") . "</option>"; } }?> </select> </td> <td class='nw'><?php if (user_authorized("19")) {?> <input type='button' value='Manage' onclick='window.location.assign("tree_manage.php?tree_id=<?php print $tree["id"];?>")'><?php }?> </td> </tr> </table> <table valign='top' cellpadding=0 cellspacing=0 width='100%'> <tr class="rowHeader"> <td class="textHeaderDark"> <?php print __("Items");?> </td> </tr> </table> </form> </td> </tr> </table> <?php }