Update gnuboard.dbt.php

This commit is contained in:
Namhyeon Go 2018-04-15 00:13:06 +09:00 committed by GitHub
parent 8293d849b0
commit a6c0566652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,11 +113,11 @@ if(!function_exists("gnb_set_post_parameters")) {
// get member data // get member data
if(!function_exists("gnb_get_member")) { if(!function_exists("gnb_get_member")) {
function gnb_get_member($mb_id, $tablename="member") { function gnb_get_member($user_name, $tablename="member") {
$result = array(); $result = array();
$bind = array( $bind = array(
"mb_id" => $mb_id, "mb_id" => $user_name,
); );
$member_table = gnb_get_db_prefix() . $tablename; $member_table = gnb_get_db_prefix() . $tablename;
@ -178,65 +178,71 @@ if(!function_exists("gnb_join_member")) {
// load network helper // load network helper
loadHelper("networktool"); loadHelper("networktool");
// get member info
$member_info = gnb_get_member($user_name);
$member_fields = array(); // allow join if not exists duplicated members
$member_default_fields = array( if(array_key_empty("mb_id", $member_info)) {
"mb_id" => $user_name, $member_fields = array();
"ug_id" => "", $member_default_fields = array(
"mb_password" => gnb_get_password($user_password), "mb_id" => $user_name,
"mb_name" => "", "ug_id" => "",
"mb_jumin" => "", "mb_password" => gnb_get_password($user_password),
"mb_sex" => "", "mb_name" => "",
"mb_birth" => "", "mb_jumin" => "",
"mb_nick" => "", "mb_sex" => "",
"mb_nick_date" => "", "mb_birth" => "",
"mb_password_q" => "", "mb_nick" => "",
"mb_password_a" => "", "mb_nick_date" => "",
"mb_email" => "", "mb_password_q" => "",
"mb_homepage" => "", "mb_password_a" => "",
"mb_tel" => "", "mb_email" => "",
"mb_hp" => "", "mb_homepage" => "",
"mb_zip1" => "", "mb_tel" => "",
"mb_zip2" => "", "mb_hp" => "",
"mb_addr1" => "", "mb_zip1" => "",
"mb_addr2" => "", "mb_zip2" => "",
"mb_addr3" => "", "mb_addr1" => "",
"mb_addr_jibeon" => "", "mb_addr2" => "",
"mb_signature" => "", "mb_addr3" => "",
"mb_profile" => "", "mb_addr_jibeon" => "",
"mb_today_login" => get_current_datetime(), "mb_signature" => "",
"mb_datetime" => get_current_datetime(), "mb_profile" => "",
"mb_ip" => get_network_client_addr(), "mb_today_login" => get_current_datetime(),
"mb_level" => get_value_in_array("cf_register_level", $gnb_config), "mb_datetime" => get_current_datetime(),
"mb_recommend" => "", "mb_ip" => get_network_client_addr(),
"mb_login_ip" => get_network_client_addr(), "mb_level" => get_value_in_array("cf_register_level", $gnb_config),
"mb_mailling" => "", "mb_recommend" => "",
"mb_sms" => "", "mb_login_ip" => get_network_client_addr(),
"mb_open" => "", "mb_mailling" => "",
"mb_open_date" => get_current_datetime(), "mb_sms" => "",
"mb_1" => "", "mb_open" => "",
"mb_2" => "", "mb_open_date" => get_current_datetime(),
"mb_3" => "", "mb_1" => "",
"mb_4" => "", "mb_2" => "",
"mb_5" => "", "mb_3" => "",
"mb_6" => "", "mb_4" => "",
"mb_7" => "", "mb_5" => "",
"mb_8" => "", "mb_6" => "",
"mb_9" => "", "mb_7" => "",
"mb_10" => "", "mb_8" => "",
); "mb_9" => "",
"mb_10" => "",
);
foreach($member_default_fields as $k=>$v) { foreach($member_default_fields as $k=>$v) {
if(in_array($k, array("mb_id", "mb_password"))) { if(in_array($k, array("mb_id", "mb_password"))) {
$member_fields[$k] = $v; $member_fields[$k] = $v;
} else { } else {
$member_fields[$k] = array_key_empty($k, $data) ? $v : $data[$k]; $member_fields[$k] = array_key_empty($k, $data) ? $v : $data[$k];
}
} }
}
if(count($member_fields) > 0) { if(count($member_fields) > 0) {
$sql = get_bind_to_sql_insert($member_table, $member_fields); $sql = get_bind_to_sql_insert($member_table, $member_fields);
$result = exec_db_query($sql, $member_fields); $result = exec_db_query($sql, $member_fields);
}
} }
return $result; return $result;