Page 1 of 1

Thank you message after each post

PostPosted: Fri Apr 07, 2006 3:57 pm
Author: Thug Lyfe
any solution to this problem..
i want this message to appear after a member makes a post

[url=http][flash=,:15q546te]http://img96.imageshack.us/img96/2813/message0xh.th.jpg[/flash:15q546te][/url]

and none of my members can see the 'who is online' box under the shoutbox on the forum page....any solutions?

thankz

PostPosted: Thu Apr 13, 2006 12:55 pm
Author: Michaelo
The message should be automatic? Can no one see it?
I think the who's on line can be disabled in the ACP just check to see it is not.

PostPosted: Thu Apr 13, 2006 1:26 pm
Author: Thug Lyfe
"Michaelo";p="1391" wrote:The message should be automatic? Can no one see it?
I think the who's on line can be disabled in the ACP just check to see it is not.


thanks for replying

that thank you message is not automatic in integramod
and i've search acp for whos online box...its enabled yet nobody can see it

PostPosted: Thu Apr 13, 2006 1:56 pm
Author: Adrian Rea
Is it the same for all styles?

A

PostPosted: Fri Apr 14, 2006 9:06 pm
Author: Thug Lyfe
yes all themes
its just like here
everytime i make a post, the browser redirects me to the post i made...i want it to display the message instead of redirecting me here

PostPosted: Fri Apr 14, 2006 10:05 pm
Author: tekguru
As far as I am aware that message has never been there in IM.

PostPosted: Sat Apr 15, 2006 7:11 am
Author: Adrian Rea
In fact I think you are right Tek, unless it used to show I cannot remember.

A

Re: Thank you message after each post

PostPosted: Sat Apr 15, 2006 8:04 am
Author: Nata
well as long as i remeber it always appear in all phpb forum even in other forums !

i don't know why it dont work for you , but i think it's due to other mod you installed !

what are all the MODs u added ?
may be speed mod the one that makes your forum execute quickly ?

PostPosted: Sat Apr 15, 2006 8:19 am
Author: Nata
here is the the guilty i swear it was not integramod : Redirect to Post v2.2.0

all u have to do is to undo that !
Code: Select all
############################################################### ## Mod Title:    Redirecting After Post## phpBB Version## supported:    1.4x## Author:       Acid## Description:  After posting (new topic, reply, edit) youÂÂÂ ´ll##        be redirected to your post on the last page.## Files To Edit: viewtopic.php, page_header.php############################################################### ###############################################################  >>>>viewtopic.php-----------------  AFTER !: $pagetype = "viewtopic";  ADD: if ($redirect=='page'){ $sql = "SELECT post_id, forum_id FROM posts WHERE topic_id = '$topic' ORDER BY post_time DESC LIMIT 1"; if(!$result = mysql_query($sql, $db)) error_die("<font>An Error Occured</font><hr>Could not connect to the forums database."); if(!$myrow = mysql_fetch_array($result)) error_die("Error - The forum/topic you selected does not exist. Please go back and try again."); if (!$topic) $topic=$myrow[topic_id]; if (!$forum) $forum=$myrow[forum_id]; $replys = (get_total_posts($topic, $db, "topic")); settype ($replys, "integer"); if (($replys-$posts_per_page)>= 0) { $hc_dlink_times = 0; for ($x = 0; $x </a>>>>page_header.php-------------------  REPLACE: echo "<META>";  WITH: echo "<META>";

PostPosted: Sat Apr 15, 2006 9:53 am
Author: tekguru
AFAIK the confirmation message is standard in PhpBBS but not in IM.

PostPosted: Sat Apr 15, 2006 4:40 pm
Author: Thug Lyfe
well i remember that someone told me its possible in integramod as i had it in my previous forum but sadly that forum got deleted and so did all the files

but i know that all i did was edit just one file(which i don't remember obviously) and i saw that confirmation there after every post

PostPosted: Sat Apr 15, 2006 11:51 pm
Author: tekguru
No ideas I'm afraid, but if you ever find what it was I'm sure we'd be interested <img>

PostPosted: Sun Apr 16, 2006 1:11 am
Author: bariq
thug lyfe, may be you are looking for REDIRECTION SUITE

REDIRECTION SUITE
Current Release: 10.2.1

Table of Contents:
1) Introduction
2) About Version Numbers
3) Release Notes
4) Installing and Upgrading Global Redirection Suite
5) License
6) Known Bugs
7) Updates, Support, Suggestions, Requests

----------------------
INTRODUCTION
----------------------

Redirection Suite is a collection of phpBB 2.0.x modifications with the common theme
of sending a user somewhere they normally would not go. Currently, the following
modifications are included:

Redirect to Forum, redirect_forum.txt:
Changes the automatic redirection after successfully posting a message. Instead of
automatically going back to the topic, the user will be sent to the forum
(viewforum.php). The in-between page that gives the option to view the posted
message is still displayed. Not compatible with Redirect to Post or Redirect to
Topic.

