EngineGP/system/sections/wiki/question.php
Sergei Solovev 276ec7f3eb Updating the server name reference in code
This change replaces the use of $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] throughout the codebase. The modification ensures consistency and compliance with best practices, since $_SERVER['HTTP_HOST'] is often used to extract the host header from an HTTP request. This update may improve compatibility and security, especially in scenarios where the Host header plays a key role in proper server configuration and routing. Please review and test the changes carefully to ensure smooth functionality in different environments.
2023-12-23 04:50:14 +03:00

44 lines
1.3 KiB
PHP

<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
$html->nav('Категории вопросов', $cfg['http'] . 'wiki');
$html->nav('Часто задаваемые вопросы');
$cat = isset($url['category']) ? sys::int($url['category']) : sys::back($cfg['http'] . 'wiki');
$sql->query('SELECT `name` FROM `wiki_category` WHERE `id`="' . $cat . '" LIMIT 1');
if (!$sql->num())
sys::back($cfg['http'] . 'wiki');
$category = $sql->get();
$sql->query('SELECT `id`, `name`, `tags`, `date` FROM `wiki` WHERE `cat`="' . $cat . '" ORDER BY `id` ASC');
while ($quest = $sql->get()) {
$aTags = explode(',', $quest['tags']);
$tags = '';
foreach ($aTags as $tag) {
$tag = trim($tag);
$tags .= '<a href="' . $cfg['http'] . 'wiki/section/search/tag/' . $tag . '">' . $tag . '</a>';
}
$html->get('list', 'sections/wiki/question');
$html->set('id', $quest['id']);
$html->set('name', $quest['name']);
$html->set('tags', $tags != '' ? $tags : 'Теги отсутствуют');
$html->set('date', sys::today($quest['date']));
$html->pack('question');
}
$html->get('question', 'sections/wiki');
$html->set('category', $category['name']);
$html->set('list', isset($html->arr['question']) ? $html->arr['question'] : '');
$html->pack('main');
?>