짧은 주소 작업중
This commit is contained in:
1 parent
7c1e1e6240
commit
16907801b7
29 files changed
+984
-50
No files matched your search
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
$is_apache = (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false);
|
||||
|
||||
$is_nginx = (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false);
|
||||
|
||||
$is_iis = !$is_apache && (stripos($_SERVER['SERVER_SOFTWARE'], 'microsoft-iis') !== false);
|
||||
|
||||
?>
|
||||
<section id="anc_cf_url">
|
||||
<h2 class="h2_frm">짧은 주소 설정</h2>
|
||||
<?php echo $pg_anchor ?>
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>
|
||||
게시판과 컨텐츠 페이지에 짧은 URL 을 사용합니다.
|
||||
</p>
|
||||
</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; ?>"><?php echo $v['label']; ?></label></td>
|
||||
<td><?php echo $v['url']; ?></td>
|
||||
</tr>
|
||||
<?php } //end foreach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="server_rewrite_info">
|
||||
<div class="is_apache">
|
||||
<pre>
|
||||
# nginx configuration
|
||||
|
||||
location /g54/ {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/g54/rss/([0-9a-zA-Z_]+)$ /g54/bbs/rss.php?bo_table=$1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)$ /g54/bbs/board.php?bo_table=$1&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/([^/]+)/$ /g54/bbs/board.php?bo_table=$1&wr_seo_title=$2&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/write$ /g54/bbs/write.php?bo_table=$1&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/p([0-9]+)$ /g54/bbs/board.php?bo_table=$1&page=$2 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/([0-9]+)$ /g54/bbs/board.php?bo_table=$1&wr_id=$2&rewrite=1 break;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="is_nginx">
|
||||
|
||||
<pre>
|
||||
# nginx configuration
|
||||
|
||||
location /g54/ {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/g54/rss/([0-9a-zA-Z_]+)$ /g54/bbs/rss.php?bo_table=$1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)$ /g54/bbs/board.php?bo_table=$1&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/([^/]+)/$ /g54/bbs/board.php?bo_table=$1&wr_seo_title=$2&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/write$ /g54/bbs/write.php?bo_table=$1&rewrite=1 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/p([0-9]+)$ /g54/bbs/board.php?bo_table=$1&page=$2 break;
|
||||
rewrite ^/g54/([0-9a-zA-Z_]+)/([0-9]+)$ /g54/bbs/board.php?bo_table=$1&wr_id=$2&rewrite=1 break;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
+1
-1
@@ -101,7 +101,7 @@ function imageview(id, w, h)
|
||||
<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 G5_ADMIN_URL ?>"><img src="<?php echo G5_ADMIN_URL ?>/img/logo.png" alt="<?php echo $config['cf_title'] ?> 관리자"></a></div>
|
||||
<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 $config['cf_title'] ?> 관리자"></a></div>
|
||||
|
||||
<div id="tnb">
|
||||
<ul>
|
||||
|
||||
+1
-1
@@ -429,7 +429,7 @@ function admin_referer_check($return=false)
|
||||
// 접근 권한 검사
|
||||
if (!$member['mb_id'])
|
||||
{
|
||||
alert('로그인 하십시오.', G5_BBS_URL.'/login.php?url=' . urlencode(G5_ADMIN_URL));
|
||||
alert('로그인 하십시오.', G5_BBS_URL.'/login.php?url=' . urlencode(correct_goto_url(G5_ADMIN_URL)));
|
||||
}
|
||||
else if ($is_admin != 'super')
|
||||
{
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ $sub_menu = "100510";
|
||||
include_once('./_common.php');
|
||||
|
||||
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE))
|
||||
alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL);
|
||||
alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL));
|
||||
|
||||
if ($is_admin != 'super')
|
||||
alert('최고관리자만 접근 가능합니다.');
|
||||
|
||||
@@ -3,7 +3,7 @@ $sub_menu = "100520";
|
||||
include_once('./_common.php');
|
||||
|
||||
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE))
|
||||
alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL);
|
||||
alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL));
|
||||
|
||||
if ($is_admin != 'super')
|
||||
alert('최고관리자만 접근 가능합니다.');
|
||||
|
||||
@@ -253,6 +253,12 @@ if(!sql_query(" DESC {$g5['social_profile_table']} ", false)) {
|
||||
) ", true);
|
||||
}
|
||||
|
||||
// 짧은 URL 주소를 사용 여부 필드 추가
|
||||
if (!isset($config['cf_bbs_rewrite'])) {
|
||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
||||
ADD `cf_bbs_rewrite` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_link_target` ", true);
|
||||
}
|
||||
|
||||
if(!$config['cf_faq_skin']) $config['cf_faq_skin'] = "basic";
|
||||
if(!$config['cf_mobile_faq_skin']) $config['cf_mobile_faq_skin'] = "basic";
|
||||
|
||||
@@ -264,6 +270,7 @@ $pg_anchor = '<ul class="anchor">
|
||||
<li><a href="#anc_cf_board">게시판기본</a></li>
|
||||
<li><a href="#anc_cf_join">회원가입</a></li>
|
||||
<li><a href="#anc_cf_cert">본인확인</a></li>
|
||||
<li><a href="#anc_cf_url">짧은주소</a></li>
|
||||
<li><a href="#anc_cf_mail">기본메일환경</a></li>
|
||||
<li><a href="#anc_cf_article_mail">글작성메일</a></li>
|
||||
<li><a href="#anc_cf_join_mail">가입메일</a></li>
|
||||
@@ -881,6 +888,9 @@ if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
include_once('_rewrite_config_form.php');
|
||||
?>
|
||||
|
||||
<section id="anc_cf_mail">
|
||||
<h2 class="h2_frm">기본 메일 환경 설정</h2>
|
||||
|
||||
@@ -59,6 +59,7 @@ $sql = " update {$g5['config_table']}
|
||||
cf_add_meta = '{$_POST['cf_add_meta']}',
|
||||
cf_syndi_token = '{$_POST['cf_syndi_token']}',
|
||||
cf_syndi_except = '{$_POST['cf_syndi_except']}',
|
||||
cf_bbs_rewrite = '{$_POST['cf_bbs_rewrite']}',
|
||||
cf_member_skin = '{$_POST['cf_member_skin']}',
|
||||
cf_use_homepage = '{$_POST['cf_use_homepage']}',
|
||||
cf_req_homepage = '{$_POST['cf_req_homepage']}',
|
||||
@@ -177,5 +178,11 @@ sql_query($sql);
|
||||
|
||||
//sql_query(" OPTIMIZE TABLE `$g5[config_table]` ");
|
||||
|
||||
if( isset($_POST['cf_bbs_rewrite']) ){
|
||||
g5_delete_all_cache();
|
||||
}
|
||||
|
||||
start_event('admin_config_form_update');
|
||||
|
||||
goto_url('./config_form.php', false);
|
||||
?>
|
||||
+1
-1
@@ -189,7 +189,7 @@ $ip = "";
|
||||
$is_ip_view = $board['bo_use_ip_view'];
|
||||
if ($is_admin) {
|
||||
$is_ip_view = true;
|
||||
if (array_key_exists('wr_ip', $write)) {
|
||||
if ($write && array_key_exists('wr_ip', $write)) {
|
||||
$ip = $write['wr_ip'];
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -211,6 +211,8 @@ if ($w == '' || $w == 'r') {
|
||||
if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
|
||||
alert('제목을 입력하여 주십시오.');
|
||||
|
||||
$wr_seo_title = exist_seo_url_recursive('bbs', generate_seo_url($wr_subject), $write_table, $wr_id);
|
||||
|
||||
if ($w == '' || $w == 'r') {
|
||||
|
||||
if ($member['mb_id']) {
|
||||
@@ -251,6 +253,7 @@ if ($w == '' || $w == 'r') {
|
||||
wr_option = '$html,$secret,$mail',
|
||||
wr_subject = '$wr_subject',
|
||||
wr_content = '$wr_content',
|
||||
wr_seo_title = '$wr_seo_title',
|
||||
wr_link1 = '$wr_link1',
|
||||
wr_link2 = '$wr_link2',
|
||||
wr_link1_hit = 0,
|
||||
@@ -372,6 +375,7 @@ if ($w == '' || $w == 'r') {
|
||||
wr_option = '{$html},{$secret},{$mail}',
|
||||
wr_subject = '{$wr_subject}',
|
||||
wr_content = '{$wr_content}',
|
||||
wr_seo_title = '$wr_seo_title',
|
||||
wr_link1 = '{$wr_link1}',
|
||||
wr_link2 = '{$wr_link2}',
|
||||
mb_id = '{$mb_id}',
|
||||
|
||||
+11
-6
@@ -122,9 +122,14 @@ $member = array();
|
||||
$board = array();
|
||||
$group = array();
|
||||
$g5 = array();
|
||||
$g5_debug = array('php'=>array(),'sql'=>array());
|
||||
|
||||
include_once(G5_LIB_PATH.'/hook.lib.php'); // hook 함수 파일
|
||||
include_once(G5_LIB_PATH.'/get_data.lib.php');
|
||||
include_once(G5_LIB_PATH.'/uri.lib.php'); // URL 함수 파일
|
||||
include_once(G5_LIB_PATH.'/cache.lib.php');
|
||||
|
||||
$g5_object = new G5_object_store();
|
||||
|
||||
//==============================================================================
|
||||
// 공통
|
||||
@@ -214,7 +219,7 @@ ini_set("session.cookie_domain", G5_COOKIE_DOMAIN);
|
||||
//------------------------------------------------------------------------------
|
||||
// 기본환경설정
|
||||
// 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음
|
||||
$config = sql_fetch(" select * from {$g5['config_table']} ");
|
||||
$config = get_config();
|
||||
|
||||
define('G5_HTTP_BBS_URL', https_url(G5_BBS_DIR, false));
|
||||
define('G5_HTTPS_BBS_URL', https_url(G5_BBS_DIR, true));
|
||||
@@ -404,16 +409,16 @@ if ($_SESSION['ss_mb_id']) { // 로그인중이라면
|
||||
$write = array();
|
||||
$write_table = "";
|
||||
if ($bo_table) {
|
||||
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");
|
||||
$board = get_board_db($bo_table);
|
||||
if ($board['bo_table']) {
|
||||
set_cookie("ck_bo_table", $board['bo_table'], 86400 * 1);
|
||||
$gr_id = $board['gr_id'];
|
||||
$write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
|
||||
|
||||
if (isset($wr_id) && $wr_id) {
|
||||
$write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
|
||||
} else if (isset($wr_unique) && $wr_unique) {
|
||||
$write = sql_fetch(" select * from $write_table where wr_unique = '$wr_unique' ", false);
|
||||
$write = get_write($write_table, $wr_id);
|
||||
} else if (isset($wr_seo_title) && $wr_seo_title) {
|
||||
$write = get_write_by_field($write_table, 'wr_seo_title', $wr_seo_title);
|
||||
if( isset($write['wr_id']) ){
|
||||
$wr_id = $write['wr_id'];
|
||||
}
|
||||
@@ -422,7 +427,7 @@ if ($bo_table) {
|
||||
}
|
||||
|
||||
if ($gr_id) {
|
||||
$group = sql_fetch(" select * from {$g5['group_table']} where gr_id = '$gr_id' ");
|
||||
$group = get_group($gr_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ if (PHP_VERSION >= '5.1.0') {
|
||||
define('G5_DOMAIN', '');
|
||||
define('G5_HTTPS_DOMAIN', '');
|
||||
|
||||
//디버깅 상수
|
||||
define('G5_DEBUG', true);
|
||||
|
||||
/*
|
||||
www.sir.kr 과 sir.kr 도메인은 서로 다른 도메인으로 인식합니다. 쿠키를 공유하려면 .sir.kr 과 같이 입력하세요.
|
||||
이곳에 입력이 없다면 www 붙은 도메인과 그렇지 않은 도메인은 쿠키를 공유하지 않으므로 로그인이 풀릴 수 있습니다.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
put_event('tail_sub', 'show_debug_bar');
|
||||
|
||||
function show_debug_bar() {
|
||||
|
||||
global $g5, $g5_debug, $is_admin;
|
||||
|
||||
if( ! get_permission_debug_show() ) return;
|
||||
|
||||
if ( !($is_admin === 'super' && !is_mobile() ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
$memory_usage = function_exists( 'memory_get_peak_usage' ) ? memory_get_peak_usage() : memory_get_usage();
|
||||
$php_run_time = get_microtime()-$gml_debug['begin_time'];
|
||||
|
||||
include_once( G5_PLUGIN_PATH.'/debugbar/debugbar.php' );
|
||||
}
|
||||
?>
|
||||
@@ -38,8 +38,8 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php"><i class="fa fa-cog" aria-hidden="true"></i> 정보수정</a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/logout.php"><i class="fa fa-sign-out" aria-hidden="true"></i> 로그아웃</a></li>
|
||||
<?php if ($is_admin) { ?>
|
||||
<li class="tnb_admin"><a href="<?php echo G5_ADMIN_URL ?>"><b><i class="fa fa-user-circle" aria-hidden="true"></i> 관리자</b></a></li>
|
||||
<?php } ?>
|
||||
<li class="tnb_admin"><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>"><b><i class="fa fa-user-circle" aria-hidden="true"></i> 관리자</b></a></li>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/register.php"><i class="fa fa-user-plus" aria-hidden="true"></i> 회원가입</a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/login.php"><b><i class="fa fa-sign-in" aria-hidden="true"></i> 로그인</b></a></li>
|
||||
@@ -165,7 +165,7 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
} //end foreach $row
|
||||
|
||||
if ($i == 0) { ?>
|
||||
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
|
||||
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<div id="gnb_all">
|
||||
@@ -198,7 +198,7 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
} //end foreach $row
|
||||
|
||||
if ($i == 0) { ?>
|
||||
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <br><a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
|
||||
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <br><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<button type="button" class="gnb_close_btn"><i class="fa fa-times" aria-hidden="true"></i></button>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
Class G5_object_store {
|
||||
public $writes = array();
|
||||
|
||||
function get($type, $key, $group ='default') {
|
||||
|
||||
switch ($type) {
|
||||
case 'bbs':
|
||||
if( $this->exists('bbs', $key, $group) ){
|
||||
if ( is_object($this->writes[$group][$key]) )
|
||||
return clone $this->writes[$group][$key];
|
||||
else
|
||||
return $this->writes[$group][$key];
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function exists($type, $key, $group = 'default' ) {
|
||||
|
||||
$return_data = '';
|
||||
|
||||
switch ($type) {
|
||||
case 'bbs':
|
||||
$datas = $this->writes;
|
||||
break;
|
||||
}
|
||||
|
||||
return isset($datas[$group]) && ( isset($datas[$group][$key]) || array_key_exists($key, $datas[$group]) );
|
||||
}
|
||||
|
||||
function set($type, $key, $data=array(), $group='default') {
|
||||
if ( is_object( $data ) )
|
||||
$data = clone $data;
|
||||
|
||||
switch ($type) {
|
||||
case 'bbs':
|
||||
$this->writes[$group][$key] = $data;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function delete($key, $group='default') {
|
||||
switch ($type) {
|
||||
case 'bbs':
|
||||
if ( ! $this->exists('bbs', $key, $group) )
|
||||
return false;
|
||||
|
||||
unset( $this->writes[$group][$key] );
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} //end Class
|
||||
|
||||
?>
|
||||
@@ -94,6 +94,8 @@ class G5_URI {
|
||||
}
|
||||
|
||||
public function url_clean($stringurl, $add_qry='') {
|
||||
global $config, $g5;
|
||||
|
||||
$stringurl = str_replace('&', '&', $stringurl);
|
||||
$url=parse_url($stringurl);
|
||||
$strurl = basename($url['path'],".php");
|
||||
@@ -117,6 +119,16 @@ class G5_URI {
|
||||
$s[$key] = $vars[$key];
|
||||
}
|
||||
|
||||
if( $config['cf_bbs_rewrite'] > 1 && (isset($s['wr_id']) && $s['wr_id']) && (isset($s['bo_table']) && $s['bo_table']) ){
|
||||
$get_write = get_write( get_write_table_name($s['bo_table']), $s['wr_id'], true);
|
||||
|
||||
if( $get_write['wr_seo_title'] ){
|
||||
unset($s['wr_id']);
|
||||
$s['wr_seo_title'] = $get_write['wr_seo_title'].'/';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';
|
||||
|
||||
$host = G5_URL;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
function g5_delete_all_cache(){
|
||||
|
||||
$board_tables = get_board_names();
|
||||
|
||||
foreach( $board_tables as $board_table ){
|
||||
delete_cache_latest($board_table);
|
||||
}
|
||||
|
||||
start_event('adm_cache_delete', $board_tables);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+108
-13
@@ -335,11 +335,13 @@ function get_dirsize($dir)
|
||||
// 게시물 정보($write_row)를 출력하기 위하여 $list로 가공된 정보를 복사 및 가공
|
||||
function get_list($write_row, $board, $skin_url, $subject_len=40)
|
||||
{
|
||||
global $g5, $config;
|
||||
global $g5, $config, $g5_object;
|
||||
global $qstr, $page;
|
||||
|
||||
//$t = get_microtime();
|
||||
|
||||
$g5_object->set('bbs', $write_row['wr_id'], $write_row, $board['bo_table']);
|
||||
|
||||
// 배열전체를 복사
|
||||
$list = $write_row;
|
||||
unset($write_row);
|
||||
@@ -682,13 +684,51 @@ function get_sql_search($search_ca_name, $search_field, $search_text, $search_op
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
// 게시판 테이블에서 하나의 행을 읽음
|
||||
function get_write($write_table, $wr_id)
|
||||
function get_write($write_table, $wr_id, $is_cache=false)
|
||||
{
|
||||
return sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
|
||||
global $g5, $g5_object;
|
||||
|
||||
$wr_bo_table = preg_replace('/^'.preg_quote($g5['write_prefix']).'/i', '', $write_table);
|
||||
|
||||
$write = $g5_object->get('bbs', $wr_id, $wr_bo_table);
|
||||
|
||||
if( !$write ){
|
||||
$sql = " select * from {$write_table} where wr_id = '{$wr_id}' ";
|
||||
$write = sql_fetch($sql);
|
||||
|
||||
$g5_object->set('bbs', $wr_id, $write, $wr_bo_table);
|
||||
}
|
||||
|
||||
return $write;
|
||||
}
|
||||
|
||||
// 게시판 테이블에서 하나의 행을 읽음
|
||||
function get_write_by_field($write_table, $where_field='', $where_value='', $is_cache=false)
|
||||
{
|
||||
global $g5, $g5_object;
|
||||
|
||||
if( ! in_array($where_field, array('wr_id', 'wr_num', 'wr_reply', 'wr_parent', 'wr_is_comment', 'ca_name', 'wr_option', 'wr_subject', 'wr_content', 'wr_seo_title', 'wr_link1', 'wr_link2', 'wr_hit', 'wr_good', 'wr_nogood', 'mb_id', 'wr_name', 'wr_email', 'wr_homepage', 'wr_datetime', 'wr_ip', 'wr_1', 'wr_2', 'wr_3', 'wr_4', 'wr_5', 'wr_6', 'wr_7', 'wr_8', 'wr_9', 'wr_10')) ){
|
||||
return '';
|
||||
}
|
||||
|
||||
$where_value = strip_tags($where_value);
|
||||
$key = md5($write_table.'|'.$where_field.'|'.$where_value);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$write_table} where $where_field = '".sql_real_escape_string($where_value)."' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
$wr_bo_table = preg_replace('/^'.preg_quote($g5['write_prefix']).'/i', '', $write_table);
|
||||
|
||||
$g5_object->set('bbs', $cache[$key]['wr_id'], $cache[$key], $wr_bo_table);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
// 게시판의 다음글 번호를 얻는다.
|
||||
function get_next_num($table)
|
||||
@@ -702,20 +742,45 @@ function get_next_num($table)
|
||||
|
||||
|
||||
// 그룹 설정 테이블에서 하나의 행을 읽음
|
||||
function get_group($gr_id)
|
||||
function get_group($gr_id, $is_cache=false)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
return sql_fetch(" select * from {$g5['group_table']} where gr_id = '$gr_id' ");
|
||||
static $cache = array();
|
||||
|
||||
$gr_id = preg_replace('/[^a-z0-9_]/i', '', $gr_id);
|
||||
$key = md5($gr_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['group_table']} where gr_id = '$gr_id' ";
|
||||
|
||||
$cache[$key] = apply_replace('get_group', sql_fetch($sql), $gr_id, $is_cache);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
|
||||
// 회원 정보를 얻는다.
|
||||
function get_member($mb_id, $fields='*')
|
||||
function get_member($mb_id, $fields='*', $is_cache=false)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
return sql_fetch(" select $fields from {$g5['member_table']} where mb_id = TRIM('$mb_id') ");
|
||||
static $cache = array();
|
||||
|
||||
$key = md5($fields);
|
||||
|
||||
if( $is_cache && isset($cache[$mb_id]) && isset($cache[$mb_id][$key]) ){
|
||||
return $cache[$mb_id][$key];
|
||||
}
|
||||
|
||||
$sql = " select $fields from {$g5['member_table']} where mb_id = TRIM('$mb_id') ";
|
||||
|
||||
$cache[$mb_id][$key] = apply_replace('get_member', sql_fetch($sql), $mb_id, $fields, $is_cache);
|
||||
|
||||
return $cache[$mb_id][$key];
|
||||
}
|
||||
|
||||
|
||||
@@ -1482,7 +1547,7 @@ function sql_set_charset($charset, $link=null)
|
||||
// mysql connect resource 지정 - 명랑폐인님 제안
|
||||
function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
|
||||
{
|
||||
global $g5;
|
||||
global $g5, $g5_debug;
|
||||
|
||||
if(!$link)
|
||||
$link = $g5['connect_db'];
|
||||
@@ -1495,6 +1560,10 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
|
||||
// `information_schema` DB로의 접근을 허락하지 않습니다.
|
||||
$sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql);
|
||||
|
||||
$is_debug = get_permission_debug_show();
|
||||
|
||||
$start_time = $is_debug ? get_microtime() : 0;
|
||||
|
||||
if(function_exists('mysqli_query') && G5_MYSQLI_USE) {
|
||||
if ($error) {
|
||||
$result = @mysqli_query($link, $sql) or die("<p>$sql<p>" . mysqli_errno($link) . " : " . mysqli_error($link) . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
|
||||
@@ -1509,6 +1578,15 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
|
||||
}
|
||||
}
|
||||
|
||||
if($result && $is_debug) {
|
||||
// 여기에 실행한 sql문을 화면에 표시하는 로직 넣기
|
||||
$g5_debug['sql'][] = array(
|
||||
'sql' => $sql,
|
||||
'start_time' => $start_time,
|
||||
'end_time' => get_microtime(),
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1994,6 +2072,16 @@ function is_utf8($str)
|
||||
// 출처 : https://www.google.co.kr/search?q=utf8_strcut&aq=f&oq=utf8_strcut&aqs=chrome.0.57j0l3.826j0&sourceid=chrome&ie=UTF-8
|
||||
function utf8_strcut( $str, $size, $suffix='...' )
|
||||
{
|
||||
if( function_exists('mb_strlen') && function_exists('mb_substr') ){
|
||||
|
||||
if(mb_strlen($str)<=$size) {
|
||||
return $str;
|
||||
} else {
|
||||
$str = mb_substr($str, 0, $size, 'utf-8');
|
||||
$str .= $suffix;
|
||||
}
|
||||
|
||||
} else {
|
||||
$substr = substr( $str, 0, $size * 2 );
|
||||
$multi_size = preg_match_all( '/[\x80-\xff]/', $substr, $multi_chars );
|
||||
|
||||
@@ -2005,8 +2093,9 @@ function utf8_strcut( $str, $size, $suffix='...' )
|
||||
$str = preg_replace( '/(([\x80-\xff]{3})*?)([\x80-\xff]{0,2})$/', '$1', $str );
|
||||
$str .= $suffix;
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
@@ -2670,10 +2759,16 @@ function get_qa_config($fld='*')
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = " select $fld from {$g5['qa_config_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
static $cache = array();
|
||||
|
||||
return $row;
|
||||
if( $is_cache && !empty($cache) ){
|
||||
return $cache;
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['qa_config_table']} ";
|
||||
$cache = apply_replace('get_qa_config', sql_fetch($sql));
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
// get_sock 함수 대체
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
function get_config($is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$cache = apply_replace('get_config_cache', $cache, $is_cache);
|
||||
|
||||
if( $is_cache && !empty($cache) ){
|
||||
return $cache;
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['config_table']} ";
|
||||
$cache = apply_replace('get_config', sql_fetch($sql));
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
function get_content_db($co_id, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$co_id = preg_replace('/[^a-z0-9_]/i', '', $co_id);
|
||||
$key = md5($co_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['content_table']} where co_id = '$co_id' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_board_names(){
|
||||
global $g5;
|
||||
|
||||
static $boards = array();
|
||||
|
||||
if( ! $boards ){
|
||||
$sql = " select bo_table from {$g5['board_table']} ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
while ($row = sql_fetch_array($result)) {
|
||||
$boards[] = $row['bo_table'];
|
||||
}
|
||||
}
|
||||
|
||||
return $boards;
|
||||
}
|
||||
|
||||
function get_board_db($bo_table, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$cache = apply_replace('get_board_db_cache', $cache, $bo_table, $is_cache);
|
||||
|
||||
$key = md5($bo_table);
|
||||
|
||||
$bo_table = preg_replace('/[^a-z0-9_]/i', '', $bo_table);
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
if( !($cache[$key] = apply_replace('get_board_db', array(), $bo_table)) ){
|
||||
|
||||
$sql = " select * from {$g5['board_table']} where bo_table = '$bo_table' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
}
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
// 게시판 첨부파일 테이블에서 하나의 행을 읽음
|
||||
function get_board_file_db($bo_table, $wr_id, $fields='*', $add_where='', $is_cache=false)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$wr_id = (int) $wr_id;
|
||||
$key = md5($bo_table.'|'.$wr_id.$fields.$add_where);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select $fields from {$g5['board_file_table']}
|
||||
where bo_table = '$bo_table' and wr_id = '$wr_id' $add_where order by bf_no limit 0, 1 ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_poll_db($po_id, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$po_id = (int) $po_id;
|
||||
$key = md5($po_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['poll_table']} where po_id = '{$po_id}' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_point_db($po_id, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$po_id = (int) $po_id;
|
||||
$key = md5($po_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['point_table']} where po_id = '{$po_id}' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_mail_content_db($ma_id, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$ma_id = (int) $ma_id;
|
||||
$key = md5($ma_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['mail_table']} where ma_id = '{$ma_id}' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_qacontent_db($qa_id, $is_cache=false){
|
||||
global $g5;
|
||||
|
||||
static $cache = array();
|
||||
|
||||
$qa_id = (int) $qa_id;
|
||||
$key = md5($qa_id);
|
||||
|
||||
if( $is_cache && isset($cache[$key]) ){
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['qa_content_table']} where qa_id = '{$qa_id}' ";
|
||||
|
||||
$cache[$key] = sql_fetch($sql);
|
||||
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
function get_thumbnail_find_cache($bo_table, $wr_id, $wr_key){
|
||||
global $g5;
|
||||
|
||||
if( $cache_content = g5_latest_cache_data($bo_table, array(), $wr_id) ){
|
||||
if( $wr_key === 'content' ){
|
||||
return $cache_content;
|
||||
} else if ( $wr_key === 'file' && isset($cache_content['first_file_thumb']) ){
|
||||
return $cache_content['first_file_thumb'];
|
||||
}
|
||||
}
|
||||
|
||||
if( $wr_key === 'content' ){
|
||||
$write_table = $g5['write_prefix'].$bo_table;
|
||||
return get_write_db($write_table, $wr_id, 'wr_content', true);
|
||||
}
|
||||
|
||||
return get_board_file_db($bo_table, $wr_id, 'bf_file, bf_content', "and bf_type between '1' and '3'", true);
|
||||
}
|
||||
|
||||
function get_write_table_name($bo_table){
|
||||
global $g5;
|
||||
|
||||
return $g5['write_prefix'].preg_replace('/[^a-z0-9_]/i', '', $bo_table);
|
||||
}
|
||||
|
||||
function get_db_charset($charset){
|
||||
|
||||
$add_charset = $charset;
|
||||
|
||||
if ( 'utf8mb4' === $charset ) {
|
||||
$add_charset .= ' COLLATE utf8mb4_unicode_ci';
|
||||
}
|
||||
|
||||
return apply_replace('get_db_charset', $add_charset, $charset);
|
||||
}
|
||||
|
||||
function get_db_create_replace($sql_str){
|
||||
|
||||
if( in_array(strtolower(G5_DB_ENGINE), array('innodb', 'myisam')) ){
|
||||
$sql_str = preg_replace('/ENGINE=MyISAM/', 'ENGINE='.G5_DB_ENGINE, $sql_str);
|
||||
} else {
|
||||
$sql_str = preg_replace('/ENGINE=MyISAM/', '', $sql_str);
|
||||
}
|
||||
|
||||
if( G5_DB_CHARSET !== 'utf8' ){
|
||||
$sql_str = preg_replace('/CHARSET=utf8/', 'CHARACTER SET '.get_db_charset(G5_DB_CHARSET), $sql_str);
|
||||
}
|
||||
|
||||
return $sql_str;
|
||||
}
|
||||
|
||||
function get_permission_debug_show(){
|
||||
global $member;
|
||||
|
||||
$bool = false;
|
||||
if ( defined('G5_DEBUG') && G5_DEBUG ){
|
||||
$bool = true;
|
||||
}
|
||||
|
||||
return apply_replace('get_permission_debug_show', $bool, $member);
|
||||
}
|
||||
|
||||
function get_check_mod_rewrite(){
|
||||
|
||||
if( function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) )
|
||||
$mod_rewrite = 1;
|
||||
elseif( isset($_SERVER['IIS_UrlRewriteModule']) )
|
||||
$mod_rewrite = 1;
|
||||
else
|
||||
$mod_rewrite = 0;
|
||||
|
||||
return $mod_rewrite;
|
||||
}
|
||||
|
||||
// 생성되면 안되는 게시판명
|
||||
function get_bo_table_banned_word(){
|
||||
|
||||
$folders = array();
|
||||
|
||||
foreach(glob(G5_PATH.'/*', GLOB_ONLYDIR) as $dir) {
|
||||
$folders[] = basename($dir);
|
||||
}
|
||||
|
||||
return apply_replace('get_bo_table_banned_word', $folders);
|
||||
}
|
||||
|
||||
// 읽지 않은 메모 갯수 반환
|
||||
function get_memo_not_read($mb_id, $add_where='')
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = " SELECT count(*) as cnt FROM {$g5['memo_table']} WHERE me_recv_mb_id = '$mb_id' and me_type= 'recv' and me_read_datetime like '0%' $add_where ";
|
||||
$row = sql_fetch($sql, false);
|
||||
|
||||
return $row['cnt'];
|
||||
}
|
||||
|
||||
function get_scrap_totals($mb_id=''){
|
||||
global $g5;
|
||||
|
||||
$add_where = $mb_id ? " and mb_id = '$mb_id' " : '';
|
||||
|
||||
$sql = " select count(*) as cnt from {$g5['scrap_table']} where 1=1 $add_where";
|
||||
$row = sql_fetch($sql, false);
|
||||
|
||||
return $row['cnt'];
|
||||
}
|
||||
?>
|
||||
+1
-1
@@ -15,7 +15,7 @@ function get_hook_class(){
|
||||
return null;
|
||||
}
|
||||
|
||||
function put_event($tag, $func, $priority=GML_HOOK_DEFAULT_PRIORITY, $args=0){
|
||||
function put_event($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){
|
||||
global $gml;
|
||||
|
||||
if( $hook = get_hook_class() ){
|
||||
|
||||
+37
-17
@@ -2,29 +2,36 @@
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
include_once(dirname(__FILE__) .'/URI/uri.class.php');
|
||||
include_once(dirname(__FILE__) .'/URI/obj.class.php');
|
||||
|
||||
// 짧은 주소 형식으로 만들어서 가져온다.
|
||||
function get_pretty_url($folder, $no='', $query_string='', $action='')
|
||||
{
|
||||
global $g5, $config;
|
||||
|
||||
static $boards = array();
|
||||
|
||||
if( ! $boards ){
|
||||
$sql = " select bo_table from {$g5['board_table']} ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
while ($row = sql_fetch_array($result)) {
|
||||
$boards[] = $row['bo_table'];
|
||||
}
|
||||
}
|
||||
$boards = get_board_names();
|
||||
|
||||
// use shortten url
|
||||
if($config['cf_bbs_rewrite']) {
|
||||
if(in_array($folder, $boards)) {
|
||||
|
||||
$url = G5_URL. '/'. $folder;
|
||||
if($no) {
|
||||
$url .= '/'. $no;
|
||||
|
||||
if( $config['cf_bbs_rewrite'] > 1 ){
|
||||
|
||||
$get_write = get_write( $g5['write_prefix'].$folder, $no , true);
|
||||
|
||||
if( $get_write['wr_seo_title'] ){
|
||||
$url .= '/'. urlencode($get_write['wr_seo_title']).'/';
|
||||
} else {
|
||||
$url .= '/'. $no;
|
||||
}
|
||||
|
||||
} else {
|
||||
$url .= '/'. $no;
|
||||
}
|
||||
|
||||
} else if($action) {
|
||||
$url .= '/'. $action;
|
||||
}
|
||||
@@ -76,6 +83,10 @@ function short_url_clean($url, $add_qry=''){
|
||||
return $url;
|
||||
}
|
||||
|
||||
function correct_goto_url($url){
|
||||
return $url.'/';
|
||||
}
|
||||
|
||||
function generate_seo_url($string, $wordLimit = 0){
|
||||
$separator = '-';
|
||||
|
||||
@@ -95,7 +106,7 @@ function generate_seo_url($string, $wordLimit = 0){
|
||||
|
||||
$string = strip_tags($string);
|
||||
foreach ($trans as $key => $val){
|
||||
$string = preg_replace('#'.$key.'#i'.(UTF8_ENABLED ? 'u' : ''), $val, $string);
|
||||
$string = preg_replace('#'.$key.'#iu', $val, $string);
|
||||
}
|
||||
|
||||
$string = strtolower($string);
|
||||
@@ -106,14 +117,18 @@ function generate_seo_url($string, $wordLimit = 0){
|
||||
function exist_seo_url($type, $seo_title, $write_table, $sql_id=0){
|
||||
global $g5;
|
||||
|
||||
$exists_title = '';
|
||||
if( $type === 'bbs' ){
|
||||
$sql = "select wr_seo_title FROM {$write_table} WHERE wr_seo_title = '$seo_title' AND wr_id != '$sql_id' limit 1";
|
||||
$sql = "select wr_seo_title FROM {$write_table} WHERE wr_seo_title = '".sql_real_escape_string($seo_title)."' AND wr_id <> '$sql_id' limit 1";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$exists_title = $row['wr_seo_title'];
|
||||
|
||||
} else {
|
||||
return $seo_title;
|
||||
}
|
||||
|
||||
if ($row['wr_seo_title'])
|
||||
if ($exists_title)
|
||||
return 'is_exists';
|
||||
else
|
||||
return '';
|
||||
@@ -122,14 +137,19 @@ function exist_seo_url($type, $seo_title, $write_table, $sql_id=0){
|
||||
function exist_seo_url_recursive($type, $seo_title, $write_table, $sql_id=0){
|
||||
static $count = 0;
|
||||
|
||||
$seo_title_add = ($count > 0) ? utf8_strcut($seo_title, 255 - (strlen($count)+1)) )."-$count" : $seo_title;
|
||||
$seo_title_add = ($count > 0) ? utf8_strcut($seo_title, 255 - ($count+1), '')."-$count" : $seo_title;
|
||||
|
||||
if( ! exist_seo_url($seo_title, $write_table, $sql_id) ){
|
||||
if( ! exist_seo_url($type, $seo_title_add, $write_table, $sql_id) ){
|
||||
return $seo_title_add;
|
||||
}
|
||||
|
||||
$count++;
|
||||
return exist_seo_url_recursive($mb_id);
|
||||
|
||||
if( $count > 253 ){
|
||||
return $seo_title_add;
|
||||
}
|
||||
|
||||
return exist_seo_url_recursive($type, $seo_title, $write_table, $sql_id);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -18,7 +18,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$outlogin_skin_url.'/style.css">'
|
||||
</div>
|
||||
|
||||
<div id="ol_after_btn">
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo G5_ADMIN_URL ?>" class="btn_admin">관리자</a><?php } ?>
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>" class="btn_admin">관리자</a><?php } ?>
|
||||
<a href="<?php echo G5_BBS_URL ?>/logout.php" id="ol_after_logout">로그아웃</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_PLUGIN_URL.'/debugbar/style.css">', 0);
|
||||
?>
|
||||
<style>
|
||||
<?php if (defined('G5_IS_ADMIN') && G5_IS_ADMIN){ ?>
|
||||
.debug_bar_wrap{z-index:991001}
|
||||
<?php } ?>
|
||||
</style>
|
||||
<div class="debug_bar_wrap">
|
||||
<div class="debug_bar_text_group">
|
||||
<div class="debug_bar_btn_group"><button class="view_debug_bar debug_button">디버그</button></div>
|
||||
<div class="debug_bar_text">
|
||||
<?php echo 'PHP 실행시간 : '.$php_run_time.' | 메모리 사용량 : '.number_format($memory_usage).' bytes'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="debug_bar_content">
|
||||
<div class="content_inner">
|
||||
|
||||
<div class="debugbar_close_btn_el"><button class="debugbar_close_btn btn">닫기</button></div>
|
||||
<div id="debugbar">
|
||||
<ul class="debugbar_tab">
|
||||
<li class="debug_tab active" data-tab="executed_query"><a href="#debug_executed_query">SQL Query</a></li>
|
||||
<li class="debug_tab" data-tab="hook_info"><a href="#debug_hook_info">HOOK 정보</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="debug_executed_query" class="inner_debug">
|
||||
<h3 class="query_top">
|
||||
총 쿼리수 : <span><?php echo isset($g5_debug['sql']) ? count($g5_debug['sql']) : 0; ?></span>
|
||||
</h3>
|
||||
|
||||
<div class="sql_query_list">
|
||||
<table class="debug_table">
|
||||
<caption>
|
||||
쿼리 목록
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">실행순서</th>
|
||||
<th scope="col">쿼리문</th>
|
||||
<th scope="col">실행시간</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach((array) $g5_debug['sql'] as $key=>$query){
|
||||
|
||||
if( empty($query) ) continue;
|
||||
|
||||
$executed_time = $query['end_time'] - $query['start_time'];
|
||||
$show_excuted_time = number_format((float)$executed_time * 1000, 2, '.', '');
|
||||
?>
|
||||
<tr>
|
||||
<td scope="row" data-label="실행순서"><?php echo $key; ?></td>
|
||||
<td class="left" data-label="쿼리문"><?php echo $query['sql']; ?></td>
|
||||
<td data-label="실행시간"><?php echo $show_excuted_time.' ms'; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="debug_hook_info" class="inner_debug">
|
||||
<?php
|
||||
$event_totals = get_hook_datas('event');
|
||||
$event_callbacks = get_hook_datas('event', 1);
|
||||
$replace_totals = get_hook_datas('replace');
|
||||
$replace_callbacks = get_hook_datas('replace', 1);
|
||||
?>
|
||||
<div class="hook_list">
|
||||
|
||||
<div class="debug_table_wrap">
|
||||
<table class="debug_table hook_table">
|
||||
<caption>
|
||||
HOOK 목록
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" width="20%">event_tag (갯수)</th>
|
||||
<th scope="col" width="60%">event_function</th>
|
||||
<th scope="col" width="10%">인수의 수</th>
|
||||
<th scope="col" width="10%">우선 순위</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
foreach((array) $event_totals as $tag=>$count){
|
||||
|
||||
if( $tag === 'count' ) continue;
|
||||
if( empty($count) ) continue;
|
||||
|
||||
$datas = array();
|
||||
if( isset($event_callbacks[$tag]) ){
|
||||
|
||||
$event_callbacks_tag = $event_callbacks[$tag];
|
||||
ksort($event_callbacks_tag);
|
||||
|
||||
foreach((array) $event_callbacks_tag as $priority=>$event_args){
|
||||
if( empty($event_args) ) continue;
|
||||
|
||||
foreach($event_args as $index=>$funcs){
|
||||
$datas[] = array(
|
||||
'priority' => $priority,
|
||||
'function' => $funcs['function'],
|
||||
'arguments' => $funcs['arguments'],
|
||||
);
|
||||
} //end foreach
|
||||
} //end foreach
|
||||
|
||||
$rowspan = $datas ? ' rowspan='.count($datas) : '';
|
||||
|
||||
$is_print = $rowspan;
|
||||
|
||||
foreach($datas as $data){
|
||||
?>
|
||||
<tr>
|
||||
<?php if ($is_print){ ?>
|
||||
<td scope="row" data-label="event_tag" <?php echo $rowspan; ?>><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
|
||||
<?php } ?>
|
||||
<td data-label="event_function">
|
||||
<?php echo $data['function']; ?>
|
||||
</td>
|
||||
<td data-label="인수의 수"><?php echo $data['arguments']; ?></td>
|
||||
<td data-label="우선 순위"><?php echo $data['priority']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$is_print = '';
|
||||
} //end foreach
|
||||
} else { // else if
|
||||
?>
|
||||
<tr>
|
||||
<td scope="row" data-label="event_tag"><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
|
||||
<td data-label="event_function"> </td>
|
||||
<td data-label="인수의 수"> </td>
|
||||
<td data-label="우선 순위"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}//end if
|
||||
} //end foreach
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="debug_table_wrap">
|
||||
<table class="debug_table hook_table">
|
||||
<caption>
|
||||
HOOK 목록
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" width="20%">replace_tag (갯수)</th>
|
||||
<th scope="col" width="60%">replace_function</th>
|
||||
<th scope="col" width="10%">인수의 수</th>
|
||||
<th scope="col" width="10%">우선 순위</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
foreach((array) $replace_totals as $tag=>$count){
|
||||
|
||||
if( $tag === 'count' ) continue;
|
||||
if( empty($count) ) continue;
|
||||
|
||||
$datas = array();
|
||||
if( isset($replace_callbacks[$tag]) ){
|
||||
|
||||
$replace_callbacks_tag = $replace_callbacks[$tag];
|
||||
ksort($replace_callbacks_tag);
|
||||
|
||||
foreach((array) $replace_callbacks_tag as $priority=>$replace_args){
|
||||
if( empty($replace_args) ) continue;
|
||||
|
||||
foreach($replace_args as $index=>$funcs){
|
||||
$datas[] = array(
|
||||
'priority' => $priority,
|
||||
'function' => $funcs['function'],
|
||||
'arguments' => $funcs['arguments'],
|
||||
);
|
||||
} //end foreach
|
||||
} //end foreach
|
||||
|
||||
$rowspan = $datas ? ' rowspan='.count($datas) : '';
|
||||
|
||||
$is_print = $rowspan;
|
||||
|
||||
foreach($datas as $data){
|
||||
?>
|
||||
<tr>
|
||||
<?php if ($is_print){ ?>
|
||||
<td scope="row" data-label="replace_tag" <?php echo $rowspan; ?>><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
|
||||
<?php } ?>
|
||||
<td data-label="replace_function">
|
||||
<?php echo $data['function']; ?>
|
||||
</td>
|
||||
<td data-label="인수의 수"><?php echo $data['arguments']; ?></td>
|
||||
<td data-label="우선 순위"><?php echo $data['priority']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$is_print = '';
|
||||
} //end foreach
|
||||
} else { // else if
|
||||
?>
|
||||
<tr>
|
||||
<td scope="row" data-label="replace_tag"><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
|
||||
<td data-label="replace_function"> </td>
|
||||
<td data-label="인수의 수"> </td>
|
||||
<td data-label="우선 순위"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}//end if
|
||||
} //end foreach
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div> <!-- end .hook_list -->
|
||||
</div>
|
||||
|
||||
</div> <!-- end .content_inner -->
|
||||
</div> <!-- end .debug_bar_content -->
|
||||
</div> <!-- end .debug_bar_wrap -->
|
||||
<script>
|
||||
jQuery(function($){
|
||||
$(".debug_tab").on("click", function() {
|
||||
$(".inner_debug").hide();
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
$("#debug_" + $(this).attr('data-tab')).show();
|
||||
});
|
||||
|
||||
$(".debug_tab").on("click", "a", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(".debug_bar_wrap").on("click", ".debugbar_close_btn", function() {
|
||||
$(".view_debug_bar").trigger("click");
|
||||
})
|
||||
.on("click", ".view_debug_bar", function() {
|
||||
$(".debug_bar_content").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Whitespace-only changes.
@@ -0,0 +1,51 @@
|
||||
.debug_bar_wrap{display:block;position:relative;z-index:80;height:32px;background-color:#1ABC9C}
|
||||
.debug_bar_content{display:none;position:absolute;z-index:81;width:100%;top:32px;min-height:300px;overflow:hidden;background:#fff;overflow-y:scroll;box-sizing:content-box;border-top:thin solid gray}
|
||||
.debug_bar_text_group{position:relative;padding:0 20px 0 120px;line-height:32px;}
|
||||
.debug_bar_btn_group{position:absolute;top:0;left:1em;line-height:32px;text-align:left}
|
||||
.debug_bar_text{line-height:32px;display:block;width:100%;color:#fff;text-align:right;font-size:1.2em;overflow:hidden;text-overflow: ellipsis;-o-text-overflow:ellipsis;white-space:nowrap;word-wrap:normal !important}
|
||||
.sql_query_list li{padding:1em;line-height:1em}
|
||||
.debug_bar_content .content_inner{position:relative;padding:1em}
|
||||
.debug_bar_content .debug_table_wrap{margin:10px 0}
|
||||
.debugbar_tab::after{display:block;visibility:hidden;clear:both;content:""}
|
||||
.debugbar_tab li{float:left;margin-bottom:-1px;position:relative;display:block;position:relative;display:block;padding:10px 15px}
|
||||
.debugbar_tab li.debug_tab{border-bottom:2px solid #DDD}
|
||||
.debugbar_tab li.active a,.debugbar_tab li.active a:focus,.debugbar_tab li.active a:hover{border-width:0}
|
||||
.debugbar_tab li a{border:none;color:#666}
|
||||
.debugbar_tab li.active a,.debugbar_tab li a:hover{border:none;color:#4285F4!important;background:transparent}
|
||||
.debugbar_tab li a::after{content:"";background:#4285F4;height:2px;position:absolute;width:100%;left:0;bottom:-1px;transition:all 250ms ease 0;transform:scale(0)}
|
||||
.debugbar_tab li.active a::after,.debugbar_tab li:hover a::after{transform:scale(1)}
|
||||
.debugbar_tab li a::after{background:#21527d none repeat scroll 0 0;color:#fff}
|
||||
.inner_debug {display:none}
|
||||
.inner_debug h3.query_top{padding:1em;font-size:1.3em}
|
||||
#debug_executed_query{display:block}
|
||||
.lang_domain_list td .num{margin-right:10px;color:#9b9ea5;font-size:9px}
|
||||
.debugbar_close_btn_el{position:absolute;top:20px;right:20px}
|
||||
.debug_table{border:1px solid #ccc;border-collapse:collapse;margin:0;padding:0;width:100%}
|
||||
.debug_table caption{display:none}
|
||||
.debug_table tr{background:#f8f8f8;border:1px solid #ddd;padding:.35em}
|
||||
.debug_table th,.debug_table td{padding:.625em;text-align:center}
|
||||
.debug_table tbody tr:hover td{background:#c7d4dd!important}
|
||||
.debug_table tbody tr:nth-child(even){background-color:#fff}
|
||||
.debug_table td.left{text-align:left}
|
||||
.debug_table th{font-size:.85em;letter-spacing:.1em;text-transform:uppercase}
|
||||
.debug_table td img{text-align:center}
|
||||
|
||||
.debug_table.hook_table th, .debug_table.hook_table td {text-align:left;border:1px solid #ddd;}
|
||||
.hook_table .hook_count{margin-left:3px;font-size:0.9em;color:#7cbc0a}
|
||||
|
||||
.debug_bar_btn_group button.debug_button{margin-top:3px}
|
||||
button.debug_button{background-color:#7fbf4d;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#7fbf4d),color-stop(100%,#63a62f));background-image:-webkit-linear-gradient(top,#7fbf4d,#63a62f);background-image:-moz-linear-gradient(top,#7fbf4d,#63a62f);background-image:-ms-linear-gradient(top,#7fbf4d,#63a62f);background-image:-o-linear-gradient(top,#7fbf4d,#63a62f);background-image:linear-gradient(top,#7fbf4d,#63a62f);border:1px solid #63a62f;border-bottom:1px solid #5b992b;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 0 #96ca6d;box-shadow:inset 0 1px 0 0 #96ca6d;color:#fff;padding:3px 0 4px;text-align:center;text-shadow:0 -1px 0 #4c9021;width:100px;font-weight:700;font-size:14px;vertical-align:top}
|
||||
button.debug_button:hover{background-color:#76b347;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#76b347),color-stop(100%,#5e9e2e));background-image:-webkit-linear-gradient(top,#76b347,#5e9e2e);background-image:-moz-linear-gradient(top,#76b347,#5e9e2e);background-image:-ms-linear-gradient(top,#76b347,#5e9e2e);background-image:-o-linear-gradient(top,#76b347,#5e9e2e);background-image:linear-gradient(top,#76b347,#5e9e2e);-webkit-box-shadow:inset 0 1px 0 0 #8dbf67;box-shadow:inset 0 1px 0 0 #8dbf67;cursor:pointer}
|
||||
button.debug_button:active{border:1px solid #5b992b;border-bottom:1px solid #538c27;-webkit-box-shadow:inset 0 0 8px 4px #548c29,0 1px 0 0 #eee;box-shadow:inset 0 0 8px 4px #548c29,0 1px 0 0 #eee}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.debug_table{border:0}
|
||||
.debug_table caption{font-size:1.3em}
|
||||
.debug_table thead{display:none}
|
||||
.debug_table tr{border-bottom:3px solid #ddd;display:block;margin-bottom:.625em}
|
||||
.debug_table td{border-bottom:1px solid #ddd;display:block;font-size:.8em;text-align:right}
|
||||
.debug_table td.left{text-align:right}
|
||||
.debug_table td:before{content:attr(data-label);float:left;font-weight:700;text-transform:uppercase}
|
||||
.debug_table.hook_table th, .debug_table.hook_table td{border:0 none;border-bottom:1px solid #ddd;text-align:right}
|
||||
.debug_table td:last-child{border-bottom:0 !important}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$outlogin_skin_url.'/style.css">'
|
||||
</span>
|
||||
<strong><?php echo $nick ?>님</strong>
|
||||
<a href="<?php echo G5_BBS_URL ?>/logout.php" id="ol_after_logout" class="btn_b04">로그아웃</a>
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo G5_ADMIN_URL ?>" class="btn_admin btn_04">관리자</a><?php } ?>
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>" class="btn_admin btn_04">관리자</a><?php } ?>
|
||||
</header>
|
||||
<ul id="ol_after_private">
|
||||
<li>
|
||||
|
||||
@@ -25,6 +25,8 @@ $(function() {
|
||||
</script>
|
||||
<![endif]-->
|
||||
|
||||
<?php start_event('tail_sub'); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php echo html_end(); // HTML 마지막 처리 함수 : 반드시 넣어주시기 바랍니다. ?>
|
||||
@@ -33,7 +33,7 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php"><i class="fa fa-cog" aria-hidden="true"></i> 정보수정</a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/logout.php"><i class="fa fa-sign-out" aria-hidden="true"></i> 로그아웃</a></li>
|
||||
<?php if ($is_admin) { ?>
|
||||
<li class="tnb_admin"><a href="<?php echo G5_ADMIN_URL ?>"><b><i class="fa fa-user-circle" aria-hidden="true"></i> 관리자</b></a></li>
|
||||
<li class="tnb_admin"><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>"><b><i class="fa fa-user-circle" aria-hidden="true"></i> 관리자</b></a></li>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/register.php"><i class="fa fa-user-plus" aria-hidden="true"></i> 회원가입</a></li>
|
||||
|
||||
@@ -15,7 +15,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$outlogin_skin_url.'/style.css">'
|
||||
</span>
|
||||
<strong><?php echo $nick ?>님</strong>
|
||||
<a href="<?php echo G5_BBS_URL ?>/logout.php" id="ol_after_logout" class="btn_b04">로그아웃</a>
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo G5_ADMIN_URL ?>" class="btn_admin btn_04">관리자</a><?php } ?>
|
||||
<?php if ($is_admin == 'super' || $is_auth) { ?><a href="<?php echo correct_goto_url(G5_ADMIN_URL); ?>" class="btn_admin btn_04">관리자</a><?php } ?>
|
||||
</header>
|
||||
<ul id="ol_after_private">
|
||||
<li>
|
||||
|
||||
@@ -20,6 +20,8 @@ $(function() {
|
||||
</script>
|
||||
<![endif]-->
|
||||
|
||||
<?php start_event('tail_sub'); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php echo html_end(); // HTML 마지막 처리 함수 : 반드시 넣어주시기 바랍니다. ?>
|
||||
Reference in new issue
Block a user