Redirect to Forum II, redirect_forum2.txt:
This has the same effect as the original Redirect to Forum above, except for one
difference: it skips the confirmation message entirely.

Redirect to Topic, redirect_topic.txt:
Bypasses the message displayed when a message is successfully posted. It will
instead redirect the user back to the topic's first post without waiting. Not
compatible with Redirect to Post or Redirect to Forum.

Redirect to Post, redirect_post.txt:
After posting, user is redirected to their post (or the last post of the topic,
which would be the same thing usually) without a confirmation message. You can also
redirect users after they send a private message. Not compatible with Redirect to
Topic or Redirect to Forum.
NOTE: This modification is not compatible with the popular Attachment modification.

Redirect After Voting, redirect_voting.txt:
After a voting form (or a poll choice) is submitted, the user is redirected to a
page of your choice instead of the topic. It's intended for use with modifications,
like phpBB Fetch All, that allow you to have a phpBB poll on non-phpBB pages. You
could redirect the user to the page the poll is on or your own custom results page.
Or somewhere completely different, it would be up to you.

Redirect From Private Forum, redirect_private.txt
If a user tries to access a forum for which they do not have the proper viewing
permissions (a private forum), they are directed to a page of your choice instead of
getting a "forum does not exist" error message.

Redirect After Registration, redirect_register.txt
After a user registers, you can send them to a page you've specified. Like so many
of the Redirection Suite modifications, this is mostly useful for sites with
register links on non-phpBB pages. You can redirect a user to a log in page, your
main page, a rules or FAQ page, or wherever you want. If you're redirecting them to
a phpBB enabled page, you can also log them in automatically - no log in form
required!

Redirect After Mark All Read, redirect_mark.txt
After a user clicks the "Mark all forums read" or "Mark all topics read" links, you
can send them to a page you've specified.

Redirect After Mark All Read II, redirect_mark2.txt
This has the same effect as the original Redirect After Mark All Read above, except
for one difference: it skips the confirmation message entirely.

Redirect For Wrong Login, redirect_badpass.txt
If a user tries to login with a non-existent username, wrong password or when their
account is inactive, they are redirected to a page you specify. You can have
separate pages for wrong usernames, passwords, and inactive users.

redirect() Enhancement, function_change.txt
phpBB 2.0.4's new redirect() function specifies a full URL for redirecting users -
but that URL always points to the phpBB directories! This enhancement allows for
redirecting users outside of the phpBB directories.

Redirect Outside phpBB After Log In/Out, redirect_outside.txt
A guide to modifying phpBB so that you redirect users outside of the phpBB
directories when they log in or out.

Global Redirection Suite, global/redirect_global.txt
This is the "crown jewel," if you will, of the Redirection Suite package. It
incorporates the abilities all the above Redirection Suite modifications into one
central, more flexible modification. This means that it offers redirection for
registering (with automatic log in), marking forums or topics read, voting, posting,
editing or deleting posts, sending private messages, wrong login information, and
failing the authorization check for private forums. There are also some unique
features: an Administration Panel interface; User Preferences; turn voting, mark all
read, registration, and posting confirmation messages on or off; default URLs for
voting and logout redirection; and override voting and logout redirects.

-------------------------------
ABOUT VERSION NUMBERS
-------------------------------

As Redirection Suite is a collection of modifications, the version numbering system
used is a bit strange. Let me explain it to you.

Each individual modification has it's own unique version number, in the format
x.x.x. The first number represents the stable release version, the second number is
the update number, and the third number is the bugfix number. So, a modification
numbered 1.2.3 would be a modification that has one stable release, two minor
features added to that release, and three bugs fixed.

Redirection Suite, as a whole, has a version number in the format x.x.x. The
first number represents the major addition number, the second number is the minor
update number, and the third number is the bugfix number. So, Redirection Suite
version 2.2.3 would include two major additions (e.g., new modifications added), two
minor updates to included modifications, and three bugfixes to included
modifications. There are variations on how this is used sometimes.


-----------------------
RELEASE NOTES
-----------------------

Version 10.2.1 - Mar 20, 2004 3:00 am Eastern Time
phBB 2.0.7a was released yesterday afternoon. It seems they introduced a redirection
bug in 2.0.7, so they needed some code changes. This release reflects these changes.

Version 10.2.0 - Mar 17, 2004 3:00 pm Eastern Time
It's been nearly a year since I did any work with Redirection Suite. This release's
main focus is updates to code modifying login.php, which had a lot of security
improvements when phpBB 2.0.7 was released. Nearly all of those fixes also needed
to be applied to Redirection Suite. I've also done some tweaking to Global RDS that
may give some performance improvements and bug fixes.

---------------------------------------------------------
INSTALLING & UPGRADING GLOBAL REDIRECTION SUITE
---------------------------------------------------------

