} } 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']; $content_section['alt'] = $content_section_alt_languages['alt']; $content_section['url'] = $content_section_alt_languages['url'];
/** * Event handler. * Check if current page meets CMS url restriction * * @see event on_cms_check_restrictions * * @return bool */ function cw_clean_url_on_cms_check_restrictions_URL($data) { global $tables, $app_web_dir, $request_prepared; $current_destination = str_replace($app_web_dir . '/', '', $request_prepared['REDIRECT_URL']); $urls = cw_ab_get_cms_clean_urls($data['contentsection_id']); if (!empty($urls) && is_array($urls)) { if (!cw_query_first_cell("SELECT count(*) FROM {$tables['cms_restrictions']} WHERE contentsection_id = '" . $data['contentsection_id'] . "' AND object_type='URL' AND value='" . $current_destination . "'")) { return false; } } return true; }