Sub Menu
Links Menu
Online Users

In total there are 302 users online :: 3 registered, 0 hidden and 299 guests

Most users ever online was 1091 on Wed Aug 16, 2023 5:27 pm

Registered users: Bing [Bot], Google [Bot], Majestic-12 [Bot] based on users active over the past 60 minutes

Known MySQL5 fixes

Support for IntegraMOD 140

Moderator: Integra Moderator

Known MySQL5 fixes

PostAuthor: Teelk » Mon Jun 12, 2006 1:14 am

If you are running MySQL5 you'll need to make the following file edits to avoid sql errors. Those who know this fix will note that the changes to admin_groups.php are absent, these were found not to be needed. However, the changes to admin_groups.php should work fine, if you've already made them.

OPEN modcp.php

FIND
Code: Select all
$user_updated [] = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max, ".$row['poster_id']." as u_id FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u         LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=".$row['poster_id']."         WHERE u.user_id=".$row['poster_id']."         AND g.group_single_user=0         AND g.group_count_enable=1         AND g.group_moderator<>".$row['poster_id'];


IN LINE, FIND
Code: Select all
" . GROUPS_TABLE . " g, ".USERS_TABLE." u


REPLACE WITH
Code: Select all
(" . GROUPS_TABLE . " g, ".USERS_TABLE." u)


OPEN includes/functions_post.php

FIND
Code: Select all
$sql = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u             LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id             WHERE u.user_id=$user_id             AND g.group_single_user=0             AND g.group_count_enable=1             AND g.group_moderator<>$user_id";


IN LINE, FIND
Code: Select all
" . GROUPS_TABLE . " g, ".USERS_TABLE." u


REPLACE WITH
Code: Select all
(" . GROUPS_TABLE . " g, ".USERS_TABLE." u)


OPEN profilcp/profilcp_board_config.php

FIND
Code: Select all
$sql = "SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u             LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id             WHERE u.user_id=$user_id                  AND ug.user_id is NULL                  AND g.group_count=0                  AND g.group_single_user=0                  AND g.group_moderator<>$user_id";


IN LINE, FIND
Code: Select all
" . GROUPS_TABLE . " g, ".USERS_TABLE." u


REPLACE WITH
Code: Select all
(" . GROUPS_TABLE . " g, ".USERS_TABLE." u)


Open ratings.php
FIND
Code: Select all
$sql_from = RATING_TABLE.' r, '. TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . ' u2, ' . RATING_OPTION_TABLE . ' ro, ' . RATING_RANK_TABLE . ' rt';  
REPLACE WITH
Code: Select all
$sql_from = '('.RATING_TABLE.' r, '. TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . ' u2, ' . RATING_OPTION_TABLE . ' ro, ' . RATING_RANK_TABLE . ' rt)';
Last edited by Teelk on Fri Jul 07, 2006 1:59 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 5:25 pm
Cash on hand: 0.00
Location: Canada

Re: Known MySQL5 fixes

PostAuthor: Juppertje » Fri Jun 16, 2006 2:09 pm

Hello Teelk has mysql 5 also somthing to do with quote errors?

We updated today from phpbb2.0.19 => version 2.0.20 and no we get quote errors like

[quote=""Juppertje";p="4893""] test

this tekst we see now instead of quote Juppertje test

has that to do with the file includes/functions_post.php ?

i made the change from:

Code: Select all
includes/functions_post.php  ##-----[ FIND ]---------------------------------------------# Line 165         $allowed_html_tags = split(',', $board_config['allow_html_tags']);           $end_html = 0;         $start_html = 1;         $tmp_message = '';         $message = ' ' . $message . ' ';           while ($start_html = strpos($message, '<', $start_html))         {             $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1)));               if ($end_html = strpos($message, '>', $start_html))             {                 $length = $end_html - $start_html + 1;                 $hold_string = substr($message, $start_html, $length);                   if (($unclosed_open = strrpos(' ' . $hold_string, '<')) != 1)                 {                     $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));                     $hold_string = substr($hold_string, $unclosed_open - 1);                 }                   $tagallowed = false;                 for ($i = 0; $i < sizeof($allowed_html_tags); $i++)                 {                     $match_tag = trim($allowed_html_tags[$i]);                     if (preg_match('#^</?' . $match_tag . '[> ]#i', $hold_string))                     {                         $tagallowed = (preg_match('#^</?' . $match_tag . ' .*?(style[ ]*?=|on[w]+[ ]*?=)#i', $hold_string)) ? false ]---------------------------------------------#         // If HTML is on, we try to make it safe         // This approach is quite agressive and anything that does not look like a valid tag         // is going to get converted to HTML entities         $message = stripslashes($message);         $html_match = '#<[^w<40>#';         $matches = array();           $message_split = preg_split($html_match, $message);         preg_match_all($html_match, $message, $matches);           $message = '';           foreach ($message_split as $part)         {             $tag = array(array_shift($matches[0]), array_shift($matches[1]), array_shift($matches[2]));             $message .= htmlspecialchars($part) . clean_html($tag);         }           $message = addslashes($message);  