When upgrading from a previous version of Global Redirection Suite, it is not
necessary to reinstall the entire modification. Only new or changed portions of the
modification need to be installed or re-installed. These portions are usually listed
in the changelog.txt entry for each version. The files affected are usually listed
in parentheses. A particular label may be listed after the file, e.g. (posting.php,
no post message). If so, you can search for that label to find the changed part(s)
of the file more quickly.

---------
IMPORTANT
---------
Redirection Suite is tested on MySQL only. This means that if you use another
type of database software, like PostgreSQL, you'll have to adapt the MySQL database
schemas in the mysql_rds_schema.sql file and create the database tables yourself. If
anyone would like to send me an adapted schema file for any other database type, I'd
be glad to include it with the Redirection Suite package.

When upgrading, it should not be necessary to do any database modifications
yourself; the installer script should take care of them.
---------
IMPORTANT
---------

When installing or upgrading Global Redirection Suite, you should upload the new
rds_install.php and mysql_rds_schema.sql before uploading any of the edited files.
You should then run rds_install.php by opening the uploaded file in your browser.
This needs to be done for every version, starting with Global Redirection Suite
2.0.0. This will install some database changes, including new configuration settings
in the phpBB configuration table and new database tables. When finished, be sure to
delete both of those files from your web server as a security precaution. Now upload
the edited files, and you can then modify Global Redirection Suite's options by
going to the General Admin > Configuration page in the phpBB Administration Panel.

When setting the URL options in the Admin Configuration, keep these things in mind,
because they are very important:
1) DO use URLs consisting only of a path from the root of your site and file
name, like these:
/index.htm <<< to go to http://yoursite.com/index.htm
/phpBB/index.php <<< to go to http://yoursite.com/phpBB/index.php
2) DO NOT use relative URLs (which are URLs containing the "../" shortcut, like
"../index.html"). While these will usually work, the HTTP/1.1 specification
(which phpBB uses) says they won't work. Some of your users may encounter
problems with relative URLs.
3) DO NOT use absolute URLs (which are full URLs like http://site.com/index.htm).
Absolute URLs will not work because phpBB will add the http://site.com/ part
automatically. If you include it, you'll be redirected to something like
http://site.com/http://site.com/index.html.

-----------------
LICENSE
-----------------

This modification, hack, or add-on is free software distributed under the GNU
General Public License as published by the Free Software Foundation. A copy
of this license is found in the gpl.txt file that comes with these files.

This modification, hack, or add-on contains code from phpBB 2.0.7 (or earlier)
which is copyright (C) the phpBB Group. All original code and images in this
modification, hack, or add-on are copyright (C) Jeremy Rogers.

--------------------
KNOWN BUGS
--------------------

A bug in some web browsers, including at least some versions of Internet Explorer,
can break certain types of URLs under certain conditions. I won't go too deep into
the details, except to say that forms of redirection to a particular post will not
work correctly when the File Attachment modification is installed on a forum.

Global Redirection Suite and the Protect useraccount mod by Niels Chr. RÃÂÂ ¸d Denmark
have a conflict - please see protect_useraccount.txt to find a way around this.

-------------------------------------------------
UPDATES, SUPPORT, SUGGESTIONS, REQUESTS
-------------------------------------------------

To get older or new versions of my modifications, please visit the following sites:
DarkMods: http://darkmods.sourceforge.net (Old and New versions)
phpBBHacks.com: http://www.phpbbhacks.com/ (Latest version only)
Shaded Wings: http://cyborgcentral.dynip.com/~pd/ (Latest version only)

If you are having a problem with one of my modifications and would like support,
please visit either the DarkMods or phpBBHacks.com forums. I visit both of these
regularly and will try to answer any questions I see. phpBBHacks.com also has a
helpful Support Team that can answer many questions. It is not necessary to post
the same question on both forums unless you post at DarkMods and I (Thoul) cannot
answer your question.

If you would like to suggest a new feature, support the development of my
modifications with a donation, or discuss other aspects of them, you can do so at
the DarkMods site and/or forums. Demonstrations of some of my modifications are
also available there.

If you wish to be informed by e-mail when I release an update to this or my
other modifications, there's a mailing list you can subscribe to at:
http://lists.sourceforge.net/mailman/li ... s-announce


PostPosted: Sun Apr 16, 2006 7:16 pm
Author: Thug Lyfe
Well i'll try to go to the old integramod site and try to find my topic if possible, who knows i might find it even though i tried hundreds of time
thanks for the help anywayz guys...i'll definately share it if i find it

Re: Thank you message after each post

PostPosted: Wed May 03, 2006 6:17 am
Author: found it
Hi

if this has not bee solved could you please post your viewtopic.php please

:mrgreen:

Re: Thank you message after each post

PostPosted: Wed May 03, 2006 1:00 pm
Author: Thug Lyfe
sure

[quote]<php>(((?>([^><]+|(?R)))*)<se>' . $message . '</a>' : '<sql_ordering>sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
$topic_id = intval($row['topic_id']);
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
redirect( "./viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id" );
//-- fin mod : categories hierarchy ----------------------------------------------------------------
}
else
{
$message = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'No_newer_topics' : 'No_older_topics';
message_die(GENERAL_MESSAGE, $message);
}
}
}

