Revision 1754
Added by Luisehahne about 13 years ago
| add.php | ||
|---|---|---|
| 223 | 223 |
$position = 1; |
| 224 | 224 |
|
| 225 | 225 |
// Add new record into the sections table |
| 226 |
$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,position,module,block) VALUES ('$page_id','$position', '$module','1')");
|
|
| 226 |
//$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,position,module,block) VALUES ('$page_id','$position', '$module','1')");
|
|
| 227 | 227 |
|
| 228 |
// Get the section id |
|
| 229 |
$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
|
|
| 230 |
|
|
| 231 |
// Include the selected modules add file if it exists |
|
| 232 |
if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) {
|
|
| 233 |
require(WB_PATH.'/modules/'.$module.'/add.php'); |
|
| 228 |
// Insert module into DB |
|
| 229 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'sections` SET '; |
|
| 230 |
$sql .= '`page_id` = '.(int)$page_id.', '; |
|
| 231 |
$sql .= '`module` = \''.$module.'\', '; |
|
| 232 |
$sql .= '`position` = '.(int)$position.', '; |
|
| 233 |
$sql .= '`block` = \'1\', '; |
|
| 234 |
$sql .= '`publ_start` = \'0\','; |
|
| 235 |
$sql .= '`publ_end` = \'0\' '; |
|
| 236 |
if($database->query($sql)) {
|
|
| 237 |
// Get the section id |
|
| 238 |
$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
|
|
| 239 |
// Include the selected modules add file if it exists |
|
| 240 |
if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) |
|
| 241 |
{
|
|
| 242 |
require(WB_PATH.'/modules/'.$module.'/add.php'); |
|
| 243 |
} |
|
| 234 | 244 |
} |
| 235 | 245 |
|
| 236 | 246 |
// Check if there is a db error, otherwise say successful |
| 237 | 247 |
if($database->is_error()) {
|
| 238 |
$admin->print_error($database->get_error()); |
|
| 248 |
$admin->print_error($database->get_error().' (sections)');
|
|
| 239 | 249 |
} else {
|
| 240 | 250 |
$admin->print_success($MESSAGE['PAGES_ADDED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
| 241 | 251 |
} |
Also available in: Unified diff
search for ->page['root_parent'] == 0 in module and shoe_menu2 calls
page['root_parent'] has always the page_id from the first adding new page in level