/** * ВНЕШНИЕ МЕТОДЫ */ function displayLink() { global $AVE_Template, $mod; $AVE_Template->assign('page', base64_encode(get_redirect_link())); $AVE_Template->assign('theme_folder', $mod['theme_folder']); $AVE_Template->display($mod['tpl_dir'] . 'recommend_link.tpl'); }
function mod_recommend() { // require_once(BASE_DIR . '/modules/recommend/class.recommend.php'); // require_once(BASE_DIR . '/functions/func.modulglobals.php'); // // set_modul_globals('recommend'); // $recommend = new Recommend; // $recommend->displayLink(); ?> <a href="javascript:void(0);" onclick="popup('<?php echo ABS_PATH; ?> index.php?module=recommend&action=form&pop=1&theme_folder=ave&page=<?php echo base64_encode(get_redirect_link()); ?> ','recommend','500','380','1');">Рекомендовать сайт</a> <?php }
} } $phpwcms['output_action'] = count($phpwcms['output_function']) || count($phpwcms['output_section']) ? true : false; } else { $phpwcms['output_action'] = false; } } //define the current article category ID $content["cat_id"] = $aktion[0]; // set default to empty string, to get back the old behavior use // frontend_render and set // $content['body_id'] = $content["cat_id"]; $content['body_id'] = ''; // check if current level is a redirect level if (!empty($content['struct'][$content["cat_id"]]['acat_redirect'])) { $redirect = get_redirect_link($content['struct'][$content["cat_id"]]['acat_redirect']); headerRedirect($redirect['link'], 301); } // Check if curret level is forced for SSL if (!PHPWCMS_SSL && (!empty($phpwcms['site_ssl_mode']) || !empty($content['struct'][$content["cat_id"]]['acat_ssl']))) { headerRedirect($phpwcms['site_ssl_url'] . (count($_getVar) ? rel_url() : ''), 301); } //try to find current tree depth $LEVEL_ID = array(); $LEVEL_KEY = array(); $LEVEL_STRUCT = array(); $level_ID_array = get_breadcrumb($content["cat_id"], $content['struct']); $level_count = 0; foreach ($level_ID_array as $key => $value) { $LEVEL_ID[$level_count] = $key; $LEVEL_KEY[$key] = $level_count;
} elseif (is_file(PHPWCMS_TEMPLATE . 'inc_cntpart/tabs/' . $crow["acontent_template"])) { $tabs['template'] = render_device(@file_get_contents(PHPWCMS_TEMPLATE . 'inc_cntpart/tabs/' . $crow["acontent_template"])); } else { $tabs['template'] = ''; } if ($tabs['template']) { $tabs['entries'] = array(); $tabs['tmpl_entry'] = get_tmpl_section('TABS_ENTRY', $tabs['template']); $tabs['template'] = get_tmpl_section('TABS', $tabs['template']); foreach ($tabs['tabs'] as $key => $entry) { $tabs['entries'][$key] = render_cnt_template($tabs['tmpl_entry'], 'TABTITLE', $entry['tabtitle'] == '-' ? '' : html_specialchars($entry['tabtitle'])); $tabs['entries'][$key] = render_cnt_template($tabs['entries'][$key], 'TABCONTENT', trim($entry['tabheadline'] . $entry['tabtext']) == '' ? '' : LF); $tabs['entries'][$key] = render_cnt_template($tabs['entries'][$key], 'TABHEADLINE', html_specialchars($entry['tabheadline'])); $tabs['entries'][$key] = render_cnt_template($tabs['entries'][$key], 'TABTEXT', $entry['tabtext']); if (empty($entry['tablink'])) { $tabs['entries'][$key] = render_cnt_template($tabs['entries'][$key], 'TABLINK', ''); } else { $entry['tablink'] = get_redirect_link($entry['tablink'], ' ', ''); $tabs['entries'][$key] = render_cnt_template($tabs['entries'][$key], 'TABLINK', $entry['tablink']['link']); $tabs['entries'][$key] = str_replace('{TARGET}', $entry['tablink']['target'], $tabs['entries'][$key]); } } $tabs['template'] = render_cnt_template($tabs['template'], 'TITLE', html_specialchars($crow['acontent_title'])); $tabs['template'] = render_cnt_template($tabs['template'], 'SUBTITLE', html_specialchars($crow['acontent_subtitle'])); $tabs['template'] = render_cnt_template($tabs['template'], 'TABS_ENTRIES', count($tabs['entries']) ? implode('', $tabs['entries']) : ''); $CNT_TMP .= str_replace('{ID}', $crow['acontent_id'], $tabs['template']); } else { $CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]); $CNT_TMP .= LF . $crow["acontent_html"]; } unset($tabs);
$news['entries'][$key] = render_cnt_template($news['entries'][$key], 'CAPTION', html_specialchars($value['cnt_caption']['caption_text'])); $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'LIGHTBOX_CAPTION', parseLightboxCaption($value['cnt_caption']['caption_text'])); } // Image URL if (empty($value['cnt_object']['cnt_image']['link'])) { $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'IMAGE_URL', ''); $news['entries'][$key] = str_replace('{IMAGE_URL_TARGET}', '', $news['entries'][$key]); } else { $value['image_url'] = get_redirect_link($value['cnt_object']['cnt_image']['link'], ' ', ''); $news['entries'][$key] = str_replace('{IMAGE_URL_TARGET}', $value['image_url']['target'], $news['entries'][$key]); $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'IMAGE_URL', html_specialchars($value['image_url']['link'])); } // Check for Zoom $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'ZOOM', empty($value['cnt_object']['cnt_image']['zoom']) ? '' : 'zoom'); // news entry URL $value['news_url'] = $value['cnt_object']['cnt_link'] == '' ? array('link' => '', 'target' => '') : get_redirect_link($value['cnt_object']['cnt_link'], ' ', ''); $news['entries'][$key] = str_replace('{URL_TARGET}', $value['news_url']['target'], $news['entries'][$key]); if (is_numeric($value['news_url']['link']) && intval($value['news_url']['link'])) { $value['news_url']['link'] = 'index.php?aid=' . intval($value['news_url']['link']); } $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'URL', html_specialchars($value['news_url']['link'])); $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'URL_TEXT', html_specialchars($value['cnt_object']['cnt_linktext'])); // Dates $news['entries'][$key] = render_cnt_date($news['entries'][$key], $value['cnt_changed'], $value['cnt_ts_livedate'], $value['cnt_ts_killdate']); $news['entries'][$key] = render_date($news['entries'][$key], $value['cnt_ts_sortdate'], 'SORTDATE'); $news['files_result'] = ''; // Files if (isset($value['cnt_object']['cnt_files']['id']) && is_array($value['cnt_object']['cnt_files']['id']) && count($value['cnt_object']['cnt_files']['id'])) { // should image files used for gallery if (!empty($value['cnt_object']['cnt_files']['gallery']) && strpos($news['entries'][$key], '/GALLERY')) { if (!$news['config']['gallery_allowed_ext']) {
$row['gross'] = $row['shopprod_price']; } else { // price given is NET price, excluding VAT $row['net'] = $row['shopprod_price']; $row['gross'] = $row['shopprod_price'] * (1 + $row['vat'] / 100); } $row['vat'] = number_format($row['vat'], $row['vat_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']); $row['net'] = number_format($row['net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']); $row['gross'] = number_format($row['gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']); $row['weight'] = $row['shopprod_weight'] > 0 ? number_format($row['shopprod_weight'], $_tmpl['config']['weight_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']) : ''; $row['shopprod_var'] = @unserialize($row['shopprod_var']); // check custom product URL if (empty($row['shopprod_var']['url'])) { $row['prod_url'] = array('link' => '', 'target' => ''); } else { $row['prod_url'] = get_redirect_link($row['shopprod_var']['url'], ' ', ''); $row['prod_url']['link'] = html($row['prod_url']['link']); } // select template based on listing or detail view $entry[$x] = $shop_detail_id ? $_tmpl['detail'] : $_tmpl['list_entry']; // get the value from the textarea for options, prepare the data, write select drop down //order options 1 $_cart_prod_opt1 = ''; if ($row['shopprod_size'] && ($_cart_opt_1 = explode(LF, $row['shopprod_size']))) { foreach ($_cart_opt_1 as $key => $value) { //title - first row in textarea - string if ($key === 0 && ($value = trim($value))) { $_cart_prod_opt1 .= '<option value="0">' . html($value) . '</option>'; continue; } $value = get_shop_option_value($value);
/** * Метод, предназанченный для сборки всей страницы в единое целое. * * @param int $id идентификатор документа * @param int $rub_id идентификатор рубрики */ function coreSiteFetch($id, $rub_id = '') { global $AVE_DB; // Если происходит вызов модуля, получаем соответствующие мета-теги и получаем шаблон модуля if (!empty($_REQUEST['module'])) { $out = $this->_coreModuleMetatagsFetch(); $out = $this->_coreDocumentTemplateGet('', '', $this->_coreModuleTemplateGet()); } else { if (!isset($this->curentdoc->Id) && !$this->_coreCurrentDocumentFetch($id, UGROUP)) { // Определяем документ с 404 ошиюкой, в случае, если документ не найден if ($this->_corePageNotFoundFetch(PAGE_NOT_FOUND_ID, UGROUP)) { $_REQUEST['id'] = $_GET['id'] = $id = PAGE_NOT_FOUND_ID; } } // проверяем параметры публикации документа if (!$this->_coreDocumentIsPublished()) { $this->_coreErrorPage404(); } // Определяем права доступа к документам рубрики define('RUB_ID', !empty($rub_id) ? $rub_id : $this->curentdoc->rubric_id); $this->_coreRubricPermissionFetch(RUB_ID); if (!(isset($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1 || isset($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) { // читать запрещено - извлекаем ругательство и отдаём вместо контента $main_content = get_settings('message_forbidden'); } else { if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) { // увеличиваем счетчик версий для печати $AVE_DB->Query("\n\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\tSET document_count_print = document_count_print+1\n\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t"); } else { if (!isset($_SESSION['doc_view'][$id])) { // увеличиваем счетчик просмотров (1 раз в пределах сессии) $AVE_DB->Query("\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\t\tSET document_count_view = document_count_view+1\n\t\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t\t"); $_SESSION['doc_view'][$id] = time(); } $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y")); if (!isset($_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'])) { // и подневный счетчик просмотров тоже увеличиваем $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $AVE_DB->Query("\n UPDATE\n " . PREFIX . "_view_count\n SET\n count = count + 1\n WHERE\n document_id = '" . $id . "' AND\n day_id = '" . $curdate . "'\n "); if (!$AVE_DB->_handle->affected_rows) { $AVE_DB->Query("\n INSERT INTO " . PREFIX . "_view_count (\n document_id,\n day_id,\n count\n )\n VALUES (\n '" . $id . "', '" . $curdate . "', '1'\n )\n "); } $_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'] = time(); } } if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) { // кэширование разрешено // извлекаем скомпилированный шаблон документа из кэша $main_content = $AVE_DB->Query("\n\t\t\t\t\t\tSELECT compiled\n\t\t\t\t\t\tFROM " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\tWHERE hash = '" . $this->_get_cache_hash() . "'\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t")->GetCell(); } else { // кэширование запрещено $main_content = false; } if (empty($main_content)) { // кэш пустой или отключен, извлекаем и компилируем шаблон if (!empty($this->curentdoc->rubric_template)) { $rubTmpl = $this->curentdoc->rubric_template; } else { $rubTmpl = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t")->GetCell(); } $rubTmpl = trim($rubTmpl); if (empty($rubTmpl)) { // не задан шаблон рубрики $main_content = $this->_rubric_template_empty; } else { // парсим теги полей в шаблоне документа $main_content = preg_replace_callback('/\\[tag:fld:([a-zA-Z0-9-_]+)\\]/', 'document_get_field', $rubTmpl); $main_content = preg_replace_callback('/\\[tag:([r|c|f|t]\\d+x\\d+r*):(.+?)]/', 'callback_make_thumbnail', $main_content); // удаляем ошибочные теги полей $main_content = preg_replace('/\\[tag:fld:\\d*\\]/', '', $main_content); if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) { // кэширование разрешено // сохраняем скомпилированный шаблон в кэш $AVE_DB->Query("\n\t\t\t\t\t\t\t\tINSERT " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\thash = '" . $this->_get_cache_hash() . "',\n\t\t\t\t\t\t\t\t\trub_id = '" . RUB_ID . "',\n\t\t\t\t\t\t\t\t\tgrp_id = '" . UGROUP . "',\n\t\t\t\t\t\t\t\t\tdoc_id = '" . $id . "',\n\t\t\t\t\t\t\t\t\tcompiled = '" . addslashes($main_content) . "'\n\t\t\t\t\t\t\t"); } } } $main_content = preg_replace('/\\[tag:date:([a-zA-Z0-9-]+)\\]/e', "RusDate(date('\$1', " . $this->curentdoc->document_published . "))", $main_content); $main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content); $main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content); $main_content = str_replace('[tag:docauthorid]', $this->curentdoc->document_author_id, $main_content); $main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content); } $out = str_replace('[tag:maincontent]', $main_content, $this->_coreDocumentTemplateGet(RUB_ID)); } // /вывод документа //Работа с условиями /* $out = preg_replace('/\[tag:if_exp:?(.*)\]/u', '<?php $my_exp000=true; $my_exp0001=\'$my_exp000=\'. str_replace(\'#var#\',\'$\',<<<BLOCK $1; BLOCK ); @eval($my_exp0001); if($my_exp000==true) { ?>', $out); $out = str_replace('[tag:if_exp_else]', '<?php }else{ ?>', $out); $out = str_replace('[tag:/if_exp]', '<?php } ?>', $out); */ // Тут мы вводим в хеадер иньекцию скриптов. if (defined('RUB_ID')) { $rubheader = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_header_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t", CACHE_LIFETIME)->GetCell(); $out = str_replace('[tag:rubheader]', $rubheader . '[tag:rubheader]', $out); } $out = preg_replace('/\\[tag:rfld:([a-zA-Z0-9-_]+)]\\[(more|esc|img|[0-9-]+)]/e', "request_get_document_field(\"\$1\", {$id}, \"\$2\")", $out); // Если в запросе пришел параметр print, т.е. страница для печати, парсим контент, который обрамлен // тегами только для печати if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) { $out = str_replace(array('[tag:if_print]', '[/tag:if_print]'), '', $out); $out = preg_replace('/\\[tag:if_notprint\\](.*?)\\[\\/tag:if_notprint\\]/si', '', $out); } else { // В противном случае наоборот, парсим только тот контент, который предназначен НЕ для печати $out = preg_replace('/\\[tag:if_print\\](.*?)\\[\\/tag:if_print\\]/si', '', $out); $out = str_replace(array('[tag:if_notprint]', '[/tag:if_notprint]'), '', $out); } // получаем из шаблона системный тег, определяющий название темы дизайна $match = ''; preg_match('/\\[tag:theme:(\\w+)]/', $out, $match); define('THEME_FOLDER', empty($match[1]) ? DEFAULT_THEME_FOLDER : $match[1]); $out = preg_replace('/\\[tag:theme:(.*?)]/', '', $out); // парсим теги модулей $out = $this->coreModuleTagParse($out); if (isset($_REQUEST['module']) && !(isset($this->install_modules[$_REQUEST['module']]) && '1' == $this->install_modules[$_REQUEST['module']]->ModuleStatus)) { display_notice($this->_module_error); } // парсим теги системных блоков $out = preg_replace_callback('/\\[tag:sysblock:([0-9-]+)\\]/', 'parse_sysblock', $out); // парсим теги системы внутренних запросов $out = preg_replace_callback('/\\[tag:request:(\\d+)\\]/', 'request_parse', $out); // парсим теги навигации $out = preg_replace_callback('/\\[tag:navigation:(\\d+):?([0-9,]*)\\]/', 'parse_navigation', $out); // парсим теги скрытого текста $out = parse_hide($out); // парсим остальные теги основного шаблона $search = array('[tag:mediapath]', '[tag:path]', '[tag:sitename]', '[tag:document]', '[tag:alias]', '[tag:home]', '[tag:robots]', '[tag:canonical]', '[tag:docid]', '[tag:breadcrumb]'); $replace = array(ABS_PATH . 'templates/' . THEME_FOLDER . '/', ABS_PATH, htmlspecialchars(get_settings('site_name'), ENT_QUOTES), get_redirect_link('print'), @$this->curentdoc->document_alias, get_home_link(), isset($this->curentdoc->document_meta_robots) ? $this->curentdoc->document_meta_robots : '', canonical($_SERVER['REQUEST_URI']), isset($this->curentdoc->Id) ? $this->curentdoc->Id : '', get_breadcrumb()); if (defined('MODULE_CONTENT')) { // парсинг тегов при выводе из модуля $search[] = '[tag:maincontent]'; $replace[] = MODULE_CONTENT; $search[] = '[tag:title]'; $replace[] = htmlspecialchars(defined('MODULE_SITE') ? MODULE_SITE : '', ENT_QUOTES); $search[] = '[tag:description]'; $replace[] = htmlspecialchars(defined('MODULE_DESCRIPTION') ? MODULE_DESCRIPTION : '', ENT_QUOTES); $search[] = '[tag:keywords]'; $replace[] = htmlspecialchars(defined('MODULE_KEYWORDS') ? MODULE_KEYWORDS : '', ENT_QUOTES); } else { $search[] = '[tag:keywords]'; $replace[] = isset($this->curentdoc->document_meta_keywords) ? htmlspecialchars($this->curentdoc->document_meta_keywords, ENT_QUOTES) : ''; $search[] = '[tag:description]'; $replace[] = isset($this->curentdoc->document_meta_description) ? htmlspecialchars($this->curentdoc->document_meta_description, ENT_QUOTES) : ''; $search[] = '[tag:title]'; $replace[] = htmlspecialchars(pretty_chars($this->curentdoc->document_title), ENT_QUOTES); } $search[] = '[tag:maincontent]'; $replace[] = ''; $search[] = '[tag:printlink]'; $replace[] = get_print_link(); $search[] = '[tag:version]'; $replace[] = APP_INFO; $search[] = '[tag:docviews]'; $replace[] = isset($this->curentdoc->document_count_view) ? $this->curentdoc->document_count_view : ''; // парсим тизер документа $out = preg_replace('/\\[tag:teaser:(\\d+)\\]/e', "showteaser(\$1)", $out); if (defined('RUB_ID')) { $out = preg_replace('/\\[tag:docauthoravatar:(\\d+)\\]/e', "getAvatar(" . intval($this->curentdoc->document_author_id) . ",\"\$1\")", $out); } if (defined('RUB_ID')) { $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($AVE_Core->curentdoc->document_lang=="$1") { ?>', $out); } else { $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($_SESSION["user_language"]=="$1") { ?>', $out); } $out = str_replace('[tag:/lang]', '<?php } ?>', $out); // парсим остальные теги основного шаблона $out = str_replace($search, $replace, $out); unset($search, $replace); // парсим теги для combine.php $out = preg_replace_callback('/\\[tag:(css|js):([^ :\\/]+):?(\\S+)*\\]/', array($this, '_parse_combine'), $out); // ЧПУ $out = rewrite_link($out); echo $out; }
/** * Return Link based on given structure level data * * @param mixed - structure level [integer] ID or Array(acat_redirect,acat_alias,acat_id,acat_name) * @param string - additional link attributes * @param string - link prefix * @param string - link suffix */ function getStructureLevelLink($acat, $attributes = '', $prefix = '', $suffix = '') { if (!is_array($acat)) { $id = is_int($acat) ? intval($acat) : -1; if ($id >= 0 && isset($GLOBALS['content']['struct'][$id])) { $acat =& $GLOBALS['content']['struct'][$id]; } else { $acat = trim($acat); if (empty($acat)) { return ''; } return $prefix . html_specialchars($acat) . $suffix; } } if ($acat['acat_redirect'] == false) { $target = ''; $link = rel_url(array(), array('newsdetail'), empty($acat['acat_alias']) ? 'id=' . $acat['acat_id'] : $acat['acat_alias']); } else { $redirect = get_redirect_link($acat['acat_redirect'], ' ', ''); $target = $redirect['target']; $link = $redirect['link']; } return trim('<a href="' . $link . '"' . $target . ' ' . $attributes) . '>' . $prefix . html_specialchars($acat['acat_name']) . $suffix . '</a>'; }
/** * Метод, предназначенный для получения из БД всех комментариев, относящихся к указанному * документу с последующим выводом в Публичной части. * * @param string $tpl_dir - путь к шаблонам модуля * * @todo Вывод информации о авторе комментария */ function commentListShow($tpl_dir) { global $AVE_DB, $AVE_Template; // Проверяем, что в настройках модуля разрешено комментирование документов if ($this->_commentSettingsGet('comment_active') == 1) { $assign['display_comments'] = 1; // Если группа пользователя, который в текущий момент просматривает документ попадает в список // разрешенных (в настройках модуля), тогда создаем флаг, который будет разрешать к показу // форму для добавления нового комментария if (in_array(UGROUP, explode(',', $this->_commentSettingsGet('comment_user_groups')))) { $assign['cancomment'] = 1; } $assign['comment_max_chars'] = $this->_commentSettingsGet('comment_max_chars'); $assign['im'] = $this->_commentSettingsGet('comment_use_antispam'); // Выполняем запрос к БД на получение количества комментариев для текущего документа $comments = array(); $sql = $AVE_DB->Query("\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM " . PREFIX . "_modul_comment_info\r\n\t\t\t\tWHERE document_id = '" . (int) $_REQUEST['id'] . "'\r\n\t\t\t\t" . (UGROUP == 1 ? '' : "AND comment_status = '1'") . "\r\n\t\t\t\tORDER BY comment_published ASC\r\n\t\t\t"); // Получаем формат даты, который указан в общих настройках системы и // приводим дату создания комментария и дату редактирования к этому формату $date_time_format = $AVE_Template->get_config_vars('COMMENT_DATE_TIME_FORMAT'); while ($row = $sql->FetchAssocArray()) { $row['comment_published'] = strftime($date_time_format, $row['comment_published']); $row['comment_changed'] = strftime($date_time_format, $row['comment_changed']); // if ($row['parent_id'] == 0) // $row['comment_text'] = nl2br(wordwrap($row['comment_text'], 100, "\n", true)); // else // $row['comment_text'] = nl2br(wordwrap($row['comment_text'], 90, "\n", true)); // $row['comment_text'] = nl2br($row['comment_text']); $comments[$row['parent_id']][] = $row; } // Формируем ряд переменных для использования в шаблоне $assign['closed'] = @$comments[0][0]['comments_close']; $assign['comments'] = $comments; $assign['theme'] = defined('THEME_FOLDER') ? THEME_FOLDER : DEFAULT_THEME_FOLDER; $assign['doc_id'] = (int) $_REQUEST['id']; $assign['page'] = base64_encode(get_redirect_link()); $assign['subtpl'] = $tpl_dir . $this->_comments_tree_sub_tpl; $AVE_Template->assign($assign); // Отображаем шаблон $AVE_Template->display($tpl_dir . $this->_comments_tree_tpl); } }
function css_level_list(&$struct, $struct_path, $level, $parent_level_name = '', $parent_level = 1, $class = '') { // returns list <div><ul><li></li></ul></div> of the current structure level // if $parent_level=1 the first list entry will be the parent level // $parent_level=0 - only the list of all levels in this structure // if $parent_leve_name != "" then it uses the given string // predefined class for this menu is "list_level" if (!trim($class)) { $class = 'list_level'; } $parent_level_name = trim($parent_level_name); $level = intval($level); $parent_level = intval($parent_level); $activated = 0; $css_list = ''; //returns the complete level of NON hidden categories $level_struct = return_struct_level($struct, $level); $breadcrumb = get_breadcrumb(key($struct_path), $struct); foreach ($level_struct as $key => $value) { if (!$level_struct[$key]["acat_redirect"]) { $link = 'index.php?'; if ($level_struct[$key]["acat_alias"]) { $link .= html_specialchars($level_struct[$key]["acat_alias"]); } else { $link .= 'id=' . $key; } $redirect['target'] = ''; } else { $redirect = get_redirect_link($level_struct[$key]["acat_redirect"], ' ', ''); $link = $redirect['link']; } $css_list .= ' <li'; $liclass = trim((empty($breadcrumb[$key]) ? '' : 'active ') . $level_struct[$key]["acat_class"]); $css_list .= empty($liclass) ? '' : ' class="' . $liclass . '"'; $css_list .= '><a href="' . $link . '"' . $redirect['target'] . '>'; $css_list .= html_specialchars($level_struct[$key]["acat_name"]); $css_list .= '</a></li>' . LF; } if ($parent_level) { if (!$struct[$level]["acat_redirect"]) { $link = 'index.php?'; if ($struct[$level]["acat_alias"]) { $link .= html_specialchars($struct[$level]["acat_alias"]); } else { $link .= 'id=' . $level; } $redirect['target'] = ''; } else { $redirect = get_redirect_link($struct[$level]["acat_redirect"], ' ', ''); $link = $redirect['link']; } $css_list_home = ' <li class="' . trim(($GLOBALS['aktion'][0] == $level ? 'active' : 'parent') . ' ' . $struct[$level]["acat_class"]) . '">'; $css_list_home .= '<a href="' . $link . '"' . $redirect['target'] . '>'; $css_list_home .= html_specialchars(!$parent_level_name ? $struct[$level]["acat_name"] : $parent_level_name); $css_list_home .= '</a></li>' . LF; $css_list = $css_list_home . $css_list; } if ($css_list) { $css_list = LF . '<ul class="' . $class . '">' . LF . $css_list . '</ul>' . LF; } return $css_list; }
function render() { $items = array('top' => array(), 'default' => array(), 'bottom' => array(), 'hide' => array()); $now = now(); foreach ($this->dates as $key => $date) { $url = ''; $target = ''; $href = $this->href ? $this->href . '&show_date=' . date('Y-m-d', $date['calendar_start_date']) . '_' . $date['calendar_id'] : ''; $itemgroup = 'default'; if ($date['calendar_range']) { $date['calendar_range_start_date'] = strtotime($date['calendar_range_start'] . ' ' . date('H:i', $date['calendar_start_date'])); $date['calendar_range_end_date'] = strtotime($date['calendar_range_end']); $expired_date = $this->expired === 'START' ? 'calendar_range_start_date' : 'calendar_range_end_date'; } else { $expired_date = $this->expired === 'START' ? 'calendar_start_date' : 'calendar_end_date'; } if ($this->expired !== '' && $date[$expired_date] < $now) { if ($this->expired === 'bottom' || $this->expired === 'top') { $itemgroup = $this->expired; } elseif ($this->expired === 'hide') { unset($this->dates[$key]); continue; } } if (!empty($date['calendar_refid'])) { $date['calendar_refid'] = get_redirect_link($date['calendar_refid'], ' ', ''); $date['calendar_refid']['link'] = trim($date['calendar_refid']['link']); $date['calendar_refid']['link'] = trim($date['calendar_refid']['link'], '#'); $target = $date['calendar_refid']['target']; if (is_intval($date['calendar_refid']['link'])) { $url = rel_url(array(), array(), 'aid=' . $date['calendar_refid']['link']); //'index.php?aid='.$date['calendar_refid']['link']; } elseif (strpos($date['calendar_refid']['link'], '://') || strpos($date['calendar_refid']['link'], '?') || strpos($date['calendar_refid']['link'], '.')) { $url = $date['calendar_refid']['link']; } elseif (!empty($date['calendar_refid']['link'])) { $url = rel_url(array(), array(), $date['calendar_refid']['link']); } } // Split title/type if ($this->gettype !== '') { $date['calendar_title'] = explode($this->gettype, $date['calendar_title'], 2); $date['calendar_type'] = empty($date['calendar_title'][1]) ? '' : trim($date['calendar_title'][1]); $date['calendar_title'] = trim($date['calendar_title'][0]); } else { $date['calendar_type'] = ''; } if ($date['calendar_teaser']) { if ($this->teaserwords) { $date['calendar_teaser'] = getCleanSubString($date['calendar_teaser'], $this->teaserwords, $GLOBALS['template_default']['ellipse_sign'], 'word'); } $date['calendar_teaser'] = plaintext_htmlencode($date['calendar_teaser']); } $items[$itemgroup][$key] = $this->template; $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'HREF', $href); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'URL', $url); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TARGET', $target); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TITLE', html_specialchars($date['calendar_title'])); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TYPE', $date['calendar_type'] ? html_specialchars($date['calendar_type']) : ''); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TEASER', $date['calendar_teaser']); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TEXT', $date['calendar_text']); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'PLACE', html_specialchars($date['calendar_where'])); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'ALLDAY', $date['calendar_allday'] ? ' ' : ''); // Detect if range date if ($date['calendar_range']) { $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'RANGEDATE', ' '); $items[$itemgroup][$key] = render_cnt_date($items[$itemgroup][$key], $date['calendar_range_start_date'], $date['calendar_range_start_date'], $date['calendar_range_end_date']); } else { $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'RANGEDATE', ''); } $items[$itemgroup][$key] = render_cnt_date($items[$itemgroup][$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']); } if (!count($items['default']) && !count($items['top']) && !count($items['bottom'])) { $items['default'][] = str_replace('{CALENDAR_RESET}', $this->resetCalendarLink(), $this->no_calendar_item_found); } elseif ($this->expired && count($items[$this->expired])) { array_unshift($items[$this->expired], $this->expired_prefix); $items[$this->expired][] = $this->expired_suffix; if ($this->expired === 'top') { $items = implode(LF, $items['top']) . LF . implode(LF, $items['default']); } else { $items = implode(LF, $items['default']) . LF . implode(LF, $items['bottom']); } } else { $items = implode(LF, $items['default']); } return $items; }
<?php /** * * * @package AVE.cms * @subpackage module_Forums * @filesource */ if (!defined("SHOWTOPIC")) { exit; } global $AVE_DB, $AVE_Template, $mod; $_REQUEST['page'] = isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) && $_REQUEST['page'] > 0 ? $_REQUEST['page'] : 1; $printlink = get_redirect_link('print') . "&print=1"; $post_count_extra = ""; $post_query_extra = ""; // alle postings fьr einen thread anzeigen if (isset($_GET['toid']) && $_GET['toid'] != "") { // gibt es den topic und das posting ueberhaupt schon if (!$this->topicExists(addslashes($_GET['toid']))) { $this->msg($mod['config_vars']['FORUMS_ERROR_TOPIC_WRONG']); } $navigation = $this->getNavigation((int) $_GET['toid'], "topic"); // ueberpruefen ob das forum passwortgeschuetzt ist // und ob der benutzer sich schon angemeldet hat $q_pass = "******" . PREFIX . "_modul_forum_forum AS f,\r\n\t\t\t" . PREFIX . "_modul_forum_topic AS t\r\n\t\tWHERE\r\n\t\t\tt.id = '" . (int) $_GET['toid'] . "' AND\r\n\t\t\tt.forum_id = f.id\r\n\t"; $r_pass = $AVE_DB->Query($q_pass); $pass = $r_pass->FetchRow(); $ForumId = $pass->id; $pass_b = false;
function localRedir() { $r = get_redirect_link(); $r2 = explode('index.php', $r); $r3 = $r2[0]; $r4 = $this->DL_Rewrite("index.php" . $r2[1]); $r4 = str_replace("&", "&", $r4); $File_URL = $r2[0] . $r4; return $File_URL; }
$modul['Status'] = 1; $modul['IstFunktion'] = 0; $modul['ModulTemplate'] = 1; $modul['AdminEdit'] = 1; $modul['ModulFunktion'] = null; $modul['CpEngineTagTpl'] = '<b>Ссылка:</b> <a target="_blank" href="../index.php?module=shop">index.php?module=shop</a>'; $modul['CpEngineTag'] = null; $modul['CpPHPTag'] = null; } //if ((isset($_REQUEST['module']) && $_REQUEST['module'] == 'shop' && UGROUP != '2') || (isset($_REQUEST['mod']) && $_REQUEST['mod'] == 'shop')) if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'shop' || isset($_REQUEST['mod']) && $_REQUEST['mod'] == 'shop') { if (defined('SSLMODE') && SSLMODE == 1 && $_SERVER['SERVER_PORT'] == '80') { header('Location:' . get_redirect_link()); } if (defined('SSLMODE') && SSLMODE != 1 && $_SERVER['SERVER_PORT'] == '443') { header('Location:' . get_redirect_link()); } //======================================================= // Klasse einbinden //======================================================= if (defined('ACP') && !(isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { require_once BASE_DIR . '/modules/shop/class.shop_admin.php'; } else { require_once BASE_DIR . '/modules/shop/class.shop.php'; } require_once BASE_DIR . '/modules/shop/funcs/func.parent_categ.php'; require_once BASE_DIR . '/modules/shop/funcs/func.rewrite.php'; if (defined('THEME_FOLDER')) { $AVE_Template->assign('shop_images', 'templates/' . THEME_FOLDER . '/modules/shop/'); } if (defined('THEME_FOLDER')) {
/** * Метод, предназанченный для сборки всей страницы в единое целое. * * @param int $id идентификатор документа * @param int $rub_id идентификатор рубрики */ function coreSiteFetch($id, $rub_id = '') { global $AVE_DB; // Если происходит вызов модуля, получаем соответствующие мета-теги и получаем шаблон модуля if (!empty($_REQUEST['module'])) { $out = $this->_coreModuleMetatagsFetch(); $out = $this->_coreDocumentTemplateGet('', '', $this->_coreModuleTemplateGet()); } else { if (!isset($this->curentdoc->Id) && !$this->_coreCurrentDocumentFetch($id, UGROUP)) { // Определяем документ с 404 ошиюкой, в случае, если документ не найден if ($this->_corePageNotFoundFetch(PAGE_NOT_FOUND_ID, UGROUP)) { $_REQUEST['id'] = $_GET['id'] = $id = PAGE_NOT_FOUND_ID; } } // проверяем параметры публикации документа if (!$this->_coreDocumentIsPublished()) { $this->_coreErrorPage404(); } // Определяем права доступа к документам рубрики define('RUB_ID', !empty($rub_id) ? $rub_id : $this->curentdoc->rubric_id); $this->_coreRubricPermissionFetch(RUB_ID); if (!(isset($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1 || isset($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) { // читать запрещено - извлекаем ругательство и отдаём вместо контента $main_content = get_settings('message_forbidden'); } else { if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) { // увеличиваем счетчик версий для печати $AVE_DB->Query("\r\n\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\r\n\t\t\t\t\t\tSET document_count_print = document_count_print+1\r\n\t\t\t\t\t\tWHERE Id = '" . $id . "'\r\n\t\t\t\t\t"); } else { if (!isset($_SESSION['doc_view[' . $id . ']'])) { // увеличиваем счетчик просмотров (1 раз в пределах сессии) $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\r\n\t\t\t\t\t\t\tSET document_count_view = document_count_view+1\r\n\t\t\t\t\t\t\tWHERE Id = '" . $id . "'\r\n\t\t\t\t\t\t"); $_SESSION['doc_view[' . $id . ']'] = 1; } } if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) { // кэширование разрешено // извлекаем скомпилированный шаблон документа из кэша $main_content = $AVE_DB->Query("\r\n\t\t\t\t\t\tSELECT compiled\r\n\t\t\t\t\t\tFROM " . PREFIX . "_rubric_template_cache\r\n\t\t\t\t\t\tWHERE hash = '" . $this->_get_cache_hash() . "'\r\n\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t")->GetCell(); } else { // кэширование запрещено $main_content = false; } if (empty($main_content)) { // кэш пустой или отключен, извлекаем и компилируем шаблон if (!empty($this->curentdoc->rubric_template)) { $rubTmpl = $this->curentdoc->rubric_template; } else { $rubTmpl = $AVE_DB->Query("\r\n\t\t\t\t\t\t\tSELECT rubric_template\r\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\r\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\r\n\t\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t\t")->GetCell(); } $rubTmpl = trim($rubTmpl); if (empty($rubTmpl)) { // не задан шаблон рубрики $main_content = $this->_rubric_template_empty; } else { // парсим теги полей в шаблоне документа $main_content = preg_replace_callback('/\\[tag:fld:(\\d+)\\]/', 'document_get_field', $rubTmpl); // удаляем ошибочные теги полей $main_content = preg_replace('/\\[tag:fld:\\d*\\]/', '', $main_content); if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) { // кэширование разрешено // сохраняем скомпилированный шаблон в кэш $AVE_DB->Query("\r\n\t\t\t\t\t\t\t\tINSERT " . PREFIX . "_rubric_template_cache\r\n\t\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\t\thash = '" . $this->_get_cache_hash() . "',\r\n\t\t\t\t\t\t\t\t\trub_id = '" . RUB_ID . "',\r\n\t\t\t\t\t\t\t\t\tgrp_id = '" . UGROUP . "',\r\n\t\t\t\t\t\t\t\t\tdoc_id = '" . $id . "',\r\n\t\t\t\t\t\t\t\t\tcompiled = '" . addslashes($main_content) . "'\r\n\t\t\t\t\t\t\t"); } } } $main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content); $main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content); $main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content); } $out = str_replace('[tag:maincontent]', $main_content, $this->_coreDocumentTemplateGet(RUB_ID)); } // /вывод документа // Если в запросе пришел параметр print, т.е. страница для печати, парсим контент, который обрамлен // тегами только для печати if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) { $out = str_replace(array('[tag:if_print]', '[/tag:if_print]'), '', $out); $out = preg_replace('/\\[tag:if_notprint\\](.*?)\\[\\/tag:if_notprint\\]/si', '', $out); } else { // В противном случае наоборот, парсим только тот контент, который предназначен НЕ для печати $out = preg_replace('/\\[tag:if_print\\](.*?)\\[\\/tag:if_print\\]/si', '', $out); $out = str_replace(array('[tag:if_notprint]', '[/tag:if_notprint]'), '', $out); } // получаем из шаблона системный тег, определяющий название темы дизайна $match = ''; preg_match('/\\[tag:theme:(\\w+)]/', $out, $match); define('THEME_FOLDER', empty($match[1]) ? DEFAULT_THEME_FOLDER : $match[1]); $out = preg_replace('/\\[tag:theme:(.*?)]/', '', $out); // парсим теги модулей $out = $this->coreModuleTagParse($out); if (isset($_REQUEST['module']) && !(isset($this->install_modules[$_REQUEST['module']]) && '1' == $this->install_modules[$_REQUEST['module']]->Status)) { display_notice($this->_module_error); } // парсим теги системы внутренних запросов $out = preg_replace_callback('/\\[tag:request:(\\d+)\\]/', 'request_parse', $out); // парсим теги скрытого текста $out = parse_hide($out); // парсим остальные теги основного шаблона $search = array('[tag:mediapath]', '[tag:path]', '[tag:sitename]', '[tag:document]', '[tag:home]', '[tag:robots]', '[tag:docid]', '[tag:breadcrumb]'); $replace = array(ABS_PATH . 'templates/' . THEME_FOLDER . '/', ABS_PATH, htmlspecialchars(get_settings('site_name'), ENT_QUOTES), get_redirect_link('print'), get_home_link(), isset($this->curentdoc->document_meta_robots) ? $this->curentdoc->document_meta_robots : '', isset($this->curentdoc->Id) ? $this->curentdoc->Id : '', get_breadcrumb()); if (defined('MODULE_CONTENT')) { // парсинг тегов при выводе из модуля $search[] = '[tag:maincontent]'; $replace[] = MODULE_CONTENT; $search[] = '[tag:title]'; $replace[] = htmlspecialchars(defined('MODULE_SITE') ? MODULE_SITE : '', ENT_QUOTES); $search[] = '[tag:description]'; $replace[] = htmlspecialchars(defined('MODULE_DESCRIPTION') ? MODULE_DESCRIPTION : '', ENT_QUOTES); $search[] = '[tag:keywords]'; $replace[] = htmlspecialchars(defined('MODULE_KEYWORDS') ? MODULE_KEYWORDS : '', ENT_QUOTES); } else { $search[] = '[tag:keywords]'; $replace[] = isset($this->curentdoc->document_meta_keywords) ? htmlspecialchars($this->curentdoc->document_meta_keywords, ENT_QUOTES) : ''; $search[] = '[tag:description]'; $replace[] = isset($this->curentdoc->document_meta_description) ? htmlspecialchars($this->curentdoc->document_meta_description, ENT_QUOTES) : ''; $search[] = '[tag:title]'; $replace[] = htmlspecialchars(pretty_chars($this->curentdoc->document_title), ENT_QUOTES); } $search[] = '[tag:maincontent]'; $replace[] = ''; $search[] = '[tag:printlink]'; $replace[] = get_print_link(); $search[] = '[tag:version]'; $replace[] = APP_INFO; $search[] = '[tag:docviews]'; $replace[] = isset($this->curentdoc->document_count_view) ? $this->curentdoc->document_count_view : ''; $out = str_replace($search, $replace, $out); unset($search, $replace); // /парсим остальные теги основного шаблона // ЧПУ $out = rewrite_link($out); echo $out; }