diff --git a/.htaccess b/.htaccess index 62ff3b6..bedb13b 100755 --- a/.htaccess +++ b/.htaccess @@ -13,6 +13,8 @@ php_value error_log ./data/php-error-logs.log RewriteEngine On +RewriteRule ^\.well-known/.+ - [END] + RewriteRule ^install($|/.*) - [L] RewriteRule ^manage$ manage/index.php [L] diff --git a/app/sub/board.php b/app/sub/board.php index 7fb5d0f..5b72050 100755 --- a/app/sub/board.php +++ b/app/sub/board.php @@ -14,11 +14,13 @@ public function init() $this->layout()->foot(); } - public function make(){ + public function make() + { $this->module(); } - public function module(){ + public function module() + { $module = new \Module\Board\Make_Controller(); $module->set('id', 'news'); $module->run(); diff --git a/layout/js/common.js b/layout/js/common.js index 07acbd3..f91ddf1 100755 --- a/layout/js/common.js +++ b/layout/js/common.js @@ -2,9 +2,11 @@ // Ajax Validator // ajax_valid = { + 'init' : function() { this.action(); }, + 'action' : function() { var $ele = $('*[data-validt-event]'); @@ -17,7 +19,7 @@ ajax_valid = { var $validt = $('.validt[data-validt-group='+group+']'); $validt.hide(); - $(document).on(evt, 'input[name='+group+']', function(e){ + $(document).on(evt, 'input[name="'+group+'"]', function(e){ var chk_var = true; if ($(this).val() === '') { chk_var = false; @@ -29,7 +31,7 @@ ajax_valid = { 'type' : 'POST', 'url' : PH_DIR + action, 'cache' : false, - 'data' : $('input[name=' + group+']').serialize(), + 'data' : $('input[name="' + group+'"]').serialize(), 'dataType' : 'html', 'success' : function(data){ if(data.indexOf('"success" :') === -1){ @@ -59,6 +61,7 @@ ajax_valid = { }); } } + } $(function(){ ajax_valid.init(); @@ -68,10 +71,11 @@ $(function(){ // Ajax Form Validator // valid = { + 'error' : function($form, opt) { if (opt.input) { - var $inp = $('*[name=' + opt.input + ']', $form); + var $inp = $('*[name="' + opt.input + '"]', $form); var inp_tit = $inp.attr('title'); } @@ -147,12 +151,14 @@ valid = { break; } } + } // // Return Ajax Submit // returnAjaxSubmit = function($form, data) { + var trim_data = data.replace(/(<([^>]+)>)/ig, ''); if (data.indexOf('"success" :') === -1) { @@ -196,20 +202,24 @@ returnAjaxSubmit = function($form, data) { // Plugin : CKEditor // function ckeEditor_action() { + $('textarea[ckeditor]').each(function() { var t_id = $(this).attr('id'); var t_cont = CKEDITOR.instances[t_id].getData(); $(this).val(t_cont); }); + } // // Ajax Submit // ajaxSubmit = { + 'init' : function($form) { this.action($form); }, + 'action' : function($form) { ckeEditor_action(); @@ -231,15 +241,18 @@ ajaxSubmit = { } }); } + } // // Ajax Submit With File // ajaxFileSubmit = { + 'init' : function($form) { this.action($form); }, + 'action' : function($form) { ckeEditor_action(); @@ -284,15 +297,18 @@ ajaxFileSubmit = { } }); } + } // // Ajax Form을 본문에서 찾아 Form setting // setAjaxForm = { + 'init' : function() { this.action(); }, + 'action' : function() { var $ele = { 'doc' : $(document) @@ -314,7 +330,9 @@ setAjaxForm = { } }); } + } + $(function() { setAjaxForm.init(); }); @@ -323,6 +341,7 @@ $(function() { // Cookie // function setCookie(name, value, expiredays) { + var todayDate = new Date(); if (expiredays === null) { expiredays = 30; @@ -330,8 +349,11 @@ function setCookie(name, value, expiredays) { // Cookie 저장 시간 (1Day = 1) todayDate.setDate(todayDate.getDate() + expiredays); document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + todayDate.toGMTString() + ';' + } + function getCookie(name) { + var nameOfCookie = name + '='; var x = 0; @@ -349,15 +371,18 @@ function getCookie(name) { } } return ''; + } // // Before confirm // formBeforeConfirm = { + 'init' : function() { this.action(); }, + 'action' : function() { $(document).on('click', '*[data-form-before-confirm]', function(e) { e.preventDefault(); @@ -382,8 +407,8 @@ formBeforeConfirm = { var org_val = new Array; for (var i = 1; i < val_exp.length; i++) { - $inp[i] = $('input[name=' + val_exp[i].split(':')[0] + ']' ,$form); - org_val[i] = $('input[name=' + val_exp[i].split(':')[0] + ']').val(); + $inp[i] = $('input[name="' + val_exp[i].split(':')[0] + '"]' ,$form); + org_val[i] = $('input[name="' + val_exp[i].split(':')[0] + '"]').val(); $inp[i].val(val_exp[i].split(':')[1]) } @@ -395,7 +420,9 @@ formBeforeConfirm = { } }); } + } + $(function(){ formBeforeConfirm.init(); }); @@ -404,6 +431,7 @@ $(function(){ // Setting Tabindex // set_elements_tabindex = function() { + $('button, input, a, *[tabindex]').each(function(i) { if ($(this).closest('*[data-no-tab-index]').length > 0) { return; @@ -411,6 +439,7 @@ set_elements_tabindex = function() { $(this).attr('data-tab-index', i); }); + } make_elements_tabindex = { 'init' : function() { @@ -428,6 +457,7 @@ make_elements_tabindex = { }); } } + $(function() { make_elements_tabindex.init(); setInterval(set_elements_tabindex, 100); @@ -459,4 +489,5 @@ zigalert = function(msg) { $(this).remove(); } }); + } diff --git a/layout/js/global.js b/layout/js/global.js index f8d61c0..25e8b0b 100755 --- a/layout/js/global.js +++ b/layout/js/global.js @@ -1,21 +1,33 @@ -// -// Popup -// -var SitePopup = { +ph_global_script = { + + // + // init + // 'init' : function() { - this.action(); + + this.site_popup(); // Popup + this.get_phonecheck(); // 휴대전화번호 SMS 인증 코드 발송 및 검증 + this.get_kakao_address(); // 카카오 주소검색 + }, - 'action' : function() { + + // + // Popup + // + 'site_popup' : function() { + var $ele = { 'closeBtn' : $('.ph-pop .close'), 'closeTodayBtn' : $('.ph-pop .close-today') } + $ele.closeBtn.on({ 'click' : function(e) { e.preventDefault(); $(this).parents('.ph-pop').remove(); } }); + $ele.closeTodayBtn.on({ 'click' : function(e) { e.preventDefault(); @@ -24,20 +36,14 @@ var SitePopup = { $(this).parents('.ph-pop').remove(); } }); - } -} -$(function() { - SitePopup.init(); -}); - -// -// 휴대전화번호 SMS 인증 코드 발송 및 검증 -// -var Get_phonecheck = { - 'init' : function() { - this.action(); + }, - 'action' : function() { + + // + // 휴대전화번호 SMS 인증 코드 발송 및 검증 + // + 'get_phonecheck' : function() { + var $ele = { 'wrap' : $('#get-phone-check-wrap'), 'sendBtn' : $('#get-phone-check-wrap').find('.send-sms-code'), @@ -103,20 +109,13 @@ var Get_phonecheck = { } }); - } -} -$(function() { - Get_phonecheck.init(); -}); - -// -// 카카오 주소검색 -// -var Get_kakaoAddress = { - 'init' : function() { - this.action(); }, - 'action' : function() { + + // + // 카카오 주소검색 + // + 'get_kakao_address' : function() { + if (typeof PH_KPOSTCODE_API_URL == 'undefined' || typeof PH_KPOSTCODE_API_URL == 'null') { return false; } @@ -153,13 +152,17 @@ var Get_kakaoAddress = { } }).open(); } + $ele.searchBtn.on({ 'click' : function() { getSearch(); } }); - }, + + } + } + $(function() { - Get_kakaoAddress.init(); + ph_global_script.init(); }); diff --git a/lib/autoload.class.php b/lib/autoload.class.php index 38838b8..b0a4048 100755 --- a/lib/autoload.class.php +++ b/lib/autoload.class.php @@ -18,7 +18,7 @@ function mod_autoloader($className) $loadfile = preg_replace("/($file(?!.*$file))/", 'controller/'.$file, $className); $loadfile = PH_MOD_PATH.$loadfile.'.php'; - if (file_exists($loadfile) === true){ + if (file_exists($loadfile) === true) { include_once $loadfile; } } diff --git a/lib/blocked.class.php b/lib/blocked.class.php index b8935f0..acd839c 100755 --- a/lib/blocked.class.php +++ b/lib/blocked.class.php @@ -37,9 +37,7 @@ static public function chk_block() $localhosts = array('127.0.0.1', '::1', 'localhost', '255.255.255.0'); - if (in_array($_SERVER['REMOTE_ADDR'], $localhosts)) { - return false; - } + if (in_array($_SERVER['REMOTE_ADDR'], $localhosts)) return false; $sql = new Pdosql(); diff --git a/lib/config.set.php b/lib/config.set.php index f8fa3bb..d7ed2b0 100755 --- a/lib/config.set.php +++ b/lib/config.set.php @@ -20,7 +20,7 @@ // //////////////////////////////////////////////////// -define('USE_MOBILE', 'C'); // 모바일 사용 여부. (사용: 'Y', 비사용: 'N', 관리페이지 설정에 따름: 'C') +define('USE_MOBILE', 'C'); // 반응형 모바일 사용 여부. (사용: 'Y', 비사용: 'N', 관리페이지 설정에 따름: 'C') //////////////////////////////////////////////////// // diff --git a/lib/controller.class.php b/lib/controller.class.php index 6b9cd7e..c10ec65 100755 --- a/lib/controller.class.php +++ b/lib/controller.class.php @@ -15,6 +15,7 @@ class Make_Controller { static private $ob_title; static private $ob_ogtitle; static private $ob_define_js; + static private $ob_body_class; static private $org_head_html; static private $setparm = array(); static private $layout_type; @@ -22,13 +23,14 @@ class Make_Controller { static public function set_ob() { - global $ob_src_css, $ob_src_js, $ob_title, $ob_ogtitle, $ob_define_js; + global $ob_src_css, $ob_src_js, $ob_title, $ob_ogtitle, $ob_define_js, $ob_body_class; self::$ob_src_css = $ob_src_css; self::$ob_src_js = $ob_src_js; self::$ob_title = $ob_title; self::$ob_ogtitle = $ob_ogtitle; self::$ob_define_js = $ob_define_js; + self::$ob_body_class = $ob_body_class; } public function set($name, $parm) @@ -97,13 +99,8 @@ public function view($viewer = '', $makedo = true, $makename = 'make') { global $CONF, $MB, $MODULE, $THEME, $NAVIGATOR; - if ($makedo === true) { - $this->{$makename}(); - } - - if ($viewer != '') { - $this->get_viewer($viewer); - } + if ($makedo === true) $this->{$makename}(); + if ($viewer != '') $this->get_viewer($viewer); } public function head($type = '') @@ -180,11 +177,14 @@ static public function print_headsrc() $html = self::$ob_head_html; + //
에 class 추가 + $html = (self::$ob_body_class) ? preg_replace("//", "", $html) : $html; + // 마지막 와 사이에 javascript 전역변수 추가 $html = preg_replace("#(var PH_DIR[^>]+;[^<]*var PH_DOMAIN[^>]+;)#", "$1".self::$ob_define_js, $html); @@ -212,12 +212,25 @@ public function get_viewer($tpl) { global $CONF, $MB, $MODULE, $THEME, $NAVIGATOR; - foreach (self::$setparm as $key => $value) { - $$key = $value; - } + extract(self::$setparm); if ($tpl != '') { if (!file_exists($tpl)) Func::core_err('View 파일이 존재하지 않습니다. ('.$tpl.')'); + + // module view가 요청된 경우 에 class 추가 + if (preg_match('/\/theme\/'.$THEME[0].'\/mod-.+?\//', $tpl, $matches)) { + $mod_name = $matches[0]; + $mod_name = str_replace(array('/theme/'.$THEME[0], '/'), array('', ''), $mod_name); + if ($mod_name) Func::add_body_class($mod_name); + } + + // module manage view가 요청된 경우 manager 에 class 추가 + if (preg_match('/\/mod\/[\w-]+\/manage\.set\/html\//', $tpl, $matches)) { + $mod_name = $matches[0]; + $mod_name = str_replace(array('/mod/', '/manage.set/html/'), array('', ''), $mod_name); + if ($mod_name) Func::add_body_class('mod-'.$mod_name.'-manage'); + } + require $tpl; } } @@ -262,7 +275,7 @@ public function run() $form_id = $REL_PATH['class_name'].'Form'; - if (isset($this->set['id']) && $this->set['id'] != '') { + if (!empty($this->set['id'])) { $form_id = $this->set['id']; } else if (!isset($this->set['type'])) { @@ -274,20 +287,13 @@ public function run() if (!isset($this->set['method'])) $this->set['method'] = 'post'; if (!isset($this->set['target'])) $this->set['target'] = ''; - switch ($this->set['type']) { - case 'static' : - $form_html = 'name="'.$form_id.'" id="'.$form_id.'" action="'.$this->set['action'].'" method="'.$this->set['method'].'"'; - break; - - case 'html' : - $form_html = 'name="'.$form_id.'" id="'.$form_id.'" ajax-action="'.$this->set['action'].'?rewritetype=submit" ajax-type="'.$this->set['type'].'"'; - break; + $form_attr = array( + 'static' => 'action="'.$this->set['action'].'" method="'.$this->set['method'].'"', + 'html' => 'ajax-action="'.$this->set['action'].'?rewritetype=submit" ajax-type="'.$this->set['type'].'"', + 'multipart' => 'enctype="multipart/form-data" ajax-action="'.$this->set['action'].'?rewritetype=submit" ajax-type="'.$this->set['type'].'"' + ); - case 'multipart' : - $form_html = 'name="'.$form_id.'" id="'.$form_id.'" enctype="multipart/form-data" ajax-action="'.$this->set['action'].'?rewritetype=submit" ajax-type="'.$this->set['type'].'"'; - break; - } - echo $form_html; + echo 'name="'.$form_id.'" id="'.$form_id.'" '.$form_attr[$this->set['type']]; } } @@ -312,7 +318,7 @@ public function run() { require_once $this->set['doc']; - if (isset($this->set['className']) && $this->set['className'] != '') { + if (!empty($this->set['className'])) { $className = $this->set['className']; } else { diff --git a/lib/functions.class.php b/lib/functions.class.php index aa271e7..b641788 100755 --- a/lib/functions.class.php +++ b/lib/functions.class.php @@ -75,8 +75,16 @@ static public function add_title($title) { global $CONF, $ob_title, $ob_ogtitle; - $ob_title .= '