rjordan
02-14-2005, 10:00 PM
This will be updated. Until then, no further support for this version will be given.
Well, folks, here it is. Your input is appreciated. As this is my first real modification for vB and in PHP, please keep flames to a minimum! :laugh: If any issues are found, please post them here. The final release will be posted after a few weeks of discussion here and any tweaks need to be made.
Screenshots are attached.
--------------
Version History:
v0.01 BETA - 02-15-05 (NO LONGER SUPPORTED)
- This release.
- Renamed from v0.99 BETA. (02-24-05)
- Added version history. (02-24-05)
- Added future release details. (02-24-05)
--------------
Future release: (IN PROGRESS)
- Seperate edits into their own database field.
- Pop-up edits in another window.
- Admin selectable limit of edits displayed.
- Admin selectable forums to track edits rather than global.
--------------
// ************************************************** ********************
// *
// * View Post Edits modification v0.99 BETA
// * Coded by Richard Jordan for vBulletin v3.0.x
// *
// * This a BETA release. As with all releases, make a backup of
// * your forums and database to ensure data integrity in the event there
// * is an unforeseen problem. Testing has been performed to the extent
// * that all possible issues have been addressed, however without proper
// * field testing, this modification CANNOT be certified as complete.
// *
// * This modification may be installed on any site with a legitimate
// * vBulletin license. It may be reposted on other sites freely as
// * long as it is done in its entirety, credit is given to the author,
// * and it is not reposted at any location where anyone must pay in any
// * way for any reason to fully obtain this modification.
// *
// ************************************************** ********************
Overview:
---------
This modification will allow viewing of all post edits. It does this
by taking the posts that are edited and appending the original to the
end of the post. This original post is enclosed in new BBCode
and tags. When this tag is found, the contents are displayed
as a previous edit and is marked as such. This is controlled by user
group. If you would like certain members or groups to have access to
view these edits, simply add this user permission. If a user enters
the new BBCode in any message, the brackets are converted to their
numerical code value thus preventing them from interfering with the
modification.
// ************************************************** ********************
// ************************************************** ********************
Notes:
------
- Previous edits are stamped with the time and date as well as who
made the post edit.
- When no reason is given for a post edit, it is automatically set
to "No reason given."
- Usergroup based permissions.
- One added query each time a post edit is submitted or previewed.
- Includes instructions for vBAdvanced CPMS news, however if other
modules/portals/hacks are used to read post data, they will need
to be modified to prevent the displaying of post edits.
- Collapsable tables conserve screen real-estate so only the post
edits you wish to see can be displayed. Scrolling is implemented
to conserve even more space.
- Uses phrases for easy language conversion.
- Uses templates for easy customization.
- Images included in the previous edits will not count toward the
total image count for the post. This should be remembered for
those with users that like to post a lot of images and they edit
those messages with any kind of frequency.
// ************************************************** ********************
// ************************************************** ********************
Modification Summary:
---------------------
SQL Queries: 1
New Templates: 2
Modified Templates: -
New Phrases: 5
Modified Phrases: -
New Files: 2
Modified Files: 9 (10 with vBAdvanced CPMS)
// ************************************************** ********************
New Files:
----------
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************
Files that will be required for this modification:
--------------------------------------------------
./editpost.php
./newreply.php
./newthread.php
./printthread.php
./admincp/usergroup.php
./includes/functions_bbcodeparse.php
./includes/functions_newpost.php
./includes/functions_showthread.php
./includes/init.php
./modules/news.php (Only if vBAdvanced CMPS is installed)
==========================
PLEASE BACK UP THESE FILES
==========================
// ************************************************** ********************
// ************************************************** ********************
Upload new files:
-----------------
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************
// ************************************************** ********************
Execute SQL query:
------------------
ALTER TABLE `usergroup` ADD `canviewpostedits` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;
// ************************************************** ********************
// ************************************************** ********************
Add new phrases:
----------------
- Type: permissions
Phrase: can_view_post_edits
Text: Can View Post Edits
- Type: postbit
Phrase: view_edits_after_edit_by_x_on_y_z
Text: After edit by {1} on {2} at {3}:
- Type: postbit
Phrase: view_edits_before_any_edits
Text: Before any edits, post was:
- Type: postbit
Phrase: view_edits_previous_edits
Text: Previous Edits:
- Type: postbit
Phrase: view_edits_no_reason
Text: No reason given.
- Type: postbit
Phrase: view_edits_show_or_hide_edits
Text: SHOW/HIDE POST EDITS
// ************************************************** ********************
// ************************************************** ********************
Create a new template: view_edits
---------------------------------
<if condition="isset($viewedits)">
<!-- edits -->
<br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td valign="top">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('view_edit_bit_$post[postcount]')">$vbphrase[view_edits_show_or_hide_edits] <img id="collapseimg_view_edit_bit_$post[postcount]" src="$stylevar[imgdir_button]/collapse_tcat_collapsed{$forumid}.gif" alt="" border="0" /></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="$stylevar[outertablewidth]" align="center" id="collapseobj_view_edit_bit_$post[postcount]" style="display:none;">
<tbody>
<tr>
<td>
<fieldset class="fieldset" style="height:300px; overflow:auto; margin:0px 0px 0px 0px;">
<legend>$vbphrase[view_edits_previous_edits] </legend>
<div style="margin:10px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="border:1px inset">
$viewedits
</td>
</tr>
</table>
</div>
</fieldset>
</td>
</tr>
</tbody>
</table>
<!-- /edits -->
</if>
// ************************************************** ********************
// ************************************************** ********************
Create a new template: view_edits_bit
-------------------------------------
<div class="smallfont"><em><b>Edit:</b><br /><table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><phrase 1="$bbuserinfo[username]" 2="$date" 3="$time">$vbphrase[view_edits_after_edit_by_x_on_y_z]</phrase>
$vbphrase[reason]: $edit[reason]</em></div><hr size="1">$newEdit</td></tr></table><br /><br /><if condition="isset($prevEdits)">$prevEdits</if><if condition="isset($firstEdit)"><table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><div class="smallfont"><em>$vbphrase[view_edits_before_any_edits]</em></div><hr size="1">$firstEdit</td></tr></table></if>
// ************************************************** ********************
// ************************************************** ********************
FILE: ./editpost.php (4 changes)
--------------------------------
FIND:
-----
$phrasegroups = array('threadmanage', 'posting');
REPLACE WITH:
-------------
$phrasegroups = array('threadmanage', 'posting', 'Postbit');
FIND:
-----
require_once('./includes/functions_editor.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
verify_post_errors('editpost', $edit, $errors);
ABOVE THAT ADD:
---------------
$oldPost = fetch_postinfo($postid);
$edit['message'] = handle_bbcode_bad_edit_tags($edit['message']);
$newEdit = $edit['message'];
$prevEdits = preg_replace('!(.*)\(.*)\[\/edit\](.*)!is', '\\2', $oldPost['pagetext']);
if ($oldPost['pagetext'] == $prevEdits) {
$firstEdit = $oldPost['pagetext'];
$prevEdits = "";
}
$date = vbdate($vboptions['dateformat'], TIMENOW, 0, 1, 0, 0);
$time = vbdate($vboptions['timeformat'], TIMENOW, 0, 1, 0, 0);
if (!$edit['reason']) {
$edit['reason'] = $vbphrase['view_edits_no_reason'];
}
eval('$edit[\'message\'] .= "' . fetch_template('view_edits_bit') . '";');
FIND:
-----
construct_edit_toolbar($newpost['message'], 0, $foruminfo['forumid'], iif($foruminfo['allowsmilies'], 1, 0), iif($postinfo['allowsmilie'] AND $_REQUEST['disablesmilies'] != 1, 1, 0));
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./newreply.php (2 changes)
--------------------------------
FIND:
-----
require_once('./includes/functions_bigthree.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
eval('$threadreviewbits .= "' . fetch_template('newreply_reviewbit') . '";');
ABOVE THAT ADD:
---------------
$pagetext = handle_bbcode_strip_edit_data($pagetext);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./newthread.php (2 changes)
--------------------------------
FIND:
-----
require_once('./includes/functions_bigthree.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
if (!($forumperms & CANPOSTPOLL))
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_bad_edit_tags($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./printthread.php (1 change)
----------------------------------
FIND:
-----
eval('$postbits .= "' . fetch_template('printthreadbit') . '";');
ABOVE THAT ADD:
---------------
$post['message'] = handle_bbcode_strip_edit_data($post['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./admincp/usergroup.php (1 change)
----------------------------------------
FIND:
-----
print_yes_no_row($vbphrase['can_delete_own_posts'], 'usergroup[candeletepost]', $ug_bitfield['candeletepost']);
ABOVE THAT ADD:
---------------
print_yes_no_row($vbphrase['can_view_post_edits'], 'usergroup[canviewpostedits]', $ug_bitfield['canviewpostedits']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_bbcodeparse.php (1 change)
-----------------------------------------------------
FIND:
-----
// ###################### Start strip_smilies #######################
ABOVE THAT ADD:
---------------
// ###################### Start bbcodehandler_viewpostedits #######################
function handle_bbcode_view_post_edits($code,$canviewedits)
{
$oldPost = $code;
if ($canviewedits)
{
$code = preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is', '\\2', $code);
if ($oldPost == $code) {
unset($code);
}
}
else {
unset($code);
}
return $code;
}
// ###################### Start bbcodehandler_strippostedits #######################
function handle_bbcode_strip_edit_data($code)
{
$code = preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is', '\\1\\3', $code);
return $code;
}
// ###################### Start bbcodehandler_invalidviewpostedits #######################
function handle_bbcode_bad_edit_tags($code)
{
$editTagFind = array("'\[edit\]'si", "'\[\/edit\]'si");
$editTagReplace = array("[edit]", "");
$code = preg_replace($editTagFind, $editTagReplace, $code);
return $code;
}
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_newpost.php (2 changes)
--------------------------------------------------
FIND:
-----
if ($vboptions['maximages'] != 0 AND fetch_character_count(parse_bbcode($post['message'], $foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages'])
REPLACE WITH:
-------------
$imgCheck = handle_bbcode_strip_edit_data($post['message']);
if ($vboptions['maximages'] != 0 AND fetch_character_count(parse_bbcode($imgCheck, $foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages'])
FIND:
-----
$previewmessage = parse_bbcode($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 0, 1));
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_showthread.php (1 change)
----------------------------------------------------
FIND:
-----
// highlight words from search engine ($_REQUEST[highlight])
ABOVE THAT ADD:
---------------
$canviewedits = $permissions[canviewpostedits];
if ($canviewedits)
{
$viewedits = handle_bbcode_view_post_edits($post['message'], $canviewedits);
if (!empty($viewedits))
{
eval('$viewedits = "' . fetch_template('view_edits') . '";');
}
}
$post['message'] = handle_bbcode_strip_edit_data($post['message']).$viewedits;
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/init.php (1 change)
------------------------------------
FIND:
-----
// ### INSERT PLUGIN USERGROUP PERMISSIONS BITFIELDS HERE ###
// ----------------------------------------------------------
BELOW THAT ADD:
---------------
$_BITFIELD['usergroup']['canviewpostedits'] = array(
'canviewpostedits' => 1,
);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./modules/news.php (1 change) (Only if vBAdvanced CMPS is installed)
-----------------------------------
FIND:
-----
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
BELOW THAT ADD:
---------------
$news['message'] = handle_bbcode_strip_edit_data($news['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
Well, folks, here it is. Your input is appreciated. As this is my first real modification for vB and in PHP, please keep flames to a minimum! :laugh: If any issues are found, please post them here. The final release will be posted after a few weeks of discussion here and any tweaks need to be made.
Screenshots are attached.
--------------
Version History:
v0.01 BETA - 02-15-05 (NO LONGER SUPPORTED)
- This release.
- Renamed from v0.99 BETA. (02-24-05)
- Added version history. (02-24-05)
- Added future release details. (02-24-05)
--------------
Future release: (IN PROGRESS)
- Seperate edits into their own database field.
- Pop-up edits in another window.
- Admin selectable limit of edits displayed.
- Admin selectable forums to track edits rather than global.
--------------
// ************************************************** ********************
// *
// * View Post Edits modification v0.99 BETA
// * Coded by Richard Jordan for vBulletin v3.0.x
// *
// * This a BETA release. As with all releases, make a backup of
// * your forums and database to ensure data integrity in the event there
// * is an unforeseen problem. Testing has been performed to the extent
// * that all possible issues have been addressed, however without proper
// * field testing, this modification CANNOT be certified as complete.
// *
// * This modification may be installed on any site with a legitimate
// * vBulletin license. It may be reposted on other sites freely as
// * long as it is done in its entirety, credit is given to the author,
// * and it is not reposted at any location where anyone must pay in any
// * way for any reason to fully obtain this modification.
// *
// ************************************************** ********************
Overview:
---------
This modification will allow viewing of all post edits. It does this
by taking the posts that are edited and appending the original to the
end of the post. This original post is enclosed in new BBCode
and tags. When this tag is found, the contents are displayed
as a previous edit and is marked as such. This is controlled by user
group. If you would like certain members or groups to have access to
view these edits, simply add this user permission. If a user enters
the new BBCode in any message, the brackets are converted to their
numerical code value thus preventing them from interfering with the
modification.
// ************************************************** ********************
// ************************************************** ********************
Notes:
------
- Previous edits are stamped with the time and date as well as who
made the post edit.
- When no reason is given for a post edit, it is automatically set
to "No reason given."
- Usergroup based permissions.
- One added query each time a post edit is submitted or previewed.
- Includes instructions for vBAdvanced CPMS news, however if other
modules/portals/hacks are used to read post data, they will need
to be modified to prevent the displaying of post edits.
- Collapsable tables conserve screen real-estate so only the post
edits you wish to see can be displayed. Scrolling is implemented
to conserve even more space.
- Uses phrases for easy language conversion.
- Uses templates for easy customization.
- Images included in the previous edits will not count toward the
total image count for the post. This should be remembered for
those with users that like to post a lot of images and they edit
those messages with any kind of frequency.
// ************************************************** ********************
// ************************************************** ********************
Modification Summary:
---------------------
SQL Queries: 1
New Templates: 2
Modified Templates: -
New Phrases: 5
Modified Phrases: -
New Files: 2
Modified Files: 9 (10 with vBAdvanced CPMS)
// ************************************************** ********************
New Files:
----------
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************
Files that will be required for this modification:
--------------------------------------------------
./editpost.php
./newreply.php
./newthread.php
./printthread.php
./admincp/usergroup.php
./includes/functions_bbcodeparse.php
./includes/functions_newpost.php
./includes/functions_showthread.php
./includes/init.php
./modules/news.php (Only if vBAdvanced CMPS is installed)
==========================
PLEASE BACK UP THESE FILES
==========================
// ************************************************** ********************
// ************************************************** ********************
Upload new files:
-----------------
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************
// ************************************************** ********************
Execute SQL query:
------------------
ALTER TABLE `usergroup` ADD `canviewpostedits` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;
// ************************************************** ********************
// ************************************************** ********************
Add new phrases:
----------------
- Type: permissions
Phrase: can_view_post_edits
Text: Can View Post Edits
- Type: postbit
Phrase: view_edits_after_edit_by_x_on_y_z
Text: After edit by {1} on {2} at {3}:
- Type: postbit
Phrase: view_edits_before_any_edits
Text: Before any edits, post was:
- Type: postbit
Phrase: view_edits_previous_edits
Text: Previous Edits:
- Type: postbit
Phrase: view_edits_no_reason
Text: No reason given.
- Type: postbit
Phrase: view_edits_show_or_hide_edits
Text: SHOW/HIDE POST EDITS
// ************************************************** ********************
// ************************************************** ********************
Create a new template: view_edits
---------------------------------
<if condition="isset($viewedits)">
<!-- edits -->
<br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td valign="top">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('view_edit_bit_$post[postcount]')">$vbphrase[view_edits_show_or_hide_edits] <img id="collapseimg_view_edit_bit_$post[postcount]" src="$stylevar[imgdir_button]/collapse_tcat_collapsed{$forumid}.gif" alt="" border="0" /></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="$stylevar[outertablewidth]" align="center" id="collapseobj_view_edit_bit_$post[postcount]" style="display:none;">
<tbody>
<tr>
<td>
<fieldset class="fieldset" style="height:300px; overflow:auto; margin:0px 0px 0px 0px;">
<legend>$vbphrase[view_edits_previous_edits] </legend>
<div style="margin:10px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="border:1px inset">
$viewedits
</td>
</tr>
</table>
</div>
</fieldset>
</td>
</tr>
</tbody>
</table>
<!-- /edits -->
</if>
// ************************************************** ********************
// ************************************************** ********************
Create a new template: view_edits_bit
-------------------------------------
<div class="smallfont"><em><b>Edit:</b><br /><table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><phrase 1="$bbuserinfo[username]" 2="$date" 3="$time">$vbphrase[view_edits_after_edit_by_x_on_y_z]</phrase>
$vbphrase[reason]: $edit[reason]</em></div><hr size="1">$newEdit</td></tr></table><br /><br /><if condition="isset($prevEdits)">$prevEdits</if><if condition="isset($firstEdit)"><table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><div class="smallfont"><em>$vbphrase[view_edits_before_any_edits]</em></div><hr size="1">$firstEdit</td></tr></table></if>
// ************************************************** ********************
// ************************************************** ********************
FILE: ./editpost.php (4 changes)
--------------------------------
FIND:
-----
$phrasegroups = array('threadmanage', 'posting');
REPLACE WITH:
-------------
$phrasegroups = array('threadmanage', 'posting', 'Postbit');
FIND:
-----
require_once('./includes/functions_editor.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
verify_post_errors('editpost', $edit, $errors);
ABOVE THAT ADD:
---------------
$oldPost = fetch_postinfo($postid);
$edit['message'] = handle_bbcode_bad_edit_tags($edit['message']);
$newEdit = $edit['message'];
$prevEdits = preg_replace('!(.*)\(.*)\[\/edit\](.*)!is', '\\2', $oldPost['pagetext']);
if ($oldPost['pagetext'] == $prevEdits) {
$firstEdit = $oldPost['pagetext'];
$prevEdits = "";
}
$date = vbdate($vboptions['dateformat'], TIMENOW, 0, 1, 0, 0);
$time = vbdate($vboptions['timeformat'], TIMENOW, 0, 1, 0, 0);
if (!$edit['reason']) {
$edit['reason'] = $vbphrase['view_edits_no_reason'];
}
eval('$edit[\'message\'] .= "' . fetch_template('view_edits_bit') . '";');
FIND:
-----
construct_edit_toolbar($newpost['message'], 0, $foruminfo['forumid'], iif($foruminfo['allowsmilies'], 1, 0), iif($postinfo['allowsmilie'] AND $_REQUEST['disablesmilies'] != 1, 1, 0));
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./newreply.php (2 changes)
--------------------------------
FIND:
-----
require_once('./includes/functions_bigthree.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
eval('$threadreviewbits .= "' . fetch_template('newreply_reviewbit') . '";');
ABOVE THAT ADD:
---------------
$pagetext = handle_bbcode_strip_edit_data($pagetext);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./newthread.php (2 changes)
--------------------------------
FIND:
-----
require_once('./includes/functions_bigthree.php');
BELOW THAT ADD:
---------------
require_once('./includes/functions_bbcodeparse.php');
FIND:
-----
if (!($forumperms & CANPOSTPOLL))
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_bad_edit_tags($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./printthread.php (1 change)
----------------------------------
FIND:
-----
eval('$postbits .= "' . fetch_template('printthreadbit') . '";');
ABOVE THAT ADD:
---------------
$post['message'] = handle_bbcode_strip_edit_data($post['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./admincp/usergroup.php (1 change)
----------------------------------------
FIND:
-----
print_yes_no_row($vbphrase['can_delete_own_posts'], 'usergroup[candeletepost]', $ug_bitfield['candeletepost']);
ABOVE THAT ADD:
---------------
print_yes_no_row($vbphrase['can_view_post_edits'], 'usergroup[canviewpostedits]', $ug_bitfield['canviewpostedits']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_bbcodeparse.php (1 change)
-----------------------------------------------------
FIND:
-----
// ###################### Start strip_smilies #######################
ABOVE THAT ADD:
---------------
// ###################### Start bbcodehandler_viewpostedits #######################
function handle_bbcode_view_post_edits($code,$canviewedits)
{
$oldPost = $code;
if ($canviewedits)
{
$code = preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is', '\\2', $code);
if ($oldPost == $code) {
unset($code);
}
}
else {
unset($code);
}
return $code;
}
// ###################### Start bbcodehandler_strippostedits #######################
function handle_bbcode_strip_edit_data($code)
{
$code = preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is', '\\1\\3', $code);
return $code;
}
// ###################### Start bbcodehandler_invalidviewpostedits #######################
function handle_bbcode_bad_edit_tags($code)
{
$editTagFind = array("'\[edit\]'si", "'\[\/edit\]'si");
$editTagReplace = array("[edit]", "");
$code = preg_replace($editTagFind, $editTagReplace, $code);
return $code;
}
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_newpost.php (2 changes)
--------------------------------------------------
FIND:
-----
if ($vboptions['maximages'] != 0 AND fetch_character_count(parse_bbcode($post['message'], $foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages'])
REPLACE WITH:
-------------
$imgCheck = handle_bbcode_strip_edit_data($post['message']);
if ($vboptions['maximages'] != 0 AND fetch_character_count(parse_bbcode($imgCheck, $foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages'])
FIND:
-----
$previewmessage = parse_bbcode($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 0, 1));
ABOVE THAT ADD:
---------------
$newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/functions_showthread.php (1 change)
----------------------------------------------------
FIND:
-----
// highlight words from search engine ($_REQUEST[highlight])
ABOVE THAT ADD:
---------------
$canviewedits = $permissions[canviewpostedits];
if ($canviewedits)
{
$viewedits = handle_bbcode_view_post_edits($post['message'], $canviewedits);
if (!empty($viewedits))
{
eval('$viewedits = "' . fetch_template('view_edits') . '";');
}
}
$post['message'] = handle_bbcode_strip_edit_data($post['message']).$viewedits;
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./includes/init.php (1 change)
------------------------------------
FIND:
-----
// ### INSERT PLUGIN USERGROUP PERMISSIONS BITFIELDS HERE ###
// ----------------------------------------------------------
BELOW THAT ADD:
---------------
$_BITFIELD['usergroup']['canviewpostedits'] = array(
'canviewpostedits' => 1,
);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************
// ************************************************** ********************
FILE: ./modules/news.php (1 change) (Only if vBAdvanced CMPS is installed)
-----------------------------------
FIND:
-----
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
BELOW THAT ADD:
---------------
$news['message'] = handle_bbcode_strip_edit_data($news['message']);
SAVE AND UPLOAD.
----------------
// ************************************************** ********************