@@ -284,7 +284,7 @@ public function datalogSave($db_table, $action, $primary_field, $primary_id, $re
284284 // Insert the server_id, if the record has a server_id
285285 $ server_id = (isset ($ record_old ['server_id ' ]) && $ record_old ['server_id ' ] > 0 )?$ record_old ['server_id ' ]:0 ;
286286 if (isset ($ record_new ['server_id ' ])) $ server_id = $ record_new ['server_id ' ];
287-
287+ $ server_id = intval ( $ server_id );
288288
289289 if ($ diff_num > 0 ) {
290290 //print_r($diff_num);
@@ -306,6 +306,9 @@ public function datalogSave($db_table, $action, $primary_field, $primary_id, $re
306306 //** Inserts a record and saves the changes into the datalog
307307 public function datalogInsert ($ tablename , $ insert_data , $ index_field ) {
308308 global $ app ;
309+
310+ $ tablename = $ this ->quote ($ tablename );
311+ $ index_field = $ this ->quote ($ index_field );
309312
310313 if (is_array ($ insert_data )) {
311314 $ key_str = '' ;
@@ -333,6 +336,10 @@ public function datalogInsert($tablename, $insert_data, $index_field) {
333336 //** Updates a record and saves the changes into the datalog
334337 public function datalogUpdate ($ tablename , $ update_data , $ index_field , $ index_value , $ force_update = false ) {
335338 global $ app ;
339+
340+ $ tablename = $ this ->quote ($ tablename );
341+ $ index_field = $ this ->quote ($ index_field );
342+ $ index_value = $ this ->quote ($ index_value );
336343
337344 $ old_rec = $ this ->queryOneRecord ("SELECT * FROM $ tablename WHERE $ index_field = ' $ index_value' " );
338345
@@ -356,6 +363,10 @@ public function datalogUpdate($tablename, $update_data, $index_field, $index_val
356363 //** Deletes a record and saves the changes into the datalog
357364 public function datalogDelete ($ tablename , $ index_field , $ index_value ) {
358365 global $ app ;
366+
367+ $ tablename = $ this ->quote ($ tablename );
368+ $ index_field = $ this ->quote ($ index_field );
369+ $ index_value = $ this ->quote ($ index_value );
359370
360371 $ old_rec = $ this ->queryOneRecord ("SELECT * FROM $ tablename WHERE $ index_field = ' $ index_value' " );
361372 $ this ->query ("DELETE FROM $ tablename WHERE $ index_field = ' $ index_value' " );
0 commit comments