jamie Site Admin Joined: 10 March 2005 Total posts: 27 Gender: Unknown Karma: 1 Karma yesterday, day before: 1, 1
|
Post: #1 (ID: 39) Posted: Mon Jul 17, 2006 3:11 pm Karma this post: (+0 -0) Post subject: [PATCH for mod-advanced_pm] : Stopping the subject line containing "Re: Re: Re:...&qu |
|
|
This patch fixes the constant addition of "Re:" to PM replies, or "Fwd: " to foward messages (it's compatible with foreign language alternatives, too)
Subjects are changed as follows:
Subject: test
Subject: Re: test
Subject: Re[2]: test
Subject: Re[3]: test
etc.
Please note, that this won't fix up any messages that already exist with long "Re: Re: Re:..." subjects, but will keep all new messages tidy. (I was going to add code to do that, but thought it was a waste of efficiency, as it's only a transitional problem)
Please test, and let me know!
| Code: |
#-----[ OPEN ]------------------------------------------
#
includes/functions_privmsga.php
#
#-----[ FIND ]------------------------------------------
#
$userclass = 'name';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// START Jamie's stuff -- Jamie Jones <jamie@bishopston.net>
function catflap_tidy_subject($subject, $prefix)
{
$raw_prefix = preg_replace ('/ *: *$/', '', $prefix);
$prefix_count = 0;
if (strpos ($subject, $prefix)===0)
{
$prefix_count = 2;
$subject = preg_replace ('/^' . $prefix . '/', '', $subject);
}
else
if (preg_match( '/^' . $raw_prefix . '\[[1-9][0-9]*\]: /', $subject ))
{
$prefix_count = preg_replace ('/^' . $raw_prefix . '\[([1-9][0-9]*)\]: .*/', '\1', $subject) + 1;
$subject = preg_replace ('/^' . $raw_prefix . '\[[1-9][0-9]*\]: /', '', $subject);
}
if ($prefix_count > 1) $subject = $raw_prefix . '[' . $prefix_count . ']: ' . $subject;
else $subject = $prefix . $subject;
return $subject;
}
// End Jamies stuff
#-----[ OPEN ]------------------------------------------
#
includes/privmsga_post.php
#
#-----[ FIND ]------------------------------------------
#
$subject = _lang('Short_reply') . $subject;
#
#-----[ REPLACE ]------------------------------------------
#
$subject = catflap_tidy_subject ($subject, _lang('Short_reply'));
#
#-----[ FIND (yes, the same thing as above occurs again) ]----
#
$subject = _lang('Short_reply') . $subject;
#
#-----[ REPLACE ]------------------------------------------
#
$subject = catflap_tidy_subject ($subject, _lang('Short_reply'));
#
#-----[ FIND ]------------------------------------------
#
$subject = _lang('Short_forward') . $subject;
#
#-----[ REPLACE ]------------------------------------------
#
$subject = catflap_tidy_subject ($subject, _lang('Short_forward'));
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
| |
|