//
// This rather complex gaggle of code handles querying for topics but
// also allows for direct linking to a post (and the calculation of which
// page the post is on and the correct display of viewtopic)
//
$join_sql_table = ( empty($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
$join_sql = ( empty($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
$count_sql = ( empty($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts";

$order_sql = ( empty($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.auth_delayedpost, f.auth_ban, f.auth_greencard, f.auth_bluecard ORDER BY p.post_id ASC";

//-- mod : calendar --------------------------------------------------------------------------------
// here we added
// , t.topic_first_post_id, t.topic_calendar_time, t.topic_calendar_duration
//-- modify
$sql = "SELECT t.topic_id, t.topic_title, t.topic_info, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, t.topic_first_post_id, t.topic_calendar_time, t.topic_calendar_duration, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.auth_delayedpost, f.auth_ban, f.auth_greencard, f.auth_bluecard" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
//-- fin mod : calendar ----------------------------------------------------------------------------
attach_setup_viewtopic_auth($order_sql, $sql);
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
}

if ( !($forum_topic_data = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

$forum_id = intval($forum_topic_data['forum_id']);

//
// Start session management
//
//-- mod : keep unread -----------------------------------------------------------------------------
//-- delete
// $userdata = session_pagestart($user_ip, $forum_id);
// init_userprefs($userdata);
//-- fin mod : keep unread -------------------------------------------------------------------------
//
// End session management
//

//
// Start auth check
//
$is_auth = array();
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
//
// if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
//-- add
$is_auth = $tree['auth'][POST_FORUM_URL . $forum_id];

if ( !$is_auth['auth_read'] )
//-- fin mod : categories hierarchy ----------------------------------------------------------------
{
if ( !$userdata['session_logged_in'] )
{
$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
$redirect .= ( isset($start) ) ? "&start=$start" : '';
redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
}

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
$message .= "<br><br>" . sprintf($lang['Click_return_subscribe_lw'], "<a>", "</a>" );
//-- add
$message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

message_die(GENERAL_MESSAGE, $message);
}
//
// End auth check
//

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $forum_name = $forum_topic_data['forum_name'];
//-- add
$forum_name = get_object_lang(POST_FORUM_URL . $forum_topic_data['forum_id'], 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------

$topic_title = $forum_topic_data['topic_title'];
$topic_info = $forum_topic_data['topic_info'];
$topic_id = intval($forum_topic_data['topic_id']);
$topic_time = $forum_topic_data['topic_time'];
//-- mod : calendar --------------------------------------------------------------------------------
//-- add
$topic_first_post_id = intval($forum_topic_data['topic_first_post_id']);
$topic_calendar_time = intval($forum_topic_data['topic_calendar_time']);
$topic_calendar_duration = intval($forum_topic_data['topic_calendar_duration']);
//-- fin mod : calendar ----------------------------------------------------------------------------

if ( !empty($post_id) )
{
$start = floor(($forum_topic_data['prev_posts'] - 1) / intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']);
}

//
// Is user watching this thread?
//
if( $userdata['session_logged_in'] )
{
$can_watch_topic = TRUE;

$sql = "SELECT notify_status
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
if ( isset($HTTP_GET_VARS['unwatch']) )
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
$is_watching_topic = 0;

$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
}
}

$template->assign_vars(array(
'META' => '<meta>')
);

$message = $lang['No_longer_watching'] . '<br><br>' . sprintf($lang['Click_return_topic'], '<a>', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = TRUE;

if ( $row['notify_status'] )
{
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
SET notify_status = 0
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql);
}
}
}
}
else
{
if ( isset($HTTP_GET_VARS['watch']) )
{
if ( $HTTP_GET_VARS['watch'] == 'topic' )
{
$is_watching_topic = TRUE;

$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
}
}

$template->assign_vars(array(
'META' => '<meta>')
);

$message = $lang['You_are_watching'] . '<br><br>' . sprintf($lang['Click_return_topic'], '<a>', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = 0;
}
}
}
else
{
if ( isset($HTTP_GET_VARS['unwatch']) )
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true));
}
}
else
{
$can_watch_topic = 0;
$is_watching_topic = 0;
}
}

//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
$previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);

if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) )
{
$post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? intval($HTTP_POST_VARS['postdays']) : intval($HTTP_GET_VARS['postdays']);
$min_post_time = time() - (intval($post_days) * 86400);

$sql = "SELECT COUNT(p.post_id) AS num_posts
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE t.topic_id = $topic_id
AND p.topic_id = t.topic_id
AND p.post_time >= $min_post_time";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain limited topics count information", '', __LINE__, __FILE__, $sql);
}

$total_replies = ( $row = $db->sql_fetchrow($result) ) ? intval($row['num_posts']) : 0;

