Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

관리자 모드 개선 및 https 변환 메뉴 추가, workflow 추가 #239

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3fa14f9
commit test sieun
tleunwlp May 15, 2023
82a658c
commit test sooobee
sooobee May 16, 2023
91a907c
4p
tleunwlp May 16, 2023
e39486a
menu_form
sooobee May 30, 2023
4dcd9f1
dd
tleunwlp May 30, 2023
c442c1c
dsdf
tleunwlp May 30, 2023
d1efd17
new_menuForm
sooobee May 30, 2023
9e93264
hook test
tleunwlp May 30, 2023
2b16abd
githooktest
tleunwlp May 30, 2023
bbab5d7
"pr test"
sooobee Jun 5, 2023
66d5db9
Merge pull request #3 from sooobee/sooobee
tleunwlp Jun 5, 2023
b889c9f
pr test2
sooobee Jun 5, 2023
4c49933
pr test3
sooobee Jun 5, 2023
021837f
Merge pull request #5 from sooobee/sooobee
tleunwlp Jun 5, 2023
3a838d0
pr test4
sooobee Jun 5, 2023
c503d23
menu_form update
sooobee Jun 8, 2023
22a2f21
add workflow
sooobee Jun 11, 2023
9d65db8
workflow test
sooobee Jun 11, 2023
a751795
workflow test
sooobee Jun 11, 2023
09a0ffe
workflow test
sooobee Jun 11, 2023
30f8e29
version update
sooobee Jun 11, 2023
0516da6
add comments
sooobee Jun 11, 2023
ebce47a
add workflow
sooobee Jun 11, 2023
553fbec
delete unnecessary comments
sooobee Jun 11, 2023
8c6337c
delete unnecessary comments
sooobee Jun 11, 2023
b20cba1
merge 4p
sooobee Jun 11, 2023
92a6311
delete unnecessary comments
sooobee Jun 11, 2023
109492d
Merge pull request #9 from sooobee/sooobee
sooobee Jun 12, 2023
8cf456f
menu_list 개별 삭제 기능
tleunwlp Jun 13, 2023
4bf585d
menu_form 리스트 개선
tleunwlp Jun 13, 2023
24321e9
menu_list 확인 버튼 submenu 개선
tleunwlp Jun 13, 2023
fdc3b05
save
tleunwlp Jun 14, 2023
7cb6b83
Merge branch '4p' into sieun
sooobee Jun 14, 2023
edcba95
Merge pull request #10 from sooobee/sieun
sooobee Jun 14, 2023
8f857b9
menu_list_update 개선 및 btn_add_submenu 수정 필요
tleunwlp Jun 14, 2023
c25ee36
hook test
tleunwlp May 30, 2023
30cb56d
menu_list_update 서브메뉴 수정
tleunwlp Jun 15, 2023
ba15656
menu_list_update groupcode 수정
tleunwlp Jun 15, 2023
1f9625f
Merge branch '4p' into eunsi
sooobee Jun 15, 2023
8e3e71b
Merge pull request #11 from sooobee/eunsi
tleunwlp Jun 15, 2023
feaba0d
add Security
sooobee Jun 15, 2023
d1773f4
menu_list에서 post전송
sooobee Jun 15, 2023
53fc9ce
phpUnitTest 폴더 경로 설정
201812722 Jun 14, 2023
19a2632
extension_dir 폴더 경로를 설정 및 응용기능 주석 확인
201812722 Jun 14, 2023
7d349c0
menu_list 메뉴설정 저장 확인을 위한 phpUnitTest파일
201812722 Jun 15, 2023
754a396
Merge pull request #13 from sooobee/addSecure
sooobee Jun 15, 2023
9c00489
Merge pull request #14 from sooobee/eunsi
sooobee Jun 15, 2023
6fa38ec
Merge pull request #15 from sooobee/gonglee2
sooobee Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .bash_logout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ~/.bash_logout

12 changes: 12 additions & 0 deletions .bash_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
11 changes: 11 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
47 changes: 47 additions & 0 deletions .github/workflows/Run Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# check version compatibility
name: Run Tests
# 매 push시 실행
on: [ push ]

jobs:
output_releases:
name: Generate PHP Releases Array
runs-on: ubuntu-latest
outputs:
range: ${{ steps.releases.outputs.range }}
steps:
- name: Fetch Current Releases
uses: tighten/phpreleases-action@v1
id: releases
with:
releases: '8.0' #version update
tests:
needs: output_releases
strategy:
matrix:
os: [Ubuntu, Windows, macOS]
php: ${{ fromJSON(needs.output_releases.outputs.range) }}

