EngineGP/system/sections/help/notice.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

47 lines
1.4 KiB
PHP

<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
if ($user['group'] == 'user')
$sql->query('SELECT `id` FROM `help` WHERE `user`="' . $user['id'] . '" AND `status`="0" AND `close`="0" LIMIT 1');
else
$sql->query('SELECT `id` FROM `help` WHERE `status`="1" AND `close`="0" LIMIT 1');
if (!$sql->num())
sys::outjs(array('empty' => ''));
if ($user['group'] != 'user') {
$sql->query('SELECT `time` FROM `help` WHERE `status`="1" AND `close`="0" ORDER BY `time` DESC LIMIT 1');
if ($sql->num()) {
$help = $sql->get();
sys::outjs(array('reply' => $help['time']));
}
sys::outjs(array('empty' => ''));
}
$help = $sql->get();
$sql->query('SELECT `text`, `time` FROM `help_dialogs` WHERE `help`="' . $help['id'] . '" AND `user`!="' . $user['id'] . '" AND `time`>"' . ($start_point - 15) . '" ORDER BY `id` DESC LIMIT 1');
if (!$sql->num())
sys::outjs(array('reply' => ''));
$msg = $sql->get();
if (strip_tags($msg['text'], '<br>,<p>') != $msg['text'])
sys::outjs(array('reply' => ''));
include(LIB . 'help.php');
$html->get('notice', 'sections/help');
$html->set('id', $help['id']);
$html->set('home', $cfg['http']);
$html->set('text', $msg['text']);
$html->set('ago', help::ago($msg['time']));
$html->pack('notice');
sys::outjs(array('notice' => $html->arr['notice']));
?>