Merge pull request #63 from vsc55/#62

fix, mysql error: Field 'is_global' doesn't have a default value
This commit is contained in:
Andre Lorbach 2020-07-08 11:04:02 +02:00 committed by GitHub
commit b9367ee304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,16 +438,15 @@ function WriteConfigValue($szPropName, $is_global = true, $userid = false, $grou
if ( !isset($rows) )
{
// New Entry
$result = DB_Query("INSERT INTO `" . DB_CONFIG . "` (propname, propvalue, userid) VALUES ( '" . $szPropName . "', '" . $szDbValue . "', " . $userid . ")");
DB_FreeQuery($result);
$sql_query = sprintf("INSERT INTO `%s` (propname, propvalue, userid, is_global) VALUES ( '%s', '%s', %d, %d )", DB_CONFIG, $szPropName, $szDbValue, $userid, ($is_global ? 1 : 0) );
}
else
{
// Update Entry
$result = DB_Query("UPDATE `" . DB_CONFIG . "` SET propvalue = '" . $szDbValue . "' WHERE propname = '" . $szPropName . "' AND userid = " . $userid);
DB_FreeQuery($result);
$sql_query = sprintf("UPDATE `%s` SET propvalue = '%s' WHERE propname = '%s' AND userid = %d", DB_CONFIG, $szDbValue, $szPropName, $userid);
}
$result = DB_Query($sql_query);
DB_FreeQuery($result);
}
else if ( $groupid != false )
DieWithFriendlyErrorMsg( "Critical Error occured in WriteConfigValue, writing GROUP specific properties is not supported yet!" );