решено Ошибка при создании темы без торрент вложения

WorkVladimir

Пользователь
Когда создаю тему не прикрепляя к ней торрент файлик, то появляется надпись

Notice:Use of undefined constant TORRENT_ATTACH_ID - assumed 'TORRENT_ATTACH_ID' ..... posting.php on line 436
if (!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))

Fatal error: DB Error [posting.php(436)] in ............ library/includes/core/mysql.php on line 804

trigger_error($msg, E_USER_ERROR);
 

Protektor

Пользователь
WorkVladimir
Поддерживаю, есть такая ошибка
Notice: Use of undefined constant TORRENT_ATTACH_ID - assumed 'TORRENT_ATTACH_ID' in C:\OpenServer\domains\torrent3\posting.php on line 432

вот это при создании темы без торрент файла,
и такая же ошибка появляется при ответе на сообщение ( с цитатой ). Где определять эту константу?
 

Protektor

Пользователь
Нашел из за чего нотис, все из за того что когда ставил Мета-теги (расширенная версия) 1.1.0 там в описании есть момент:
Открыть posting.php

Найти

if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)

Ниже добавить

if ($mode == 'newtopic' && defined('TORRENT_ATTACH_ID') || defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
$row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");
preg_match_all('/\[poster\](.*?)\[\/poster\]/i', $row['post_text'], $poster4, PREG_SET_ORDER);
preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $row['post_text'], $poster3, PREG_SET_ORDER);
preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $row['post_text'], $poster2, PREG_SET_ORDER);
preg_match_all('/\[img\](.*?)\[\/img\]/i', $row['post_text'], $poster1, PREG_SET_ORDER);
$url = '';
if (isset($poster3[0][1])) $url = $poster3[0][1];
elseif (isset($poster4[0][1])) $url = $poster4[0][1];
elseif (isset($poster2[0][1])) $url = $poster2[0][1];
elseif (isset($poster1[0][1])) $url = $poster1[0][1];
DB()->query("UPDATE ". BB_TOPICS ." SET topic_image = '$url' WHERE topic_id = $topic_id ");
}

ну я не посмотрел что делаю и вставил тупо после
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)

и все ))) а сей час посмотрел откуда ошибка и поправил ниже пример кому нужно берите
Открыть posting.php

Найти
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
include(INC_DIR .'functions_torrent.php');
if (!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
{
if ($bb_cfg['premod'])
{
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
$count_rowset = DB()->fetch_rowset("SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_parent = $forum_parent");
$sub_forums = array();
foreach ($count_rowset as $count_row)
{
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
}
$sub_forums[] = $forum_id;
$sub_forums = join(',', $sub_forums);
// Подсчет проверенных релизов в форумах раздела
$count_checked_releases = DB()->fetch_row("
SELECT COUNT(*) AS checked_releases
FROM ". BB_BT_TORRENTS ."
WHERE poster_id = ". $userdata['user_id'] ."
AND forum_id IN($sub_forums)
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM)
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
else
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
}
}
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
}

Ниже добавить

if ($mode == 'newtopic' && defined('TORRENT_ATTACH_ID') || defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
$row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");
preg_match_all('/\[poster\](.*?)\[\/poster\]/i', $row['post_text'], $poster4, PREG_SET_ORDER);
preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $row['post_text'], $poster3, PREG_SET_ORDER);
preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $row['post_text'], $poster2, PREG_SET_ORDER);
preg_match_all('/\[img\](.*?)\[\/img\]/i', $row['post_text'], $poster1, PREG_SET_ORDER);
$url = '';
if (isset($poster3[0][1])) $url = $poster3[0][1];
elseif (isset($poster4[0][1])) $url = $poster4[0][1];
elseif (isset($poster2[0][1])) $url = $poster2[0][1];
elseif (isset($poster1[0][1])) $url = $poster1[0][1];
DB()->query("UPDATE ". BB_TOPICS ." SET topic_image = '$url' WHERE topic_id = $topic_id ");
}
 

Protektor

Пользователь
Да, совсем забыл написать, если нужно что бы ссылка на картинку после создания темы ложилась в
meta property="og:image"
то тогда
Открыть posting.php
найти
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
include(INC_DIR .'functions_torrent.php');
if (!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
{
if ($bb_cfg['premod'])
{
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
$count_rowset = DB()->fetch_rowset("SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_parent = $forum_parent");
$sub_forums = array();
foreach ($count_rowset as $count_row)
{
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
}
$sub_forums[] = $forum_id;
$sub_forums = join(',', $sub_forums);
// Подсчет проверенных релизов в форумах раздела
$count_checked_releases = DB()->fetch_row("
SELECT COUNT(*) AS checked_releases
FROM ". BB_BT_TORRENTS ."
WHERE poster_id = ". $userdata['user_id'] ."
AND forum_id IN($sub_forums)
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM)
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
else
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
}
}
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
}
заменить на
if ($mode == 'newtopic' && defined('TORRENT_ATTACH_ID') || defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
$row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");
preg_match_all('/\[poster\](.*?)\[\/poster\]/i', $row['post_text'], $poster4, PREG_SET_ORDER);
preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $row['post_text'], $poster3, PREG_SET_ORDER);
preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $row['post_text'], $poster2, PREG_SET_ORDER);
preg_match_all('/\[img\](.*?)\[\/img\]/i', $row['post_text'], $poster1, PREG_SET_ORDER);
$url = '';
if (isset($poster3[0][1])) $url = $poster3[0][1];
elseif (isset($poster4[0][1])) $url = $poster4[0][1];
elseif (isset($poster2[0][1])) $url = $poster2[0][1];
elseif (isset($poster1[0][1])) $url = $poster1[0][1];
DB()->query("UPDATE ". BB_TOPICS ." SET topic_image = '$url' WHERE topic_id = $topic_id ");

if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
include(INC_DIR .'functions_torrent.php');
if (!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
{
if ($bb_cfg['premod'])
{
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
$count_rowset = DB()->fetch_rowset("SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_parent = $forum_parent");
$sub_forums = array();
foreach ($count_rowset as $count_row)
{
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
}
$sub_forums[] = $forum_id;
$sub_forums = join(',', $sub_forums);
// Подсчет проверенных релизов в форумах раздела
$count_checked_releases = DB()->fetch_row("
SELECT COUNT(*) AS checked_releases
FROM ". BB_BT_TORRENTS ."
WHERE poster_id = ". $userdata['user_id'] ."
AND forum_id IN($sub_forums)
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM)
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
else
{
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
}
}
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}

}

}
 
Сверху