Project

General

Profile

1 1457 Luisehahne
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
require('../../config.php');
19
20
// Include WB admin wrapper script
21
require(WB_PATH.'/modules/admin.php');
22
23
// Include the ordering class
24
require(WB_PATH.'/framework/class.order.php');
25
// Get new order
26
$order = new order(TABLE_PREFIX.'mod_news_posts', 'position', 'post_id', 'section_id');
27
$position = $order->get_new($section_id);
28
29
// Get default commenting
30
$query_settings = $database->query("SELECT commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
31
$fetch_settings = $query_settings->fetchRow();
32
$commenting = $fetch_settings['commenting'];
33
34
// Insert new row into database
35
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id,position,commenting,active) VALUES ('$section_id','$page_id','$position','$commenting','1')");
36
37
// Get the id
38
$post_id = $admin->getIDKEY($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(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
43
} else {
44
	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
45
}
46
47
// Print admin footer
48
$admin->print_footer();