$add_to_block = $val->sanitizePost('add_to_block', 'numeric'); // add section if ($add_module != '') { // Get section info $module = preg_replace("/\\W/", "", $add_module); // fix secunia 2010-91-4 // check if module exists if (!$addons->isModuleInstalled($module)) { $backend->print_error('The required module is not (properly) installed!'); } if (!$addons->checkModulePermissions($module)) { $backend->print_error("Sorry, but you don't have the permissions for this action"); } // make sure we have a valid block id $add_to_block = $add_to_block > 0 ? $add_to_block : 1; $section_id = CAT_Sections::addSection($page_id, $module, $add_to_block); if ($section_id === false) { $backend->print_error('Error adding module'); } else { if (file_exists(CAT_PATH . '/modules/' . $module . '/add.php')) { global $backend, $admin; $admin =& $backend; require CAT_PATH . '/modules/' . $module . '/add.php'; } } } elseif ($delete_section_id != '') { $section_id = $delete_section_id; $section = CAT_Sections::getSection($section_id); if (file_exists(CAT_PATH . '/modules/' . $section['module'] . '/delete.php')) { require CAT_PATH . '/modules/' . $section['module'] . '/delete.php'; }
print json_encode($ajax); exit; } // check module permission if (!CAT_Helper_Addons::checkModulePermissions($add_module)) { $ajax = array('message' => $backend->lang()->translate('Sorry, but you don\'t have the permissions for this action.'), 'success' => false); print json_encode($ajax); exit; } // make sure we have a valid block id $add_to_block = is_numeric($add_to_block) && $add_to_block > 0 ? $add_to_block : 1; // re-order require CAT_PATH . '/framework/class.order.php'; $order = new order(CAT_TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id'); $position = $order->get_new($page_id); if (!CAT_Sections::addSection($page_id, $module, $add_to_block)) { $ajax = array('message' => $backend->lang()->translate('Unable to add a section for module [{{module}}]', array('module' => $module)), 'success' => false); print json_encode($ajax); exit; } } elseif ($delete_section_id) { $section = CAT_Sections::getSection($delete_section_id); if (!$section || !is_array($section) || !count($section)) { $ajax = array('message' => $backend->lang()->translate('Section not found.'), 'success' => false); print json_encode($ajax); exit; } // ================================================ // ! Include the modules delete file if it exists // ================================================ if (file_exists(CAT_PATH . '/modules/' . $section['module'] . '/delete.php')) {