// ========================== $module_permissions = $_SESSION['MODULE_PERMISSIONS']; $add_module = $val->add_slashes($val->sanitizePost('add_module')); $add_to_block = $val->add_slashes($val->sanitizePost('add_to_block')); if ($add_module != '') { // Get section info $module = preg_replace("/\\W/", "", $add_module); // fix secunia 2010-91-4 // check if the module exists if (!CAT_Helper_Addons::isModuleInstalled($add_module)) { $ajax = array('message' => $backend->lang()->translate('The module [{{module}}] does not exist / is not installed', array('module' => $add_module)), 'success' => false); 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; }