Project

General

Profile

« Previous | Next » 

Revision 1503

Added by Dietmar almost 13 years ago

change sql statements to strict in module droplets
fix vars in compatibility mode for versions before 2.8.1 in frontend.functions.php

View differences:

add_droplet.php
21 21

  
22 22
require_once(WB_PATH.'/framework/class.admin.php');
23 23
require_once(WB_PATH.'/framework/functions.php');
24
$admin = new admin('admintools','admintools',false,false);
24
$admin = new admin('admintools','admintools',true,false);
25 25
if($admin->get_permission('admintools') == true) {
26
	
26

  
27 27
	$admintool_link = ADMIN_URL .'/admintools/index.php';
28 28
	$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
29
	$admin = new admin('admintools', 'admintools');
29
	// $admin = new admin('admintools', 'admintools');
30 30

  
31 31
	$modified_when = time();
32
	$modified_by = $admin->get_user_id();
32
	$modified_by = intval($admin->get_user_id());
33 33

  
34 34
	// Insert new row into database
35
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_droplets (active,modified_when,modified_by) VALUES ('1','$modified_when','$modified_by' )");
35
	$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_droplets` SET ';
36
	$sql .= '`active` = 1, ';
37
	$sql .= '`modified_when` = '.$modified_when.', ';
38
	$sql .= '`modified_by` = '.$modified_by.' ';
39
	$database->query($sql);
36 40

  
37 41
	// Get the id
38
	$droplet_id = $database->get_one("SELECT LAST_INSERT_ID()");
42
	$droplet_id = intval($database->get_one("SELECT LAST_INSERT_ID()"));
39 43

  
40 44
	// Say that a new record has been added, then redirect to modify page
41 45
	if($database->is_error()) {
......
44 48
		$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
45 49
	}
46 50

  
47
	// Print admin footer
48
	$admin->print_footer();
49 51
} else {
50
	die(header('Location: ../../index.php'));
51
} 
52
?>
52
		$admin->print_error($database->get_error(), $module_edit_link);
53
}
54

  
55
// Print admin footer
56
$admin->print_footer();

Also available in: Unified diff