/** * Загрузка формы для редактирования раздела (подраздела) * * @param integer $section_id ИД Раздела * @param integer $parent_section ИД родителя если есть (для подразделов) * @return object xajaxResponse */ function loadFormEdit($section_id, $parent_section = false, $direct_id = null) { session_start(); if (!hasPermissions('seo')) { return false; } $objResponse = new xajaxResponse(); $is_edit = true; $seo = new seo($_SESSION['subdomain']); $subdomains = $seo->getSubdomains(false); if ($parent_section) { $sections = $seo->getSections(false, $direct_id); } $positions = $seo->getPositions($parent_section, $direct_id); $form_section = $seo->getSectionById($section_id); if ($direct_id) { $form_section['direct_id'] = $direct_id; } $subdomain_id = $form_section['subdomain_id']; $directions = $seo->getDirections(); $is_subcategory = $parent_section ? true : false; ob_start(); include $_SERVER['DOCUMENT_ROOT'] . '/catalog/admin/tpl.form-section.php'; $html = ob_get_clean(); $objResponse->assign("form_content", "innerHTML", $html); $objResponse->script("window.addEvent('domready', function() { var KeyWord = __key(1); KeyWord.bind(document.getElementById('kword_se'), kword, {bodybox:'body_1', maxlen:120}); CKEDITOR.replaceAll('ckeditor');});"); return $objResponse; }
$res = $seo->getSections(true, $direct_id); $sections = array(); if ($res) { foreach ($res as $row) { $sections[$row['direct_id']][] = $row; } } $cat_info = $seo->getSectionByName($_GET['cat'], false, $direct_id); if ($cat_info) { $catid = $cat_info['id']; $content_type = $content_type ? $content_type : 'dir'; } else { $catid = 0; $content_type = $content_type ? $content_type : 'direction'; } $subdomains = $seo->getSubdomains(); $rpath = '../'; $countries = $seo->getCountries(); if (empty($_GET['subdomain']) && empty($_GET['direction']) || !empty($_GET['subdomain']) && empty($_GET['direction'])) { if (empty($_GET['subdomain'])) { $seo = new seo('all'); } else { $seo = new seo($_GET['subdomain']); } $tmp_directions = $seo->getDirections(); foreach ($tmp_directions as $direction) { $directions[$direction['id']] = $direction; } $sections = $seo->getSectionsForMain(); $content = 'content-main.php'; } else {
break; case 4: $is_save = true; $msgtext = 'Ќаправление успешно изменено'; break; case 5: $is_save = true; $msgtext = 'ѕодраздел успешно добавлен'; break; case 6: $is_save = true; $msgtext = 'ѕодраздел успешно изменен'; break; } $sections = $seo->getSections(true, $direct_id); $subdomains = $seo->getSubdomains(false); $directions = $seo->getDirections(); $activeItems = json_decode(stripslashes($_COOKIE['seocatalogmenu'])); if (!$activeItems) { $activeItems = array(); } $action = $_POST['action']; switch ($action) { case "main": $update['meta_description'] = __paramInit("String", null, 'meta_description', null); $update['meta_keywords'] = __paramInit("String", null, 'meta_keywords', null); $update['content'] = __paramInit("String", null, 'content', null); $id = __paramInit('int', null, 'subdomain'); $seo->updateContentSubdomain($update, $id); $subdomain_id = $id; break;
<?php chdir(dirname(__FILE__)); require_once '../classes/stdf.php'; require_once '../classes/seo.php'; $seo = new seo(); $directions = $seo->getDirections($direct_id); $res = $seo->getSections(true, $direct_id); $sections = array(); if ($res) { foreach ($res as $row) { $sections[$row['direct_id']][] = $row; } } $subdomains = $seo->getSubdomains(true); foreach ($subdomains as $subdomain) { $f = fopen("./seo-data-{$subdomain['subdomain']}.csv", "w"); foreach ($directions as $direction) { if ($direction['id'] != 2 && $direction['id'] != 19 && $direction['id'] != 18 && $direction['id'] != 20 && $direction['id'] != 21 && $direction['id'] != 11 && $direction['id'] != 1) { fwrite($f, '"-' . $direction['dir_name'] . "\"\n"); if ($sections[$direction['id']]) { foreach ($sections[$direction['id']] as $key => $section) { fwrite($f, '"--' . $section['name_section'] . "\"\n"); if ($section['subsection']) { foreach ($section['subsection'] as $i => $subsection) { if ($subsection['subdomain_id'] == $subdomain['id']) { fwrite($f, '"---' . $subsection['name_section'] . "\"\n"); } } } }