Exemple #1
0
/**
 * Генерация карты XML.
 */
function sitemap_outXML()
{
    A::$CACHE->page = null;
    require_once "modules/sitemap/sitemap.php";
    $checkeds = getTextOption(getSectionByModule('sitemap'), 'sections');
    $checkeds = !empty($checkeds) ? unserialize($checkeds) : array();
    A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE lang='" . LANG . "' OR lang='all' ORDER BY sort");
    while ($row = A::$DB->fetchRow()) {
        if (in_array($row['id'], $checkeds)) {
            if (function_exists($row['module'] . '_createMap')) {
                $section = DOMAIN . "_" . $row['lang'] . "_" . $row['name'];
                if ($caption = !empty($row['caption_' . LANG]) ? $row['caption_' . LANG] : $row['caption']) {
                    call_user_func($row['module'] . "_createMap", A::$MAINFRAME->treemap, $section, $caption);
                }
            }
        }
    }
    A::$DB->free();
    require_once 'XML/Serializer.php';
    $options = array(XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_XML_ENCODING => "utf-8", XML_SERIALIZER_OPTION_INDENT => "\t", XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_ROOT_NAME => 'urlset', XML_SERIALIZER_OPTION_ROOT_ATTRIBS => array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'), XML_SERIALIZER_OPTION_DEFAULT_TAG => 'url');
    $serializer = new XML_Serializer($options);
    $data = array();
    sitemap_itemXML(A::$MAINFRAME->treemap, $data);
    $serializer->serialize($data);
    header("Content-type: text/xml; charset=utf-8");
    die($serializer->getSerializedData());
}
Exemple #2
0
function cfields_getfields($idcat, $section)
{
    static $cfields = null;
    static $fields = array();
    if (isset($fields[$section][$idcat])) {
        return $fields[$section][$idcat];
    }
    if (is_null($cfields)) {
        $cfields = getTextOption(getStructureByPlugin('cfields'), 'cfields');
        $cfields = !empty($cfields) ? unserialize($cfields) : array();
        $cfields = isset($cfields[$section]) ? $cfields[$section] : $cfields;
    }
    $cpath[] = $idcat;
    if ($idcat > 0) {
        $catrow = A::$DB->getRowById($idcat, $section . "_categories");
        $cpath[] = $catrow['idker'];
        while ($catrow = A::$DB->getRowById($catrow['idker'], $section . "_categories")) {
            $cpath[] = $catrow['idker'];
            if ($catrow['idker'] == 0) {
                break;
            }
        }
    }
    $fields[$section][$idcat] = array();
    foreach ($cpath as $idc) {
        if (!empty($cfields[$idc])) {
            foreach ($cfields[$idc] as $field) {
                $fields[$section][$idcat][$field] = 1;
            }
        }
    }
    return $fields[$section][$idcat];
}
Exemple #3
0
 /**
  * Обработчик действия: Отдает форму редактирования текста страницы.
  */
 function getPageForm()
 {
     $form = new A_Form("module_feedback_page.tpl");
     $form->data['content'] = getTextOption(SECTION, 'content');
     $this->RESULT['title'] = SECTION_NAME;
     $this->RESULT['html'] = $form->getContent();
 }
Exemple #4
0
 function createData()
 {
     $sections = array();
     A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE module='shoplite' OR module='catalog' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         $_section = DOMAIN . "_" . $row['lang'] . "_" . $row['name'];
         if (getFields($_section)) {
             $sections[$_section] = $row['caption'];
         }
     }
     A::$DB->free();
     $this->Assign("sections", $sections);
     if (!empty($_GET['section'])) {
         $_section = preg_replace("/[^a-zA-Z0-9_-]/i", "", $_GET['section']);
         if (isset($sections[$_section])) {
             $section = $_section;
             setcookie(STRUCTURE, $_GET['section'], time() + 31104000);
         }
     }
     if (empty($section)) {
         $section = preg_replace("/[^a-zA-Z0-9_-]/i", "", A_Session::get(STRUCTURE, isset($_COOKIE[STRUCTURE]) ? $_COOKIE[STRUCTURE] : key($sections)));
     }
     A_Session::set(STRUCTURE, $section);
     $this->Assign("section", $section);
     if (empty($section)) {
         return;
     }
     $categories = A::$DB->getAll("SELECT id,idker,name FROM {$section}_categories ORDER BY level,sort");
     $this->Assign("categories", $categories);
     $idcat = !empty($_GET['idcat']) ? (int) $_GET['idcat'] : 0;
     $_cfields = getTextOption(STRUCTURE, 'cfields');
     $_cfields = !empty($_cfields) ? unserialize($_cfields) : array();
     if (!isset($_cfields[$section])) {
         $_cfields[$section] = $_cfields;
     }
     $_cfields = !empty($_cfields[$section][$idcat]) ? $_cfields[$section][$idcat] : array();
     $cfields = cfields_getfields($idcat, $section);
     foreach ($cfields as $field => $value) {
         if (in_array($field, $_cfields)) {
             unset($cfields[$field]);
         }
     }
     $fields = array();
     A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='{$section}' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         $row['disabled'] = isset($cfields[$row['field']]);
         $row['checked'] = in_array($row['field'], $_cfields) || $row['disabled'];
         $row['caption'] = $row['name_' . LANG];
         $fields[] = $row;
     }
     A::$DB->free();
     $this->Assign("fields", $fields);
 }
