Changeset 3664567
- Timestamp:
- 08/25/2026 04:59:21 AM (8 weeks ago)
- Location:
- mangboard/trunk
- Files:
-
- 1 added
- 11 edited
-
api/mb-board.php (modified) (2 diffs)
-
api/mb-template.php (modified) (1 diff)
-
includes/functions/func.api.php (modified) (2 diffs)
-
includes/functions/func.board.php (modified) (13 diffs)
-
includes/functions/func.store.php (modified) (1 diff)
-
includes/functions/func.user.php (modified) (10 diffs)
-
includes/mb-version.php (modified) (1 diff)
-
mangboard.php (modified) (3 diffs)
-
models/admin/users.php (modified) (1 diff)
-
plugins/datepicker/css/style.css (added)
-
plugins/datepicker/datepicker.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mangboard/trunk/api/mb-board.php
r3652096 r3664567 295 295 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_board_table_name." WHERE `".$api_fields["fn_pid"]."` in (".implode(",",$pid_format).")", $pid_array ); 296 296 297 //게시물 삭제시 댓글도 삭제298 if(!empty($mb_comment_table_name) && mbw_get_board_option("fn_use_comment") == 1 && $mstore->table_exists($mb_comment_table_name)){299 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_comment_table_name." WHERE `".$mb_fields["select_comment"]["fn_parent_pid"]."` in (".implode(",",$pid_format).")", $pid_array );300 }301 302 297 //게시물 삭제시 파일 연결 해제 303 298 $query_data[] = $mdb->prepare("UPDATE ".$mb_admin_tables["files"]." set ".$mb_fields["files"]["fn_board_pid"]."=0 where ".$mb_fields["files"]["fn_table_name"]."='".$mb_board_table_name."' and ".$mb_fields["files"]["fn_board_pid"]." in (".implode(",",$pid_format).")", $pid_array ); … … 305 300 //게시물 삭제시 게시물에 연결된 쿠키정보 삭제 306 301 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_admin_tables["cookies"]." WHERE ".$mb_fields["cookies"]["fn_board_name"]."=%s",mbw_get_param("board_name")). $mdb->prepare( " and ".$mb_fields["cookies"]["fn_cookie_type"]."='mb_board_vote' and ".$mb_fields["cookies"]["fn_cookie_value"]." in (".implode(",",$pid_format).");", $pid_array ); 307 308 $comment_items = $mdb->get_results($mdb->prepare( "SELECT ".$mb_fields["select_comment"]["fn_pid"]." FROM ".$mb_comment_table_name." WHERE ".$mb_fields["select_comment"]["fn_parent_pid"]." in (".implode(",",$pid_format).")", $pid_array ), ARRAY_A); 309 if(!empty($comment_items)){ 310 $comment_pid_array = array_column($comment_items, $mb_fields["select_comment"]["fn_pid"]); 311 if(!empty($comment_pid_array)){ 312 $comment_pid_format = array(); 313 foreach($comment_pid_array as $key){ 314 $comment_pid_format[] = "%d"; 315 } 316 //댓글 삭제시 댓글에 연결된 쿠키정보 삭제 317 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_admin_tables["cookies"]." WHERE ".$mb_fields["cookies"]["fn_board_name"]."=%s",mbw_get_param("board_name")).$mdb->prepare( " and ".$mb_fields["cookies"]["fn_cookie_type"]."='mb_comment_vote' and ".$mb_fields["cookies"]["fn_cookie_value"]." in (".implode(",",$comment_pid_format).");", $comment_pid_array ); 318 } 302 303 if(!empty($mb_comment_table_name) && mbw_get_board_option("fn_use_comment") == 1 && $mstore->table_exists($mb_comment_table_name)){ 304 $comment_items = $mdb->get_results($mdb->prepare( "SELECT ".$mb_fields["select_comment"]["fn_pid"]." FROM ".$mb_comment_table_name." WHERE ".$mb_fields["select_comment"]["fn_parent_pid"]." in (".implode(",",$pid_format).")", $pid_array ), ARRAY_A); 305 if(!empty($comment_items)){ 306 $comment_pid_array = array_column($comment_items, $mb_fields["select_comment"]["fn_pid"]); 307 if(!empty($comment_pid_array)){ 308 $comment_pid_format = array(); 309 foreach($comment_pid_array as $key){ 310 $comment_pid_format[] = "%d"; 311 } 312 //댓글 삭제시 댓글에 연결된 쿠키정보 삭제 313 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_admin_tables["cookies"]." WHERE ".$mb_fields["cookies"]["fn_board_name"]."=%s",mbw_get_param("board_name")).$mdb->prepare( " and ".$mb_fields["cookies"]["fn_cookie_type"]."='mb_comment_vote' and ".$mb_fields["cookies"]["fn_cookie_value"]." in (".implode(",",$comment_pid_format).");", $comment_pid_array ); 314 } 315 } 316 $query_data[] = $mdb->prepare( "DELETE FROM ".$mb_comment_table_name." WHERE `".$mb_fields["select_comment"]["fn_parent_pid"]."` in (".implode(",",$pid_format).")", $pid_array ); 319 317 } 320 318 } -
mangboard/trunk/api/mb-template.php
r3576755 r3664567 56 56 $user_name = $filter_item["value"]; 57 57 } 58 $user_point = $user_data[$mb_fields["users"]["fn_user_point"]]; 59 $user_level = $user_data[$mb_fields["users"]["fn_user_level"]]; 58 if($mb_user_level>=8){ 59 $user_point = $user_data[$mb_fields["users"]["fn_user_point"]]; 60 $user_level = $user_data[$mb_fields["users"]["fn_user_level"]]; 61 } 60 62 } 61 63 if(has_filter('mf_user_popup_menu')) $menu_body = apply_filters("mf_user_popup_menu",$menu_body); -
mangboard/trunk/includes/functions/func.api.php
r3641424 r3664567 368 368 } 369 369 //입력 패턴 검사 370 if(!empty($data["pattern"]) && !empty($api_fields[$data["field"]]) && $send_data[$api_fields[$data["field"]]]!=""){370 if(!empty($data["pattern"]) && !empty($api_fields[$data["field"]]) && isset($send_data[$api_fields[$data["field"]]]) && $send_data[$api_fields[$data["field"]]]!==""){ 371 371 if(!empty($data["pattern_action"]) && $data["pattern_action"]!=mbw_get_param("board_action")){ 372 372 //pattern_action 설정이 있고, board_action과 일치하지 않을 경우 예외처리 … … 387 387 388 388 if(!empty($data["filter"]) && $data["filter"]!="false" && $mb_user_level<mbw_get_option("admin_level")){ 389 $filter = mbw_check_filter($data["filter"], $send_data[$api_fields[$data["field"]]]); 390 if(!empty($filter)){ 391 if(isset($data["filter_error"])){ 392 $error_message = '<div>"'.$filter.'"</div>'.mbw_get_message($data["filter_error"]); 393 }else{ 394 $error_message = "MSG_FILTER_ERROR"; 395 } 396 mbw_error_message($error_message, $filter,"1204",str_replace("fn_", "", $data["field"])); 397 break; 389 if(!empty($api_fields[$data["field"]]) && isset($send_data[$api_fields[$data["field"]]]) && $send_data[$api_fields[$data["field"]]]!==""){ 390 $filter = mbw_check_filter($data["filter"], $send_data[$api_fields[$data["field"]]]); 391 if(!empty($filter)){ 392 if(isset($data["filter_error"])){ 393 $error_message = '<div>"'.$filter.'"</div>'.mbw_get_message($data["filter_error"]); 394 }else{ 395 $error_message = "MSG_FILTER_ERROR"; 396 } 397 mbw_error_message($error_message, $filter,"1204",str_replace("fn_", "", $data["field"])); 398 break; 399 } 398 400 } 399 401 } -
mangboard/trunk/includes/functions/func.board.php
r3652096 r3664567 20 20 global $mstore,$mdb,$mb_admin_tables,$mb_fields; 21 21 $hash = ""; 22 if(!empty($token)) $access_to ekn = $token;23 else $access_to ekn = mbw_generate_access_token();22 if(!empty($token)) $access_token = $token; 23 else $access_token = mbw_generate_access_token($uid); 24 24 25 $a uth_key = md5(MBW_AUTH_SITE_URL).$access_toekn;26 if(($expiration+intval(mbw_get_option("cookie_expire")))< mbw_get_timestamp()){25 $access_token2 = md5(MBW_AUTH_SITE_URL).$access_token; 26 if(($expiration+intval(mbw_get_option("cookie_expire")))<time()){ 27 27 return ""; 28 28 } 29 29 30 global $current_user;31 30 $user_id = ""; 32 if(get_current_user_id()!=0){ 33 $user_id = $current_user->data->user_login; 34 }else if($mstore->is_login_cookie()){ 35 $cookie = $mstore->get_login_cookie(); 36 $cookie_elements = explode('|', $cookie); 37 list($user_id, $expiration2, $hmac, $user_mode) = $cookie_elements; 38 if(empty($expiration)) $expiration = $expiration2; 39 }else if($uid!=""){ 31 if( !empty($uid) ) { 40 32 $user_id = $uid; 41 } 33 } else { 34 if(get_current_user_id()!=0){ 35 $current_user = wp_get_current_user(); 36 if($current_user->ID){ 37 $user_id = $current_user->user_login; 38 } 39 }else if(mbw_is_login_cookie()){ 40 $cookie = mbw_get_login_cookie(); 41 $cookie_elements = explode('|', $cookie); 42 list($user_id, $expiration2, $hmac, $user_mode, $auth_key) = $cookie_elements; 43 if(empty($expiration)) $expiration = $expiration2; 44 } 45 } 46 42 47 if($user_id!=""){ 43 $user_auth_key = $mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;", $user_id)); 48 if( mbw_get_vars("mb_".$user_id."_auth_key") != "" ) { 49 $user_auth_key = mbw_get_vars("mb_".$user_id."_auth_key"); 50 } else { 51 $user_auth_key = $mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;", $user_id)); 52 mbw_set_vars("mb_".$user_id."_auth_key",$user_auth_key); 53 } 44 54 }else{ 45 55 $user_id = "guest"; … … 55 65 $tmp_tag = $tag.'_'.$table_name; 56 66 } 57 $key = md5($user_id . $user_auth_key . '|' . $expiration.$auth_key.'|'.$tmp_tag);67 $key = md5($user_id . $user_auth_key . '|' . $expiration.$access_token2.'|'.$tmp_tag); 58 68 $hash = hash_hmac('md5', $user_id . '|' . $expiration, $key); 59 69 if($tag=="nonce"){ … … 125 135 if(!function_exists('mbw_create_nonce')){ 126 136 function mbw_create_nonce($type,$name=""){ 127 global $mstore ,$current_user;137 global $mstore; 128 138 129 139 $board_name = $name; 130 $time = mbw_get_timestamp();140 $time = time(); 131 141 if(empty($board_name)) { 132 142 $board_name = mbw_get_board_name(); … … 770 780 $se_text = mbw_htmlspecialchars(mbw_get_param("se_text".$i)); 771 781 $se_field = mbw_get_param("se_field".$i); 772 if(strpos($se_text, ',') !== false){ $is_multi = '1'; } 773 else{ $is_multi = '0'; } 782 if(strpos($se_text, ",") !== false){ 783 $is_multi = "1"; 784 }else{ 785 $is_multi = "0"; 786 } 774 787 $se_sign = mbw_get_param("se_sign".$i); 775 788 if(!empty($se_sign)){ 776 if($se_sign=='lt') $se_sign = '<'; 777 else if($se_sign=='lt2') $se_sign = '<='; 778 else if($se_sign=='gt') $se_sign = '>'; 779 else if($se_sign=='gt2') $se_sign = '>='; 780 else if($se_sign=='like'){ 781 if($is_multi=='1'){ 782 $se_text = '%'.str_replace(',', '%,%', $se_text).'%'; 789 if($se_sign=="lt"){ 790 $se_sign = "<"; 791 }else if($se_sign=="lt2"){ 792 $se_sign = "<="; 793 }else if($se_sign=="gt"){ 794 $se_sign = ">"; 795 }else if($se_sign=="gt2"){ 796 $se_sign = ">="; 797 }else if($se_sign=="like"){ 798 if($is_multi=="1"){ 799 $se_text = "%".str_replace(",", "%,%", $se_text)."%"; 783 800 }else{ 784 $se_text = '%'.$se_text.'%';801 $se_text = "%".$se_text."%"; 785 802 } 786 }else $se_sign = '='; 803 }else{ 804 $se_sign = "="; 805 } 787 806 }else{ 788 $se_sign = '=';807 $se_sign = "="; 789 808 } 790 809 mbw_set_board_where(array("field"=>$se_field, "value"=>$se_text, "sign"=> $se_sign, "multi"=>$is_multi)); … … 1174 1193 $jquery_ver = "1.11.4"; 1175 1194 if(!empty($wp_scripts->registered['jquery-ui-core']->ver)) $jquery_ver = $wp_scripts->registered['jquery-ui-core']->ver; 1176 wp_register_style('jquery-ui-css', "//ajax.googleapis.com/ajax/libs/jqueryui/".$jquery_ver."/themes/smoothness/jquery-ui.css"); 1195 //wp_register_style('jquery-ui-css', "//ajax.googleapis.com/ajax/libs/jqueryui/".$jquery_ver."/themes/smoothness/jquery-ui.css"); 1196 wp_register_style('jquery-ui-css', "//code.jquery.com/ui/".$jquery_ver."/themes/base/jquery-ui.css"); 1177 1197 if(mbw_is_admin_page()) wp_enqueue_style('jquery-ui-css'); 1178 1198 … … 1181 1201 while (false !== ($entry = $dir->read())){ 1182 1202 if(strpos($entry,'.')!==0 && is_file($path."/".$entry)){ 1183 if(s trpos($entry,".js")!==false){1203 if(substr($entry, -3) === '.js'){ 1184 1204 loadScript(MBW_PLUGIN_URL.'assets/js/'.$entry); 1185 1205 } … … 1190 1210 while (false !== ($entry = $dir->read())){ 1191 1211 if(strpos($entry,'.')!==0 && is_file($path."/".$entry)){ 1192 if(s trpos($entry,".css")!==false){1212 if(substr($entry, -4) === '.css'){ 1193 1213 loadStyle(MBW_PLUGIN_URL.'assets/css/'.$entry); 1194 1214 } … … 1512 1532 if(!function_exists('mbw_generate_auth_cookie')){ 1513 1533 function mbw_generate_auth_cookie($user_id="",$user_mode="MB",$expire=0){ 1514 global $mstore ;1534 global $mstore,$mdb,$mb_fields,$mb_admin_tables; 1515 1535 1516 1536 if(empty($user_id)) return; 1517 1537 1518 1538 $auth_cookie_name = $mstore->get_auth_cookie_name(); 1519 mbw_set_wp_user_data($user_id );1520 $expiration = mbw_get_timestamp() + intval(mbw_get_option("cookie_expire"));1539 mbw_set_wp_user_data($user_id, $user_mode); 1540 $expiration = time(); 1521 1541 $hash = mbw_get_hash_key("cookie",$expiration,$user_id); 1522 $auth_cookie = $user_id. '|' . $expiration . '|' . $hash . '|' . $user_mode; 1542 1543 if( mbw_get_vars("mb_".$user_id."_auth_key") != "" ) { 1544 $user_auth_key = mbw_get_vars("mb_".$user_id."_auth_key"); 1545 } else { 1546 $user_auth_key = $mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;", $user_id)); 1547 mbw_set_vars("mb_".$user_id."_auth_key",$user_auth_key); 1548 } 1549 $auth_key = md5($user_id.'|'.$expiration.'|'.$user_auth_key); 1550 $auth_cookie = $user_id. '|' . $expiration . '|' . $hash . '|' . $user_mode . '|' . $auth_key; 1523 1551 mbw_set_cookie($auth_cookie_name, $auth_cookie, $expire); 1524 1552 mbw_set_cookie("wordpress_mb_logged", $user_id, $expire); //wordpress.com 호스팅 캐시 방지 쿠키 … … 1530 1558 global $mstore,$mdb,$mb_admin_tables,$mb_fields; 1531 1559 1532 if ( ! $mstore->is_login_cookie() )1560 if ( !mbw_is_login_cookie() ) 1533 1561 return false; 1534 1562 1535 $cookie = $mstore->get_login_cookie();1563 $cookie = mbw_get_login_cookie(); 1536 1564 $cookie_elements = explode('|', $cookie); 1537 1565 1538 if ( count($cookie_elements) != 4 )1566 if ( count($cookie_elements) != 5 ) { 1539 1567 return false; 1568 } 1540 1569 1541 list($user_id, $expiration, $hmac, $user_mode) = $cookie_elements; 1542 if(!empty($user_id)) $user_access_token = $mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_access_token"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;",$user_id)); 1543 else $user_access_token = ""; 1544 $hash = mbw_get_hash_key("cookie",$expiration,$user_id,$user_access_token); 1545 $hash2 = mbw_get_hash_key("cookie",$expiration,$user_id); 1546 1547 if($hmac==$hash || $hmac==$hash2){ 1548 $expire = mbw_get_timestamp() + 7776000; 1549 mbw_clear_auth_cookie(); 1550 mbw_generate_auth_cookie($user_id,$user_mode,$expire); 1551 $mdb->query($mdb->prepare("update ".$mb_admin_tables["users"]." set ".$mb_fields["users"]["fn_user_access_token"]."='".mbw_generate_access_token()."' where ".$mb_fields["users"]["fn_user_id"]."=%s;",$user_id)); 1570 list($user_id, $expiration, $hmac, $user_mode, $auth_key) = $cookie_elements; 1571 $user_access_token = ""; 1572 $user_auth_key = ""; 1573 if( !empty($user_id) ) { 1574 if( mbw_get_vars("mb_".$user_id."_access_token") != "" && mbw_get_vars("mb_".$user_id."_auth_key") != "" ) { 1575 $user_access_token = mbw_get_vars("mb_".$user_id."_access_token"); 1576 $user_auth_key = mbw_get_vars("mb_".$user_id."_auth_key"); 1577 } else { 1578 $row = $mdb->get_row($mdb->prepare("select ".$mb_fields["users"]["fn_user_access_token"].",".$mb_fields["users"]["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;", $user_id), ARRAY_A); 1579 if(!empty($row)){ 1580 $user_access_token = $row[$mb_fields["users"]["fn_user_access_token"]]; 1581 $user_auth_key = $row[$mb_fields["users"]["fn_user_auth_key"]]; 1582 mbw_set_vars("mb_".$user_id."_access_token",$user_access_token); 1583 mbw_set_vars("mb_".$user_id."_auth_key",$user_auth_key); 1584 } 1585 } 1586 } 1587 if( !empty($auth_key) && $auth_key == md5($user_id.'|'.$expiration.'|'.$user_auth_key) ){ 1588 $hash = mbw_get_hash_key("cookie",$expiration,$user_id,$user_access_token); 1589 $hash2 = mbw_get_hash_key("cookie",$expiration,$user_id); 1590 1591 if($hmac==$hash || $hmac==$hash2){ 1592 $expire = time() + 7776000; 1593 mbw_clear_auth_cookie(); 1594 mbw_generate_auth_cookie($user_id,$user_mode,$expire); 1595 $mdb->query($mdb->prepare("update ".$mb_admin_tables["users"]." set ".$mb_fields["users"]["fn_user_access_token"]."='".mbw_generate_access_token($user_id)."' where ".$mb_fields["users"]["fn_user_id"]."=%s;",$user_id)); 1596 } 1552 1597 } 1553 1598 } … … 1556 1601 if(!function_exists('mbw_validate_auth_cookie')){ 1557 1602 function mbw_validate_auth_cookie(){ 1558 if(mbw_get_trace("mbw_set_wp_user_data")!="") return true; 1603 if( mbw_get_trace("mbw_set_wp_user_data")!="" ) { 1604 return true; 1605 } 1559 1606 1560 1607 global $mstore,$mdb; 1561 1608 global $mb_admin_tables,$mb_fields; 1562 1563 if ( !$mstore->is_login_cookie() ) 1609 if ( !mbw_is_login_cookie() ) { 1564 1610 return false; 1565 1566 $cookie = $mstore->get_login_cookie(); 1567 1611 } 1612 $cookie = mbw_get_login_cookie(); 1568 1613 $cookie_elements = explode('|', $cookie); 1569 1570 if ( count($cookie_elements) != 4 ) 1614 if ( count($cookie_elements) != 5 ) { 1571 1615 return false; 1572 1573 list($user_id, $expiration, $hmac, $user_mode) = $cookie_elements; 1574 if(!empty($user_id)) $user_access_token = $mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_access_token"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;",$user_id)); 1575 else $user_access_token = ""; 1616 } 1617 1618 list($user_id, $expiration, $hmac, $user_mode, $auth_key) = $cookie_elements; 1619 $user_access_token = ""; 1620 $user_auth_key = ""; 1621 if( !empty($user_id) ) { 1622 if( mbw_get_vars("mb_".$user_id."_access_token") != "" && mbw_get_vars("mb_".$user_id."_auth_key") != "" ) { 1623 $user_access_token = mbw_get_vars("mb_".$user_id."_access_token"); 1624 $user_auth_key = mbw_get_vars("mb_".$user_id."_auth_key"); 1625 } else { 1626 $row = $mdb->get_row($mdb->prepare("select ".$mb_fields["users"]["fn_user_access_token"].",".$mb_fields["users"]["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_user_id"]."`=%s;", $user_id), ARRAY_A); 1627 if(!empty($row)){ 1628 $user_access_token = $row[$mb_fields["users"]["fn_user_access_token"]]; 1629 $user_auth_key = $row[$mb_fields["users"]["fn_user_auth_key"]]; 1630 mbw_set_vars("mb_".$user_id."_access_token",$user_access_token); 1631 mbw_set_vars("mb_".$user_id."_auth_key",$user_auth_key); 1632 } 1633 } 1634 } 1635 if( empty($auth_key) || $auth_key != md5($user_id.'|'.$expiration.'|'.$user_auth_key) ){ 1636 return false; 1637 } 1576 1638 $hash = mbw_get_hash_key("cookie",$expiration,$user_id,$user_access_token); 1577 1639 … … 1620 1682 $name = $_REQUEST["board_name"]; 1621 1683 }else{ 1622 $name = $mb_board_name; 1684 $name = $mb_board_name; 1623 1685 } 1624 1686 return $mb_table_prefix.$name."_"; … … 1627 1689 1628 1690 if(!function_exists('mbw_generate_access_token')){ 1629 function mbw_generate_access_token( ){1691 function mbw_generate_access_token($uid=""){ 1630 1692 if(mbw_get_access_token()!=""){ 1631 returnmbw_get_access_token();1693 $token = mbw_get_access_token(); 1632 1694 }else{ 1633 1695 if(function_exists('wp_generate_password')){ 1634 $auth_key = wp_generate_password( 2 0, false );1696 $auth_key = wp_generate_password( 24, false ); 1635 1697 }else{ 1636 1698 $auth_key = md5(time()); 1637 1699 } 1638 mbw_set_cookie("mb_access_token",$auth_key,(mbw_get_timestamp()+7776000)); 1639 return $auth_key; 1640 } 1700 mbw_set_cookie("mb_access_token",$auth_key,(time()+7776000)); 1701 $token = $auth_key; 1702 } 1703 if(!empty($uid)){ 1704 $token = md5($uid.$token); 1705 }else if(get_current_user_id()!=0){ 1706 $current_user = wp_get_current_user(); 1707 if($current_user->ID){ 1708 $token = md5($current_user->user_login.$token); 1709 } 1710 }else if(mbw_is_login()){ 1711 $token = md5(mbw_get_user("fn_user_id").$token); 1712 } 1713 return $token; 1641 1714 } 1642 1715 } … … 1761 1834 } 1762 1835 } 1763 mbw_set_cookie("mb_".$mode,"mb_".$mode, mbw_get_timestamp()+(60*60*24));1836 mbw_set_cookie("mb_".$mode,"mb_".$mode, time()+(60*60*24)); 1764 1837 $mdb->query($mdb->prepare("UPDATE ".$mb_admin_tables["analytics"]." set today_visit=today_visit+%d,total_visit=total_visit+%d where ".$mb_fields["analytics"]["fn_date"]."=%s;",$value,$value,$today)); 1765 1838 do_action("mbw_".$mode); -
mangboard/trunk/includes/functions/func.store.php
r3388547 r3664567 553 553 } 554 554 @setcookie($name, $value, $cookie_options); 555 $_COOKIE[$name] = $value; 555 556 } 556 557 } -
mangboard/trunk/includes/functions/func.user.php
r3576755 r3664567 412 412 $today_point = 0; 413 413 if(!empty($user_pid)){ 414 global $mdb ;415 $items = $mdb->get_results($mdb->prepare("SELECT content FROM mb_logswhere type='point' and (action='write' or action='reply') and user_pid=%d and reg_date>=DATE_SUB(curdate(),INTERVAL 0 DAY);",$user_pid), ARRAY_A);414 global $mdb,$mb_admin_tables; 415 $items = $mdb->get_results($mdb->prepare("SELECT content FROM ".$mb_admin_tables["logs"]." where type='point' and (action='write' or action='reply') and user_pid=%d and reg_date>=DATE_SUB(curdate(),INTERVAL 0 DAY);",$user_pid), ARRAY_A); 416 416 if(!empty($items)){ 417 417 foreach($items as $key=>$item){ … … 432 432 } 433 433 if(!function_exists('mbw_set_wp_user_data')){ 434 function mbw_set_wp_user_data($user_id=NULL ){434 function mbw_set_wp_user_data($user_id=NULL,$mode=""){ 435 435 if(mbw_get_trace("mbw_set_wp_user_data")!="") return; 436 436 … … 442 442 $where_data = array(); 443 443 $cookie = ""; 444 $user_mode = "WP"; 444 if(!empty($mode)){ 445 $user_mode = $mode; 446 }else{ 447 $user_mode = mbw_get_option("user_mode"); 448 } 445 449 446 450 if(empty($user_id)){ 447 if($mstore->is_login_cookie()){ 448 $cookie = $mstore->get_login_cookie(); 449 $cookie_elements = explode('|', $cookie); 450 list($user_id, $expiration, $hmac, $user_mode) = $cookie_elements; 451 if(mbw_is_login_cookie()){ 452 if(mbw_validate_auth_cookie()){ 453 $cookie = mbw_get_login_cookie(); 454 $cookie_elements = explode('|', $cookie); 455 list($user_id, $expiration, $hmac, $user_mode, $auth_key) = $cookie_elements; 456 } 451 457 } 452 458 } … … 454 460 if(empty($mb_admin_tables["users"])) return; 455 461 if(!empty($user_id)){ 456 $today_date = $mstore->get_current_date(); 462 //현재 로그인된 워드프레스 아이디가 있을 경우 동일한 회원 ID로 설정되는지 체크 463 if(get_current_user_id()!=0){ 464 $current_user = wp_get_current_user(); 465 if($current_user->user_login!=$user_id){ 466 return; 467 } 468 } 469 $today_date = mbw_get_current_date(); 457 470 $point_type = ""; 458 471 $log_type = ""; … … 481 494 482 495 $send_data[$field["fn_passwd"]] = $user->data->user_pass; 483 $send_data[$field["fn_user_auth_key"]] = mbw_get_user_auth_key( );496 $send_data[$field["fn_user_auth_key"]] = mbw_get_user_auth_key($user_id); 484 497 $send_data[$field["fn_reg_date"]] = mbw_get_current_time(); 485 498 $send_data[$field["fn_last_login"]] = mbw_get_current_time(); 486 $send_data[$field["fn_user_access_token"]] = mbw_generate_access_token( );499 $send_data[$field["fn_user_access_token"]] = mbw_generate_access_token($user_id); 487 500 488 501 //회원 가입 포인트 지급 … … 502 515 503 516 }else{ 504 $log_type = "login";505 $user_data = $mdb->get_row($mdb->prepare("select ".$field["fn_last_login"].",".$field["fn_login_count"]." from `".$mb_admin_tables["users"]."` where `".$field["fn_user_id"]."`=%s",$user_id),ARRAY_A);517 $log_type = "login"; 518 $user_data = $mdb->get_row($mdb->prepare("select ".$field["fn_last_login"].",".$field["fn_login_count"].",".$field["fn_user_auth_key"]." from `".$mb_admin_tables["users"]."` where `".$field["fn_user_id"]."`=%s",$user_id),ARRAY_A); 506 519 if(!empty($user_data)){ 507 520 $user_last_login = $user_data[$field["fn_last_login"]]; … … 512 525 $point_type = $log_type; 513 526 } 514 } 527 } 528 529 $current_dt = new DateTime(mbw_get_current_time()); 530 $last_login_dt = new DateTime($user_last_login); 531 $diff = $current_dt->diff($last_login_dt); 532 //처음 로그인을 하거나 로그인 날짜가 30일이 지났을 경우 auth key 갱신 533 if( empty($user_data[$field["fn_user_auth_key"]]) || $diff->days >= 30 ){ 534 $send_data[$field["fn_user_auth_key"]] = mbw_get_user_auth_key($user_id); 535 } 536 515 537 if($user_mode=="WP" && function_exists('wp_get_current_user')){ 516 538 $user = wp_get_current_user(); … … 521 543 //if(!empty($user->data->display_name)) $send_data[$field["fn_user_name"]] = $user->data->display_name; 522 544 if(!empty($user->data->user_pass)) $send_data[$field["fn_passwd"]] = $user->data->user_pass; 545 546 //워드프레스 기능에서 쿠키를 생성하지 못해 연속으로 로그인 로그가 남는 문제 방지 547 if( (abs($current_dt->getTimestamp() - $last_login_dt->getTimestamp()) < 10) || (strpos(mbw_get_vars("user_agent"), 'JetpackbyWordPr') !== false) ) { 548 $log_type = ""; 549 } 523 550 } 524 551 525 552 //마지막 로그인 시간 수정 526 $send_data[$field["fn_last_login"]] = mbw_get_current_time(); 527 //$send_data[$field["fn_user_auth_key"]] = mbw_get_user_auth_key(); 553 $send_data[$field["fn_last_login"]] = mbw_get_current_time(); 528 554 $send_data[$field["fn_login_count"]] = $user_login_count+1; 529 $send_data[$field["fn_user_access_token"]] = mbw_generate_access_token( );555 $send_data[$field["fn_user_access_token"]] = mbw_generate_access_token($user_id); 530 556 $where_data[$field["fn_user_id"]] = $user_id; 531 557 … … 540 566 541 567 //로그인 포인트 설정 542 if(!empty($point_type)) mbw_set_user_point("user",$point_type); 543 if(!empty($log_type) && mbw_get_option("login_log")) mbw_set_log($log_type,"",array("mode"=>"user","board_action"=>$log_type,"board_name"=>"users")); 568 if(!empty($point_type)){ 569 mbw_set_user_point("user",$point_type); 570 } 571 if(!empty($log_type) && mbw_get_option("login_log")){ 572 mbw_set_log($log_type,"",array("mode"=>"user","board_action"=>$log_type,"board_name"=>"users")); 573 } 544 574 } 545 575 } … … 592 622 593 623 if(!function_exists('mbw_get_user_auth_key')){ 594 function mbw_get_user_auth_key(){ 595 return md5(mbw_generate_access_token()); 624 function mbw_get_user_auth_key($uid=""){ 625 if(function_exists('wp_generate_password')){ 626 $auth_key = wp_generate_password( 10, false ); 627 }else{ 628 $auth_key = md5(time()); 629 } 630 return md5($auth_key.$uid.mbw_generate_access_token($uid)); 596 631 } 597 632 } -
mangboard/trunk/includes/mb-version.php
r3652096 r3664567 1 1 <?php 2 $mb_version = '2.3. 7';3 $mb_index = '20 6';2 $mb_version = '2.3.8'; 3 $mb_index = '208'; 4 4 $mb_db_version = '1.0.7'; 5 5 ?> -
mangboard/trunk/mangboard.php
r3652096 r3664567 4 4 * Plugin URI: https://mangboard.com/ 5 5 * Description: MangBoard WP는 Wordpress에서 게시판을 생성/관리 할 수 있는 기능을 제공합니다 6 * Version: 2.3. 76 * Version: 2.3.8 7 7 * Author: Hometory 8 8 * Author URI: https://www.hometory.com/ … … 42 42 if(empty($mstore)) return; 43 43 44 44 45 if(!function_exists('mbw_init')){ 45 46 function mbw_init(){ 46 mbw_add_trace("mbw_init"); 47 global $mb_options; 48 global $mstore,$mb_vars; 47 mbw_add_trace("mbw_init"); 49 48 if(function_exists('load_plugin_textdomain')){ 50 if( $mb_options["wp_multi_language"])49 if( mbw_get_option("wp_multi_language") ) { 51 50 load_plugin_textdomain('mangboard', false, MBW_PLUGIN_PATH . '/includes/languages/'); 51 } 52 52 } 53 53 mbw_set_params(); 54 54 if(mbw_get_access_token()==""){ 55 55 mbw_generate_access_token(); 56 if($mstore->is_login_cookie()) mbw_refresh_auth_cookie(); 57 } 58 global $current_user; 59 if(get_current_user_id()!=0){ 60 if(!$mstore->is_login_cookie()){ 61 mbw_generate_auth_cookie($current_user->data->user_login,"WP"); 56 if(mbw_is_login_cookie()) mbw_refresh_auth_cookie(); 57 } 58 if(get_current_user_id()!=0){ 59 if(!mbw_is_login_cookie()){ 60 $current_user = wp_get_current_user(); 61 if($current_user->ID){ 62 mbw_generate_auth_cookie($current_user->user_login,"WP"); 63 } 62 64 }else if(!mbw_validate_auth_cookie()){ 63 65 mbw_clear_auth_cookie(); 64 mbw_generate_auth_cookie($current_user->data->user_login,"WP"); 65 } 66 }else if($mstore->is_login_cookie()){ 66 $current_user = wp_get_current_user(); 67 if($current_user->ID){ 68 mbw_generate_auth_cookie($current_user->user_login,"WP"); 69 } 70 } 71 }else if(mbw_is_login_cookie()){ 67 72 if(mbw_validate_auth_cookie()){ 68 $cookie = $mstore->get_login_cookie();73 $cookie = mbw_get_login_cookie(); 69 74 $cookie_elements = explode('|', $cookie); 70 list($user_id, $expiration, $hmac, $user_mode ) = $cookie_elements;71 mbw_set_wp_user_data($user_id );75 list($user_id, $expiration, $hmac, $user_mode, $auth_key) = $cookie_elements; 76 mbw_set_wp_user_data($user_id, $user_mode); 72 77 if($user_mode=="WP") mbw_logout("MB",false); 73 78 }else{ … … 79 84 $page_name = $_GET["page"]; 80 85 if(strpos($page_name, 'mbw_')===0 && strpos($page_name, 'mbw_page')!==0 && $page_name!="mbw_dashboard" && $page_name!="mbw_commerce_dashboard" && $page_name!="mbw_commerce_category"){ 86 global $mstore; 81 87 $mstore->set_board_options(mbw_get_admin_board_name()); 82 88 } -
mangboard/trunk/models/admin/users.php
r3576755 r3664567 111 111 if(!function_exists('mbw_api_header_admin_modify_passwd')){ 112 112 function mbw_api_header_admin_modify_passwd(){ 113 if(mbw_is_admin() && mbw_get_param('board_action')=='admin_modify_password' && mbw_get_param('admin_modify_passwd')!=''){ 114 global $mdb,$mstore,$mb_admin_tables,$mb_fields; 115 $user_pid = mbw_get_param('board_pid'); 116 if(!empty($user_pid)){ 117 $user_mode = mbw_get_option("user_mode"); 118 119 $hashed = mbw_hash_password(mbw_get_param("admin_modify_passwd")); 120 $mdb->query($mdb->prepare("update ".$mb_admin_tables["users"]." set ".$mb_fields["users"]["fn_passwd"]."='".$hashed."' where ".$mb_fields["users"]["fn_pid"]."=%d", $user_pid)); 121 122 if($user_mode=="WP"){ 123 global $wpdb; 124 $user_id = ($mdb->get_var($mdb->prepare("select ".$mb_fields["users"]["fn_user_id"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_pid"]."`=%d limit 1", $user_pid))); 125 $wpdb->update( $wpdb->users, array( 'user_pass' => $hashed ), array( 'user_login' => $user_id ) ); 113 if(mbw_is_admin() && current_user_can('administrator') && mbw_get_param('board_action')=='admin_modify_password' && mbw_get_param('admin_modify_passwd')!=''){ 114 if(!mbw_verify_nonce()){ 115 mbw_error_message("MSG_NONCE_MATCH_ERROR", "","1401"); 116 }else{ 117 global $mdb,$mstore,$mb_admin_tables,$mb_fields; 118 $user_pid = mbw_get_param('board_pid'); 119 if(!empty($user_pid)){ 120 $user_mode = mbw_get_option("user_mode"); 121 $hashed = mbw_hash_password(mbw_get_param("admin_modify_passwd")); 122 123 if($user_mode=="WP"){ 124 global $wpdb; 125 $row = $mdb->get_row($mdb->prepare("select ".$mb_fields["users"]["fn_user_id"].",".$mb_fields["users"]["fn_wp_user_pid"]." from `".$mb_admin_tables["users"]."` where `".$mb_fields["users"]["fn_pid"]."`=%d limit 1", $user_pid), ARRAY_A); 126 if(!empty($row)){ 127 $user_id = $row[$mb_fields["users"]["fn_user_id"]]; 128 $wp_pid = $row[$mb_fields["users"]["fn_wp_user_pid"]]; 129 //로그인 사용자가 슈퍼 관리자이면 모든 사용자의 비밀번호 변경 가능 (멀티사이트에서 일반 관리자는 슈퍼 관리자의 비밀번호를 변경하지 못하도록 설정) 130 if(is_super_admin() || !is_super_admin($wp_pid)){ 131 $mdb->query($mdb->prepare("update ".$mb_admin_tables["users"]." set ".$mb_fields["users"]["fn_passwd"]."=%s where ".$mb_fields["users"]["fn_pid"]."=%d", $hashed, $user_pid)); 132 $wpdb->update( $wpdb->users, array( 'user_pass' => $hashed ), array( 'user_login' => $user_id ) ); 133 mbw_set_result_data(array("message"=>__MM('MSG_PASSWD_MODIFY'))); 134 }else{ 135 global $mb_languages; 136 mbw_error_message("MSG_PERMISSION_ERROR", $mb_languages["W_MODIFY"],"1102"); 137 } 138 } 139 }else{ 140 $mdb->query($mdb->prepare("update ".$mb_admin_tables["users"]." set ".$mb_fields["users"]["fn_passwd"]."=%s where ".$mb_fields["users"]["fn_pid"]."=%d", $hashed, $user_pid)); 141 mbw_set_result_data(array("message"=>__MM('MSG_PASSWD_MODIFY'))); 142 } 126 143 } 127 mbw_set_result_data(array("message"=>__MM('MSG_PASSWD_MODIFY'))); 128 } 144 } 129 145 } 130 146 } -
mangboard/trunk/plugins/datepicker/datepicker.php
r1706645 r3664567 1 1 <?php 2 if(!function_exists('mbw_init_datepicker')){ 2 if(!function_exists('mbw_init_datepicker')){ 3 3 function mbw_init_datepicker(){ 4 loadStyle(MBW_PLUGIN_URL."plugins/datepicker/css/style.css"); 4 5 loadScript(MBW_PLUGIN_URL."plugins/datepicker/js/datepicker.js"); 5 6 } -
mangboard/trunk/readme.txt
r3652096 r3664567 6 6 Tested up to: 7.1 7 7 Requires PHP: 5.5.1 8 Stable tag: 2.3. 78 Stable tag: 2.3.8 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 122 122 123 123 == Changelog == 124 125 = 2.4.9 (2.3.8) = 126 * 보안 취약점 수정 [Wordfence에서 보안점검을 통해 알려주신 취약점 수정] 127 * 워드프레스 7.1 버전에서 팝업 캘린더 호환성 문제 수정 128 * minor bug 수정 124 129 125 130 = 2.4.8 =
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)