function on_cms_check_restrictions_P($data)
{
    global $tables, $product_id;
    if (isset($product_id)) {
        $allowed_product_ids = cw_ab_get_cms_products($data['contentsection_id']);
        $allowed_product_ids = array_column($allowed_product_ids, 'id');
        if (!empty($allowed_product_ids) && is_array($allowed_product_ids)) {
            if (!in_array(intval($product_id), $allowed_product_ids)) {
                return false;
            }
        }
    }
    return true;
}
                                cw_add_top_message(cw_get_langvar_by_name('msg_ab_err_banner_image_not_uploaded_or_saved'), 'E');
                                cw_header_location('index.php?target=cms&mode=add');
                            }
                        }
                        break;
                }
                cw_event('on_cms_update', array($contentsection_id, $content_section));
                $presaved_content_section = array();
                cw_header_location('index.php?target=cms&mode=update&contentsection_id=' . $contentsection_id);
            }
            break;
    }
    cw_header_location('index.php?target=cms&mode=add');
}
$categories = cw_ab_get_cms_categories($contentsection_id);
$products = cw_ab_get_cms_products($contentsection_id);
$manufacturers = cw_ab_get_cms_manufacturers($contentsection_id);
$clean_urls = cw_ab_get_cms_clean_urls($contentsection_id);
$restricted_attributes = cw_ab_get_cms_restrict_attributes($contentsection_id);
$skins = cw_files_get_dir($app_dir . '/skins/addons/cms/skins', 2);
$skins = array_map('basename', $skins);
$presaved_content_section['image'] = 0;
//cw_image_get('cms_images', intval($presaved_content_section['contentsection_id']));
$attributes = cw_func_call('cw_attributes_get', array('item_id' => 0, 'item_type' => 'AB', 'language' => $edited_language));
if (!empty($contentsection_id)) {
    $query = "SELECT *, service_code as service_code FROM {$tables['cms']} WHERE contentsection_id = '" . intval($contentsection_id) . "'";
    $content_section = cw_query_first($query);
    if (!empty($content_section) && is_array($content_section) && $mode != 'add') {
        $content_section_alt_languages = cw_query_first("SELECT name, alt, url, content FROM {$tables['cms_alt_languages']} WHERE contentsection_id = '" . intval($contentsection_id) . "' AND code = '" . $current_language . "'");
        if (!empty($content_section_alt_languages) && is_array($content_section_alt_languages)) {
            $content_section['name'] = $content_section_alt_languages['name'];