Project

General

Profile

1
<?php
2

    
3
// $Id: add_droplet.php 1072 2009-07-16 18:50:11Z Ruebenwurzel $
4

    
5
/*
6
*	@version	1.0
7
*	@author		Ruud Eisinga (Ruud) John (PCWacht)
8
*	@date		June 2009
9
*
10
*	droplets are small codeblocks that are called from anywhere in the template. 
11
* 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]
12
*/
13

    
14
require('../../config.php');
15

    
16
require_once(WB_PATH.'/framework/class.admin.php');
17
require_once(WB_PATH.'/framework/functions.php');
18
$admin = new admin('admintools','admintools',false,false);
19
if($admin->get_permission('admintools') == true) {
20
	
21
	$admintool_link = ADMIN_URL .'/admintools/index.php';
22
	$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
23
	$admin = new admin('admintools', 'admintools');
24

    
25
	$modified_when = time();
26
	$modified_by = $admin->get_user_id();
27

    
28
	// Insert new row into database
29
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_droplets (active,modified_when,modified_by) VALUES ('1','$modified_when','$modified_by' )");
30

    
31
	// Get the id
32
	$droplet_id = $database->get_one("SELECT LAST_INSERT_ID()");
33

    
34
	// Say that a new record has been added, then redirect to modify page
35
	if($database->is_error()) {
36
		$admin->print_error($database->get_error(), $module_edit_link);
37
	} else {
38
		$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
39
	}
40

    
41
	// Print admin footer
42
	$admin->print_footer();
43
} else {
44
	die(header('Location: ../../index.php'));
45
} 
46
?>
(1-1/13)