$limit_posts_time = "AND p.post_time >= $min_post_time ";

if ( !empty($HTTP_POST_VARS['postdays']))
{
$start = 0;
}
}
else
{
$total_replies = intval($forum_topic_data['topic_replies']) + 1;

$limit_posts_time = '';
$post_days = 0;
}

$select_post_days = '<select>';
for($i = 0; $i </option> this.topic_last_post_id )
LEFT JOIN " . TOPICS_TABLE . " prev
ON ( prev.forum_id = this.forum_id
AND prev.topic_last_post_id < this.topic_last_post_id )
WHERE this.topic_id = $topic_id
ORDER BY next.topic_last_post_id ASC
, prev.topic_last_post_id DESC
LIMIT 1";
if ( !($result = $db->sql_query($sql)) ){
message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) ){
if($row['prevtopic']){
$view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=".$row['prevtopic']);
$previmg = 'topic_previous';
} else{
$view_prev_topic_url = '';
$previmg = 'topic_previous_no';
}
if($row['nexttopic']){
$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=".$row['nexttopic']);
$nextimg = 'topic_next';
} else{
$view_next_topic_url = '';
$nextimg = 'topic_next_no';
}
} else {
// no next and no prev?
$view_prev_topic_url = '';
$view_next_topic_url = '';
$previmg = 'topic_previous_no';
$nextimg = 'topic_next_no';
}
// Hide Buttons :: Added :: End

//
// Mozilla navigation bar
//
$nav_links['prev'] = array(
'url' => $view_prev_topic_url,
'title' => $lang['View_previous_topic']
);
$nav_links['next'] = array(
'url' => $view_next_topic_url,
'title' => $lang['View_next_topic']
);
$nav_links['up'] = array(
'url' => $view_forum_url,
'title' => $forum_name
);

$reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
$reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic'];
$post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
$post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];

//
// Set a cookie for this topic
//
//-- mod : keep unread -----------------------------------------------------------------------------
//-- delete
// if ( $userdata['session_logged_in'] )
// {
// $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
// $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
//
// if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) )
// {
// $topic_last_read = ( $tracking_topics[$topic_id] > $tracking_forums[$forum_id] ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
// }
// else if ( !empty($tracking_topics[$topic_id]) || !empty($tracking_forums[$forum_id]) )
// {
// $topic_last_read = ( !empty($tracking_topics[$topic_id]) ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
// }
// else
// {
// $topic_last_read = $userdata['user_lastvisit'];
// }
//
// if ( count($tracking_topics) >= 150 && empty($tracking_topics[$topic_id]) )
// {
// asort($tracking_topics);
// unset($tracking_topics[key($tracking_topics)]);
// }
//
// $tracking_topics[$topic_id] = time();
//
// setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
// }
//-- add
// clean some cookies
if ( !empty($board_config['tracking_all']) && isset($board_config['tracking_forums'][$forum_id]) && ($board_config['tracking_all'] >= $board_config['tracking_forums'][$forum_id]) )
{
unset($board_config['tracking_forums'][$forum_id]);
}
if ( isset($board_config['tracking_unreads'][$topic_id]) )
{
unset($board_config['tracking_unreads'][$topic_id]);
}

// add a cookie for this topic
$board_config['tracking_topics'][$topic_id] = time();

// except the cookies
write_cookies($userdata);
//-- fin mod : keep unread -------------------------------------------------------------------------

//
// Load templates
//
if(isset($HTTP_GET_VARS['printertopic']))
{
$template->set_filenames(array(
'body' => 'printertopic_body.tpl')
);
} else
{
$template->set_filenames(array(
'body' => 'viewtopic_body.tpl')
);
}
make_jumpbox('viewforum.'.$phpEx, $forum_id);

//
// Output page header
//
$page_title = $lang['View_topic'] .' - ' . $topic_title;
if(isset($HTTP_GET_VARS['printertopic']))
{
include($phpbb_root_path . 'includes/page_header_printer.'.$phpEx);
} else
{
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//-- mod : sub-template ----------------------------------------------------------------------------
//-- add
$reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
$post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
//-- fin mod : sub-template ------------------------------------------------------------------------
}

//Parse smilies to display topic title
$topic_title2 = $topic_title;
$topic_title = smilies_pass($topic_title);

