News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

TopicRenamer

Started by D#S, September 08, 2011, 11:07:38 AM

Previous topic - Next topic

BeatsMe

Just wondering if this mod is still supported by the developer, and if it works under 2.0.11 ???

Failing that is another mod that does the same.

br360

The mod author may not be around, but this mod works just fine on 2.0.11. It's using hooks so it's even working on my 2.1 test site with no issues as well.

BeatsMe

Good to know it works on 2.1 too  ;)
Thanks for the reply.

Wellwisher

This is a great mod works with 2.0.11 so easy to use, smf should apply this to their main SMF release. I love this mod it was suggested to me by br360. So easy and simple to use, it's sexy man.

Steve

Does it still do this?

Quote from: jsgrom on January 25, 2014, 11:49:22 AM
TopicRenamer is not only changing the title of the topic, but also removing the Re: (reply) why this is happening? It can't be this way, that this modification remove "Re:" from title of topic from reply. Author by this modification why is happen this way?

Your modification should change title of topic, without remove Re:

Perhaps somebody is able to correct this topicrenamer modification? I think that the author this modification didn't offend for this.
DO NOT pm me for support!

Wellwisher

Steve'o works on 2.0.11 beautifully 100%. Tested on local and now running this on production. I also heard it works on 2.1.

Steve

DO NOT pm me for support!

BeatsMe

Just installed this mod on my test forum.... strips the "Re:" from all the replies when you do the rename :(

Not the way I would want a rename mod to work.

Quote from: Steve on November 16, 2015, 08:27:03 AM
Does it still do this?

Quote from: jsgrom on January 25, 2014, 11:49:22 AM
TopicRenamer is not only changing the title of the topic, but also removing the Re: (reply) why this is happening? It can't be this way, that this modification remove "Re:" from title of topic from reply. Author by this modification why is happen this way?

Your modification should change title of topic, without remove Re:

Perhaps somebody is able to correct this topicrenamer modification? I think that the author this modification didn't offend for this.

Shambles

Quote from: ErrorLogOnly variables should be passed by reference

To avoid the warning message when using PHP7.1...

Sources/TopicRenamer.php
Code (Find) Select
// Stripslashes and htmlspecialchars
$context['currentSubject'] = strtr(censorText($smcFunc['db_unescape_string']($currentSubject)), array("\r" => '', "\n" => '', "\t" => ''));


Code (Replace with) Select
// Stripslashes and htmlspecialchars
$tempText = $smcFunc['db_unescape_string']($currentSubject);
$context['currentSubject'] = strtr(censorText($tempText), array("\r" => '', "\n" => '', "\t" => ''));

Shambles

To anyone who is annoyed that messages subordinate to the opening message lose the "RE:" prefix, please find a fix below.

Sources/TopicRenamer.php

Code (find) Select


// Do the dew.
$update = $smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET subject = {string:subject}
WHERE id_topic = {int:topic}',
array(
'subject' => $_POST['subject'],
'topic' => $ID_TOPIC,
)
);


Code (Upgrade to) Select


// Do the dew.
$update = $smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET subject = {string:subject}
WHERE id_topic = {int:topic}
LIMIT 1',
array(
'subject' => $_POST['subject'],
'topic' => $ID_TOPIC,
)
);

$REsubject = 'RE: ' . $_POST['subject'];

// Update subordinate messages.

$update = $smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET subject = {string:REsubject}
WHERE id_topic = {int:topic}
AND subject != {string:newsubject}',
array(
'newsubject' => $_POST['subject'],
'REsubject' => $REsubject,
'topic' => $ID_TOPIC,
)
);

Steve

DO NOT pm me for support!

Steve

Does anyone else use this on 2.0.19 and get tons of errors?
DO NOT pm me for support!

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

Steve

I'm getting:

2048: Only variables should be passed by reference (Line 41)
DO NOT pm me for support!

Wellwisher

@Steve 
Quote from: Steve on February 12, 2022, 04:27:57 PM2048: Only variables should be passed by reference (Line 41)

SMF version? Can you add the line 41 here & what's the file location where the error code sits in?

Also what "type" of error is it under aka Critical | General |  Undefined | User?

I am using it on 2.0.19, not seeing errors.

Steve

I haven't forgotten your question Wellwisher. I just haven't had a chance to reinstall it to get your answers. I'll try to do that today. :)
DO NOT pm me for support!

Steve

As I said ... SMF version is 2.0.19

I'm not sure what more error information you want: d30e5ce2f94b8ae7cd613ef9538a8145
Apply Filter: Only show the errors of this type Type of error: General

2048: Only variables should be passed by reference
Apply Filter: Only show the errors from this file
File: /home/steve/public_html/forums/Sources/TopicRenamer.php
Line: 41

Line 41 reads:

$context['currentSubject'] = strtr(censorText($smcFunc['db_unescape_string']($currentSubject)), array("\r" => '', "\n" => '', "\t" => ''));
DO NOT pm me for support!

Arantor

I was going to rewrite the snippet to make the censorText call not be a weird reference mash (because it shouldn't be) but I'm suddenly having doubts about the unescape call in there at the same time.

I'll take a proper look tonight because this feels like the wrong set of things to be doing... and I'm not sure it isn't a security risk.

Steve

Did you get a chance to look at this Arantor?
DO NOT pm me for support!

Arantor

Thanks for reminding me :)

OK so whatever this mod is doing is actually some really weird archaic nonsense; not even SMF core does this directly (or for any reason here). That said, in its present form it's just weird and harmless in practice because the real protection is still handled by SMF's own routines and this is just a weird shuffle around that won't actually hurt anything.

To fix the immediate issue you're having, the line in question was:
$context['currentSubject'] = strtr(censorText($smcFunc['db_unescape_string']($currentSubject)), array("\r" => '', "\n" => '', "\t" => ''));
It looks like it should become:
$context['currentSubject'] = $smcFunc['db_unescape_string']($currentSubject);
censorText($context['currentSubject']);
$context['currentSubject'] = strtr($context['currentSubject'], array("\r" => '', "\n" => '', "\t" => ''));

More time should really be spent on it to unpick exactly which of the unescape/escape statements can go (probably all of them) but its present form should be fine, just largely unnecessary and confusing.

The issue is censorText expects a reference, what this code was giving it is indirect and not a reference.

Advertisement: