add missing pages

This commit is contained in:
Amberstone 2024-10-07 11:03:55 +09:00
parent b4fe117c38
commit 37a2c53f79
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
5 changed files with 334 additions and 5 deletions

View file

@ -52,5 +52,10 @@ $menu["config"]->addChildMenu("config", "홈페이지 상세관리", G5_ADMIN_UR
$menu["config"]->getLastAddedMenu()->addSubFile("/config_form_update.php");
if (Community::isInitCommunity()) {
$menu["config"]->addChildMenu("config", "메인슬라이드 관리", G5_ADMIN_URL . "/banner_list.php", true, 700, "\F155", 0);
$menu["config"]->addChildMenu("config", "메인슬라이드 관리", G5_ADMIN_URL . "/banner_list.php", true, 700, "\F2CC", 0);
$menu["config"]->getLastAddedMenu()->addSubFile("/banner_form.php");
$menu["config"]->addChildMenu("config", "인트로 관리", G5_ADMIN_URL . "/intro_list.php", true, 700, "\F289", 0);
$menu["config"]->getLastAddedMenu()->addSubFile("/intro_form.php");
$menu["config"]->getLastAddedMenu()->addSubFile("/intro_form_update.php");
}

View file

@ -0,0 +1,117 @@
<?php
include_once './_common.php';
auth_check($auth[$sub_menu], "w");
$html_title = '인트로 ';
$g5['title'] = $html_title . '관리';
if ($w == "u") {
$html_title .= ' 수정';
$sql = " select * from {$g5['intro_table']} where bn_id = '{$bn_id}' ";
$bn = sql_fetch($sql);
} else {
$html_title .= ' 입력';
$bn['bn_url'] = "http://";
$bn['bn_begin_time'] = date("Y-m-d 00:00:00", time());
$bn['bn_end_time'] = date("Y-m-d 00:00:00", time() + (60 * 60 * 24 * 31));
}
include_once G5_ADMIN_PATH . '/admin.head.php';
?>
<form name="fbanner" action="./intro_form_update.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="bn_id" value="<?php echo $bn_id; ?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col style="width: 130px">
<col style="width: 150px">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row" rowspan="2">인트로 이미지</th>
<td rowspan="2" class="txt-center bo-right ">
<? if ($bn['bn_img']) { ?>
<img src="<?= $bn['bn_img'] ?>" class="prev_thumb" />
<? } else { ?>
이미지 없음
<? } ?>
</td>
<td>
직접등록&nbsp;&nbsp; <input type="file" name="bn_img_file" size="50" />
</td>
</tr>
<tr>
<td>
외부경로&nbsp;&nbsp; <input type="text" name="bn_img" value="<?= $bn['bn_img'] ?>" size="50" />
</td>
</tr>
<tr>
<th scope="row" rowspan="2">인트로 모바일 이미지</th>
<td rowspan="2" class="txt-center bo-right ">
<? if ($bn['bn_img']) { ?>
<img src="<?= $bn['bn_m_img'] ?>" class="prev_thumb" />
<? } else { ?>
이미지 없음
<? } ?>
</td>
<td>
직접등록&nbsp;&nbsp; <input type="file" name="bn_m_img_file" size="50" />
</td>
</tr>
<tr>
<td>
외부경로&nbsp;&nbsp; <input type="text" name="bn_m_img" value="<?= $bn['bn_m_img'] ?>" size="50" />
</td>
</tr>
<tr>
<th>대체텍스트</th>
<td colspan="2">
<input type="text" name="bn_alt" value="<?php echo $bn['bn_alt']; ?>" size="84">
</td>
</tr>
<tr>
<th scope="row"><label for="bn_begin_time">시작일시</label></th>
<td colspan="2">
<?php echo help("인트로 게시 시작일시를 설정합니다."); ?>
<input type="text" name="bn_begin_time" value="<?php echo $bn['bn_begin_time']; ?>" id="bn_begin_time"
class="frm_input" size="21" maxlength="19">
<input type="checkbox" name="bn_begin_chk" value="<?php echo date("Y-m-d 00:00:00", time()); ?>"
id="bn_begin_chk"
onclick="if (this.checked == true) this.form.bn_begin_time.value=this.form.bn_begin_chk.value; else this.form.bn_begin_time.value = this.form.bn_begin_time.defaultValue;">
<label for="bn_begin_chk">오늘</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_end_time">종료일시</label></th>
<td colspan="2">
<?php echo help("비쥬얼 게시 종료일시를 설정합니다."); ?>
<input type="text" name="bn_end_time" value="<?php echo $bn['bn_end_time']; ?>" id="bn_end_time"
class="frm_input" size=21 maxlength=19>
<input type="checkbox" name="bn_end_chk" value="<?php echo date("Y-m-d 23:59:59", time() + 60 * 60 * 24 * 31); ?>"
id="bn_end_chk"
onclick="if (this.checked == true) this.form.bn_end_time.value=this.form.bn_end_chk.value; else this.form.bn_end_time.value = this.form.bn_end_time.defaultValue;">
<label for="bn_end_chk">오늘+31</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_order">출력 순서</label></th>
<td colspan="2">
<?php echo help("인트로를 출력할 때 순서를 정합니다. 숫자가 작을수록 먼저 출력됩니다."); ?>
<?php echo order_select("bn_order", $bn['bn_order']); ?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./intro_list.php">목록</a>
</div>
</form>
<?php
include_once G5_ADMIN_PATH . '/admin.tail.php';

View file

@ -0,0 +1,90 @@
<?php
/**
* @var string|int $bn_alt
* @var string|int $bn_url
* @var string|int $bn_order
*/
include_once './_common.php';
check_demo();
if ($w == 'd')
auth_check($auth[$sub_menu], "d");
else
auth_check($auth[$sub_menu], "w");
$intro_path = G5_DATA_PATH . "/banner";
$intro_url = G5_DATA_URL . "/banner";
@mkdir($intro_path, G5_DIR_PERMISSION);
@chmod($intro_path, G5_DIR_PERMISSION);
if ($w == "" || $w == "u") {
if ($w == "") {
$sql = " insert into {$g5['intro_table']}
set bn_img = '{$bn_img}',
bn_m_img = '{$bn_m_img}',
bn_alt = '{$bn_alt}',
bn_url = '{$bn_url}',
bn_new_win = '{$bn_new_win}',
bn_begin_time = '{$bn_begin_time}',
bn_end_time = '{$bn_end_time}',
bn_order = '{$bn_order}'";
sql_query($sql);
$bn_id = sql_insert_id();
} else if ($w == "u") {
$sql = " update {$g5['intro_table']}
set bn_img = '{$bn_img}',
bn_m_img = '{$bn_m_img}',
bn_alt = '{$bn_alt}',
bn_url = '{$bn_url}',
bn_new_win = '{$bn_new_win}',
bn_begin_time = '{$bn_begin_time}',
bn_end_time = '{$bn_end_time}',
bn_order = '{$bn_order}'
where bn_id = '{$bn_id}' ";
sql_query($sql);
}
// 이미지 등록 시, 이미지를 업로드한 뒤 - 해당 이미지 경로를 삽입
if ($_FILES['bn_img_file']['name']) {
// 확장자 따기
$intro_name = "intro_" . $bn_id;
upload_file($_FILES['bn_img_file']['tmp_name'], $intro_name, $intro_path);
$bn_img = $intro_url . "/" . $intro_name;
$sql = " update {$g5['intro_table']}
set bn_img = '{$bn_img}'
where bn_id = '{$bn_id}' ";
sql_query($sql);
}
// 이미지 등록 시, 이미지를 업로드한 뒤 - 해당 이미지 경로를 삽입
if ($_FILES['bn_m_img_file']['name']) {
// 확장자 따기
$intro_name = "intro_" . $bn_id . "_m";
upload_file($_FILES['bn_m_img_file']['tmp_name'], $intro_name, $intro_path);
$bn_img = $intro_url . "/" . $intro_name;
$sql = " update {$g5['intro_table']}
set bn_m_img = '{$bn_img}'
where bn_id = '{$bn_id}' ";
sql_query($sql);
}
} else if ($w == "d") {
@unlink($intro_path . "/intro_" . $bn_id);
@unlink($intro_path . "/intro_" . $bn_id . "_m");
$sql = " delete from {$g5['intro_table']} where bn_id = '{$bn_id}' ";
$result = sql_query($sql);
}
goto_url("./intro_list.php");

View file

@ -0,0 +1,115 @@
<?php
$sub_menu = '100330';
include_once './_common.php';
auth_check($auth[$sub_menu], "r");
$g5['title'] = '인트로 관리';
include_once G5_ADMIN_PATH . '/admin.head.php';
$sql_common = " from {$g5['intro_table']} ";
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) {
$page = 1;
} // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select * {$sql_common}
order by bn_order, bn_id desc
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
?>
<div class="local_ov01 local_ov">
등록된 이미지 <?php echo $total_count; ?>
</div>
<div class="btn_add01 btn_add">
<a href="./intro_form.php">인트로 추가</a>
</div>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<colgroup>
<col style="width: 50px;" />
<col style="width: 170px;" />
<col />
<col style="width: 130px;" />
<col style="width: 130px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
</colgroup>
<thead>
<tr>
<th scope="col" class="bo-right">ID</th>
<th scope="col">이미지</th>
<th scope="col">대체텍스트</th>
<th scope="col">시작일시</th>
<th scope="col">종료일시</th>
<th scope="col">출력순서</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $row = sql_fetch_array($result); $i++) {
// 새창 띄우기인지
$bn_new_win = ($row['bn_new_win']) ? 'target="_blank"' : '';
$bn_img_obj = "";
$link_tag = false;
if ($row['bn_img']) {
if ($row['bn_url'] && $row['bn_url'] != "http://") {
$link_tag = true;
}
if ($link_tag)
$bn_img_obj .= "<a hreef='" . $row['bn_url'] . "' " . $bn_new_win . ">";
$bn_img_obj .= "<img src='" . $row['bn_img'] . "' alt='" . $row['bn_alt'] . "' class='banner-thumb'/>";
if ($link_tag)
$bn_img_obj .= "</a>";
}
$bn_begin_time = substr($row['bn_begin_time'], 2, 14);
$bn_end_time = substr($row['bn_end_time'], 2, 14);
$bg = 'bg' . ($i % 2);
?>
<tr class="<?php echo $bg; ?>">
<td><?php echo $row['bn_id']; ?></td>
<td><?php echo $bn_img_obj; ?></td>
<td><?php echo $row['bn_alt']; ?></td>
<td><?php echo $bn_begin_time; ?></td>
<td><?php echo $bn_end_time; ?></td>
<td><?php echo $row['bn_order']; ?></td>
<td>
<a href="./intro_form.php?w=u&amp;bn_id=<?php echo $row['bn_id']; ?>">수정</a></li>
<a href="./intro_form_update.php?w=d&amp;bn_id=<?php echo $row['bn_id']; ?>"
onclick="return delete_confirm();">삭제</a>
</td>
</tr>
<?php
}
if ($i == 0) {
echo '<tr><td colspan="7" class="empty_table">자료가 없습니다.</td></tr>';
}
?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;position=$position&amp;page="); ?>
<script>
$(function () {
$(".sbn_img_view").on("click", function () {
$(this).closest(".td_img_view").find(".sbn_image").slideToggle();
});
});
</script>
<?php
include_once G5_ADMIN_PATH . '/admin.tail.php';

View file

@ -1,4 +1,8 @@
<?php
/**
* ignore G5_USE_CACHE (it can edit by user)
* @suppress PHP0419
*/
if (!defined('_GNUBOARD_'))
exit; // 개별 페이지 접근 불가
@ -32,11 +36,9 @@ function display_banner($skin = '', $start = true, $effect = 'slide', $speed = '
}
if (!$cache_fwrite)
include($cache_file);
include $cache_file;
}
}
if (!G5_USE_CACHE || $cache_fwrite) {
} else if (!G5_USE_CACHE || $cache_fwrite) {
$banner = [];
$sql = " select * from {$g5['banner_table']} where '" . G5_TIME_YMDHIS . "' between bn_begin_time and bn_end_time order by bn_order, bn_id desc ";
$result = sql_query($sql);