1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category module
|
5
|
* @package Form
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright WebsiteBaker Org. e.V.
|
8
|
* @link http://websitebaker.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.3
|
11
|
* @requirements PHP 5.3.6 and higher
|
12
|
* @version $Id: add_field.php 2 2017-07-02 15:14:29Z Manuela $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/modules/form/add_field.php $
|
14
|
* @lastmodified $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
|
15
|
* @description
|
16
|
*/
|
17
|
// Include config file
|
18
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
19
|
|
20
|
// Include WB admin wrapper script
|
21
|
require(WB_PATH.'/modules/admin.php');
|
22
|
|
23
|
$sBacklink = ADMIN_URL.'/pages/modify.php?page_id='.$page_id;
|
24
|
if (!$admin->checkFTAN( $_SERVER["REQUEST_METHOD"] ))
|
25
|
{
|
26
|
// $admin->print_header();
|
27
|
$admin->print_error($_SERVER["REQUEST_METHOD"].':: '.$MESSAGE['GENERIC_SECURITY_ACCESS'], $sBacklink);
|
28
|
}
|
29
|
//$aFtan = $admin->getFTAN('');
|
30
|
|
31
|
// Include the ordering class
|
32
|
require(WB_PATH.'/framework/class.order.php');
|
33
|
// Get new order
|
34
|
$order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id');
|
35
|
$position = $order->get_new($section_id);
|
36
|
$field_id = 0;
|
37
|
try {
|
38
|
// Insert new row into database
|
39
|
$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_form_fields` SET '
|
40
|
. '`section_id` = '.$database->escapeString($section_id).', '
|
41
|
. '`page_id` = '.$database->escapeString($page_id).', '
|
42
|
. '`position` = '.$database->escapeString($position).', '
|
43
|
. '`title` = \'\', '
|
44
|
. '`type` = \'\', '
|
45
|
. '`required` = 0, '
|
46
|
. '`value` = \'\', '
|
47
|
. '`extra` = \'\' ';
|
48
|
if(!$database->query($sql)) {
|
49
|
$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
|
50
|
}
|
51
|
$field_id = $database->getLastInsertId();
|
52
|
} catch(ErrorMsgException $e) {
|
53
|
$admin->print_error($database->get_error(), WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$admin->getIDKEY($field_id));
|
54
|
}
|
55
|
|
56
|
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$admin->getIDKEY($field_id));
|
57
|
// Print admin footer
|
58
|
$admin->print_footer();
|