diff --git a/adm/_rewrite_config_form.php b/adm/_rewrite_config_form.php
new file mode 100644
index 000000000..f67e99deb
--- /dev/null
+++ b/adm/_rewrite_config_form.php
@@ -0,0 +1,83 @@
+
+
+ 게시판과 컨텐츠 페이지에 짧은 URL 을 사용합니다.
+ 짧은 주소 설정
+
+
+
+
+
+
+
+ >
+
+
+ # 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;
+ }
+ }
+
+
+ # 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;
+ }
+ }
+
+
$sql
" . mysqli_errno($link) . " : " . mysqli_error($link) . "
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 함수 대체 diff --git a/lib/get_data.lib.php b/lib/get_data.lib.php new file mode 100644 index 000000000..51f7f30e0 --- /dev/null +++ b/lib/get_data.lib.php @@ -0,0 +1,287 @@ + \ No newline at end of file diff --git a/lib/hook.lib.php b/lib/hook.lib.php index 3739fbcc3..77ca17253 100644 --- a/lib/hook.lib.php +++ b/lib/hook.lib.php @@ -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() ){ diff --git a/lib/uri.lib.php b/lib/uri.lib.php index 81cf63fdb..7da5ce1be 100644 --- a/lib/uri.lib.php +++ b/lib/uri.lib.php @@ -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); } ?> \ No newline at end of file diff --git a/mobile/skin/outlogin/basic/outlogin.skin.2.php b/mobile/skin/outlogin/basic/outlogin.skin.2.php index 6b338c82a..1fc98eca7 100644 --- a/mobile/skin/outlogin/basic/outlogin.skin.2.php +++ b/mobile/skin/outlogin/basic/outlogin.skin.2.php @@ -18,7 +18,7 @@ add_stylesheet(''