Если не ошибаюсь юнионы появились в mysql >=4.1, скорее всего у тя база 4.0xx или 3.сгакомUNION SELECT

Код: Выделить всё
include('functions_post.php');
Код: Выделить всё
include($phpbb_root_path . 'includes/functions_post.' . $phpEx);
Код: Выделить всё
include($phpbb_root_path . 'includes/functions_autobirthday.php');
Код: Выделить всё
include($phpbb_root_path . 'includes/functions_autobirthday.' . $phpEx);
Код: Выделить всё
$topic_title = addslashes(htmlspecialchars($bday_config['grats_topic_name']));
Код: Выделить всё
$topic_title = addslashes(htmlspecialchars($user_birthday_data['username'] . ',' . ' ' . $bday_config['grats_topic_name']));
Код: Выделить всё
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$topic_title', $user_id, $current_time, $forum_id, $topic_locked, $topic_type, false)";
Подскажите, что исправить, чтобы bbCode обрабатывался, плиз.// Функция выбирает поздравление на основании пола, создаёт пост и обновляет статистику
function create_grats_post($existed, $topic_id, $bday_config, $user_birthday_data, $current_time)
{
// по $user_ip и $post_username можно будет узнать кто в действительности поздравил чела
// Иными словами - тот, кто открыл index.php и вызвал эту функцию.
global $db, $user_ip, $userdata;
include($phpbb_root_path . 'includes/functions_post.' . $phpEx);
$bbcode_on = 1;
$html_on = 0;
$attach_sig = 1;
$smilies_on = $bday_config['allowsmilies'];
$forum_id = $bday_config['grats_forum_id'];
$user_id = $bday_config['from_id'];
$post_subject = addslashes(htmlspecialchars($bday_config['grats_topic_name']));
$post_username = $userdata['username'];
switch ($user_birthday_data['user_gender'])
{
case 1:
$post_message = $bday_config['grats_text_male'];
$bbcode_uid = $bday_config['bbcode_grats_text_male'];
break;
case 2:
$post_message = $bday_config['grats_text_female'];
$bbcode_uid = $bday_config['bbcode_grats_text_female'];
break;
default :
$post_message = $bday_config['grats_text'];
$bbcode_uid = $bday_config['bbcode_grats_text'];
break;
}
$post_message = addslashes(sprintf($post_message, $user_birthday_data['username']));
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, $user_id, '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)";
if (!$db->sql_query($sql, BEGIN_TRANSACTION))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$post_id = $db->sql_nextid();
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// В поиск слова не добавляем, нафик надо.
// Заключительный этап - обновление статистики
$mode = $existed ? 'reply' : 'newtopic';
update_post_stats($mode, $empty, $forum_id, $topic_id, $post_id, $user_id);
}
Код: Выделить всё
function create_grats_topic(
$user_birthday_data,
$user_attach_sig = 1,
$topic_type = POST_NORMAL,
$do_notification = false,
$notify_user = false,
$current_time = 0,
$error_die_function = '',
$html_on = 0,
$bbcode_on = 1,
$smilies_on = 1 )
{
global $db, $board_config, $user_ip, $lang, $userdata;
// initialise some variables
$topic_vote = 0;
$poll_title = '';
$poll_options = '';
$poll_length = '';
$mode = 'reply';
$sql = "SELECT *
FROM " . AUTOBIRTHDAY_CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, 'Could not query birthday config information', "", __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$bday_config[$config_name] = $config_value;
}
$forum_id = $bday_config['grats_forum_id'];
$subject = addslashes(htmlspecialchars($bday_config['grats_topic_name']));
$subject = addslashes(sprintf($subject, $user_birthday_data['username']));
$user_id = $bday_config['from_id'];
// Проверяем, есть ли форум, ID которого пытался нам впарить админ
$sql = "SELECT COUNT(forum_id) AS existed
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not select forum_id($forum_id) in create_grats_topic()", "", __LINE__, __FILE__, $sql);
}
$count = $db->sql_fetchrow($result);
if ( !$count['existed'] )
{
message_die(GENERAL_ERROR, $lang['no_grats_forum_users']);
}
$username = $userdata['username'];
switch ($user_birthday_data['user_gender'])
{
case 1:
$message = $bday_config['grats_text_male'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
case 2:
$message = $bday_config['grats_text_female'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
default :
$message = $bday_config['grats_text'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
}
$error_die_function = ($error_die_function == '') ? "message_die" : $error_die_function;
$current_time = ($current_time == 0) ? time() : $current_time;
// parse the message and the subject (belt & braces :)
$message = addslashes(sprintf($message, $user_birthday_data['username']));
$message = addslashes(unprepare_message($message));
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
$subject = addslashes(unprepare_message(trim($subject)));
$username = addslashes(unprepare_message(trim($username)));
// fix for \" in username - wineknow.com
$username = str_replace("\\\"","\"", $username);
// if this is a new topic then insert the topic details
$sql = "SELECT topic_id, topic_title
FROM " . TOPICS_TABLE . "
WHERE forum_id = $forum_id
AND topic_title = '$subject'";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, 'Could not select topic_title in create_grats_topic()', "", __LINE__, __FILE__, $sql);
}
elseif (!($row = $db->sql_fetchrow($result)))
{
$mode = 'newtopic';
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$subject', " . $user_id . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$topic_id = $db->sql_nextid();
}
else $topic_id = $row['topic_id'];
// insert the post details using the topic id
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $user_id . ", '$username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $user_attach_sig)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$post_id = $db->sql_nextid();
// insert the actual post text for our new post
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$subject', '$bbcode_uid', '$message')";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the post counts etc.
$newpostsql = ($mode == 'newtopic') ? ',forum_topics = forum_topics + 1' : '';
$sql = "UPDATE " . FORUMS_TABLE . " SET
forum_posts = forum_posts + 1,
forum_last_post_id = $post_id
$newpostsql
WHERE forum_id = $forum_id";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the first / last post ids for the topic
$first_post_sql = ( $mode == 'newtopic' ) ? ", topic_first_post_id = $post_id " : ' , topic_replies=topic_replies+1';
$sql = "UPDATE " . TOPICS_TABLE . " SET
topic_last_post_id = $post_id
$first_post_sql
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the user's post count and commit the transaction
$sql = "UPDATE " . USERS_TABLE . " SET
user_posts = user_posts + 1
WHERE user_id = $user_id";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// add the search words for our new post
switch ($board_config['version'])
{
case '.0.0' :
case '.0.1' :
case '.0.2' :
case '.0.3' :
add_search_words($post_id, stripslashes($message), stripslashes($subject));
break;
default :
add_search_words('', $post_id, stripslashes($message), stripslashes($subject));
break;
}
// do we need to do user notification
if ( ($mode == 'reply') && $do_notification )
{
$post_data = array();
user_notification($mode, $post_data, $subject, $forum_id, $topic_id, $post_id, $notify_user);
}
// if all is well then return the id of our new post
return array('post_id'=>$post_id, 'topic_id'=>$topic_id);
}
Код: Выделить всё
phpBB : Critical Error
Could not query birthday config information in admin_birthdays
DEBUG MODE
SQL Error : 1146 Table 'phpBB.autobirthday_config' doesn't exist
SELECT * FROM phpBB_bbconfig WHERE config_name LIKE 'bday%' UNION SELECT * FROM autobirthday_config
Line : 213
File : admin_birthdays.php
решается заменой кодаиз набора, скажем, 10-15 разных поздравлений, случайно или по порядку, во избежание повторов
Код: Выделить всё
switch ($user_birthday_data['user_gender'])
{
case 1:
$message = $bday_config['grats_text_male'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
case 2:
$message = $bday_config['grats_text_female'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
default :
$message = $bday_config['grats_text'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
}
Код: Выделить всё
$sql = "SELECT * FROM " . AUTOBIRTHDAY_CONFIG_TABLE . " WHERE config_name LIKE 'grats_text%' ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain congratulation text', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$message = $row['config_value'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
Код: Выделить всё
switch ($user_birthday_data['user_gender'])
{
case 1:
$sql = "SELECT * FROM " . AUTOBIRTHDAY_CONFIG_TABLE . " WHERE config_name LIKE 'grats_text_male%' ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain congratulation text', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$message = $row['config_value'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
case 2:
$sql = "SELECT * FROM " . AUTOBIRTHDAY_CONFIG_TABLE . " WHERE config_name LIKE 'grats_text_female%' ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain congratulation text', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$message = $row['config_value'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
default :
$sql = "SELECT * FROM " . AUTOBIRTHDAY_CONFIG_TABLE . " WHERE config_name LIKE 'grats_text%' ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain congratulation text', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$message = $row['config_value'];
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
break;
}
Table 'phpBB.autobirthday_config' doesn't exist
Код: Выделить всё
INSERT INTO `phpbb_bbconfig` VALUES ('bday_show', '1');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_require', '1');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_year', '0');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_lock', '1');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_lookahead', '7');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_max', '50');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_min', '7');
INSERT INTO `phpbb_bbconfig` VALUES ('bday_autobirthday', '0');
Вам необходимо запустить файл обновления бд , называется он db_update.php или что-то наподобии етого .fskon писал(а):SQL Error : 1146 Table 'phpBB.autobirthday_config' doesn't exist
Разница в том что sql можно неправильно прикрутить , а db_update.php - нет .fskon писал(а):Так получается между ними существует разница?
Для общего развития .fskon писал(а):Тогда зачем он нужен в комплекте?