동시성 문제로 wr_seo_title 값이 중복되는 문제 수정 #293
This commit is contained in:
@ -57,6 +57,9 @@ if ($w == "u") {
|
|||||||
if (!$co['co_id']) {
|
if (!$co['co_id']) {
|
||||||
alert('등록된 자료가 없습니다.');
|
alert('등록된 자료가 없습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function_exists('check_case_exist_title')) check_case_exist_title($co, G5_CONTENT_DIR, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$html_title .= ' 입력';
|
$html_title .= ' 입력';
|
||||||
$co = array(
|
$co = array(
|
||||||
|
|||||||
@ -112,6 +112,8 @@ else if ($w == "u")
|
|||||||
|
|
||||||
if(!$it)
|
if(!$it)
|
||||||
alert('상품정보가 존재하지 않습니다.');
|
alert('상품정보가 존재하지 않습니다.');
|
||||||
|
|
||||||
|
if (function_exists('check_case_exist_title')) check_case_exist_title($it, G5_SHOP_DIR, false);
|
||||||
|
|
||||||
if (! (isset($ca_id) && $ca_id))
|
if (! (isset($ca_id) && $ca_id))
|
||||||
$ca_id = $it['ca_id'];
|
$ca_id = $it['ca_id'];
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
|
if (function_exists('check_case_exist_title')) check_case_exist_title($write, G5_BBS_DIR, true);
|
||||||
|
|
||||||
// 게시판에서 두단어 이상 검색 후 검색된 게시물에 코멘트를 남기면 나오던 오류 수정
|
// 게시판에서 두단어 이상 검색 후 검색된 게시물에 코멘트를 남기면 나오던 오류 수정
|
||||||
$sop = strtolower($sop);
|
$sop = strtolower($sop);
|
||||||
if ($sop != 'and' && $sop != 'or')
|
if ($sop != 'and' && $sop != 'or')
|
||||||
|
|||||||
@ -145,8 +145,12 @@ function get_content_by_field($write_table, $type='bbs', $where_field='', $where
|
|||||||
{
|
{
|
||||||
global $g5, $g5_object;
|
global $g5, $g5_object;
|
||||||
|
|
||||||
|
$order_key = 'wr_id';
|
||||||
|
|
||||||
if( $type === 'content' ){
|
if( $type === 'content' ){
|
||||||
$check_array = array('co_id', 'co_html', 'co_subject', 'co_content', 'co_seo_title', 'co_mobile_content', 'co_skin', 'co_mobile_skin', 'co_tag_filter_use', 'co_hit', 'co_include_head', 'co_include_tail');
|
$check_array = array('co_id', 'co_html', 'co_subject', 'co_content', 'co_seo_title', 'co_mobile_content', 'co_skin', 'co_mobile_skin', 'co_tag_filter_use', 'co_hit', 'co_include_head', 'co_include_tail');
|
||||||
|
|
||||||
|
$order_key = 'co_id';
|
||||||
} else {
|
} else {
|
||||||
$check_array = array('wr_id', 'wr_num', 'wr_reply', 'wr_parent', 'wr_is_comment', 'ca_name', 'wr_option', 'wr_subject', 'wr_content', 'wr_seo_title', 'wr_link1', 'wr_link2', 'wr_hit', 'wr_good', 'wr_nogood', 'mb_id', 'wr_name', 'wr_email', 'wr_homepage', 'wr_datetime', 'wr_ip', 'wr_1', 'wr_2', 'wr_3', 'wr_4', 'wr_5', 'wr_6', 'wr_7', 'wr_8', 'wr_9', 'wr_10');
|
$check_array = array('wr_id', 'wr_num', 'wr_reply', 'wr_parent', 'wr_is_comment', 'ca_name', 'wr_option', 'wr_subject', 'wr_content', 'wr_seo_title', 'wr_link1', 'wr_link2', 'wr_hit', 'wr_good', 'wr_nogood', 'mb_id', 'wr_name', 'wr_email', 'wr_homepage', 'wr_datetime', 'wr_ip', 'wr_1', 'wr_2', 'wr_3', 'wr_4', 'wr_5', 'wr_6', 'wr_7', 'wr_8', 'wr_9', 'wr_10');
|
||||||
}
|
}
|
||||||
@ -162,7 +166,7 @@ function get_content_by_field($write_table, $type='bbs', $where_field='', $where
|
|||||||
return $cache[$key];
|
return $cache[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = " select * from {$write_table} where $where_field = '".sql_real_escape_string($where_value)."' ";
|
$sql = " select * from {$write_table} where $where_field = '".sql_real_escape_string($where_value)."' order by $order_key desc limit 1 ";
|
||||||
|
|
||||||
$cache[$key] = sql_fetch($sql);
|
$cache[$key] = sql_fetch($sql);
|
||||||
|
|
||||||
|
|||||||
@ -32,9 +32,9 @@ function get_shop_item_with_category($it_id, $seo_title='', $add_query=''){
|
|||||||
global $g5, $default;
|
global $g5, $default;
|
||||||
|
|
||||||
if( $seo_title ){
|
if( $seo_title ){
|
||||||
$sql = " select a.*, b.ca_name, b.ca_use from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b where a.it_seo_title = '".sql_real_escape_string(generate_seo_title($seo_title))."' and a.ca_id = b.ca_id $add_query";
|
$sql = " select a.*, b.ca_name, b.ca_use from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b where a.it_seo_title = '".sql_real_escape_string(generate_seo_title($seo_title))."' and a.ca_id = b.ca_id $add_query order by it_id desc limit 1";
|
||||||
} else {
|
} else {
|
||||||
$sql = " select a.*, b.ca_name, b.ca_use from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b where a.it_id = '$it_id' and a.ca_id = b.ca_id $add_query";
|
$sql = " select a.*, b.ca_name, b.ca_use from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b where a.it_id = '$it_id' and a.ca_id = b.ca_id $add_query order by it_id desc limit 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = sql_fetch($sql);
|
$item = sql_fetch($sql);
|
||||||
|
|||||||
@ -253,10 +253,61 @@ function exist_seo_url($type, $seo_title, $write_table, $sql_id=0){
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_case_exist_title($data, $case=G5_BBS_DIR, $is_redirect=false) {
|
||||||
|
global $config, $g5, $board;
|
||||||
|
|
||||||
|
if ((int) $config['cf_bbs_rewrite'] !== 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$seo_title = '';
|
||||||
|
$redirect_url = '';
|
||||||
|
|
||||||
|
if ($case == G5_BBS_DIR && isset($data['wr_seo_title'])) {
|
||||||
|
$db_table = $g5['write_prefix'].$board['bo_table'];
|
||||||
|
|
||||||
|
if (exist_seo_url($case, $data['wr_seo_title'], $db_table, $data['wr_id'])) {
|
||||||
|
$seo_title = $data['wr_seo_title'].'-'.$data['wr_id'];
|
||||||
|
$sql = " update `{$db_table}` set wr_seo_title = '".sql_real_escape_string($seo_title)."' where wr_id = '{$data['wr_id']}' ";
|
||||||
|
sql_query($sql, false);
|
||||||
|
|
||||||
|
get_write($db_table, $data['wr_id'], false);
|
||||||
|
$redirect_url = get_pretty_url($board['bo_table'], $data['wr_id']);
|
||||||
|
}
|
||||||
|
} else if ($case == G5_CONTENT_DIR && isset($data['co_seo_title'])) {
|
||||||
|
$db_table = $g5['content_table'];
|
||||||
|
|
||||||
|
if (exist_seo_url($case, $data['co_seo_title'], $db_table, $data['co_id'])) {
|
||||||
|
$seo_title = $data['co_seo_title'].'-'.substr(get_random_token_string(4), 4);
|
||||||
|
$sql = " update `{$db_table}` set co_seo_title = '".sql_real_escape_string($seo_title)."' where co_id = '{$data['co_id']}' ";
|
||||||
|
sql_query($sql, false);
|
||||||
|
|
||||||
|
get_content_db($data['co_id'], false);
|
||||||
|
g5_delete_cache_by_prefix('content-' . $data['co_id'] . '-');
|
||||||
|
$redirect_url = get_pretty_url($case, $data['co_id']);
|
||||||
|
}
|
||||||
|
} else if (defined('G5_SHOP_DIR') && $case == G5_SHOP_DIR && isset($data['it_seo_title'])) {
|
||||||
|
$db_table = $g5['g5_shop_item_table'];
|
||||||
|
|
||||||
|
if (shop_exist_check_seo_title($data['it_seo_title'], $case, $db_table, $data['it_id'])) {
|
||||||
|
$seo_title = $data['it_seo_title'].'-'.substr(get_random_token_string(4), 4);
|
||||||
|
$sql = " update `{$db_table}` set it_seo_title = '".sql_real_escape_string($seo_title)."' where it_id = '{$data['it_id']}' ";
|
||||||
|
sql_query($sql, false);
|
||||||
|
|
||||||
|
get_shop_item($data['it_id'], false);
|
||||||
|
$redirect_url = get_pretty_url($case, $data['it_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_redirect && $seo_title && $redirect_url) {
|
||||||
|
goto_url($redirect_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function exist_seo_title_recursive($type, $seo_title, $write_table, $sql_id=0){
|
function exist_seo_title_recursive($type, $seo_title, $write_table, $sql_id=0){
|
||||||
static $count = 0;
|
static $count = 0;
|
||||||
|
|
||||||
$seo_title_add = ($count > 0) ? utf8_strcut($seo_title, 200 - ($count+1), '')."-$count" : $seo_title;
|
$seo_title_add = ($count > 0) ? utf8_strcut($seo_title, 100000 - ($count+1), '')."-$count" : $seo_title;
|
||||||
|
|
||||||
if( ! exist_seo_url($type, $seo_title_add, $write_table, $sql_id) ){
|
if( ! exist_seo_url($type, $seo_title_add, $write_table, $sql_id) ){
|
||||||
return $seo_title_add;
|
return $seo_title_add;
|
||||||
@ -264,7 +315,7 @@ function exist_seo_title_recursive($type, $seo_title, $write_table, $sql_id=0){
|
|||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
|
|
||||||
if( $count > 198 ){
|
if( $count > 99998 ){
|
||||||
return $seo_title_add;
|
return $seo_title_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@ if( isset($row['it_seo_title']) && ! $row['it_seo_title'] ){
|
|||||||
shop_seo_title_update($row['it_id']);
|
shop_seo_title_update($row['it_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function_exists('check_case_exist_title')) check_case_exist_title($it, G5_SHOP_DIR, true);
|
||||||
|
|
||||||
if (!($it['ca_use'] && $it['it_use'])) {
|
if (!($it['ca_use'] && $it['it_use'])) {
|
||||||
if (!$is_admin)
|
if (!$is_admin)
|
||||||
alert('판매가능한 상품이 아닙니다.');
|
alert('판매가능한 상품이 아닙니다.');
|
||||||
|
|||||||
@ -20,6 +20,8 @@ if( isset($row['it_seo_title']) && ! $row['it_seo_title'] ){
|
|||||||
shop_seo_title_update($row['it_id']);
|
shop_seo_title_update($row['it_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function_exists('check_case_exist_title')) check_case_exist_title($it, G5_SHOP_DIR, true);
|
||||||
|
|
||||||
if (!($it['ca_use'] && $it['it_use'])) {
|
if (!($it['ca_use'] && $it['it_use'])) {
|
||||||
if (!$is_admin)
|
if (!$is_admin)
|
||||||
alert('현재 판매가능한 상품이 아닙니다.');
|
alert('현재 판매가능한 상품이 아닙니다.');
|
||||||
|
|||||||
Reference in New Issue
Block a user