protected function __construct() { if (Path::IsAdminPage()) { $this->path = Path::admin(); } else { $this->path = Path::manager(); } $menu = array(); $dir = dir($this->path); while ($file = $dir->read()) { if (strrpos($file, 'menu_') !== false) { $name = substr($file, 0, strrpos($file, '.')); $div = explode('_', $name); if (sizeof($div) == 2) { $contents = implode('', file($this->path($file))); preg_match("/title=[\\S ]+/", $contents, $matches); $title = explode('"', $matches[0]); $menu[$div[1]]['title'] = $title[1]; } else { if (sizeof($div) == 3) { $contents = implode('', file($this->path($file))); preg_match("/title=[\\S ]+/", $contents, $matches); $title = explode('"', $matches[0]); if (!isset($menu[$div[1]])) { $menu[$div[1]] = array(); } if (!isset($menu[$div[1]['child']])) { $menu[$div[1]]['child'] = array(); } $menu[$div[1]]['child'][$div[2]] = $title[1]; ksort($menu[$div[1]]['child']); } } } } ksort($menu); $this->menu = $menu; // 현재 관리자페이지 위치 분석 $urls = explode('?', Url::This()); $url = substr($urls[0], 0, strrpos($urls[0], '.')); $url = substr($url, strrpos($url, '/')); $position = explode('_', $url); $this->position[0] = $position[1]; if (isset($position[2])) { $this->position[1] = $position[2]; } }
function signin() { // user already logged in if (isLogged()) { header('Location: ' . Path::admin()); exit; } global $tpl; global $_CONFIG; if (!canLogin()) { global $tpl; $tpl->assign('page_title', 'Error'); $tpl->assign('menu_links', Path::menu('error')); $tpl->assign('error_title', 'You’re in jail'); $tpl->assign('error_content', 'You have been banned after too many bad attemps. <div class="espace-top">Please try later.</div>'); $tpl->draw('error'); exit; } if (!empty($_POST['login']) && !empty($_POST['password'])) { if (!empty($_POST['token']) && acceptToken($_POST['token'])) { if (check_auth(htmlspecialchars($_POST['login']), $_POST['password'])) { loginSucceeded(); $cookiedir = ''; if (dirname($_SERVER['SCRIPT_NAME']) != '/') { $cookiedir = dirname($_SERVER["SCRIPT_NAME"]) . '/'; } session_set_cookie_params(0, $cookiedir, $_SERVER['HTTP_HOST']); session_regenerate_id(TRUE); // check if we need to redirect the user $target = isset($_GET['target']) && targetIsAllowed($_GET['target']) ? Path::$_GET['target']() : './'; header('Location: ' . $target); exit; } loginFailed(); errorPage('The given username or password was wrong. <br />If you do not remberer your login informations, just delete the file <code>' . basename($_CONFIG['settings']) . '</code>.', 'Invalid username or password'); } loginFailed(); errorPage('The received token was empty or invalid.', 'Invalid security token'); } $tpl->assign('page_title', 'Sign in'); $tpl->assign('menu_links', Path::menu('signin')); $tpl->assign('target', isset($_GET['target']) && targetIsAllowed($_GET['target']) ? htmlspecialchars($_GET['target']) : NULL); $tpl->assign('token', getToken()); $tpl->draw('form.signin'); exit; }
<?php if (!defined("__MAGIC__")) { exit; } $m = Member::Inst(); $top_btns = array(); if ($m->Action('is_login')) { $top_btns[10] = array(); $top_btns[10]['title'] = '회원페이지'; $top_btns[10]['link'] = $m->Link('view'); if ($m->Action('is_admin')) { $top_btns[20]['title'] = '관리자'; $top_btns[20]['link'] = Path::admin(); if (Widget::Inst()->Config('is_page')) { $top_btns[21]['title'] = '페이지[ON]'; } else { $top_btns[21]['title'] = '페이지[OFF]'; } $top_btns[21]['link'] = Widget::Inst()->Config('link_page'); if (Widget::Inst()->Config('is_design')) { $top_btns[22]['title'] = '디자인[ON]'; } else { $top_btns[22]['title'] = '디자인[OFF]'; } $top_btns[22]['link'] = Widget::Inst()->Config('link_design'); } $top_btns[30] = array(); $top_btns[30]['title'] = '로그아웃'; $top_btns[30]['link'] = $m->Link('logout'); } else {