include:
- os: Ubuntu
os-version: ubuntu-latest

- os: Windows
os-version: windows-latest

- os: macOS
os-version: macos-latest

name: ${{ matrix.os }} - PHP ${{ matrix.php }}

runs-on: ${{ matrix.os-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, bcmath, soap, intl, gd, exif, iconv, imagick
1 change: 1 addition & 0 deletions .htpasswd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s00bee2:$apr1$oWRZouHp$HS7Q0oVmO9IX8Hmn4w8vE/
2 changes: 2 additions & 0 deletions adm/_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require_once '../common.php';
require_once G5_ADMIN_PATH . '/admin.lib.php';

// test commit

if (isset($token)) {
$token = @htmlspecialchars(strip_tags($token), ENT_QUOTES);
}
Expand Down
1 change: 1 addition & 0 deletions adm/admin.menu100.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@

$menu['menu100'][] = array('100410', 'DB업그레이드', G5_ADMIN_URL . '/dbupgrade.php', 'db_upgrade');
$menu['menu100'][] = array('100400', '부가서비스', G5_ADMIN_URL . '/service.php', 'cf_service');
$menu['menu100'][] = array('100600', '추가 보안', G5_ADMIN_URL . '/security.php', 'cf_service');
27 changes: 14 additions & 13 deletions adm/menu_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
$new = isset($_GET['new']) ? clean_xss_tags($_GET['new'], 1, 1) : '';
$code = isset($_GET['code']) ? (string)preg_replace('/[^0-9a-zA-Z]/', '', $_GET['code']) : '';

// 코드
if ($new == 'new' || !$code) {
$code = (int)base_convert(substr($code, 0, 2), 36, 10);
$code += 36;
Expand All @@ -25,7 +24,6 @@
<h1><?php echo $g5['title']; ?></h1>

<form name="fmenuform" id="fmenuform" class="new_win_con">

<div class="new_win_desc">
<label for="me_type">대상선택</label>
<select name="me_type" id="me_type">
Expand All @@ -35,7 +33,6 @@
<option value="content">내용관리</option>
</select>
</div>

<div id="menu_result"></div>

</form>
Expand Down Expand Up @@ -112,25 +109,30 @@ function() {
$(document).on("click", ".add_select", function() {
var me_name = $.trim($(this).siblings("input[name='subject[]']").val());
var me_link = $.trim($(this).siblings("input[name='link[]']").val());

//$new = 'new';

add_menu_list(me_name, me_link, "<?php echo $code; ?>");

});
});

function add_menu_list(name, link, code) {
var $menulist = $("#menulist", opener.document);
var ms = new Date().getTime();
var sub_menu_class;

<?php if ($new == 'new') { ?>
sub_menu_class = " class=\"td_category\"";
<?php } else { ?>
sub_menu_class = " class=\"td_category sub_menu_class\"";
sub_menu_class = " class=\"td_category sub_menu_class\"";
<?php } ?>

var list = "<tr class=\"menu_list menu_group_<?php echo $code; ?>\">";
list += "<td" + sub_menu_class + ">";
list += "<label for=\"me_name_" + ms + "\" class=\"sound_only\">메뉴<strong class=\"sound_only\"> 필수</strong></label>";
list += "<input type=\"hidden\" name=\"code[]\" value=\"<?php echo $code; ?>\">";

list += "<input type=\"text\" name=\"me_name[]\" value=\"" + name + "\" id=\"me_name_" + ms + "\" required class=\"required frm_input full_input\">";
list += "</td>";
list += "<td>";
Expand Down Expand Up @@ -179,21 +181,20 @@ function add_menu_list(name, link, code) {

if ($menu_last.length > 0) {
$menu_last.after(list);
} else {
if ($menulist.find("#empty_menu_list").length > 0)
$menulist.find("#empty_menu_list").remove();

$menulist.find("table tbody").append(list);
} else { // 리스트가 없을 때(추가한 게 없을 때)
if ($menulist.find("#empty_menu_list").length > 0) // 이미 추가된 게 있으면
$menulist.find("#empty_menu_list").remove(); // 메뉴리스트가 비지 않았다
$menulist.find("table tbody").append(list); // 리스트를 붙혀
}

$menulist.find("#empty_menu_list").remove(); // 추가
$menulist.find("tr.menu_list").each(function(index) {
$(this).removeClass("bg0 bg1")
.addClass("bg" + (index % 2));
});

window.close();
sloacation.replace(location.href);
}
</script>

<?php
require_once G5_PATH . '/tail.sub.php';
require_once G5_PATH . '/tail.sub.php';
2 changes: 1 addition & 1 deletion adm/menu_form_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@
<button type="button" id="add_manual" class="btn_submit btn">추가</button>
<button type="button" class="btn_02 btn" onclick="window.close();">창닫기</button>
</div>
<?php } // end if;
<?php }
27 changes: 17 additions & 10 deletions adm/menu_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
alert('최고관리자만 접근 가능합니다.');
}

