Страниц: 1
title
Description
Body
An error was encountered
File: /home/.../public_html/samovarchik/misc.php
Line: 406
PunBB reported: Unable to fetch topic info
Database reported: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND t.moved_to IS NULL' at line 1 (Errno: 1064)
Неактивен
Так как всё-таки лечить?
Неактивен
Здесь ошибка не возникает. Смогу ответить если кто-то приведет мне кусок кода где возникает ошибка ИЗ СВОЕЙ ВЕРСИИ.
Подозреваю, что дело в неинициализированной переменной.
Неактивен
Как указывает niikto, ошибка возникает в файле misc.php
Умнее ничего не придумал, как заслать его сюда
Отредактированно fourent (09.12.2009 19:24:16)
Неактивен
Выяснил: да, подписка содержит ошибку. Я дал возможность подписываться сразу на список тем через запятую, но недоделал.
Вот исправление. В misc.php найти фрагмент
else if (isset($_GET['subscribe']))
и заменить всё до следующего else if на
else if (isset($_GET['subscribe']))
{
if ($pun_user['is_guest'] || $pun_config['o_subscriptions'] != '1')
message($lang_common['No permission']);
// Accept comma-separated id list
$topic_ids = (strpos($_GET['subscribe'], ',') !== false) ? explode(',', $_GET['subscribe']) : array($_GET['subscribe']);
$topic_ids = array_map('intval', $topic_ids);
if (count($topic_ids) < 1)
message($lang_common['Bad request']);
// Make sure the user can view the topic
foreach ($topic_ids as $topic_id)
{
$result = $db->query('SELECT 1 FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=1) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$topic_id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id IN('.implode(',',$topic_ids).')') or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
message($lang_misc['Already subscribed']);
$db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$topic_id.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
}
// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to given topic after that)
$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($base_url).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : ($base_url.'/viewtopic.php?id='.$topic_ids[0]);
redirect($redirect_url, $lang_misc['Subscribe redirect']);
}Неактивен
Ага, спасибо, вот теперь порядок.
Неактивен
Страниц: 1