Page 2 of 7

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Sun Jul 09, 2006 11:20 am
Author: Teelk
Good eye, I didn't catch that. Technically you can just skip that edit altogether since it's there to add the global $db which is already there. I'll ammend the update, but can't upload it since I don't have access to sourceforge currently.

I'll post when the file is updated.

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Sun Jul 09, 2006 11:28 am
Author: obiku
I think you can better leave the mod as it is, including in the search the global $db;. This because a lot of people already applied the Mod.

Then you can point the ones who already updated to remove the global $db;. So all updates are the same for futher updates

PostPosted: Sun Jul 09, 2006 12:06 pm
Author: MrGrim
obiku that a no?

PostPosted: Sun Jul 09, 2006 1:20 pm
Author: obiku
"Trag";p="11376" wrote:obiku that a no?
???
Explain your self? Don't know what you mean

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Sun Jul 09, 2006 2:33 pm
Author: obiku
I found something what needs an explanation. in the Mod there is this code change.
Code: Select all
# #-----[ OPEN ]--------------------------------------------- # search.php  ##-----[ FIND ]---------------------------------------------# Line 343                 if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )  ##-----[ REPLACE WITH ]---------------------------------------------#                 if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )  ##-----[ FIND ]---------------------------------------------# Line 463                 if (preg_match('#^[*%]+$#', trim($split_search[$i])) || preg_match('#^[^*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))  ##-----[ REPLACE WITH ]---------------------------------------------#                 if ( strlen(str_replace(array('*', '%'), '', trim($split_search[$i]))) < $board_config['search_min_chars'] )  ##-----[ FIND ]---------------------------------------------# Line 643             if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )  ##-----[ REPLACE WITH ]---------------------------------------------#             if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )

The hard coded value of the minimum requered chars is changed to one that is in de boardconfig.
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
Thats great, and the value is put in the database by the update_to_latest.php. But shouldn't it be in the ACP config, so you can change it?
If not, than you can just let that part of code change away.

PostPosted: Sun Jul 09, 2006 4:18 pm
Author: MrGrim
"obiku";p="11380" wrote:
"Trag";p="11376" wrote:obiku that a no?
???
Explain your self? Don't know what you mean
About helping me with the upgrade?

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Mon Jul 10, 2006 2:41 pm
Author: Teelk
"obiku";p="11388" wrote:I found something what needs an explanation. in the Mod there is this code change.
Code: Select all
# #-----[ OPEN ]--------------------------------------------- # search.php  ##-----[ FIND ]---------------------------------------------# Line 343                 if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )  ##-----[ REPLACE WITH ]---------------------------------------------#                 if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )  ##-----[ FIND ]---------------------------------------------# Line 463                 if (preg_match('#^[*%]+$#', trim($split_search[$i])) || preg_match('#^[^*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))  ##-----[ REPLACE WITH ]---------------------------------------------#                 if ( strlen(str_replace(array('*', '%'), '', trim($split_search[$i]))) < $board_config['search_min_chars'] )  ##-----[ FIND ]---------------------------------------------# Line 643             if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )  ##-----[ REPLACE WITH ]---------------------------------------------#             if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )

The hard coded value of the minimum requered chars is changed to one that is in de boardconfig.
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
Thats great, and the value is put in the database by the update_to_latest.php. But shouldn't it be in the ACP config, so you can change it?
If not, than you can just let that part of code change away.
That is a good question obiku, but one which I don't have an answer to... that question should be posed to phpBB I think as there's nothing in the original phpBB updates to include this in the ACP... but, I'll see what's up...

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Mon Jul 10, 2006 7:55 pm
Author: Michaelo
Globals can be replace with single line to remove any confusion:
Code: Select all
global $template, $lang, $phpEx, $phpbb_root_path, $nav_links, $db;


search_min_chars is in config but have we added the facility to edit the value in ACP? Don't think so!

Mike

PostPosted: Mon Jul 10, 2006 7:58 pm
Author: Unregistered
replace with?

PostPosted: Mon Jul 10, 2006 8:04 pm
Author: Michaelo
Unregistered correct your profile data please... you can't be 96 <img>

The line is intended to show how globals should be defined i.e In one line... no need for seperate lines...

PostPosted: Mon Jul 10, 2006 8:06 pm
Author: Unregistered
hehe il think abt it after i wake up.. now almost fallin asleep..

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Tue Jul 11, 2006 5:44 am
Author: atomhead
worked great, thank you.

PostPosted: Tue Jul 11, 2006 8:14 am
Author: Master Dwarf
Cheers to Jason for his hard work and dedication. Thanks.

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Wed Jul 12, 2006 7:34 am
Author: Juppertje
line not fount in includes/functions_post.php

Code: Select all
 ##-----[ FIND ]---------------------------------------------# Line 180             $message .= htmlspecialchars($part) . clean_html($tag);         }           $message = addslashes($message);  ##-----[ REPLACE WITH ]---------------------------------------------#             $message .= preg_replace($html_entities_match, $html_entities_replace, $part) . clean_html($tag);         }           $message = addslashes($message);


i have not that line ]<php>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 . "                     AND u.user_id = tw.user_id";             if (!($result = $db->sql_query($sql)))             {                 message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);             }               $update_watched_sql = '';             $bcc_list_ary = array();                         if ($row = $db->sql_fetchrow($result))             {                 // Sixty second limit                 @set_time_limit(60);                   do                 {                     if ($row['user_email'] != '')                     {                         $bcc_list_ary[$row['user_lang']][] = $row['user_email'];                     }                     $update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];                 }                 while ($row = $db->sql_fetchrow($result));                   //                 // Let's do some checking to make sure that mass mail functions                 // are working in win32 versions of php.                 //                 if (preg_match('/[c-z]:\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])                 {                     $ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';                       // We are running on windows, force delivery to use our smtp functions                     // since php's are broken by default                     $board_config['smtp_delivery'] = 1;                     $board_config['smtp_host'] = @$ini_val('SMTP');                 }                   if (sizeof($bcc_list_ary))                 {                     include($phpbb_root_path . 'includes/emailer.'.$phpEx);                     $emailer = new emailer($board_config['smtp_delivery']);                       $script_name = preg_replace('/^/?(.*?)/?$/', '1', trim($board_config['script_path']));                     $script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;                     $server_name = trim($board_config['server_name']);               

Re: phpBB 2.0.21 update for IntegraMOD 1.4.0

PostPosted: Wed Jul 12, 2006 2:01 pm
Author: Teelk
That line should be within the prepare_message function. You're prepare_message function is quite a bit different then it should be. Have you added any MODs that would have changed this function?