Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
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_group.php 2 2017-07-02 15:14:29Z Manuela $ 
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/modules/news/add_group.php $
14
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
15
 *
16
 */
17

    
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19
// suppress to print the header, so no new FTAN will be set
20
$admin_header = false;
21
// Tells script to update when this page was last updated
22
$update_when_modified = false;
23
// show the info banner
24
//$print_info_banner = true;
25
// Include WB admin wrapper script
26
require(WB_PATH.'/modules/admin.php');
27

    
28
if(!$admin->checkFTAN('GET')) {
29
    $admin->print_header();
30
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL );
31
}
32

    
33
// After check print the header
34
$admin->print_header();
35

    
36
// Include the ordering class
37
require(WB_PATH.'/framework/class.order.php');
38
// Get new order
39
$order = new order(TABLE_PREFIX.'mod_news_groups', 'position', 'group_id', 'section_id');
40
$position = $order->get_new($section_id);
41

    
42
// Insert new row into database
43

    
44
    // Insert new row into database
45
    $sql  = 'INSERT INTO `'.TABLE_PREFIX.'mod_news_groups` SET '
46
          . '`section_id` = '.$database->escapeString($section_id).', '
47
          . '`page_id` = '.$database->escapeString($page_id).', '
48
          . '`position` = '.$database->escapeString($position).', '
49
          . '`active` = 1, '
50
          . '`title` = \'\' ';
51

    
52
$database->query($sql);
53

    
54
// Get the id
55
$group_id = $admin->getIDKEY(intval($database->getLastInsertId()));
56

    
57
// Say that a new record has been added, then redirect to modify page
58
if($database->is_error()) {
59
   $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
60
} else {
61
   $admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/'.basename(__DIR__).'/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
62
}
63

    
64
// Print admin footer
65
$admin->print_footer();
(2-2/36)