From eca24d196ed46c3c41787ad4d79ead13ba4ba8bb Mon Sep 17 00:00:00 2001 From: thisgun Date: Wed, 24 Oct 2018 11:05:48 +0900 Subject: [PATCH] =?UTF-8?q?url=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/URI/obj.class.php | 13 +++++++++++++ lib/uri.lib.php | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/URI/obj.class.php b/lib/URI/obj.class.php index 194f4f923..8e606e1d3 100644 --- a/lib/URI/obj.class.php +++ b/lib/URI/obj.class.php @@ -4,6 +4,7 @@ if (!defined('_GNUBOARD_')) exit; Class G5_object_store { public $writes = array(); public $contents = array(); + public $etcs = array(); function get($type, $key, $group ='default') { @@ -14,6 +15,9 @@ Class G5_object_store { case 'content' : $datas = $this->contents; break; + default : + $datas = $this->etcs; + break; } if( $this->exists($type, $key, $group) ){ @@ -37,6 +41,9 @@ Class G5_object_store { case 'content': $datas = $this->contents; break; + default : + $datas = $this->etcs; + break; } return isset($datas[$group]) && ( isset($datas[$group][$key]) || array_key_exists($key, $datas[$group]) ); @@ -53,6 +60,9 @@ Class G5_object_store { case 'content': $this->contents[$group][$key] = $data; break; + default : + $datas = $this->etcs[$group][$key] = $data; + break; } } @@ -65,6 +75,9 @@ Class G5_object_store { case 'content': $datas = $this->contents; break; + default : + $datas = $this->etcs; + break; } if ( ! $this->exists('bbs', $key, $group) ) diff --git a/lib/uri.lib.php b/lib/uri.lib.php index 42ac7aa66..fb7a893f6 100644 --- a/lib/uri.lib.php +++ b/lib/uri.lib.php @@ -13,6 +13,10 @@ function get_pretty_url($folder, $no='', $query_string='', $action='') $segments = array(); $url = $add_query = ''; + if( $url = apply_replace('get_pretty_url', $url, $folder, $no, $query_string, $action) ){ + return $url; + } + // use shortten url if($config['cf_bbs_rewrite']) { @@ -286,7 +290,7 @@ function seo_title_update($db_table, $pk_id, $type='bbs'){ function get_nginx_conf_rules($return_string=false){ - $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'].'/' : '/'; @@ -294,6 +298,11 @@ function get_nginx_conf_rules($return_string=false){ $rules[] = '#### '.G5_VERSION.' url rules BOF #####'; $rules[] = 'if (!-e $request_filename){'; + + if( $add_rules = apply_replace('add_nginx_conf_rules', '', $get_path_url, $base_path, $return_string) ){ + $rules[] = $add_rules; + } + $rules[] = "rewrite ^{$base_path}content/([0-9a-zA-Z_]+)$ {$base_path}bbs/content.php?co_id=$1&rewrite=1 break;"; $rules[] = "rewrite ^{$base_path}content/([^/]+)/$ {$base_path}bbs/content.php?co_seo_title=$1&rewrite=1 break;"; $rules[] = "rewrite ^{$base_path}rss/([0-9a-zA-Z_]+)$ {$base_path}bbs/rss.php?bo_table=$1 break;"; @@ -309,7 +318,7 @@ function get_nginx_conf_rules($return_string=false){ function get_mod_rewrite_rules($return_string=false){ - $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'].'/' : '/'; @@ -321,6 +330,11 @@ function get_mod_rewrite_rules($return_string=false){ $rules[] = 'RewriteBase '.$base_path; $rules[] = 'RewriteCond %{REQUEST_FILENAME} !-f'; $rules[] = 'RewriteCond %{REQUEST_FILENAME} !-d'; + + if( $add_rules = apply_replace('add_mod_rewrite_rules', '', $get_path_url, $base_path, $return_string) ){ + $rules[] = $add_rules; + } + $rules[] = 'RewriteRule ^content/([0-9a-zA-Z_]+)$ '.G5_BBS_DIR.'/content.php?co_id=$1&rewrite=1 [L]'; $rules[] = 'RewriteRule ^content/([^/]+)/$ '.G5_BBS_DIR.'/content.php?co_seo_title=$1&rewrite=1 [QSA,L]'; $rules[] = 'RewriteRule ^rss/([0-9a-zA-Z_]+)$ '.G5_BBS_DIR.'/rss.php?bo_table=$1 [L]';