afther that i changed the file back to the old version off includes/functions_post.php and the quote works fine now so i think theire is a bug in the replacement file.

mine includes/functions_post.php looks now like:

[code]<?php/***************************************************************************  *                            functions_post.php  *                            -------------------  *   begin                ]+;))#', '#<41>sql_query($sql)) )     {         message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user', '', __LINE__, __FILE__, $sql);     }     $usertodata = $db->sql_fetchrow($result);       // prepare wpm message     $bbcode_uid = make_bbcode_uid();     $wpm_message = str_replace("'", "''", $wpm_message);       if(empty($wpm_message))     {         $wpm_message = "Thank you for registering.";     }     $wpm_message = prepare_message(trim($wpm_message), 0, 1, 1, $bbcode_uid);       $msg_time = time();       // Do inbox limit stuff     $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time         FROM " . PRIVMSGS_TABLE . "         WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "             OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "               OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )             AND privmsgs_to_userid = " . $usertodata['user_id'];     if ( !($result = $db->sql_query($sql)) )     {         message_die(GENERAL_MESSAGE, $lang['No_such_user']);     }       $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : '';       if ( $inbox_info = $db->sql_fetchrow($result) )     {         if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )         {             $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "                 WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "                     OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "                     OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  )                     AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "                     AND privmsgs_to_userid = " . $usertodata['user_id'];             if ( !$db->sql_query($sql) )             {                 message_die(GENERAL_ERROR, 'Could not delete your oldest privmsgs', '', __LINE__, __FILE__, $sql);             }         }     }       $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)         VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("'", "''", $wpm_subject) . "', " . $swpm_config['wpm_userid'] . ", " . $usertodata['user_id'] . ", $msg_time, '$user_ip', 0, 1, 1, 1)";       if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )     {         message_die(GENERAL_ERROR, "Could not insert private message sent info.", "", __LINE__, __FILE__, $sql_info);     }       $privmsg_sent_id = $db->sql_nextid();       $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)         VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("'", "''", $wpm_message) . "')";       if ( !$db->sql_query($sql, END_TRANSACTION) )     {         message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);     }       // Add to the users new pm counter     $sql = "UPDATE " . USERS_TABLE . "         SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = '9999999999'         WHERE user_id = " . $usertodata['user_id'];     if ( !$status = $db->sql_query($sql) )     {         message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);     }       if ( $send_email && $usertodata['user_notify_pm'] && !empty($usertodata['user_email']) && $usertodata['user_active'] )     {         $email_headers = 'From: ' . $board_config['board_email'] . "nReturn-Path: " . $board_config['board_email'] . "rn";           $script_name = preg_replace('/^/?(.*?)/?$/', "\1", trim($board_config['script_path']));         $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;         $server_name = trim($board_config['server_name']);         $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';         $server_port = ( $board_config['server_port'] <80>use_template('privmsg_notify', $usertodata['user_lang']);         $emailer->extra_headers($email_headers);         $emailer->email_address($usertodata['user_email']);         $emailer->set_subject(); //$lang['Notification_subject']                     $emailer->assign_vars(array(             'USERNAME' => $usertodata['username'],             'SITENAME' => $board_config['sitename'],             'EMAIL_SIG' => str_replace('<br>', "n", "-- n" . $board_config['board_email_sig']),               'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')         );           $emailer->send();         $emailer->reset();     }       return;}// end wpm mod//// This function will prepare a posted message for// entry into the database.//function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0){     global $board_config, $html_entities_match, $html_entities_replace;       //     // Clean up the message     //     $message = trim($message);       if ($html_on)     {         $allowed_html_tags = split(',', $board_config['allow_html_tags']);           $end_html = 0;         $start_html = 1;         $tmp_message = '';         $message = ' ' . $message . ' ';           while ($start_html = strpos($message, '<', $start_html))         {             $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1)));               if ($end_html = strpos($message, '>', $start_html))             {                 $length = $end_html - $start_html + 1;                 $hold_string = substr($message, $start_html, $length);                   if (($unclosed_open = strrpos(' ' . $hold_string, '<')) != 1)                 {                     $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));                     $hold_string = substr($hold_string, $unclosed_open - 1);                 }                   $tagallowed = false;                 for ($i = 0; $i < sizeof($allowed_html_tags); $i++)                 {                     $match_tag = trim($allowed_html_tags[$i]);                     if (preg_match('#^</?' . $match_tag . '[> ]#i', $hold_string))                     {                         $tagallowed = (preg_match('#^</?' . $match_tag . ' .*?(style[ ]*?=|on[w]+[ ]*?=)#i', $hold_string)) ? false : true;                     }                 }                   $tmp_message .= ($length && !$tagallowed) ? preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string;                   $start_html += $length;             }             else             {                 $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $start_html, strlen($message)));                   $start_html = strlen($message);                 $end_html = $start_html;             }         }           if ($end_html != strlen($message) && $tmp_message != '')         {             $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1));         }           $message = ($tmp_message != '') ? trim($tmp_message) : trim($message);     }     else     {         $message = preg_replace($html_entities_match, $html_entities_replace, $message);     }       if($bbcode_on && $bbcode_uid != '')     {         $message = bbencode_first_pass($message, $bbcode_uid);     }       return $message;}  function unprepare_message($message){     global $unhtml_specialchars_match, $unhtml_specialchars_replace;       return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message);}  //// Prepare a message for posting// //-- mod : calendar --------------------------------------------------------------------------------// here we have added//   , $topic_calendar_time = 0, $topic_calendar_duration = 0//-- modifyfunction prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length, &$max_vote, &$hide_vote, &$tothide_vote, &$topic_desc, $topic_calendar_time = 0, $topic_calendar_duration = 0, $topic_calendar_repeat)//-- fin mod : calendar ----------------------------------------------------------------------------{     global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;       // Check username     if (!empty($username))     {         $username = phpbb_clean_username($username);           if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username']))         {             include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);               $result = validate_username($username);             if ($result['error'])             {                 $error_msg .= (!empty($error_msg)) ? '<br>' . $result['error_msg'] : $result['error_msg'];             }         }         else         {             $username = '';         }     }       // Check subject     if (!empty($subject))     {         $subject = htmlspecialchars(trim($subject));     }     else if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))     {         $error_msg .= (!empty($error_msg)) ? '<br>' . $lang['Empty_subject'] : $lang['Empty_subject'];     }  // Check Topic Desciptionif ( !empty($topic_desc) )    {       $topic_desc = htmlspecialchars(trim($topic_desc));    }       // Check message     if (!empty($message))     {         $bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';         $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);     }     else if ($mode != 'delete' && $mode != 'poll_delete')     {         $error_msg .= (!empty($error_msg)) ? '<br>' . $lang['Empty_message'] : $lang['Empty_message'];     }//-- mod : calendar --------------------------------------------------------------------------------//-- add     //     // check calendar date     //     if ((!empty($topic_calendar_time)) && ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])))     {         $year    = intval(date( 'Y', $topic_calendar_time));         $month   = intval(date( 'm', $topic_calendar_time));         $day     = intval(date( 'd', $topic_calendar_time));         if (!checkdate($month, $day, $year))         {             $error_msg .= (!empty($error_msg) ? '<br>' : '') . sprintf($lang['Date_error'], $day, $month, $year);         }     }//-- fin mod : calendar ----------------------------------------------------------------------------       //     // Handle poll stuff     //     if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))     {         $poll_length = (isset($poll_length)) ? max(0, ($poll_length+$poll_length_h/24)) : 0;         $$max_vote = (isset($max_vote)) ? max(0, intval($max_vote)) : 0;         $$hide_vote = (isset($hide_vote)) ? max(0, intval($hide_vote)) : 0;         $$tothide_vote = (isset($tothide_vote)) ? max(0, intval($tothide_vote)) : 0;           if (!empty($poll_title))         {             $poll_title = htmlspecialchars(trim($poll_title));         }           if(!empty($poll_options))         {             $temp_option_text = array();             while(list($option_id, $option_text) = @each($poll_options))             {                 $option_text = trim($option_text);                 if (!empty($option_text))                 {                     $temp_option_text[$option_id] = htmlspecialchars($option_text);                 }             }             $option_text = $temp_option_text;               if (count($poll_options) <2> $board_config['max_poll_options'])             {                 $error_msg .= (!empty($error_msg)) ? '<br>' . $lang['To_many_poll_options'] : $lang['To_many_poll_options'];             }             else if ($poll_title == '')             {                 $error_msg .= (!empty($error_msg)) ? '<br>' . $lang['Empty_poll_title'] : $lang['Empty_poll_title'];             }         }     }       return;}  //// Post a new topic/reply/poll or edit existing post/poll////-- mod : announces -------------------------------------------------------------------------------// here we have added//   , $topic_announce_duration = 0//-- modify//-- mod : calendar --------------------------------------------------------------------------------// here we have added//   , $topic_calendar_time = 0, $topic_calendar_duration = 0//-- modify//-- mod : post icon -------------------------------------------------------------------------------// here we added//   , $post_icon = 0//-- modifyfunction submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, &$max_vote, &$hide_vote, &$tothide_vote, $forcetime='', &$topic_desc, &$news_category, $topic_announce_duration = 0, $topic_calendar_time = 0, $topic_calendar_duration = 0, $post_icon = 0, $topic_calendar_repeat)//-- fin mod : post icon ---------------------------------------------------------------------------//-- fin mod : calendar ----------------------------------------------------------------------------//-- fin mod : announces ---------------------------------------------------------------------------{     global $board_config, $lang, $db, $phpbb_root_path, $phpEx;     global $userdata, $user_ip, $post_info;  // BEGIN cmx_slash_news_mod     if( isset( $news_category ) && is_numeric( $news_category ) )     {         $news_id = intval( $news_category );     }     else     {         $news_id = 0;     }// END cmx_slash_news_mod       include($phpbb_root_path . 'includes/functions_search.'.$phpEx);       $current_time = time();     $lastposttime = 0;   // MOD: Delayed Topics       if ($mode == 'newtopic' || $mode == 'reply' )     {         if ($board_config['points_post'] && !$post_info['points_disabled'])         {             $points = abs(($mode == 'newtopic') ? $board_config['points_topic'] : $board_config['points_reply']);               if ($userdata['user_id'] != ANONYMOUS)             {                 add_points($userdata['user_id'], $points);             }         }     }     if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost')     {         //         // Flood control         //         $where_sql = ($userdata['user_id'] == ANONYMOUS) ? "poster_ip = '$user_ip'" : 'poster_id = ' . $userdata['user_id'];         $sql = "SELECT MAX(post_time) AS last_post_time             FROM " . POSTS_TABLE . "             WHERE $where_sql";         if ($result = $db->sql_query($sql))         {             if ($row = $db->sql_fetchrow($result))             {                 if (intval($row['last_post_time']) > 0 && ($current_time - intval($row['last_post_time'])) < intval($board_config['flood_interval']) && intval($row['last_post_time']) < $current_time)                 {                     message_die(GENERAL_MESSAGE, $lang['Flood_Error']);                 }                 $lastposttime = intval($row['last_post_time']);  // MOD: Delayed Topics             }         }     }       if ($mode == 'editpost')     {         remove_search_post($post_id);     }       //-----------------------------------------------------------------------------     // MOD: Delayed Topics       // If we're not trying to force the time, use the current time...     $exta = '';     $delayed = 0;       $old_forcetime = '';if (mode != 'newtopic') {         // how do I read from the topic?         $myquery = "SELECT topic_time FROM ". TOPICS_TABLE ." WHERE topic_id = $topic_id";         if ($myresult = $db->sql_query($myquery)) {             if ($myrow = $db->sql_fetchrow($myresult)) {                 if ($myrow['topic_time'] > time()) {                                         $old_forcetime = $myrow['topic_time'];                     $delayed = 1;                 }             }         }     }     if ($forcetime == '') {         $forcetime = time();         if ($old_forcetime){             $extra = ", topic_time = $forcetime";         }     } else {         $delayed = 1;         $extra = ", topic_time = $forcetime";     }         // MOD: Delayed Topics {end}     //-----------------------------------------------------------------------------         if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))     {         $topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;  //-- mod : announces -------------------------------------------------------------------------------// here we added //   topic_announce_duration,//   $topic_announce_duration,//// and//   , topic_announce_duration = $topic_announce_duration//-- modify//-- mod : calendar --------------------------------------------------------------------------------// here we have added//   , topic_calendar_time, topic_calendar_duration//   , $topic_calendar_time, $topic_calendar_duration// and//   , topic_calendar_time = $topic_calendar_time, topic_calendar_duration = $topic_calendar_duration//-- modify//-- mod : post icon -------------------------------------------------------------------------------// here we added//   , topic_icon//   , $post_icon//// and//   , topic_icon = $post_icon//-- modify       // correct timezone and summertime     if($topic_calendar_time) user2boardtime($topic_calendar_time);             $sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_desc, topic_poster, topic_time, forum_id, news_id, topic_status, topic_type, topic_icon, topic_calendar_time, topic_calendar_duration, topic_announce_duration, topic_calendar_repeat, topic_vote) VALUES ('$post_subject', '$topic_desc', " . $userdata['user_id'] . ", $forcetime, $forum_id, $news_id, " . TOPIC_UNLOCKED . ", $topic_type, $post_icon, $topic_calendar_time, $topic_calendar_duration, " . intval($topic_announce_duration) . ", '$topic_calendar_repeat', $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_desc = '$topic_desc', news_id = $news_id, topic_type = $topic_type, topic_icon=$post_icon, topic_calendar_time = $topic_calendar_time, topic_calendar_duration = $topic_calendar_duration, topic_announce_duration = " . intval($topic_announce_duration) . "$extra, topic_calendar_repeat = '$topic_calendar_repeat'  " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . " WHERE topic_id = $topic_id";//-- fin mod : post icon ---------------------------------------------------------------------------//-- fin mod : calendar ----------------------------------------------------------------------------//-- fin mod : announces ---------------------------------------------------------------------------         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);         }           if ($mode == 'newtopic')         {             $topic_id = $db->sql_nextid();         }     }       //-----------------------------------------------------------------------------     // MOD: Delayed Topics       // is our topic a delayed topic?     $extra = '';     $post_time = $current_time;       if ($delayed == 1)     {         if ($mode == 'newtopic')         {             $extra = ", post_time = $forcetime";             $post_time = $forcetime;         }         else if ($mode == 'reply')         {             // post after last postif($old_forcetime > time()){     $post_time = intval($old_forcetime); } else {     $post_time = time(); }         }     }       // MOD: Delayed Topics {end}     //-----------------------------------------------------------------------------         $edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";//-- mod : post icon -------------------------------------------------------------------------------// here we added// , post_icon// , $post_icon//// and//  , post_icon = $post_icon//-- modify     $sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig, post_icon) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $post_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig, $post_icon)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig, post_icon = $post_icon" . $edited_sql . " $extra WHERE post_id = $post_id";//-- fin mod : post icon ---------------------------------------------------------------------------     if (!$db->sql_query($sql, BEGIN_TRANSACTION))     {         message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);     }       if ($mode != 'editpost')     {         $post_id = $db->sql_nextid();     }       $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";     if (!$db->sql_query($sql))     {         message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);     }       add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));       //     // Add poll     //     if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)     {         $sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length, vote_max, vote_hide, vote_tothide) VALUES ($topic_id, '$poll_title', $current_time, '$max_vote', '$hide_vote', '$tothide_vote', " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ($poll_length * 86400) . ", vote_max = '$max_vote', vote_hide = '$hide_vote', vote_tothide = '$tothide_vote' WHERE topic_id = $topic_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);         }           $delete_option_sql = '';         $old_poll_result = array();         if ($mode == 'editpost' && $post_data['has_poll'])         {             $sql = "SELECT vote_option_id, vote_result                   FROM " . VOTE_RESULTS_TABLE . "                 WHERE vote_id = $poll_id                 ORDER BY vote_option_id ASC";             if (!($result = $db->sql_query($sql)))             {                 message_die(GENERAL_ERROR, 'Could not obtain vote data results for this topic', '', __LINE__, __FILE__, $sql);             }               while ($row = $db->sql_fetchrow($result))             {                 $old_poll_result[$row['vote_option_id']] = $row['vote_result'];                   if (!isset($poll_options[$row['vote_option_id']]))                 {                     $delete_option_sql .= ($delete_option_sql != '') ? ', ' . $row['vote_option_id'] : $row['vote_option_id'];                 }             }         }         else         {             $poll_id = $db->sql_nextid();         }           @reset($poll_options);           $poll_option_id = 1;         while (list($option_id, $option_text) = each($poll_options))         {             if (!empty($option_text))             {                 $option_text = str_replace("'", "''", htmlspecialchars($option_text));                 $poll_result = ($mode == "editpost" && isset($old_poll_result[$option_id])) ? $old_poll_result[$option_id] : 0;                   $sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";                 if (!$db->sql_query($sql))                 {                     message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);                 }                 $poll_option_id++;             }         }           if ($delete_option_sql != '')         {             $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "                 WHERE vote_option_id IN ($delete_option_sql)                     AND vote_id = $poll_id";             if (!$db->sql_query($sql))             {                 message_die(GENERAL_ERROR, 'Error deleting pruned poll options', '', __LINE__, __FILE__, $sql);             }         }     }     //-----------------------------------------------------------------------------     // MOD: Delayed Topics       // If we modified the forced date, we need to redate the messages to reflect that  if ($delayed && $mode == 'editpost' && $post_data['first_post'] && $old_forcetime != $forcetime)     {         $sql = "UPDATE " . POSTS_TABLE . " set post_time=$forcetime WHERE forum_id = $forum_id and topic_id = $topic_id";         if ( !$db->sql_query($sql) )         {             message_die(GENERAL_ERROR, 'Error in redating delayed topic', '', __LINE__, __FILE__, $sql);         }     }       // MOD: Delayed Topics {end}     //-----------------------------------------------------------------------------  //-- mod : categories hierarchy --------------------------------------------------------------------//-- add     board_stats();     cache_tree(true);//-- fin mod : categories hierarchy ----------------------------------------------------------------       $meta = '<meta>';     $message = $lang['Stored'] . '<br><br>' . sprintf($lang['Click_view_message'], '<a>', '</a>') . '<br><br>' . sprintf($lang['Click_return_forum'], '<a>', '</a>');       return false;}  //// Update post stats and details//function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id) {     global $db;       // prepare update of topics table     // get first poster and first posttime     $sql = "SELECT poster_id, post_time                         FROM ".POSTS_TABLE."                      WHERE topic_id = ".$topic_id."               ORDER BY post_time ASC                      LIMIT 1 ";     if (!$db->sql_query($sql)) {         message_die(GENERAL_ERROR, 'Error in fetching first post data', '', __LINE__, __FILE__, $sql);     }     if ($row = $db->sql_fetchrow($result)) {         $topicposter = $row['poster_id'];         $topictime = $row['post_time'];     }     //get replies, firts post and last post     $sql = "SELECT count( post_id )-1 AS replies,                                  min( post_id )  AS firstpost,                                  max( post_id )  AS lastpost                         FROM ".POSTS_TABLE."                      WHERE topic_id = ".$topic_id;     if (!$db->sql_query($sql)) {         message_die(GENERAL_ERROR, 'Error in fetching topic posts data', '', __LINE__, __FILE__, $sql);     }     if ($row = $db->sql_fetchrow($result)) {         $replies = $row['replies'];         $firstpost = $row['firstpost'];         $lastpost = $row['lastpost'];     }     // extra's only for poll delete     if ($mode == 'poll_delete'){         $extra = ', topic_vote = 0';     }     if(isset($topicposter) && isset($topictime)){         // update the topics table         $sql = "UPDATE " . TOPICS_TABLE . "                 SET topic_poster = ".$topicposter.",                         topic_time = ".$topictime    .",                         topic_replies = ".$replies    .",                         topic_first_post_id = ".$firstpost    .",                         topic_last_post_id  = ".$lastpost ."                         ".$extra."                 WHERE topic_id = ".$topic_id;         if (!$db->sql_query($sql)) {             message_die(GENERAL_ERROR, 'Error in updating topics', '', __LINE__, __FILE__, $sql);         }     }     // prepare update of forums table     // get forum posts and last post     $sql = "SELECT count( p.post_id ) AS posts,                                  max( p.post_id ) last_post                         FROM ".POSTS_TABLE." p                                      LEFT OUTER JOIN                                  ".APPROVE_POSTS_TABLE." ap                                     ON ( p.post_id = ap.post_id )                      WHERE forum_id = ".$forum_id."                           AND post_time <time>sql_query($sql)) {         message_die(GENERAL_ERROR, 'Error in fetching posts data', '', __LINE__, __FILE__, $sql);     }     if ($row = $db->sql_fetchrow($result)) {         $posts = $row['posts'];         $lastpost = $row['last_post'];     }     // get forum topics     $sql = "SELECT count( t.topic_id ) AS topics                         FROM ".TOPICS_TABLE." t                         LEFT OUTER JOIN                                  ".APPROVE_POSTS_TABLE." ap                                     ON (t.topic_id = ap.topic_id)                      WHERE forum_id = ".$forum_id."                           AND topic_time <time>sql_query($sql)) {         message_die(GENERAL_ERROR, 'Error in fetching topics data', '', __LINE__, __FILE__, $sql);     }     if ($row = $db->sql_fetchrow($result)) {         $topics = $row['topics'];     } else {         $topics = 0;     }     if($lastpost <1>sql_query($sql)) {         message_die(GENERAL_ERROR, 'Error in updating forums', '', __LINE__, __FILE__, $sql);     }     // only continue the old code if not edit mode     $sign = ($mode == 'delete') ? '- 1' : '+ 1';     if ($mode != 'poll_delete' && $mode != 'editpost')     {         $sql = "UPDATE " . USERS_TABLE . "             SET user_posts = user_posts $sign             WHERE user_id = $user_id";         if (!$db->sql_query($sql, END_TRANSACTION))         {             message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);         }     } //-- mod : categories hierarchy -------------------------------------------------------------------- //-- add     // keep even in edit mode     board_stats();     cache_tree(true); //-- fin mod : categories hierarchy ----------------------------------------------------------------     // only continue the old code if not edit mode     if ($mode != 'editpost'){         $sql = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max FROM (" . GROUPS_TABLE . " g, ".USERS_TABLE." u)             LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id             WHERE u.user_id=$user_id             AND g.group_single_user=0             AND g.group_count_enable=1             AND g.group_moderator<>$user_id";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);         }         while ($group_data = $db->sql_fetchrow($result))         {     $user_already_added = (empty($group_data['user_id'])) ? FALSE : TRUE;     $user_add = ($group_data['group_count'] == $group_data['user_posts'] && $user_id!=ANONYMOUS) ? TRUE : FALSE;     $user_remove = ($group_data['group_count'] > $group_data['user_posts'] || $group_data['group_count_max'] <group_data>sql_query($sql)) )                 {                     message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);                 }             } else             if ( $user_already_added && $user_remove)             {                 //remove user from auto group                 $sql = "DELETE FROM " . USER_GROUP_TABLE . "                     WHERE group_id=".$group_data['g_id']."                     AND user_id=$user_id";                 if ( !($db->sql_query($sql)) )                 {                     message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);                 }             }         }     }     return; }//// Delete a post/poll//function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id){     global $board_config, $lang, $db, $phpbb_root_path, $phpEx;     global $userdata, $user_ip;       if ($mode != 'poll_delete')     {         include($phpbb_root_path . 'includes/functions_search.'.$phpEx);           $sql = "DELETE FROM " . POSTS_TABLE . "             WHERE post_id = $post_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);         }           $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "             WHERE post_id = $post_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);         }           if ($post_data['last_post'])         {             if ($post_data['first_post'])             {                 $forum_update_sql .= ', forum_topics = forum_topics - 1';                 $sql = "DELETE FROM " . TOPICS_TABLE . "                     WHERE topic_id = $topic_id                         OR topic_moved_id = $topic_id";                 if (!$db->sql_query($sql))                 {                     message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);                 }                   $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "                     WHERE topic_id = $topic_id";                 if (!$db->sql_query($sql))                 {                     message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);                 }                 $sql = "DELETE FROM " . BOOKMARK_TABLE . "                     WHERE topic_id = $topic_id";                 if ( !$db->sql_query($sql) )                 {                     message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);                 }             }         }           remove_search_post($post_id);     }       if ($mode == 'poll_delete' || ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) && $post_data['has_poll'] && $post_data['edit_poll'])     {         $sql = "DELETE FROM " . VOTE_DESC_TABLE . "             WHERE topic_id = $topic_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);         }           $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "             WHERE vote_id = $poll_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);         }           $sql = "DELETE FROM " . VOTE_USERS_TABLE . "             WHERE vote_id = $poll_id";         if (!$db->sql_query($sql))         {             message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);         }     }       if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post'])     {         $meta = '<meta>';         $message = $lang['Deleted'];     }     else     {         $meta = '<meta>';         $message = (($mode == 'poll_delete') ? $lang['Poll_delete'] : $lang['Deleted']) . '<br><br>' . sprintf($lang['Click_return_topic'], '<a>', '</a>');     }       $message .=  '<br><br>' . sprintf($lang['Click_return_forum'], '<a>', '</a>');//-- mod : categories hierarchy --------------------------------------------------------------------//-- add     board_stats();     cache_tree(true);//-- fin mod : categories hierarchy ----------------------------------------------------------------       return;}  //// Handle user notification on new post//function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user){     global $board_config, $lang, $db, $phpbb_root_path, $phpEx;     global $userdata, $user_ip;       $current_time = time();       if ($mode != 'delete')     {         if ($mode == 'reply')         {             $sql = "SELECT ban_userid                 FROM " . BANLIST_TABLE;             if (!($result = $db->sql_query($sql)))             {                 message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);             }               $user_id_sql = '';             while ($row = $db->sql_fetchrow($result))             {                 if (isset($row['ban_userid']) && !empty($row['ban_userid']))                 {                     $user_id_sql .= ', ' . $row['ban_userid'];                 }             }               $sql = "SELECT u.user_id, u.user_email, u.user_lang                 FROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u                 WHERE tw.topic_id = $topic_id                     AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ")                     AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
Last edited by Juppertje on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

Juppertje
Integra Member
Integra Member
 
Posts: 113
Likes: 0 post
Liked in: 0 post
Joined: Sat May 20, 2006 12:12 pm
Cash on hand: 0.00

Re: Known MySQL5 fixes

PostAuthor: Teelk » Fri Jun 16, 2006 7:30 pm

I believe that is a problem with the phpBB 2.0.20 update itself, the 2.0.21 update was released very quickly afterwards because of this and should be available soon for IntegraMOD.
Last edited by Teelk on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 5:25 pm
Cash on hand: 0.00
Location: Canada

Re: Known MySQL5 fixes

PostAuthor: Juppertje » Sat Jun 17, 2006 12:09 am

"Teelk";p="9593" wrote:I believe that is a problem with the phpBB 2.0.20 update itself, the 2.0.21 update was released very quickly afterwards because of this and should be available soon for IntegraMOD.


okay thank you for the information and people who has the same promblem now with 2.0.20 can use de file includes/functions_post.php as above so the problem is solved until IM comes with the upgrade to 2.0.21 <img>
Last edited by Juppertje on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

Juppertje
Integra Member
Integra Member
 
Posts: 113
Likes: 0 post
Liked in: 0 post
Joined: Sat May 20, 2006 12:12 pm
Cash on hand: 0.00

Re: Known MySQL5 fixes

PostAuthor: obiku » Wed Aug 16, 2006 11:34 pm

@Teelk, does your fix have any effect if you use it on MySQL 3 or 4. Because if that does not matter, we all better do this fix.

Then mebers who still use MySQL 3 or 4 don't have a problem if the DB is changed to 5.
Last edited by obiku on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
http://www.familie-smit.nl
http://portfolio.familie-smit.nl

Do not tsunami my inbox... instead use the forums...
Hard work may not kill me, but why take a chance?

[hr]
User avatar
obiku
Dev Team
Dev Team
 
Posts: 218
Likes: 0 post
Liked in: 0 post
Joined: Tue May 02, 2006 10:22 am
Cash on hand: 0.00
Location: level 8

Re: Known MySQL5 fixes

PostAuthor: Teelk » Thu Aug 17, 2006 7:18 pm

MySQL4 won't have a problem with these fixes, I'm not 100% sure about MySQL3 as it's so outdated I haven't had the opportunity to test it. But, I see no reason it shouldn't.
Last edited by Teelk on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 5:25 pm
Cash on hand: 0.00
Location: Canada

PostAuthor: Jacky » Sun Aug 27, 2006 9:18 am

The MySQL 5 fixes can also be found [url=http]here[/url].
Last edited by Jacky on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Jacky
User avatar
Jacky
Members
Members
 
Posts: 71
Likes: 0 post
Liked in: 0 post
Joined: Thu Apr 20, 2006 7:21 am
Cash on hand: 0.00

PostAuthor: Juppertje » Sun Aug 27, 2006 12:29 pm

"Jacky";p="14224" wrote:The MySQL 5 fixes can also be found [url=http]here[/url].


Yes so what you try to tell us? :oops: :?
Last edited by Juppertje on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

Juppertje
Integra Member
Integra Member
 
Posts: 113
Likes: 0 post
Liked in: 0 post
Joined: Sat May 20, 2006 12:12 pm
Cash on hand: 0.00

PostAuthor: Jacky » Mon Aug 28, 2006 3:29 am

"Juppertje" wrote:
"Jacky";p="14224" wrote:The MySQL 5 fixes can also be found [url=http]here[/url].


Yes so what you try to tell us? :oops: :?
Telling you that there is also another source for the fix?
Last edited by Jacky on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Jacky
User avatar
Jacky
Members
Members
 
Posts: 71
Likes: 0 post
Liked in: 0 post
Joined: Thu Apr 20, 2006 7:21 am
Cash on hand: 0.00

Re: Known MySQL5 fixes

PostAuthor: Juppertje » Mon Aug 28, 2006 11:31 am

Still has nothing to do with quistion above abouth mysql 3 and 4 but okay if you are happy to giove a answer abouth 5 when somebodyelkse asked somthing abouth 3 and 4 be happy then <img>
Last edited by Juppertje on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

Juppertje
Integra Member
Integra Member
 
Posts: 113
Likes: 0 post
Liked in: 0 post
Joined: Sat May 20, 2006 12:12 pm
Cash on hand: 0.00

PostAuthor: Jacky » Mon Aug 28, 2006 11:02 pm

"Juppertje" wrote:Still has nothing to do with quistion above abouth mysql 3 and 4 but okay if you are happy to giove a answer abouth 5 when somebodyelkse asked somthing abouth 3 and 4 be happy then <img>
Ahem, this topic is about known MySQL 5 fixes, not 3 and 4. I posted a link to a topic in the archive which also contains the fix.
Last edited by Jacky on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Jacky
User avatar
Jacky
Members
Members
 
Posts: 71
Likes: 0 post
Liked in: 0 post
Joined: Thu Apr 20, 2006 7:21 am
Cash on hand: 0.00

Re: Known MySQL5 fixes

PostAuthor: found it » Tue Aug 29, 2006 2:33 am

[quote=""Juppertje";p="14326""]Still has nothing to do with quistion above abouth mysql 3 and 4 but okay if you are happy to giove a answer abouth 5 when somebodyelkse asked somthing abouth 3 and 4 be happy then :mrgreen: <img>
Last edited by found it on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:29 am
Cash on hand: 0.00


Return to IntegraMOD 140

Who is online

Registered users: Bing [Bot], Google [Bot], Majestic-12 [Bot]

cron