diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php index ad9b1f14..1580ff93 100644 --- a/f_install/j_setup_db.php +++ b/f_install/j_setup_db.php @@ -217,8 +217,8 @@ $result = Util::generateFileUsingSimpleTemplate( ); $result = Util::generateFileUsingSimpleTemplate( - __dir__.'/templates/menu.orig.js', - ROOT.'/d_shared/menu.js', + __dir__.'/templates/menu.orig.json', + ROOT.'/d_shared/menu.json', [], true ); diff --git a/f_install/templates/menu.orig.js b/f_install/templates/menu.orig.js deleted file mode 100644 index 308daf9d..00000000 --- a/f_install/templates/menu.orig.js +++ /dev/null @@ -1,8 +0,0 @@ -window.sammo_menu = [ - ['/bbs/board', '삼모게시판', '_blank'], - ['/bbs/tip', '팁/강좌', '_blank'], - ['/bbs/news', '삼국 일보', '_blank'], - ['/bbs/history2', '개인 열전', '_blank'], - ['/bbs/history3', '국가 열전', '_blank'], - ['/bbs/patch', '패치 내역', '_blank'] -]; \ No newline at end of file diff --git a/f_install/templates/menu.orig.json b/f_install/templates/menu.orig.json new file mode 100644 index 00000000..7bb5f4af --- /dev/null +++ b/f_install/templates/menu.orig.json @@ -0,0 +1,8 @@ +[ + ["/bbs/board", "삼모게시판", "_blank"], + ["/bbs/tip", "팁/강좌", "_blank"], + ["/bbs/news", "삼국 일보", "_blank"], + ["/bbs/history2", "개인 열전", "_blank"], + ["/bbs/history3", "국가 열전", "_blank"], + ["/bbs/patch", "패치 내역", "_blank"] +] \ No newline at end of file diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php index aad1c6a4..b2c7a7f3 100644 --- a/i_entrance/entrance.php +++ b/i_entrance/entrance.php @@ -12,6 +12,7 @@ $db = RootDB::db(); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1'); $userGrade = $session->userGrade; $acl = $session->acl; + ?> @@ -34,8 +35,6 @@ $acl = $session->acl; - - = 5 || $acl): ?> @@ -53,6 +52,7 @@ $acl = $session->acl; diff --git a/i_entrance/user_info.php b/i_entrance/user_info.php index 7203a283..dd650a15 100644 --- a/i_entrance/user_info.php +++ b/i_entrance/user_info.php @@ -26,8 +26,6 @@ require(__dir__.'/../vendor/autoload.php'); - - diff --git a/index.php b/index.php index 2d1297ce..9a9c9b85 100644 --- a/index.php +++ b/index.php @@ -30,10 +30,8 @@ if ($session->isLoggedIn()) { - - @@ -141,6 +139,7 @@ function postOAuthResult(result){ diff --git a/js/title.js b/js/title.js deleted file mode 100644 index 7fe5c47d..00000000 --- a/js/title.js +++ /dev/null @@ -1,15 +0,0 @@ -jQuery(function($){ - $.each(window.sammo_menu, function(idx){ - var href = this[0]; - var name = this[1]; - var target = (this.length > 2)?this[2]:null; - - var $a = $('{1}'.format(href, name)); - if(target){ - $a.attr('target', target); - } - var $li = $('').append($a); - $('#navbarNav .navbar-nav').append($li); - console.log(this); - }); -}); \ No newline at end of file diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php index a97f0a98..d403061e 100644 --- a/src/sammo/WebUtil.php +++ b/src/sammo/WebUtil.php @@ -135,4 +135,26 @@ class WebUtil $purifier = new \HTMLPurifier($config); return $purifier->purify($text); } + + public static function drawMenu(string $path): string{ + $json = Json::decode(file_get_contents($path)); + + $result = []; + foreach($json as $menuItem){ + if (count($path) == 2) { + [$url, $title] = $menuItem; + $targetAttr = ''; + } + else{ + [$url, $title, $target] = $menuItem; + $target = htmlspecialchars($target); + $targetAttr = "target='$target' "; + } + $title = htmlspecialchars($title); + $url = htmlspecialchars($url); + $result[] = "$title"; + } + + return join("\n", $result); + } }