Exemple #5
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     $checkeds = getTextOption(SECTION, 'sections');
     $checkeds = !empty($checkeds) ? unserialize($checkeds) : array();
     $sections = array();
     A::$DB->query("\r\r\n\tSELECT * FROM " . DOMAIN . "_sections\r\r\n\tWHERE lang='" . LANG . "' OR lang='all' AND module<>'sitemap'\r\r\n\tORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         if (function_exists($row['module'] . '_createMap')) {
             $row['checked'] = in_array($row['id'], $checkeds);
             $sections[] = $row;
         }
     }
     A::$DB->free();
     $this->Assign("sections", $sections);
     $this->AddJVar("csections", count($sections));
 }
Exemple #6
0
 /**
  * Формирование данных доступных в шаблоне главной страницы раздела.
  */
 function MainPage()
 {
     $this->Assign("form", $_REQUEST);
     $this->prepareAddForm();
     $this->Assign("content", getTextOption(SECTION, 'content'));
     $this->Assign("captcha", $captcha = substr(time(), rand(0, 6), 4));
     A_Session::set("captcha", md5($captcha));
     $this->AddNavigation(SECTION_NAME);
 }
Exemple #7
0
/**
 * Индексация страницы в базу поиска по сайту.
 *
 * @param string $section Полный строковой идентификатор раздела.
 */
function feedback_searchIndexAll($section)
{
    $idsec = getSectionId($section);
    $name = A::$DB->getOne("SELECT caption_" . A::$LANG . " FROM " . DOMAIN . "_sections WHERE id=" . $idsec);
    A_SearchEngine::getInstance()->updateIndex($idsec, 0, $name, getTextOption($section, 'content'));
}
Exemple #8
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     $this->Assign("maincontent", getTextOption(SECTION, 'content'));
     $types = array('string' => 'Строка', 'int' => 'Целое число', 'float' => 'Дробное число', 'bool' => 'Логический (Да/Нет)', 'date' => 'Дата', 'text' => 'Текст', 'format' => 'Форматированный текст', 'select' => 'Значение из списка', 'mselect' => 'Множество значений из списка', 'image' => 'Изображение', 'file' => 'Файл');
     $fields = array();
     A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='" . SECTION . "' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         $row['name'] = $row['name_' . DEFAULTLANG];
         $row['type'] = isset($types[$row['type']]) ? $types[$row['type']] : "";
         $fields[] = $row;
     }
     A::$DB->free();
     $this->Assign("fields", $fields);
     $arch = array();
     $pager = new A_Pager(20);
     $pager->tab = "arch";
     $pager->query("SELECT * FROM " . SECTION . "_arch ORDER BY date DESC");
     while ($row = $pager->fetchRow()) {
         $arch[] = $row;
     }
     $this->Assign("arch", $arch);
     $this->Assign("arch_pager", $pager);
     $this->Assign("optbox", new A_OptionsBox("", array("idgroup" => 1)));
 }
Exemple #9
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     $this->supportCached();
     $checkeds = getTextOption(SECTION, 'sections');
     $checkeds = !empty($checkeds) ? unserialize($checkeds) : array();
     A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE lang='" . LANG . "' OR lang='all' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         if (in_array($row['id'], $checkeds)) {
             if (function_exists($row['module'] . '_createMap')) {
                 $section = DOMAIN . "_" . $row['lang'] . "_" . $row['name'];
                 $caption = !empty($row['caption_' . LANG]) ? $row['caption_' . LANG] : $row['caption'];
                 call_user_func($row['module'] . "_createMap", $this->treemap, $section, $caption);
             }
         }
     }
     A::$DB->free();
     $this->Assign_by_ref("treemap", $this->treemap);
     $this->AddNavigation(SECTION_NAME);
 }