Revision 1457
Added by Luisehahne over 14 years ago
| add_droplet.php | ||
|---|---|---|
| 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$
|
|
| 15 |
* @filesource $HeadURL$
|
|
| 16 |
* @lastmodified $Date$
|
|
| 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',false,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 = $admin->get_user_id();
|
|
| 33 |
|
|
| 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' )");
|
|
| 36 |
|
|
| 37 |
// Get the id
|
|
| 38 |
$droplet_id = $database->get_one("SELECT LAST_INSERT_ID()");
|
|
| 39 |
|
|
| 40 |
// Say that a new record has been added, then redirect to modify page
|
|
| 41 |
if($database->is_error()) {
|
|
| 42 |
$admin->print_error($database->get_error(), $module_edit_link);
|
|
| 43 |
} else {
|
|
| 44 |
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
|
|
| 45 |
}
|
|
| 46 |
|
|
| 47 |
// Print admin footer
|
|
| 48 |
$admin->print_footer();
|
|
| 49 |
} else {
|
|
| 50 |
die(header('Location: ../../index.php'));
|
|
| 51 |
}
|
|
| 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$ |
|
| 15 |
* @filesource $HeadURL$ |
|
| 16 |
* @lastmodified $Date$ |
|
| 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',false,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 = $admin->get_user_id(); |
|
| 33 |
|
|
| 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' )");
|
|
| 36 |
|
|
| 37 |
// Get the id |
|
| 38 |
$droplet_id = $database->get_one("SELECT LAST_INSERT_ID()");
|
|
| 39 |
|
|
| 40 |
// Say that a new record has been added, then redirect to modify page |
|
| 41 |
if($database->is_error()) {
|
|
| 42 |
$admin->print_error($database->get_error(), $module_edit_link); |
|
| 43 |
} else {
|
|
| 44 |
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id)); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
// Print admin footer |
|
| 48 |
$admin->print_footer(); |
|
| 49 |
} else {
|
|
| 50 |
die(header('Location: ../../index.php'));
|
|
| 51 |
} |
|
| 52 | 52 |
?> |
| 53 | 53 | |
Also available in: Unified diff
Preparing 2.8.2 stable, last tests