Update gnuboard.dbt.php

This commit is contained in:
Namhyeon Go 2018-05-27 18:37:06 +09:00 committed by GitHub
parent 57bb6a340f
commit e9bc80fdec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
<?php
/**
* @file gnuboard.php
* @date 2018-04-11
* @date 2018-05-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief Database Helper for Gnuboard 4, Gnuboard 5
*/
@ -40,7 +40,7 @@ if(!function_exists("gnb_get_write_next")) {
// write post
if(!function_exists("gnb_write_post")) {
function gnb_write_post($tablename, $data=array(), $version=4) {
$result = false;
$result = 0;
$write_table = gnb_get_write_table($tablename);
$mb_id = get_current_user_name();
@ -95,9 +95,17 @@ if(!function_exists("gnb_write_post")) {
}
}
foreach($data as $k=>$v) {
if(!in_array($k, $write_default_fields)) {
$write_fields[$k] = $v;
}
}
if(count($write_fields) > 0) {
$sql = get_bind_to_sql_insert($write_table, $write_fields);
$result = exec_db_query($sql, $write_fields);
if(exec_db_query($sql, $write_fields)) {
$result = get_db_last_id();
}
}
return $result;
@ -248,6 +256,12 @@ if(!function_exists("gnb_join_member")) {
}
}
foreach($data as $k=>$v) {
if(!in_array($k, $member_default_fields)) {
$member_fields[$k] = $v;
}
}
if(count($member_fields) > 0) {
$sql = get_bind_to_sql_insert($member_table, $member_fields);
$result = exec_db_query($sql, $member_fields);