1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category module
|
5
|
* @package droplet
|
6
|
* @author Ruud Eisinga (Ruud) John (PCWacht)
|
7
|
* @author WebsiteBaker Project
|
8
|
* @copyright 2004-2009, Ryan Djurovich
|
9
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
10
|
* @link http://www.websitebaker2.org/
|
11
|
* @license http://www.gnu.org/licenses/gpl.html
|
12
|
* @platform WebsiteBaker 2.8.x
|
13
|
* @requirements PHP 5.2.2 and higher
|
14
|
* @version $Id: add_droplet.php 1503 2011-08-18 02:18:59Z Luisehahne $
|
15
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/tags/2.8.3/wb/modules/droplets/add_droplet.php $
|
16
|
* @lastmodified $Date: 2011-08-18 04:18:59 +0200 (Thu, 18 Aug 2011) $
|
17
|
*
|
18
|
*/
|
19
|
|
20
|
require('../../config.php');
|
21
|
|
22
|
require_once(WB_PATH.'/framework/class.admin.php');
|
23
|
require_once(WB_PATH.'/framework/functions.php');
|
24
|
$admin = new admin('admintools','admintools',true,false);
|
25
|
if($admin->get_permission('admintools') == true) {
|
26
|
|
27
|
$admintool_link = ADMIN_URL .'/admintools/index.php';
|
28
|
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
|
29
|
// $admin = new admin('admintools', 'admintools');
|
30
|
|
31
|
$modified_when = time();
|
32
|
$modified_by = intval($admin->get_user_id());
|
33
|
|
34
|
// Insert new row into database
|
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);
|
40
|
|
41
|
// Get the id
|
42
|
$droplet_id = intval($database->get_one("SELECT LAST_INSERT_ID()"));
|
43
|
|
44
|
// Say that a new record has been added, then redirect to modify page
|
45
|
if($database->is_error()) {
|
46
|
$admin->print_error($database->get_error(), $module_edit_link);
|
47
|
} else {
|
48
|
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
|
49
|
}
|
50
|
|
51
|
} else {
|
52
|
$admin->print_error($database->get_error(), $module_edit_link);
|
53
|
}
|
54
|
|
55
|
// Print admin footer
|
56
|
$admin->print_footer();
|