// 메뉴테이블 생성
if (!isset($g5['menu_table'])) {
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'menu_table\'] = G5_TABLE_PREFIX.\'menu\';</strong> 를 추가해 주세요.');
}
Expand Down Expand Up @@ -141,27 +140,35 @@
$(document).on("click", ".btn_add_submenu", function() {
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
add_submenu(code);

var form = document.getElementById("fmenulist");
form.action = "./menu_list_update.php";
form.method = "post";

form.addEventListener("submit", function(event) {
event.preventDefault();
});

/*var form = document.getElementById("fmenulist");
form.action = "./menu_list_update.php";
form.method = "post";
form.submit();*/
});

$(document).on("click", ".btn_del_menu", function() {
if (!confirm("메뉴를 삭제하시겠습니까?\n메뉴 삭제후 메뉴설정의 확인 버튼을 눌러 메뉴를 저장해 주세요."))
if (!confirm("메뉴를 삭제하시겠습니까?\n메뉴 삭제 후 메뉴 설정의 확인 버튼을 눌러 메뉴를 저장해 주세요.")) {
return false;
}

var $tr = $(this).closest("tr");
if ($tr.find("td.sub_menu_class").length > 0) {
$tr.remove();
} else {
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
$("tr.menu_group_" + code).remove();
}

if ($("#menulist tr.menu_list").length < 1) {
var list = "<tr id=\"empty_menu_list\"><td colspan=\"<?php echo $colspan; ?>\" class=\"empty_table\">자료가 없습니다.</td></tr>\n";
$("#menulist table tbody").append(list);
} else {
$("#menulist tr.menu_list").each(function(index) {
$(this).removeClass("bg0 bg1")
.addClass("bg" + (index % 2));
$(this).removeClass("bg0 bg1").addClass("bg" + (index % 2));
});
}
});
Expand Down Expand Up @@ -217,4 +224,4 @@ function fmenulist_submit(f) {
</script>

<?php
require_once './admin.tail.php';
require_once './admin.tail.php';
90 changes: 90 additions & 0 deletions adm/menu_listTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

use PHPUnit\Framework\TestCase;

class Menu_listTest extends TestCase
{
public function testDeleteMenuConfirmation()
{
$confirmationMessage = "메뉴를 삭제하시겠습니까?\n메뉴 삭제 후 메뉴 설정의 확인 버튼을 눌러 메뉴를 저장해 주세요.";
$expectedConfirmation = false;

$this->expectOutputString($confirmationMessage);
$this->assertEquals($expectedConfirmation, confirm($confirmationMessage));
}

public function testDeleteMenu()
{
$html = '
<table id="menulist">
<tbody>
<tr class="menu_list">
<td></td>
<td class="btn_del_menu"></td>
</tr>
<tr class="menu_list">
<td></td>
<td class="btn_del_menu"></td>
</tr>
</tbody>
</table>';

$expectedHtml = '
<table id="menulist">
<tbody>
<tr class="menu_list">
<td></td>
</tr>
<tr class="menu_list">
<td></td>
<td class="btn_del_menu"></td>
</tr>
</tbody>
</table>';

$dom = new DOMDocument();
$dom->loadHTML($html);

$menuList = $dom->getElementById('menulist');
$buttons = $dom->getElementsByTagName('td');

$this->assertEquals($expectedHtml, $dom->saveHTML());

$buttons->item(1)->click();

$this->assertEquals($expectedHtml, $dom->saveHTML());
}

public function testEmptyMenuList()
{
$html = '
<table id="menulist">
<tbody>
<tr id="empty_menu_list">
<td class="empty_table">자료가 없습니다.</td>
</tr>
</tbody>
</table>';

$expectedHtml = '
<table id="menulist">
<tbody>
<tr id="empty_menu_list">
<td class="empty_table">자료가 없습니다.</td>
</tr>
</tbody>
</table>';

$dom = new DOMDocument();
$dom->loadHTML($html);

$menuList = $dom->getElementById('menulist');
$button = $dom->getElementById('empty_menu_list')->getElementsByTagName('td')->item(0);

$this->assertEquals($expectedHtml, $dom->saveHTML());

$button->click();

$this->assertEquals($expectedHtml, $dom->saveHTML());
}
}