Merge branch 'master' of github.com:gnuboard/gnuboard5

This commit is contained in:
thisgun
2023-07-17 11:54:08 +09:00
18 changed files with 115 additions and 50 deletions

View File

@ -113,17 +113,20 @@ if ($w == "") {
set co_id = '$co_id',
$sql_common ";
sql_query($sql);
run_event('admin_content_created', $co_id);
} elseif ($w == "u") {
$sql = " update {$g5['content_table']}
set $sql_common
where co_id = '$co_id' ";
sql_query($sql);
run_event('admin_content_updated', $co_id);
} elseif ($w == "d") {
@unlink(G5_DATA_PATH . "/content/{$co_id}_h");
@unlink(G5_DATA_PATH . "/content/{$co_id}_t");
$sql = " delete from {$g5['content_table']} where co_id = '$co_id' ";
sql_query($sql);
run_event('admin_content_deleted', $co_id);
}
if (function_exists('get_admin_captcha_by')) {

View File

@ -30,6 +30,7 @@ if ($w == "")
sql_query($sql);
$fa_id = sql_insert_id();
run_event('admin_faq_item_created', $fa_id, $fm_id);
}
else if ($w == "u")
{
@ -37,11 +38,14 @@ else if ($w == "u")
set $sql_common
where fa_id = '$fa_id' ";
sql_query($sql);
run_event('admin_faq_item_updated', $fa_id, $fm_id);
}
else if ($w == "d")
{
$sql = " delete from {$g5['faq_table']} where fa_id = '$fa_id' ";
sql_query($sql);
run_event('admin_faq_item_deleted', $fa_id, $fm_id);
}
if ($w == 'd')

View File

