Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/mangboard/api/mb-board.php
+++ b/mangboard/api/mb-board.php
@@ -485,19 +485,24 @@
}
$check_image_path = true;
if(!empty($_FILES)){
- if(!empty($_FILES["image_path"])) $check_image_path = false;
- foreach($_FILES as $key=>$file_data){
- if(!empty($api_fields["fn_".$key])){
- $file_name = mbw_check_upload_filename($_FILES[$key]["name"]);
- $image_path = $mdb->get_var($mdb->prepare("select ".$mb_fields["files"]["fn_file_path"]." from `".$mb_admin_tables["files"]."` where ".$mb_fields["files"]["fn_board_pid"]."=%d and ".$mb_fields["files"]["fn_table_name"]."=%s and ".$mb_fields["files"]["fn_file_name"]."=%s", $board_pid,$mb_board_table_name,$file_name)." order by ".$mb_fields["files"]["fn_file_sequence"]." desc limit 1;");
- if(!empty($image_path)){
- mbw_set_param("image_path",$image_path);
- $query_data[] = $mdb->prepare("UPDATE ".$mb_board_table_name." set ".$api_fields["fn_".$key]."=%s where ".$api_fields["fn_pid"]."=%d", $image_path, $board_pid);
+ if(!empty($_FILES["image_path"])){
+ $check_image_path = false;
+ }
+ $allow_fields = mbw_get_vars("model_file_fields");
+ if(!empty($allow_fields) && is_array($allow_fields)){
+ foreach($_FILES as $key=>$file_data){
+ if(!empty($api_fields["fn_".$key]) && in_array("fn_".$key, $allow_fields)){
+ $file_name = mbw_check_upload_filename($_FILES[$key]["name"]);
+ $image_path = $mdb->get_var($mdb->prepare("select ".$mb_fields["files"]["fn_file_path"]." from `".$mb_admin_tables["files"]."` where ".$mb_fields["files"]["fn_board_pid"]."=%d and ".$mb_fields["files"]["fn_table_name"]."=%s and ".$mb_fields["files"]["fn_file_name"]."=%s", $board_pid,$mb_board_table_name,$file_name)." order by ".$mb_fields["files"]["fn_file_sequence"]." desc limit 1;");
+ if(!empty($image_path)){
+ mbw_set_param("image_path",$image_path);
+ $query_data[] = $mdb->prepare("UPDATE ".$mb_board_table_name." set ".$api_fields["fn_".$key]."=%s where ".$api_fields["fn_pid"]."=%d", $image_path, $board_pid);
+ }
}
}
}
}
- if($check_image_path && isset($api_fields["fn_image_path"])){
+ if($check_image_path && isset($api_fields["fn_image_path"])){
//대표 이미지 경로가 있을 경우
if(mbw_get_param("board_action")=="write" && !empty($send_data[$api_fields["fn_image_path"]])){
}else if(mbw_get_param("board_action")!="write" && isset($send_data[$api_fields["fn_image_path"]])){
--- a/mangboard/api/mb-comment.php
+++ b/mangboard/api/mb-comment.php
@@ -136,13 +136,16 @@
if($upload_check) {
mbw_file_upload(array("board_name"=>mbw_get_param("board_name"),"table_name"=>$mb_comment_table_name,"board_pid"=>$parent_pid,"type"=>"board"));
if(!empty($_FILES)){
- foreach($_FILES as $key=>$file_data){
- if(!empty($api_fields["fn_".$key])){
- $file_name = mbw_check_upload_filename($_FILES[$key]["name"]);
- $image_path = $mdb->get_var($mdb->prepare("select ".$mb_fields["files"]["fn_file_path"]." from `".$mb_admin_tables["files"]."` where ".$mb_fields["files"]["fn_board_pid"]."=%d and ".$mb_fields["files"]["fn_table_name"]."=%s and ".$mb_fields["files"]["fn_file_name"]."=%s", $parent_pid,$mb_comment_table_name,$file_name)." order by ".$mb_fields["files"]["fn_pid"]." desc limit 1");
- if(!empty($image_path)){
- mbw_set_param("image_path",$image_path);
- $query_data[] = $mdb->prepare("UPDATE ".$mb_comment_table_name." set ".$api_fields["fn_".$key]."=%s where ".$api_fields["fn_pid"]."=%d", $image_path, $comment_pid);
+ $allow_fields = mbw_get_vars("model_file_fields");
+ if(!empty($allow_fields) && is_array($allow_fields)){
+ foreach($_FILES as $key=>$file_data){
+ if(!empty($api_fields["fn_".$key]) && in_array("fn_".$key, $allow_fields)){
+ $file_name = mbw_check_upload_filename($_FILES[$key]["name"]);
+ $image_path = $mdb->get_var($mdb->prepare("select ".$mb_fields["files"]["fn_file_path"]." from `".$mb_admin_tables["files"]."` where ".$mb_fields["files"]["fn_board_pid"]."=%d and ".$mb_fields["files"]["fn_table_name"]."=%s and ".$mb_fields["files"]["fn_file_name"]."=%s", $parent_pid,$mb_comment_table_name,$file_name)." order by ".$mb_fields["files"]["fn_pid"]." desc limit 1");
+ if(!empty($image_path)){
+ mbw_set_param("image_path",$image_path);
+ $query_data[] = $mdb->prepare("UPDATE ".$mb_comment_table_name." set ".$api_fields["fn_".$key]."=%s where ".$api_fields["fn_pid"]."=%d", $image_path, $comment_pid);
+ }
}
}
}
--- a/mangboard/api/mb-template.php
+++ b/mangboard/api/mb-template.php
@@ -143,7 +143,10 @@
foreach($content_items as $item){
$content = ($item[$mb_fields["select_board"]["fn_content"]]);
if(!empty($mb_fields["select_board"]["fn_data_type"]) && !empty($item[$mb_fields["select_board"]["fn_data_type"]]) && ($item[$mb_fields["select_board"]["fn_data_type"]]=="html")){
- $content = mbw_htmlspecialchars_decode($content);
+ $content = mbw_htmlspecialchars_decode($content);
+ if ( function_exists('mbw_replace_image_url') ) {
+ $content = mbw_replace_image_url($content);
+ }
$item_level = intval($item[$mb_fields["select_board"]["fn_level"]]);
//레벨 10 (관리자) 이하의 회원이 작성했거나 DISALLOW_UNFILTERED_HTML 설정이 있을 경우 추가 검증
if ( $item_level < 10 || (defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) ) {
@@ -152,9 +155,6 @@
} else {
$content = wp_kses_post($content);
}
- }
- if(function_exists('mbw_replace_image_url')){
- $content = mbw_replace_image_url($content);
}
}else{
$content = esc_html(mbw_htmlspecialchars_decode($content));
--- a/mangboard/includes/functions/func.admin.php
+++ b/mangboard/includes/functions/func.admin.php
@@ -15,8 +15,12 @@
}
if(!function_exists('mbw_manage_custom')){
function mbw_manage_custom(){
- mbw_add_trace("mbw_manage_custom");
- echo '<div class="mb-admin-custom" style="margin-top:20px;padding:0 15px 0 0;"><div style="background-color:#FFF;padding:20px 15px;border:1px solid #EEE;overflow-x:auto;">';
+ mbw_add_trace("mbw_manage_custom");
+ $add_class = "";
+ if(has_filter('mf_manage_custom_class')){
+ $add_class = apply_filters("mf_manage_custom_class",$add_class);
+ }
+ echo '<div class="mb-admin-custom'.esc_attr($add_class).'" style="margin-top:20px;padding:0 15px 0 0;"><div style="background-color:#FFF;padding:20px 15px;border:1px solid #EEE;overflow-x:auto;">';
do_action('mbw_manage_custom');
echo '</div></div>';
}
@@ -25,7 +29,11 @@
function mbw_manage_board(){
mbw_add_trace("mbw_manage_board");
do_action('mbw_manage_board_header');
- echo '<div class="mb-admin-board" style="margin-top:20px;padding:0 15px 0 0;"><div style="background-color:#FFF;padding:20px 15px;border:1px solid #EEE;overflow-x:auto;">';
+ $add_class = "";
+ if(has_filter('mf_manage_board_class')){
+ $add_class = apply_filters("mf_manage_board_class",$add_class);
+ }
+ echo '<div class="mb-admin-board'.esc_attr($add_class).'" style="margin-top:20px;padding:0 15px 0 0;"><div style="background-color:#FFF;padding:20px 15px;border:1px solid #EEE;overflow-x:auto;">';
mbw_create_board(array("name"=>mbw_get_admin_board_name(),"echo"=>"true"));
echo '</div></div>';
do_action('mbw_manage_board_footer');
@@ -38,7 +46,11 @@
global $mb_admin_tables,$mb_board_table_name,$mb_comment_table_name;
do_action('mbw_manage_page_header');
- echo '<div class="mb-admin-page" style="margin-top:0px;padding:0 15px 0 0;">';
+ $add_class = "";
+ if(has_filter('mf_manage_page_class')){
+ $add_class = apply_filters("mf_manage_page_class",$add_class);
+ }
+ echo '<div class="mb-admin-page'.esc_attr($add_class).'" style="margin-top:0px;padding:0 15px 0 0;">';
$page = str_replace( "mbw_", "", mbw_get_param("page"));
$page = mbw_value_filter($page,"name");
@@ -133,7 +145,11 @@
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
- curl_close($ch);
+ if ( PHP_VERSION_ID < 80000 ) {
+ curl_close( $ch );
+ } else {
+ unset( $ch );
+ }
$response = mbw_json_decode($response);
return ($response);
}
@@ -180,7 +196,11 @@
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
- curl_close($ch);
+ if ( PHP_VERSION_ID < 80000 ) {
+ curl_close( $ch );
+ } else {
+ unset( $ch );
+ }
if(!empty($response)){
$response = json_decode(trim($response),true);
@@ -512,67 +532,67 @@
function mbw_template_api_admin_table_data(){
if(mbw_get_param("mode")=="plugin"){
if(mbw_get_param("board_action")=="admin_table_data"){
- if(mbw_is_admin()){//start
+ if ( mbw_is_admin() && current_user_can('administrator') ) { //start
global $mstore,$mdb,$mb_fields,$mb_board_table_name,$mb_comment_table_name;
+ $table_data = "";
+ $api_fields = $mb_fields["select_board"];
+ $select_pid = mbw_get_param("select_pid");
+ $select_pid = mbw_value_filter($select_pid);
+ if(!empty($select_pid)){
+ $pid_format = array();
+ $pid_array = explode(",", $select_pid);
+ foreach($pid_array as $value) $pid_format[] = "%d";
+ $select_query = mbw_get_add_query(array("column"=>"*","join"=>"none")).$mdb->prepare(' where pid in ('.implode(",",$pid_format).') order by pid desc', $pid_array);
+ }else{
+ $select_query = mbw_get_add_query(array("column"=>"*","join"=>"none"), "where", "order")." limit 0, 5000";
+ }
+ $items = $mdb->get_results($select_query,ARRAY_A);
- $table_data = "";
- if(mbw_is_admin()) {
- $api_fields = $mb_fields["select_board"];
-
- $select_pid = mbw_get_param("select_pid");
- $select_pid = mbw_value_filter($select_pid);
- if(!empty($select_pid)){
- $pid_format = array();
- $pid_array = explode(",", $select_pid);
- foreach($pid_array as $value) $pid_format[] = "%d";
- $select_query = mbw_get_add_query(array("column"=>"*","join"=>"none")).$mdb->prepare(' where pid in ('.implode(",",$pid_format).') order by pid desc', $pid_array);
- }else{
- $select_query = mbw_get_add_query(array("column"=>"*","join"=>"none"), "where", "order")." limit 0, 5000";
+ $table_data = "<table>";
+ $table_array = array();
+ $table_item = array();
+ $table_fields = explode(",", mbw_get_param("fields"));
+ $table_titles = explode(",", mbw_get_param("titles"));
+
+ if(count($items)> 0){
+ $table_data .= '<tr>';
+ foreach($table_titles as $title){
+ $table_data = $table_data.'<td style="width:100px;border:solid 3px #EEE;">'.$title.'</td>';
+ $table_item[] = $title;
}
- $items = $mdb->get_results($select_query,ARRAY_A);
-
- $table_data = "<table>";
- $table_array = array();
- $table_item = array();
- $table_fields = explode(",", mbw_get_param("fields"));
- $table_titles = explode(",", mbw_get_param("titles"));
-
- if(count($items)> 0){
+ $table_data .= '</tr>';
+ $table_array[] = $table_item;
+ foreach($items as $item){
$table_data .= '<tr>';
- foreach($table_titles as $title){
- $table_data = $table_data.'<td style="width:100px;border:solid 3px #EEE;">'.$title.'</td>';
- $table_item[] = $title;
- }
+ $table_item = array();
+
+ foreach($table_fields as $field){
+ if(strpos($field,'passwd')!==false || strpos($field,'auth_key')!==false || strpos($field,'access_token')!==false || strpos($field,'user_pass')!==false){
+ $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;"></td>';
+ $table_item[] = "";
+ }else if($field=='fn_home_address'){
+ $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.mbw_htmlspecialchars_decode($item[$api_fields['fn_home_address1']].' '.$item[$api_fields['fn_home_address2']]).'</td>';
+ $table_item[] = mbw_htmlspecialchars_decode($item[$api_fields['fn_home_address1']].' '.$item[$api_fields['fn_home_address2']]);
+ }else if(strpos($field,'fn_')===0){
+ $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.mbw_htmlspecialchars_decode($item[$api_fields[$field]]).'</td>';
+ $table_item[] = mbw_htmlspecialchars_decode($item[$api_fields[$field]]);
+ }else{
+ $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.$field.'</td>';
+ $table_item[] = $field;
+ }
+ }
$table_data .= '</tr>';
$table_array[] = $table_item;
- foreach($items as $item){
- $table_data .= '<tr>';
- $table_item = array();
-
- foreach($table_fields as $field){
- if($field=='fn_home_address'){
- $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.mbw_htmlspecialchars_decode($item[$api_fields['fn_home_address1']].' '.$item[$api_fields['fn_home_address2']]).'</td>';
- $table_item[] = mbw_htmlspecialchars_decode($item[$api_fields['fn_home_address1']].' '.$item[$api_fields['fn_home_address2']]);
- }else if(strpos($field,'fn_')===0){
- $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.mbw_htmlspecialchars_decode($item[$api_fields[$field]]).'</td>';
- $table_item[] = mbw_htmlspecialchars_decode($item[$api_fields[$field]]);
- }else{
- $table_data .= '<td style="width:100px;border:solid 0.5px #EEE;">'.$field.'</td>';
- $table_item[] = $field;
- }
- }
- $table_data .= '</tr>';
- $table_array[] = $table_item;
- }
- }
- $table_data .= "</table>";
- }
+ }
+ }
+ $table_data .= "</table>";
+
$admin_data = $table_data;
if(has_filter('mf_admin_table_data')){
$admin_data = apply_filters("mf_admin_table_data",$admin_data, $table_array);
}
- $mstore->set_result_data(array("data"=>$admin_data));
+ mbw_set_result_data(array("data"=>$admin_data));
}//end
}
--- a/mangboard/includes/functions/func.api.php
+++ b/mangboard/includes/functions/func.api.php
@@ -111,19 +111,42 @@
}
}else{
if(!mbw_is_admin()){
+ $not_allow_fields = array();
if(!$is_admin_table){
if(mbw_get_param("mode")=="comment"){
- if(!empty($mb_fields["comment_not_allow"])) $check_fields = array_diff($api_fields, $mb_fields["comment_not_allow"]);
+ if(!empty($mb_fields["comment_not_allow"])){
+ $check_fields = array_diff($api_fields, $mb_fields["comment_not_allow"]);
+ $not_allow_fields = $mb_fields["comment_not_allow"];
+ }
}else{
- if(!empty($mb_fields["board_not_allow"])) $check_fields = array_diff($api_fields, $mb_fields["board_not_allow"]);
+ if(!empty($mb_fields["board_not_allow"])){
+ $check_fields = array_diff($api_fields, $mb_fields["board_not_allow"]);
+ $not_allow_fields = $mb_fields["board_not_allow"];
+ }
}
}else{
if($mb_board_table_name==$mb_admin_tables["users"]){
- if(!empty($mb_fields["users_not_allow"])) $check_fields = array_diff($api_fields, $mb_fields["users_not_allow"]);
+ if(!empty($mb_fields["users_not_allow"])){
+ $check_fields = array_diff($api_fields, $mb_fields["users_not_allow"]);
+ $not_allow_fields = $mb_fields["users_not_allow"];
+ }
}else{
- if(!empty($mb_fields[mbw_get_board_name()."_not_allow"])) $check_fields = array_diff($api_fields, $mb_fields[mbw_get_board_name()."_not_allow"]);
+ if(!empty($mb_fields[mbw_get_board_name()."_not_allow"])){
+ $check_fields = array_diff($api_fields, $mb_fields[mbw_get_board_name()."_not_allow"]);
+ $not_allow_fields = $mb_fields[mbw_get_board_name()."_not_allow"];
+ }
}
}
+
+ if(!empty($not_allow_fields)){
+ if(!empty($_FILES)){
+ foreach($_FILES as $key=>$file_data){
+ if(array_key_exists("fn_".$key, $not_allow_fields)){
+ unset($_FILES[$key]);
+ }
+ }
+ }
+ }
}
}
}
@@ -302,6 +325,7 @@
if(!empty($model)){
$model_data = mbw_json_decode($model);
$mb_user_level = mbw_get_user("fn_user_level");
+ $file_fields = array();
foreach($model_data as $data){
if(mbw_check_item($data)){
//필수 입력 검사
@@ -420,9 +444,12 @@
}
if ( !empty($data["type"]) ) {
- $item_type = $data["type"];
-
- if ( $item_type == "kcaptcha_img" ) {
+ $item_type = $data["type"];
+ if ( strpos($item_type, 'file') !== false ) {
+ if(!empty($data["field"])){
+ $file_fields[] = $data["field"];
+ }
+ }else if ( $item_type == "kcaptcha_img" ) {
if ( intval(mbw_get_option("kcaptcha_mode")) !=0 ) {
$mode = mbw_value_filter(mbw_get_param("mode"),"name");
$board_action = mbw_value_filter(mbw_get_param("board_action"),"name");
@@ -443,8 +470,9 @@
}
}
}
- }
- }
+ }
+ } //foreach end
+ mbw_set_vars("model_file_fields", $file_fields);
}
}
}
@@ -611,6 +639,7 @@
return $upload_check;
}
}
+
if(!function_exists('mbw_check_upload_filename')){
function mbw_check_upload_filename($file_name){
$file_name = trim($file_name);
--- a/mangboard/includes/functions/func.board.php
+++ b/mangboard/includes/functions/func.board.php
@@ -245,7 +245,9 @@
$image_url = mbw_get_file_url();
if(strpos($type, 'url')===0){
- if(strpos($data, 'http') === 0) return $data;
+ if(strpos($data, 'http') === 0){
+ return esc_url_raw($data);
+ }
$upload_url = MBW_CONTENT_URL."/uploads/mangboard/";
if(strpos($upload_url, 'http') !== 0){
if(strpos($upload_url, '/wp-content') === 0){
@@ -253,7 +255,7 @@
}
}
$file_path = $data;
- $file_name = basename($file_path);
+ $file_name = basename($file_path);
$file_name2 = $file_name;
if($type=="url_small" || $type=="url_middle"){
@@ -292,14 +294,14 @@
$file_url = str_replace(array("http://","https://"), "", $file_url);
while(($index1= strpos($content,$file_url,$index1))!==false){
- $start_index = $index1;
+ $start_index = $index1;
$end_index = strpos($content,'"',$index1);
if(empty($end_index)) break;
$image_url = substr($content,$start_index,$end_index-$start_index);
$url = mbw_get_image_url($image_type,urldecode(str_replace($file_url, "", $image_url)));
- $url_data1[] = $image_url;
- $url_data2[] = str_replace(array("http://","https://"), "", $url);
+ $url_data1[] = $image_url;
+ $url_data2[] = str_replace(array("http://","https://"), "", $url);
$index1 = $end_index;
}
@@ -308,22 +310,22 @@
$file_url = str_replace(array("http://","https://"), "", $file_url);
while(($index1= strpos($content,$file_url,$index1))!==false){
- $start_index = $index1;
+ $start_index = $index1;
$end_index = strpos($content,'"',$index1);
if(empty($end_index)) break;
$image_url = substr($content,$start_index,$end_index-$start_index);
$url = mbw_get_image_url($image_type,urldecode(str_replace($file_url, "", $image_url)));
- $url_data1[] = $image_url;
- $url_data2[] = str_replace(array("http://","https://"), "", $url);
+ $url_data1[] = $image_url;
+ $url_data2[] = str_replace(array("http://","https://"), "", $url);
$index1 = $end_index;
}
if(!empty($url_data1)){
if(mbw_is_ssl()){
$site_url = str_replace(array("http://","https://"), "", MBW_SITE_URL);
- $url_data1[] = 'http://'.$site_url.'/';
- $url_data2[] = 'https://'.$site_url.'/';
+ $url_data1[] = 'http://'.$site_url.'/';
+ $url_data2[] = 'https://'.$site_url.'/';
}
$content = str_replace($url_data1, $url_data2, $content);
}
--- a/mangboard/includes/mb-settings.php
+++ b/mangboard/includes/mb-settings.php
@@ -247,7 +247,11 @@
if($response!==trim($response)) $security_mode = 1;
else $security_mode = 3;
}
- curl_close($curl_handle);
+ if ( PHP_VERSION_ID < 80000 ) {
+ curl_close( $curl_handle );
+ } else {
+ unset( $curl_handle );
+ }
}else{
$security_mode = 2;
}
--- a/mangboard/includes/mb-version.php
+++ b/mangboard/includes/mb-version.php
@@ -1,5 +1,5 @@
<?php
-$mb_version = '2.4.9';
-$mb_index = '257';
+$mb_version = '2.5.0';
+$mb_index = '261';
$mb_db_version = '1.0.7';
?>
No newline at end of file
--- a/mangboard/includes/skin-filters.php
+++ b/mangboard/includes/skin-filters.php
@@ -74,6 +74,9 @@
//html 에디터로 작성된 글만 디코드
$item["value"] = mbw_htmlspecialchars_decode($item["value"]);
+ if ( ( mbw_get_param("mode") == "list" || mbw_get_param("mode")=="view" ) && function_exists('mbw_replace_image_url') ) {
+ $item["value"] = mbw_replace_image_url($item["value"]);
+ }
$item_level = intval(mbw_get_board_item("fn_level", false));
//레벨 10 (관리자) 이하의 회원이 작성했거나 DISALLOW_UNFILTERED_HTML 설정이 있을 경우 추가 검증
if ( $item_level < 10 || (defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) ) {
@@ -82,50 +85,24 @@
} else {
$item["value"] = wp_kses_post($item["value"]);
}
- }
- if((mbw_get_param("mode")=="list" || mbw_get_param("mode")=="view") && function_exists('mbw_replace_image_url')){
- $item["value"] = mbw_replace_image_url($item["value"]);
- }
- } else {
+ }
+ } else {
$item["value"] = esc_html(mbw_htmlspecialchars_decode($item["value"]));
- if ( $item["type"] != "comment" && mbw_get_param("mode") != "write" ) {
- $item["value"] = nl2br($item["value"]);
- }
- }
-
- if( !empty($mb_fields["select_board"]["fn_editor_type"]) && !empty($data[$mb_fields["select_board"]["fn_editor_type"]]) && $data[$mb_fields["select_board"]["fn_editor_type"]] == "W" ){
- //워드프레스 에디터에서 작성된 게시물에만 shortcode 허용
- //$item["value"] = do_shortcode($item["value"]);
- }
-
- /* wordpress-https 플러그인 기능에 포함되어 있어 주석처리 */
- // if(mbw_get_option("ssl_mode")){
- // //SSL 주소 매칭
- // $parse_url = parse_url("http://".$_SERVER['HTTP_HOST']);
- // if(mbw_is_ssl()){ //Https 프로토콜 접속일 경우 http => https로 교체
- // $search_text = "http://".$parse_url["host"];
- // $replace_text = "https://".$parse_url["host"];
- // if(mbw_get_option("ssl_port")!="" && mbw_get_option("ssl_port")!="443")
- // $replace_text .= ":".mbw_get_option("ssl_port");
- // $item["value"] = str_replace($search_text,$replace_text,$item["value"]);
- // }else{ //Http 프로토콜 접속일 경우 https => http로 교체
- // $search_text = "https://".$parse_url["host"];
- // if(mbw_get_option("ssl_port")!="" && mbw_get_option("ssl_port")!="443")
- // $search_text .= ":".mbw_get_option("ssl_port");
- // $replace_text = "http://".$parse_url["host"];
- // $item["value"] = str_replace($search_text,$replace_text,$item["value"]);
- // }
- // }
- if(function_exists('make_clickable')){ // URL주소에 <a> 태그 링크 설정
- if($item["type"]=="comment"){
- $item["value"] = str_replace("'", "'", $item["value"]);
- $item["value"] = str_replace(""", '"', $item["value"]);
- }
- if((!empty($data["editor_type"]) && $data["editor_type"]=="N") || $item["type"]=="comment"){
- $item["value"] = make_clickable($item["value"]);
+ if ( mbw_get_param("mode") != "write" ) {
+ if ( $item["type"] != "comment" ) {
+ $item["value"] = nl2br($item["value"]);
+ }
+ if(function_exists('make_clickable')){ // URL주소에 <a> 태그 링크 설정
+ if($item["type"]=="comment"){
+ $item["value"] = str_replace("'", "'", $item["value"]);
+ $item["value"] = str_replace(""", '"', $item["value"]);
+ }
+ if((!empty($data["editor_type"]) && $data["editor_type"]=="N") || $item["type"]=="comment"){
+ $item["value"] = make_clickable($item["value"]);
+ }
+ }
}
}
-
}else if($item["field"]=="fn_hit"){ //HIT FILTER
$value = intval($item["value"]);
if(mbw_get_param("mode")=="list"){
--- a/mangboard/includes/skin-template.php
+++ b/mangboard/includes/skin-template.php
@@ -818,8 +818,6 @@
$template_start .= '<span style="float:left";>'.mbw_get_user("fn_user_name").'</span><span style="float:right;"><label><input title="'.__MW("W_SECRET").'" type="checkbox" name="'.mbw_set_form_name("is_secret").'" value="1" '.$secret_checked.'/>'.__MW("W_SECRET").'</label></span>';
}else if($data["type"]=='cw_content'){
$template_start .= '<textarea'.$data["ext"].__STYLE($data["style"]).' name="'.mbw_set_form_name($data["item_name"]).'" id="'.esc_attr($data["item_id"]).'">'.$data["value"].'</textarea>';
- $send_action = "'".$action."'";
- if($action=="reply") $send_action = "'".$action."'";
}else{
$item_template = mbw_get_item_template("comment",$data);
if($item_template=="") return;
--- a/mangboard/mangboard.php
+++ b/mangboard/mangboard.php
@@ -3,7 +3,7 @@
* Plugin Name: MangBoard
* Plugin URI: https://mangboard.com/
* Description: MangBoard는 Wordpress에서 게시판을 생성/관리 할 수 있는 기능을 제공합니다
- * Version: 2.4.9
+ * Version: 2.5.0
* Author: Hometory
* Author URI: https://www.hometory.com/
* License: GPLv2 or later
--- a/mangboard/models/admin/files.php
+++ b/mangboard/models/admin/files.php
@@ -62,14 +62,14 @@
$query_command = "";
$field = $mb_fields["files"];
- if ( mbw_is_admin() && current_user_can('administrator') ) {
- if(mbw_get_param("board_action")=="delete"){
+ if ( mbw_is_admin() && current_user_can('administrator') ) {
+ if ( mbw_get_param("board_action") == "delete" ) {
$query_command = "DELETE";
$where_query = $mdb->prepare(" WHERE ".$field["fn_pid"]."=%d", mbw_get_param("board_pid") );
- }else if(mbw_get_param("board_action")=="multi_delete"){
+ } else if ( mbw_get_param("board_action") == "multi_delete" ) {
$query_command = "DELETE";
- $pid_array = mbw_get_param("check_array");
+ $pid_array = mbw_get_param("check_array");
$pid_format = array();
foreach($pid_array as $key){
$pid_format[] = "%d";
@@ -77,28 +77,26 @@
$where_query = $mdb->prepare(" WHERE ".$field["fn_pid"]." in (".implode(",",$pid_format).")", $pid_array );
}
- if($query_command=="DELETE"){
+ if ( $query_command == "DELETE" ) {
$select_query = "SELECT * FROM ".$mb_admin_tables["files"].$where_query;
$items = $mdb->get_results($select_query,ARRAY_A);
foreach($items as $item){
- if($item[$field["fn_link_count"]]=="0" && !empty($item[$field["fn_file_path"]])){
-
+ if ( $item[$field["fn_link_count"]] == "0" && !empty($item[$field["fn_file_path"]]) ) {
$file_path = str_replace('..', '.', $item[$field["fn_file_path"]]);
- $file_path = MBW_UPLOAD_PATH.$file_path;
- if ( strpos(wp_normalize_path(realpath($file_path)), MBW_UPLOAD_PATH)===0 && is_file($file_path)) {
+ $file_path = MBW_UPLOAD_PATH.$file_path;
+ if ( strpos(wp_normalize_path(realpath($file_path)), MBW_UPLOAD_PATH)===0 && is_file($file_path) ) {
@unlink($file_path);
$file_path_small = substr($file_path,0,strrpos($file_path, "."))."_small".substr($file_path,strrpos($file_path, "."),strlen($file_path));
if(is_file($file_path_small)) @unlink($file_path_small);
- $file_path_middle = substr($file_path,0,strrpos($file_path, "."))."_middle".substr($file_path,strrpos($file_path, "."),strlen($file_path));
+ $file_path_middle = substr($file_path,0,strrpos($file_path, "."))."_middle".substr($file_path,strrpos($file_path, "."),strlen($file_path));
if(is_file($file_path_middle)) @unlink($file_path_middle);
-
}
}
}
- }
+ }
}
}
}
--- a/mangboard/models/admin/users.php
+++ b/mangboard/models/admin/users.php
@@ -206,7 +206,7 @@
}
add_action('mbw_board_skin_search', 'mbw_get_user_date_search_template',10); // 기간 설정 템플릿 추가
- if(mbw_is_admin()){
+ if ( mbw_is_admin() && current_user_can('administrator') ) {
$titles = "번호,아이디,이름,레벨,그룹,이메일,휴대폰,포인트,우편번호,집주소,집 전화,메일링 수신,로그인수,글쓰기수,답변수,댓글수,가입 시간,최종 접속일";
$fields = "fn_pid,fn_user_id,fn_user_name,fn_user_level,fn_user_group,fn_user_email,fn_user_phone,fn_user_point,fn_home_postcode,fn_home_address,fn_home_tel,fn_allow_mailing,fn_login_count,fn_write_count,fn_reply_count,fn_comment_count,fn_reg_date,fn_last_login";
mbw_add_left_button("list",mbw_get_btn_template(array("name"=>"Excel 저장하기","onclick"=>"sendAdminExcelData('".$fields."','".$titles."')","class"=>"btn btn-default","title"=>"검색 또는 선택된 회원을 Excel 파일로 저장합니다")));
--- a/mangboard/plugins/board_item/board_item.php
+++ b/mangboard/plugins/board_item/board_item.php
@@ -46,21 +46,22 @@
$item_level = intval($item[$fields["fn_level"]]);
if($item[$fields["fn_data_type"]]=="html"){
$content = mbw_htmlspecialchars_decode($content);
-
- if ( $item_level == 0 ) { //비회원이 작성한 게시물은 추가 보안 검증
+ if ( function_exists('mbw_replace_image_url') ) {
+ $content = mbw_replace_image_url($content);
+ }
+ if ( $item_level < 10 || (defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) ) {
if( function_exists('mbw_get_htmlpurify') && version_compare(PHP_VERSION, '5.4.0', '>=') ){
$content = mbw_get_htmlpurify($content);
} else {
$content = wp_kses_post($content);
}
}
-
- if(function_exists('mbw_replace_image_url')) $content = mbw_replace_image_url($content);
}else{
$content = esc_html(mbw_htmlspecialchars_decode($content));
- }
- if($is_link=="true" && (!empty($item[$fields["fn_editor_type"]]) && $item[$fields["fn_editor_type"]]=="N")){
- $content = make_clickable($content);
+ $content = nl2br($content);
+ if($is_link=="true" && function_exists('make_clickable')) {
+ $content = make_clickable($content);
+ }
}
if($is_shortcode=="true" && !empty($item_level) && $item_level>7 ){
$content = do_shortcode($content);
--- a/mangboard/templates/mtpl.input.php
+++ b/mangboard/templates/mtpl.input.php
@@ -82,16 +82,18 @@
}
}else{
//수정 모드에서 업로드 파일이 있을 경우 삭제버튼 표시
- if(mbw_get_param("board_action")=="modify"){
- $file = $mstore->get_board_file(mbw_get_board_item("fn_pid"));
- if(($item_type=='file_image' && !empty($file)) && ((strpos($file[$mb_fields["files"]["fn_file_type"]],"image/")!==0) || (strpos($file[$mb_fields["files"]["fn_file_description"]],"ext")===0) || (strpos($file[$mb_fields["files"]["fn_file_description"]],"site_link")===0))){
- $mstore->add_board_file($file);
- $file = $mstore->get_board_file(mbw_get_board_item("fn_pid"));
- if(($item_type=='file_image' && !empty($file)) && ((strpos($file[$mb_fields["files"]["fn_file_type"]],"image/")!==0) || (strpos($file[$mb_fields["files"]["fn_file_description"]],"ext")===0) || (strpos($file[$mb_fields["files"]["fn_file_description"]],"site_link")===0))){
- $mstore->add_board_file($file);
- $file = null;
+ if(mbw_get_param("board_action")=="modify"){
+ $type_key = $mb_fields["files"]["fn_file_type"];
+ $desc_key = $mb_fields["files"]["fn_file_description"];
+ do {
+ $should_retry = false;
+ $file = $mstore->get_board_file(mbw_get_board_item("fn_pid"));
+ if($item_type=='file_image' && !empty($file)){
+ if((strpos($file[$type_key],"image/")!==0) || (strpos($file[$desc_key],"ext")===0) || (strpos($file[$desc_key],"site_link")===0)){
+ $should_retry = true;
+ }
}
- }
+ } while ($should_retry);
if(!empty($file)){
$template_start = '<label><input'.$data["ext"].__STYLE($data["style"]).' name="'.mbw_set_form_name("file_delete_pid[]").'"'.$t_id.' value="'.esc_attr($file[$mb_fields["files"]["fn_pid"]]).'" title="'.esc_attr($file[$mb_fields["files"]["fn_file_name"]]).'" type="checkbox"/>';
@@ -99,8 +101,16 @@
$template_start .= '<input name="'.mbw_set_form_name("file_list_pid[]").'" id="'.esc_attr($data["item_id"]).'_pid" value="'.esc_attr($file[$mb_fields["files"]["fn_pid"]]).'" type="hidden" />';
if(!empty($data["sequence"])){
- if($data["sequence"]=="number")
- $template_start .= ' <input style="width:45px !important;height:28px !important;text-align:center;font-size:12px;" maxlength="4" name="'.mbw_set_form_name("file_list_sequence[]").'" value="'.esc_attr($file[$mb_fields["files"]["fn_file_sequence"]]).'" type="number" onkeydown="return inputOnlyNumber(event)" />';
+ if($data["sequence"]=="number"){
+ $file_sequence = mbw_get_vars("mb_file_sequence");
+ if(empty($file_sequence)){
+ $file_sequence = "1";
+ }else{
+ $file_sequence = $file[$mb_fields["files"]["fn_file_sequence"]];
+ }
+ mbw_set_vars("mb_file_sequence",$file_sequence);
+ $template_start .= ' <input style="width:45px !important;height:28px !important;text-align:center;font-size:12px;" maxlength="4" name="'.mbw_set_form_name("file_list_sequence[]").'" value="'.esc_attr($file_sequence).'" type="number" onkeydown="return inputOnlyNumber(event)" />';
+ }
}
}
}
--- a/mangboard/templates/tpl.board.php
+++ b/mangboard/templates/tpl.board.php
@@ -818,8 +818,6 @@
$template_start .= '<span style="float:left";>'.mbw_get_user("fn_user_name").'</span><span style="float:right;"><label><input title="'.__MW("W_SECRET").'" type="checkbox" name="'.mbw_set_form_name("is_secret").'" value="1" '.$secret_checked.'/>'.__MW("W_SECRET").'</label></span>';
}else if($data["type"]=='cw_content'){
$template_start .= '<textarea'.$data["ext"].__STYLE($data["style"]).' name="'.mbw_set_form_name($data["item_name"]).'" id="'.esc_attr($data["item_id"]).'">'.$data["value"].'</textarea>';
- $send_action = "'".$action."'";
- if($action=="reply") $send_action = "'".$action."'";
}else{
$item_template = mbw_get_item_template("comment",$data);
if($item_template=="") return;