Checked PSR-1: Basic Coding Standard

This commit is contained in:
kjh
2022-05-27 09:20:20 +00:00
parent 9199b7c986
commit b1640d7b76
42 changed files with 3734 additions and 3518 deletions

View File

@ -1,25 +1,29 @@
<?php
if (!defined('_GNUBOARD_')) exit;
if (!defined('_GNUBOARD_')) {
exit;
}
$g5_debug['php']['begin_time'] = $begin_time = get_microtime();
$files = glob(G5_ADMIN_PATH.'/css/admin_extend_*');
$files = glob(G5_ADMIN_PATH . '/css/admin_extend_*');
if (is_array($files)) {
foreach ((array) $files as $k=>$css_file) {
foreach ((array) $files as $k => $css_file) {
$fileinfo = pathinfo($css_file);
$ext = $fileinfo['extension'];
if( $ext !== 'css' ) continue;
if ($ext !== 'css') {
continue;
}
$css_file = str_replace(G5_ADMIN_PATH, G5_ADMIN_URL, $css_file);
add_stylesheet('<link rel="stylesheet" href="'.$css_file.'">', $k);
add_stylesheet('<link rel="stylesheet" href="' . $css_file . '">', $k);
}
}
include_once(G5_PATH.'/head.sub.php');
require_once G5_PATH . '/head.sub.php';
function print_menu1($key, $no='')
function print_menu1($key, $no = '')
{
global $menu;
@ -28,35 +32,39 @@ function print_menu1($key, $no='')
return $str;
}
function print_menu2($key, $no='')
function print_menu2($key, $no = '')
{
global $menu, $auth_menu, $is_admin, $auth, $g5, $sub_menu;
$str = "<ul>";
for($i=1; $i<count($menu[$key]); $i++)
{
if( ! isset($menu[$key][$i]) ){
for ($i = 1; $i < count($menu[$key]); $i++) {
if (!isset($menu[$key][$i])) {
continue;
}
if ($is_admin != 'super' && (!array_key_exists($menu[$key][$i][0],$auth) || !strstr($auth[$menu[$key][$i][0]], 'r')))
if ($is_admin != 'super' && (!array_key_exists($menu[$key][$i][0], $auth) || !strstr($auth[$menu[$key][$i][0]], 'r'))) {
continue;
}
$gnb_grp_div = $gnb_grp_style = '';
if (isset($menu[$key][$i][4])){
if (($menu[$key][$i][4] == 1 && $gnb_grp_style == false) || ($menu[$key][$i][4] != 1 && $gnb_grp_style == true)) $gnb_grp_div = 'gnb_grp_div';
if (isset($menu[$key][$i][4])) {
if (($menu[$key][$i][4] == 1 && $gnb_grp_style == false) || ($menu[$key][$i][4] != 1 && $gnb_grp_style == true)) {
$gnb_grp_div = 'gnb_grp_div';
}
if ($menu[$key][$i][4] == 1) $gnb_grp_style = 'gnb_grp_style';
if ($menu[$key][$i][4] == 1) {
$gnb_grp_style = 'gnb_grp_style';
}
}
$current_class = '';
if ($menu[$key][$i][0] == $sub_menu){
if ($menu[$key][$i][0] == $sub_menu) {
$current_class = ' on';
}
$str .= '<li data-menu="'.$menu[$key][$i][0].'"><a href="'.$menu[$key][$i][2].'" class="gnb_2da '.$gnb_grp_style.' '.$gnb_grp_div.$current_class.'">'.$menu[$key][$i][1].'</a></li>';
$str .= '<li data-menu="' . $menu[$key][$i][0] . '"><a href="' . $menu[$key][$i][2] . '" class="gnb_2da ' . $gnb_grp_style . ' ' . $gnb_grp_div . $current_class . '">' . $menu[$key][$i][1] . '</a></li>';
$auth_menu[$menu[$key][$i][0]] = $menu[$key][$i][1];
}
@ -66,12 +74,12 @@ function print_menu2($key, $no='')
}
$adm_menu_cookie = array(
'container' => '',
'gnb' => '',
'btn_gnb' => '',
'container' => '',
'gnb' => '',
'btn_gnb' => '',
);
if( ! empty($_COOKIE['g5_admin_btn_gnb']) ){
if (!empty($_COOKIE['g5_admin_btn_gnb'])) {
$adm_menu_cookie['container'] = 'container-small';
$adm_menu_cookie['gnb'] = 'gnb_small';
$adm_menu_cookie['btn_gnb'] = 'btn_gnb_open';
@ -79,26 +87,25 @@ if( ! empty($_COOKIE['g5_admin_btn_gnb']) ){
?>
<script>
var tempX = 0;
var tempY = 0;
var tempX = 0;
var tempY = 0;
function imageview(id, w, h)
{
function imageview(id, w, h) {
menu(id);
menu(id);
var el_id = document.getElementById(id);
var el_id = document.getElementById(id);
//submenu = eval(name+".style");
submenu = el_id.style;
submenu.left = tempX - ( w + 11 );
submenu.top = tempY - ( h / 2 );
//submenu = eval(name+".style");
submenu = el_id.style;
submenu.left = tempX - (w + 11);
submenu.top = tempY - (h / 2);
selectBoxVisible();
selectBoxVisible();
if (el_id.style.display != 'none')
selectBoxHidden(id);
}
if (el_id.style.display != 'none')
selectBoxHidden(id);
}
</script>
<div id="to_content"><a href="#container">본문 바로가기</a></div>
@ -106,13 +113,13 @@ function imageview(id, w, h)
<header id="hd">
<h1><?php echo $config['cf_title'] ?></h1>
<div id="hd_top">
<button type="button" id="btn_gnb" class="btn_gnb_close <?php echo $adm_menu_cookie['btn_gnb'];?>">메뉴</button>
<div id="logo"><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>"><img src="<?php echo G5_ADMIN_URL ?>/img/logo.png" alt="<?php echo get_text($config['cf_title']); ?> 관리자"></a></div>
<button type="button" id="btn_gnb" class="btn_gnb_close <?php echo $adm_menu_cookie['btn_gnb']; ?>">메뉴</button>
<div id="logo"><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>"><img src="<?php echo G5_ADMIN_URL ?>/img/logo.png" alt="<?php echo get_text($config['cf_title']); ?> 관리자"></a></div>
<div id="tnb">
<ul>
<?php if (defined('G5_USE_SHOP') && G5_USE_SHOP) { ?>
<li class="tnb_li"><a href="<?php echo G5_SHOP_URL ?>/" class="tnb_shop" target="_blank" title="쇼핑몰 바로가기">쇼핑몰 바로가기</a></li>
<li class="tnb_li"><a href="<?php echo G5_SHOP_URL ?>/" class="tnb_shop" target="_blank" title="쇼핑몰 바로가기">쇼핑몰 바로가기</a></li>
<?php } ?>
<li class="tnb_li"><a href="<?php echo G5_URL ?>/" class="tnb_community" target="_blank" title="커뮤니티 바로가기">커뮤니티 바로가기</a></li>
<li class="tnb_li"><a href="<?php echo G5_ADMIN_URL ?>/service.php" class="tnb_service">부가서비스</a></li>
@ -130,33 +137,34 @@ function imageview(id, w, h)
<ul class="gnb_ul">
<?php
$jj = 1;
foreach($amenu as $key=>$value) {
foreach ($amenu as $key => $value) {
$href1 = $href2 = '';
if (isset($menu['menu'.$key][0][2]) && $menu['menu'.$key][0][2]) {
$href1 = '<a href="'.$menu['menu'.$key][0][2].'" class="gnb_1da">';
if (isset($menu['menu' . $key][0][2]) && $menu['menu' . $key][0][2]) {
$href1 = '<a href="' . $menu['menu' . $key][0][2] . '" class="gnb_1da">';
$href2 = '</a>';
} else {
continue;
}
$current_class = "";
if (isset($sub_menu) && (substr($sub_menu, 0, 3) == substr($menu['menu'.$key][0][0], 0, 3)))
if (isset($sub_menu) && (substr($sub_menu, 0, 3) == substr($menu['menu' . $key][0][0], 0, 3))) {
$current_class = " on";
}
$button_title = $menu['menu'.$key][0][1];
$button_title = $menu['menu' . $key][0][1];
?>
<li class="gnb_li<?php echo $current_class;?>">
<button type="button" class="btn_op menu-<?php echo $key; ?> menu-order-<?php echo $jj; ?>" title="<?php echo $button_title; ?>"><?php echo $button_title;?></button>
<div class="gnb_oparea_wr">
<div class="gnb_oparea">
<h3><?php echo $menu['menu'.$key][0][1];?></h3>
<?php echo print_menu1('menu'.$key, 1); ?>
<li class="gnb_li<?php echo $current_class; ?>">
<button type="button" class="btn_op menu-<?php echo $key; ?> menu-order-<?php echo $jj; ?>" title="<?php echo $button_title; ?>"><?php echo $button_title; ?></button>
<div class="gnb_oparea_wr">
<div class="gnb_oparea">
<h3><?php echo $menu['menu' . $key][0][1]; ?></h3>
<?php echo print_menu1('menu' . $key, 1); ?>
</div>
</div>
</div>
</li>
</li>
<?php
$jj++;
$jj++;
} //end foreach
?>
</ul>
@ -164,39 +172,37 @@ function imageview(id, w, h)
</header>
<script>
jQuery(function($){
jQuery(function($) {
var menu_cookie_key = 'g5_admin_btn_gnb';
var menu_cookie_key = 'g5_admin_btn_gnb';
$(".tnb_mb_btn").click(function(){
$(".tnb_mb_area").toggle();
});
$(".tnb_mb_btn").click(function() {
$(".tnb_mb_area").toggle();
});
$("#btn_gnb").click(function(){
var $this = $(this);
$("#btn_gnb").click(function() {
try {
if( ! $this.hasClass("btn_gnb_open") ){
set_cookie(menu_cookie_key, 1, 60*60*24*365);
} else {
delete_cookie(menu_cookie_key);
}
}
catch(err) {
}
var $this = $(this);
$("#container").toggleClass("container-small");
$("#gnb").toggleClass("gnb_small");
$this.toggleClass("btn_gnb_open");
try {
if (!$this.hasClass("btn_gnb_open")) {
set_cookie(menu_cookie_key, 1, 60 * 60 * 24 * 365);
} else {
delete_cookie(menu_cookie_key);
}
} catch (err) {}
$("#container").toggleClass("container-small");
$("#gnb").toggleClass("gnb_small");
$this.toggleClass("btn_gnb_open");
});
$(".gnb_ul li .btn_op").click(function() {
$(this).parent().addClass("on").siblings().removeClass("on");
});
});
$(".gnb_ul li .btn_op" ).click(function() {
$(this).parent().addClass("on").siblings().removeClass("on");
});
});
</script>