Skip to content

Commit

Permalink
Checked PSR-1: Basic Coding Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
KimTom89 committed May 27, 2022
1 parent 9199b7c commit b1640d7
Show file tree
Hide file tree
Showing 42 changed files with 3,751 additions and 3,535 deletions.
8 changes: 4 additions & 4 deletions adm/_common.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
define('G5_IS_ADMIN', true);
include_once ('../common.php');
include_once(G5_ADMIN_PATH.'/admin.lib.php');
require_once '../common.php';
require_once G5_ADMIN_PATH . '/admin.lib.php';

if( isset($token) ){
if (isset($token)) {
$token = @htmlspecialchars(strip_tags($token), ENT_QUOTES);
}

run_event('admin_common');
run_event('admin_common');
92 changes: 47 additions & 45 deletions adm/_rewrite_config_form.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
if (!defined('_GNUBOARD_')) exit;
if (!defined('_GNUBOARD_')) {
exit;
}

$is_use_apache = (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false);

Expand All @@ -11,78 +13,78 @@
$is_apache_need_rules = false;
$is_apache_rewrite = false;

if( !($is_use_apache || $is_use_nginx || $is_use_iis) ){ // 셋다 아니면 다 출력시킨다.
if (!($is_use_apache || $is_use_nginx || $is_use_iis)) { // 셋다 아니면 다 출력시킨다.
$is_use_apache = true;
$is_use_nginx = true;
}

if ( $is_use_nginx ){
if ($is_use_nginx) {
$is_write_file = false;
}

if ( $is_use_apache ){
$is_write_file = (is_writable(G5_PATH) || (file_exists(G5_PATH.'/.htaccess') && is_writable(G5_PATH.'/.htaccess'))) ? true : false;
if ($is_use_apache) {
$is_write_file = (is_writable(G5_PATH) || (file_exists(G5_PATH . '/.htaccess') && is_writable(G5_PATH . '/.htaccess'))) ? true : false;
$is_apache_need_rules = check_need_rewrite_rules();
$is_apache_rewrite = function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules());
}

$get_path_url = parse_url( G5_URL );
$get_path_url = parse_url(G5_URL);

$base_path = isset($get_path_url['path']) ? $get_path_url['path'].'/' : '/';
$base_path = isset($get_path_url['path']) ? $get_path_url['path'] . '/' : '/';

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_JS_URL.'/remodal/remodal.css">', 11);
add_stylesheet('<link rel="stylesheet" href="'.G5_JS_URL.'/remodal/remodal-default-theme.css">', 12);
add_javascript('<script src="'.G5_JS_URL.'/remodal/remodal.js"></script>', 10);
add_stylesheet('<link rel="stylesheet" href="' . G5_JS_URL . '/remodal/remodal.css">', 11);
add_stylesheet('<link rel="stylesheet" href="' . G5_JS_URL . '/remodal/remodal-default-theme.css">', 12);
add_javascript('<script src="' . G5_JS_URL . '/remodal/remodal.js"></script>', 10);
?>
<section id="anc_cf_url">
<h2 class="h2_frm">짧은 주소 설정</h2>
<?php echo $pg_anchor ?>
<div class="local_desc02 local_desc">
<p>
게시판과 컨텐츠 페이지에 짧은 URL 을 사용합니다. <a href="https://sir.kr/manual/g5/286" class="btn btn_03" target="_blank" style="margin-left:10px">설정 관련 메뉴얼 보기</a>
<?php if( $is_use_apache && ! $is_use_nginx ){ ?>
<?php if( ! $is_apache_rewrite ){ ?>
<br><strong>Apache 서버인 경우 rewrite_module 이 비활성화 되어 있으면 짧은 주소를 사용할수 없습니다.</strong>
<?php } else if( ! $is_write_file && $is_apache_need_rules ) { // apache인 경우 ?>
<br><strong>짧은 주소 사용시 아래 Apache 설정 코드를 참고하여 설정해 주세요.</strong>
<?php if ($is_use_apache && !$is_use_nginx) { ?>
<?php if (!$is_apache_rewrite) { ?>
<br><strong>Apache 서버인 경우 rewrite_module 이 비활성화 되어 있으면 짧은 주소를 사용할수 없습니다.</strong>
<?php } elseif (!$is_write_file && $is_apache_need_rules) { // apache인 경우 ?>
<br><strong>짧은 주소 사용시 아래 Apache 설정 코드를 참고하여 설정해 주세요.</strong>
<?php } ?>
<?php } ?>
</p>
</div>

<div class="server_config_views">
<?php if ( $is_use_apache ){ ?>
<?php if ($is_use_apache) { ?>
<button type="button" data-remodal-target="modal_apache" class="btn btn_03">Apache 설정 코드 보기</button>
<?php } ?>
<?php if ( $is_use_nginx ) { ?>
<?php if ($is_use_nginx) { ?>
<button type="button" data-remodal-target="modal_nginx" class="btn btn_03">Nginx 설정 코드 보기</button>
<?php } ?>
</div>

<div class="tbl_frm01 tbl_wrap">
<table>
<caption>짧은주소 설정</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<?php
$short_url_arrs = array(
'0'=>array('label'=>'사용안함', 'url'=>G5_URL.'/board.php?bo_table=free&wr_id=123'),
'1'=>array('label'=>'숫자', 'url'=>G5_URL.'/free/123'),
'2'=>array('label'=>'글 이름', 'url'=>G5_URL.'/free/안녕하세요/'),
);
foreach($short_url_arrs as $k=>$v){
$checked = ((int) $config['cf_bbs_rewrite'] === (int) $k) ? 'checked' : '';
?>
<tr>
<td><input name="cf_bbs_rewrite" id="cf_bbs_rewrite_<?php echo $k; ?>" type="radio" value="<?php echo $k; ?>" <?php echo $checked;?> ><label for="cf_bbs_rewrite_<?php echo $k; ?>" class="rules_label"><?php echo $v['label']; ?></label></td>
<td><?php echo $v['url']; ?></td>
</tr>
<?php } //end foreach ?>
</tbody>
<caption>짧은주소 설정</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<?php
$short_url_arrs = array(
'0' => array('label' => '사용안함', 'url' => G5_URL . '/board.php?bo_table=free&wr_id=123'),
'1' => array('label' => '숫자', 'url' => G5_URL . '/free/123'),
'2' => array('label' => '글 이름', 'url' => G5_URL . '/free/안녕하세요/'),
);
foreach ($short_url_arrs as $k => $v) {
$checked = ((int) $config['cf_bbs_rewrite'] === (int) $k) ? 'checked' : '';
?>
<tr>
<td><input name="cf_bbs_rewrite" id="cf_bbs_rewrite_<?php echo $k; ?>" type="radio" value="<?php echo $k; ?>" <?php echo $checked; ?>><label for="cf_bbs_rewrite_<?php echo $k; ?>" class="rules_label"><?php echo $v['label']; ?></label></td>
<td><?php echo $v['url']; ?></td>
</tr>
<?php } //end foreach ?>
</tbody>
</table>
</div>

Expand All @@ -95,13 +97,13 @@
</button>

<h4 class="copy_title">.htaccess 파일에 적용할 코드입니다.
<?php if( ! $is_apache_rewrite ) { ?>
<br><span class="info-warning">Apache 서버인 경우 rewrite_module 이 비활성화 되어 있으면 짧은 주소를 사용할수 없습니다.</span>
<?php } else if ( ! $is_write_file && $is_apache_need_rules ) { ?>
<br><span class="info-warning">자동으로 .htaccess 파일을 수정 할수 있는 권한이 없습니다.<br>.htaccess 파일이 없다면 생성 후에, 아래 코드가 없으면 코드를 복사하여 붙여넣기 해 주세요.</span>
<?php } else if ( ! $is_apache_need_rules ){ ?>
<br><span class="info-success">정상적으로 적용된 상태입니다.</span>
<?php } ?>
<?php if (!$is_apache_rewrite) { ?>
<br><span class="info-warning">Apache 서버인 경우 rewrite_module 이 비활성화 되어 있으면 짧은 주소를 사용할수 없습니다.</span>
<?php } elseif (!$is_write_file && $is_apache_need_rules) { ?>
<br><span class="info-warning">자동으로 .htaccess 파일을 수정 할수 있는 권한이 없습니다.<br>.htaccess 파일이 없다면 생성 후에, 아래 코드가 없으면 코드를 복사하여 붙여넣기 해 주세요.</span>
<?php } elseif (!$is_apache_need_rules) { ?>
<br><span class="info-success">정상적으로 적용된 상태입니다.</span>
<?php } ?>
</h4>
<textarea readonly="readonly" rows="10"><?php echo get_mod_rewrite_rules(true); ?></textarea>
</div>
Expand Down
Loading

0 comments on commit b1640d7

Please sign in to comment.