//
// User authorisation levels output
//
$s_auth_can = ( ( $is_auth['auth_post'] ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br>';
$s_auth_can .= ( ( $is_auth['auth_reply'] ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br>';
$s_auth_can .= ( ( $is_auth['auth_edit'] ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br>';
$s_auth_can .= ( ( $is_auth['auth_delete'] ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br>';
$s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '<br>';
$s_auth_can .= ( $is_auth['auth_ban'] ) ? $lang['Rules_ban_can'] . "<br>" : "";
$s_auth_can .= ( $is_auth['auth_greencard'] ) ? $lang['Rules_greencard_can'] . "<br>" : "";
$s_auth_can .= ( $is_auth['auth_bluecard'] ) ? $lang['Rules_bluecard_can'] . "<br>" : "";
attach_build_auth_levels($is_auth, $s_auth_can);

$topic_mod = '';

if ( $is_auth['auth_mod'] )
{
$s_auth_can .= sprintf($lang['Rules_moderate'], "</a><img></a> ';

$topic_mod .= "</a><img></a> ' : "</a><img></a> ';

//-- mod : merge -----------------------------------------------------------------------------------
//-- add
$topic_mod .= '<a><img></a> ';
//-- fin mod : merge -------------------------------------------------------------------------------

}

//
// Topic watch information
//
$s_watching_topic = '';
if ( $can_watch_topic )
{
if ( $is_watching_topic )
{
$s_watching_topic = "</a><img></a>' : '';
}
else
{
$s_watching_topic = "</a><img></a>' : '';
}
}

//
// Bookmark information
//
if ( $userdata['session_logged_in'] )
{
$template->assign_block_vars('bookmark_state', array());
// Send vars to template
$bm_action = (is_bookmark_set($topic_id)) ? ("&removebm=true") : ("&setbm=true");
$template->assign_vars(array(
'L_BOOKMARK_ACTION' => (is_bookmark_set($topic_id)) ? ($lang['Remove_Bookmark']) : ($lang['Set_Bookmark']),
'BM_IMG' => (is_bookmark_set($topic_id)) ? $images['bm_remove'] : $images['bm_add'],
'U_BOOKMARK_ACTION' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=" . $HTTP_GET_VARS['highlight'] . $bm_action))
);
}

//
// If we've got a hightlight set pass it on to pagination,
// I get annoyed when I lose my highlight after the first page.
//
if(isset($HTTP_GET_VARS['printertopic']))
{
$pagination_printertopic = "printertopic=1&";
}
if($highlight != '')
{
$pagination_highlight = "highlight=$highlight&";
}
$pagination_ppp = $board_config['posts_per_page'];
if(isset($finish))
{
$pagination_ppp = ($finish <0>assign_block_vars('switch_info', array());
}

if ( isset($HTTP_POST_VARS['submit_topic_info']) && trim($HTTP_POST_VARS['topic_info']) != '' && (($userdata['user_level'] == ADMIN) || ($is_auth['auth_mod'])) )
{
$sql = "UPDATE ". TOPICS_TABLE ."
SET topic_info = '" . str_replace("'", "''", $HTTP_POST_VARS['topic_info']) . "'
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update topic info.', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Topic_info_updated'] . "<br><br>" . sprintf($lang['Click_return_topic'], "<a>", "</a>") . "<br><br>" . sprintf($lang['Click_return_forum'], "<a>", "</a>");
message_die(GENERAL_MESSAGE, $message);
}

if($pagination != '' && isset($pagination_printertopic))
{
$pagination .= " <a>:| |:</a>";
}

// Hide Buttons :: Added :: Start
if ($userdata['session_logged_in']){
$template->assign_block_vars('switch_logged_in', array());
}
if($is_auth['auth_post']){
$template->assign_block_vars('is_auth_post', array());
}
if($is_auth['auth_reply']){
$template->assign_block_vars('is_auth_reply', array());
}
// Hide Buttons :: Added :: End
//
// Send vars to template
//
$template->assign_vars(array(
'L_DOWNLOAD_POST' => $lang['Download_post'],
'START_REL' => ($start + 1),
'FINISH_REL' => (isset($HTTP_GET_VARS['finish_rel'])? intval($HTTP_GET_VARS['finish_rel']) : ($board_config['posts_per_page'] - $start)),
'L_TOPIC_INFO' => $lang['Topic_info'],
'S_INFO_ACTION' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"),
'TOPIC_INFO' => $topic_info,
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name,
'TOPIC_ID' => $topic_id,
'TOPIC_TITLE' => $topic_title,
'TOPIC_TITLE2' => $topic_title2,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $pagination_ppp ) + 1 ), ceil( $total_replies / $pagination_ppp )),

'POST_IMG' => $post_img,
'REPLY_IMG' => $reply_img,

/* Hide Buttons :: Altered
'TOPIC_PREVIOUS_IMAGE' => $images['topic_previous'],*/
'TOPIC_PREVIOUS_IMAGE' => $images[$previmg],
'TOPIC_PRINT_IMAGE' => $images['topic_print'],
'TOPIC_EMAIL_IMAGE' => $images['topic_email'],
'TOPIC_SEARCH_IMAGE' => $images['topic_search'],
'TOPIC_WHO_POST_IMAGE' => $images['topic_who_post'],
'TOPIC_EXPORT_IMAGE' => $images['topic_export'],
'TOPIC_DOWN_IMAGE' => $images['topic_down'],
/* Hide Buttons :: Altered
'TOPIC_NEXT_IMAGE' => $images['topic_next'],*/
'TOPIC_NEXT_IMAGE' => $images[$nextimg],
'ICON_DISK_IMAGE' => $images['icon_disk'],
'TOPIC_UP_IMAGE' => $images['topic_up'],
'ICON_UP_IMAGE' => $images['icon_up'],

'L_AUTHOR' => $lang['Author'],
'L_POPUP_MESSAGE' => $lang['Postings_popup_message'],
'L_EXPORT' => $lang['Export'],
'L_MESSAGE' => $lang['Message'],
'L_POSTED' => $lang['Posted'],
'L_POST_SUBJECT' => $lang['Post_subject'],
'L_VIEW_NEXT_TOPIC' => $lang['View_next_topic'],
'L_VIEW_PREVIOUS_TOPIC' => $lang['View_previous_topic'],
'L_POST_NEW_TOPIC' => $post_alt,
'L_POST_REPLY_TOPIC' => $reply_alt,
'L_PRINTER_TOPIC' => $lang['Printer_topic'],
'L_BACK_TO_TOP' => $lang['Back_to_top'],
'L_DISPLAY_POSTS' => $lang['Display_posts'],
'L_LOCK_TOPIC' => $lang['Lock_topic'],
'L_UNLOCK_TOPIC' => $lang['Unlock_topic'],
'L_MOVE_TOPIC' => $lang['Move_topic'],
'L_SPLIT_TOPIC' => $lang['Split_topic'],
'L_DELETE_TOPIC' => $lang['Delete_topic'],
'L_GOTO_PAGE' => $lang['Goto_page'],
'L_TELL_FRIEND' => $lang['Tell_Friend'],

'S_TOPIC_LINK' => POST_TOPIC_URL,
'S_SELECT_POST_DAYS' => $select_post_days,
'S_SELECT_POST_ORDER' => $select_post_order,
'S_POST_DAYS_ACTION' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . "&start=$start"),
'S_AUTH_LIST' => $s_auth_can,
'S_TOPIC_ADMIN' => $topic_mod,
'S_WATCH_TOPIC' => $s_watching_topic,
'S_WATCH_TOPIC_IMG' => $s_watching_topic_img,

'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"),
'U_VIEW_FORUM' => $view_forum_url,
'U_POSTINGS_POPUP' => append_sid("postings_popup.$phpEx?t=$topic_id"),
'U_EXPORT' => append_sid("export.$phpEx?t=$topic_id"),
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
'U_POST_NEW_TOPIC' => $new_topic_url,
'U_PRINTER_TOPIC' => $printer_topic_url,
'U_POST_REPLY_TOPIC' => $reply_topic_url)
);

//
// Does this topic contain a poll?
//
if ( !empty($forum_topic_data['topic_vote']) )
{
//
// Begin Approve_Mod Block : 10
//

} //end of: if ( !empty($forum_topic_data['topic_vote']) )
//ends the 'Does this topic conatin a poll?' (instead of doing a replace, we redid the if on the bottom of this 'after, add'

$approve_mod = array();
$approve_sql = "SELECT * FROM " . APPROVE_FORUMS_TABLE . "
WHERE forum_id = " . intval($forum_id) . "
LIMIT 0,1";
if ( !($approve_result = $db->sql_query($approve_sql)) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql);
}
if ( $approve_row = $db->sql_fetchrow($approve_result) )
{
if ( intval($approve_row['enabled']) == 1 )
{
$approve_mod = $approve_row;
$approve_mod['enabled'] = true;
}

}
$approve_mod['moderators'] = explode('|', get_moderators_user_id_of_forum($forum_id));

if ( $approve_mod['enabled'] )
{
if ( in_array($userdata['user_id'], $approve_mod['moderators']) || $is_auth['auth_mod'] )
{
function approve_mod_pm($type, $id)
{
global $approve_mod, $userdata, $user_ip, $session_length, $starttime, $template, $images, $theme, $db, $board_config, $phpEx, $lang, $phpbb_root_path, $html_entities_match, $html_entities_replace, $unhtml_specialchars_match, $unhtml_specialchars_replace;

if ( $approve_mod['approve_notify_approval'] )
{
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <80>sql_query($approve_sql) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql);
}
if ( $approve_row = $db->sql_fetchrow($approve_result) )
{
$approve_to[0] = $approve_row;
}
$privmsg_subject = $lang['approve_notify_post_approved'] . " " . $lang['Post'] . ": " . $id;
$privmsg_message = $lang['approve_notify_user_link'] . "n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $id . '#' . $id;
}
elseif ( $type == 'app_c' )
{
//notify user of post approval
$approve_sql = "SELECT u.*, p.post_id, p.topic_id FROM " . USERS_TABLE . " u, " . APPROVE_POSTS_TABLE . " p WHERE p.topic_id = " . intval($id) . "
AND u.user_id = p.poster_id";
if ( !$approve_result = $db->sql_query($approve_sql) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql);
}
if ( $approve_row = $db->sql_fetchrow($approve_result) )
{
$approve_to[0] = $approve_row;
}
$privmsg_subject = $lang['approve_notify_post_approved'] . " " . $lang['Topic'] . ": " . $id;
$privmsg_message = $lang['approve_notify_user_link'] . "n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $approve_to[0]['post_id'] . '#' . $approve_to[0]['post_id'] . "nn" . $lang['approve_notify_user_topic'];
}
else
{
$approve_sql = "SELECT * FROM " . USERS_TABLE . "
WHERE user_id = " . intval($id);
if ( !$approve_result = $db->sql_query($approve_sql) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql);
}
if ( $approve_row = $db->sql_fetchrow($approve_result) )
{
$approve_to[0] = $approve_row;
}
switch($type)
{
case 'app_ua':
$privmsg_subject = $lang['approve_notify_auto_app'];
$privmsg_message = $lang['approve_notify_auto_app_msg'];
break;

case 'app_ur':
$privmsg_subject = $lang['approve_notify_auto_app_rem'];
$privmsg_message = $lang['approve_notify_auto_app_rem_msg'];
break;

case 'app_ma':
$privmsg_subject = $lang['approve_notify_moderation'];
$privmsg_message = $lang['approve_notify_moderation_msg'];
break;

case 'app_mr':
$privmsg_subject = $lang['approve_notify_moderation_rem'];
$privmsg_message = $lang['approve_notify_moderation_rem_msg'];
break;
}
}
$approve_user_list = array();
for($i = 0; !empty($approve_to[$i]['user_id']); $i++)
{
if ( $approve_to[$i]['user_id'] != ANONYMOUS && !in_array($approve_to[$i]['user_id'], $approve_user_list) )
{
$approve_user_list[] = $approve_to[$i]['user_id'];

$bbcode_uid = make_bbcode_uid();
$privmsg_message = prepare_message($privmsg_message, 1, 1, 1, $bbcode_uid);
$msg_time = time();
//
// See if recipient is at their inbox limit
//
$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 = " . intval($approve_to[$i]['user_id']);
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : '';
if ( $inbox_info = $db->sql_fetchrow($result) )
{
if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] && !empty($inbox_info['oldest_post_time']) )
{
$sql = "SELECT privmsgs_id 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 = " . intval($approve_to[$i]['user_id']);
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
}
$old_privmsgs_id = $db->sql_fetchrow($result);
$old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_id = $old_privmsgs_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)'.$sql, '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . "
WHERE privmsgs_text_id = $old_privmsgs_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
}
}
}
//
// Send the pm notification
//
$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("'", "'", $privmsg_subject) . "', " . intval($approve_to[$i]['user_id']) . ", " . intval($approve_to[$i]['user_id']) . ", $msg_time, '0.0.0.0', 1, 1, 1, 0)";
if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, "Could not insert/update 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("'", "'", $privmsg_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 = " . time() . "
WHERE user_id = " . intval($approve_to[$i]['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);
}
//
// E-mail notify the user of the new PM if they have email notification for PM enabled in profile
//
if ( $approve_to[$i]['user_notify_pm'] && !empty($approve_to[$i]['user_email']) && $approve_to[$i]['user_active'] )
{
$email_headers = 'From: ' . $board_config['board_email'] . "nReturn-Path: " . $board_config['board_email'] . "n";
$script_name = preg_replace('/^/?(.*?)/?$/', "\1", trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->use_template('privmsg_notify',$approve_to[$i]['user_lang']);
$emailer->extra_headers($email_headers);
$emailer->email_address($approve_to[$i]['user_email']);
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array(
'USERNAME' => $approve_to[$i]['username'],
'SITENAME' => $board_config['sitename'],
'EMAIL_SIG' => (!empty($board_config['board_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();
}
}//if not guest or we've already notified them once
}//for loop
}
}//function approve_mod_pm

if ( isset($HTTP_GET_VARS['app_p']) )
{
//notify user
approve_mod_pm('app_p', intval($HTTP_GET_VARS['app_p']));
$approve_sql = "DELETE FROM " . APPROVE_POSTS_TABLE . "
WHERE post_id = " . intval($HTTP_GET_VARS['app_p']);
if ( !($approve_result = $db->sql_query($approve_sql)) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_delete'], '', __LINE__, __FILE__, $approve_sql);
}
}
if ( isset($HTTP_GET_VARS['app_c']) )
{
//loop through & notify users
approve_mod_pm('app_c', intval($HTTP_GET_VARS['app_c']));
$approve_sql = "DELETE FROM " . APPROVE_POSTS_TABLE . "
WHERE topic_id = " . intval($HTTP_GET_VARS['app_c']);
if ( !($approve_result = $db->sql_query($approve_sql)) )
{
message_die(GENERAL_ERROR, $lang['approve_posts_error_delete'], '', __LINE__, __FILE__, $approve_sql);
}
}
if ( isset($HTTP_GET_VARS['app_f']) )
{
$approve_sql = "DELETE FROM " . APPROVE_TOPICS_TABLE . "