@ -49,9 +49,13 @@ if ($w == "") {
sql_query($sql);
$fm_id = sql_insert_id();
run_event('admin_faq_master_created', $fm_id);
} elseif ($w == "u") {
$sql = " update {$g5['faq_master_table']} $sql_common where fm_id = '$fm_id' ";
sql_query($sql);
run_event('admin_faq_master_updated', $fm_id);
} elseif ($w == "d") {
@unlink(G5_DATA_PATH . "/faq/{$fm_id}_h");
@unlink(G5_DATA_PATH . "/faq/{$fm_id}_t");
@ -63,6 +67,8 @@ if ($w == "") {
// FAQ상세삭제
$sql = " delete from {$g5['faq_table']} where fm_id = '$fm_id' ";
sql_query($sql);
run_event('admin_faq_master_deleted', $fm_id);
}
if ($w == "" || $w == "u") {

View File

@ -19,6 +19,7 @@ for ($i = 0; $i < $post_count_chk; $i++) {
$sql = " delete from {$g5['mail_table']} where ma_id = '$ma_id' ";
sql_query($sql);
run_event('admin_mail_deleted', $ma_id);
}
goto_url('./mail_list.php');

View File

@ -21,6 +21,10 @@ if ($w == '') {
ma_time = '" . G5_TIME_YMDHIS . "',
ma_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql);
$ma_id = sql_insert_id();
run_event('admin_mail_created', $ma_id);
} elseif ($w == 'u') {
$sql = " update {$g5['mail_table']}
set ma_subject = '{$ma_subject}',
@ -29,9 +33,12 @@ if ($w == '') {
ma_ip = '{$_SERVER['REMOTE_ADDR']}'
where ma_id = '{$ma_id}' ";
sql_query($sql);
run_event('admin_mail_updated', $ma_id);
} elseif ($w == 'd') {
$sql = " delete from {$g5['mail_table']} where ma_id = '{$ma_id}' ";
sql_query($sql);
run_event('admin_mail_deleted', $ma_id);
}
goto_url('./mail_list.php');

View File

@ -59,14 +59,16 @@ $sql_common = " nw_device = '{$posts['nw_device']}',
if ($w == "") {
$sql = " insert {$g5['new_win_table']} set $sql_common ";
sql_query($sql);
$nw_id = sql_insert_id();
run_event('admin_newwin_created', $nw_id);
} elseif ($w == "u") {
$sql = " update {$g5['new_win_table']} set $sql_common where nw_id = '$nw_id' ";
sql_query($sql);
run_event('admin_newwin_updated', $nw_id);
} elseif ($w == "d") {
$sql = " delete from {$g5['new_win_table']} where nw_id = '$nw_id' ";
sql_query($sql);
run_event('admin_newwin_deleted', $nw_id);
}
if ($w == "d") {

View File

@ -108,6 +108,8 @@ $sql = " update {$g5['qa_config_table']}
qa_5 = '{$_POST['qa_5']}' ";
sql_query($sql);
run_event('admin_qa_config_updated');
if (function_exists('get_admin_captcha_by')) {
get_admin_captcha_by('remove');
}

View File

@ -193,6 +193,7 @@ if ($w == "")
ca_name = '$ca_name',
$sql_common ";
sql_query($sql);
run_event('shop_admin_category_created', $ca_id);
}
else if ($w == "u")
{
@ -212,6 +213,7 @@ else if ($w == "u")
$sql .= " and ca_mb_id = '{$member['mb_id']}' ";
sql_query($sql);
}
run_event('shop_admin_category_updated', $ca_id);
}
else if ($w == "d")
{
@ -243,6 +245,7 @@ else if ($w == "d")
// 분류 삭제
$sql = " delete from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
sql_query($sql);
run_event('shop_admin_category_deleted', $ca_id);
}
if(function_exists('get_admin_captcha_by'))

View File

@ -75,6 +75,7 @@ if ($w == "")
$sql_common
, ev_id = '$ev_id' ";
sql_query($sql);
run_event('shop_admin_event_created', $ev_id);
}
else if ($w == "u")
{
@ -82,6 +83,7 @@ else if ($w == "u")
$sql_common
where ev_id = '$ev_id' ";
sql_query($sql);
run_event('shop_admin_event_updated', $ev_id);
}
else if ($w == "d")
{
@ -92,6 +94,7 @@ else if ($w == "d")
// 이벤트상품삭제
$sql = " delete from {$g5['g5_shop_event_item_table']} where ev_id = '$ev_id' ";
sql_query($sql);
run_event('shop_admin_event_deleted', $ev_id);
$sql = " delete from {$g5['g5_shop_event_table']} where ev_id = '$ev_id' ";
sql_query($sql);

View File

@ -19,6 +19,7 @@ if ($w == "u")
iq_answer = '$iq_answer'
where iq_id = '$iq_id' ";
sql_query($sql);
run_event('shop_admin_item_qa_updated', $iq_id);
if(trim($iq_answer)) {
$sql = " select a.iq_email, a.iq_hp, b.it_name

View File

@ -23,6 +23,7 @@ if ($_POST['act_button'] == "선택삭제") {
$sql = "delete from {$g5['g5_shop_item_qa_table']} where iq_id = '{$iiq_id}' ";
sql_query($sql);
run_event('shop_admin_item_qa_deleted', $iiq_id);
}
}

View File

@ -34,6 +34,7 @@ if ($w == "u")
is_reply_name = '".$member['mb_nick']."'
where is_id = '".$posts['is_id']."'";
sql_query($sql);
run_event('shop_admin_item_use_updated', $posts['is_id']);
if( isset($_POST['it_id']) ) {
update_use_cnt($_POST['it_id']);

View File

@ -40,6 +40,7 @@ for ($i=0; $i<$count_post_chk; $i++)
{
$sql = "delete from {$g5['g5_shop_item_use_table']} where is_id = '{$iis_id}' ";
sql_query($sql);
run_event('shop_admin_item_use_deleted', $iis_id);
}
if($iit_id){

View File

@ -9,11 +9,14 @@ include_once(dirname(__FILE__) .'/pbkdf2.compat.php');
**
*************************************************************************/
// 마이크로 타임을 얻어 계산 형식으로 만듦
/**
* 마이크로타임을 반환
* @return float
* @deprecated use `microtime(true)`
*/
function get_microtime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
return microtime(true);
}

View File

@ -65,7 +65,7 @@ function run_event($tag, $arg = ''){
}
}
function add_replace($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){
function add_replace($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=1){
if( $hook = get_hook_class() ){
return $hook->addFilter($tag, $func, $priority, $args);
@ -130,4 +130,4 @@ function get_hook_datas($type='', $is_callback=''){
}
return null;
}
}

View File

@ -1,35 +1,35 @@
<?php
require_once("config.php");
if(!function_exists('ft_nonce_is_valid')){
if (!function_exists('ft_nonce_is_valid')) {
include_once('../editor.lib.php');
}
if( !function_exists('che_reprocessImage') ){
function che_reprocessImage($file_path, $callback){
if (!function_exists('che_reprocessImage')) {
function che_reprocessImage($file_path, $callback)
{
$MIME_TYPES_PROCESSORS = array(
"image/gif" => array("imagecreatefromgif", "imagegif"),
"image/jpg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/jpeg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/png" => array("imagecreatefrompng", "imagepng"),
"image/webp" => array("imagecreatefromwebp", "imagewebp"),
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
"image/gif" => array("imagecreatefromgif", "imagegif"),
"image/jpg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/jpeg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/png" => array("imagecreatefrompng", "imagepng"),
"image/webp" => array("imagecreatefromwebp", "imagewebp"),
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
);
// Extracting mime type using getimagesize
try {
$image_info = getimagesize($file_path);
if ($image_info === null) {
//throw new Exception("Invalid image type");
return false;
//throw new Exception("Invalid image type");
return false;
}
$mime_type = $image_info["mime"];
if (!array_key_exists($mime_type, $MIME_TYPES_PROCESSORS)) {
//throw new Exception("Invalid image MIME type");
return false;
//throw new Exception("Invalid image MIME type");
return false;
}
$image_from_file = $MIME_TYPES_PROCESSORS[$mime_type][0];
@ -38,13 +38,13 @@ if( !function_exists('che_reprocessImage') ){
$reprocessed_image = @$image_from_file($file_path);
if (!$reprocessed_image) {
//throw new Exception("Unable to create reprocessed image from file");
return false;
//throw new Exception("Unable to create reprocessed image from file");
return false;
}
// Calling callback(if set) with path of image as a parameter
if ($callback !== null) {
$callback($reprocessed_image);
$callback($reprocessed_image);
}
// Freeing up memory
@ -60,13 +60,13 @@ if( !function_exists('che_reprocessImage') ){
$is_editor_upload = false;
$get_nonce = get_session('nonce_'.FT_NONCE_SESSION_KEY);
$get_nonce = get_session('nonce_' . FT_NONCE_SESSION_KEY);
if( $get_nonce && ft_nonce_is_valid( $get_nonce, 'cheditor' ) ){
if ($get_nonce && ft_nonce_is_valid($get_nonce, 'cheditor')) {
$is_editor_upload = true;
}
if( !$is_editor_upload ){
if (!$is_editor_upload) {
exit;
}
@ -78,19 +78,19 @@ run_event('cheditor_photo_upload', $data_dir, $data_url);
$tempfile = $_FILES['file']['tmp_name'];
$filename = $_FILES['file']['name'];
$filename_len = strrpos($filename, ".");
$type = substr($filename, strrpos($filename, ".")+1);
$type = substr($filename, strrpos($filename, ".") + 1);
$found = false;
switch ($type) {
case "jpg":
case "jpeg":
case "gif":
case "png":
case "jpg":
case "jpeg":
case "gif":
case "png":
case "webp":
$found = true;
$found = true;
}
if ($found != true || $filename_len != 23) {
exit;
exit;
}
// 저장 파일 이름: 년월일시분초_렌덤문자8자
@ -105,32 +105,51 @@ $imgsize = getimagesize($savefile);
$filesize = filesize($savefile);
if (!$imgsize) {
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
};
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
}
if ( CHE_UPLOAD_IMG_CHECK && ! che_reprocessImage($savefile, null) ){
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
if (CHE_UPLOAD_IMG_CHECK && !che_reprocessImage($savefile, null)) {
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
}
try {
if(defined('G5_FILE_PERMISSION')) chmod($savefile, G5_FILE_PERMISSION);
if (defined('G5_FILE_PERMISSION')) {
chmod($savefile, G5_FILE_PERMISSION);
}
} catch (Exception $e) {
}
$file_url = SAVE_URL.'/'.$filename;
$file_url = SAVE_URL . '/' . $filename;
if( function_exists('run_replace') ){
$file_url = run_replace('get_editor_upload_url', $file_url, $savefile, array());
if (function_exists('run_replace')) {
$fileInfo = new \stdClass();
$fileInfo->name = (string) $filename;
$fileInfo->size = (int) $filesize;
$fileInfo->url = (string) $file_url;
if (isset($_POST['origname'])) {
$fileInfo->oriname = (string) $_POST['origname'];
}
if ($imgsize) {
$fileInfo->width = (int) $imgsize[0];
$fileInfo->height = (int) $imgsize[1];
$fileInfo->type = (string) $imgsize['mime'];
}
$file_url = run_replace('get_editor_upload_url', $file_url, $savefile, $fileInfo);
}
$rdata = sprintf('{"fileUrl": "%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }',
$file_url,
$savefile,
$filename,
$filesize );
$rdata = sprintf(
'{"fileUrl": "%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }',
$file_url,
$savefile,
$filename,
$filesize
);
echo $rdata;

View File

@ -47,6 +47,8 @@ if ($w == "")
iq_time = '".G5_TIME_YMDHIS."',
iq_ip = '".$_SERVER['REMOTE_ADDR']."' ";
sql_query($sql);
$iq_id = sql_insert_id();
run_event('shop_item_qa_created', $iq_id, $it_id);
$alert_msg = '상품문의가 등록 되었습니다.';
}
@ -68,6 +70,7 @@ else if ($w == "u")
iq_question = '$iq_question'
where iq_id = '$iq_id' ";
sql_query($sql);
run_event('shop_item_qa_updated', $iq_id, $it_id);
$alert_msg = '상품문의가 수정 되었습니다.';
}
@ -132,6 +135,7 @@ else if ($w == "d")
$sql = " delete from {$g5['g5_shop_item_qa_table']} where iq_id = '$iq_id' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
sql_query($sql);
run_event('shop_item_qa_deleted', $iq_id, $it_id);
$alert_msg = '상품문의가 삭제 되었습니다.';
}

View File

@ -59,6 +59,8 @@ if ($w == "")
if (!$default['de_item_use_use'])
$sql .= ", is_confirm = '1' ";
sql_query($sql);
$is_id = sql_insert_id();
run_event('shop_item_use_created', $is_id, $it_id);
if ($default['de_item_use_use']) {
$alert_msg = "평가하신 글은 관리자가 확인한 후에 출력됩니다.";
@ -80,6 +82,7 @@ else if ($w == "u")
is_score = '$is_score'
where is_id = '$is_id' ";
sql_query($sql);
run_event('shop_item_use_updated', $is_id, $it_id);
$alert_msg = "사용후기가 수정 되었습니다.";
}
@ -120,6 +123,7 @@ else if ($w == "d")
$sql = " delete from {$g5['g5_shop_item_use_table']} where is_id = '$is_id' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
sql_query($sql);
run_event('shop_item_use_deleted', $is_id, $it_id);
$alert_msg = "사용후기를 삭제 하였습니다.";
}