News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

Move Topic Notification [SMF 2.0 Supported]

Started by Nibogo, March 19, 2007, 06:58:51 PM

Previous topic - Next topic

Bugo

This mod has no settings. Try moving some topic and you'll see that this mod adds.

Rav33n

Bug report:

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Power Fan' Header', 1, 255), SUBSTRING('This is an automated message to inform y' at line 3
File: /home/gamerlk/gamer.lk/Sources/Subs-Post.php
Line: 863

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.11, while your database is at version 1.1.2. The above error might possibly go away if you execute the latest version of upgrade.php.

The topic title has a apostrophe in it ('). Title is [HELP] 'Power Fan' Header

Arantor

That's because it's not being sanitised properly before going into the database and not making use of proper string protections.
Perhaps it would have been better if I'd simply never bothered. Y'all clearly would be less unhappy that way.


frozenas

Hi, i cannot find this code:


</div>
<br />
.

There is move.topic.template.php file:

<?php
// Version: 2.0 RC3; MoveTopic

// Show an interface for selecting which board to move a post to.
function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<div id="move_topic" class="lower_padding">
<form action="'
$scripturl'?action=movetopic2;topic='$context['current_topic'], '.0" method="post" accept-charset="'$context['character_set'], '" onsubmit="submitonce(this);">
<div class="cat_bar">
<h3 class="catbg">'
$txt['move_topic'], '</h3>
</div>
<div class="windowbg centertext">
<span class="topslice"><span></span></span>
<div class="content">
<div class="move_topic">
<dl class="settings">
<dt>
<strong>'
$txt['move_to'], ':</strong>
</dt>
<dd>
<select name="toboard">'
;

foreach ($context['categories'] as $category)
{
echo '
<optgroup label="'
$category['name'], '">';

foreach ($category['boards'] as $board)
echo '
<option value="'
$board['id'], '"'$board['selected'] ? ' selected="selected"' ''$board['id'] == $context['current_board'] ? ' disabled="disabled"' '''>'$board['child_level'] > str_repeat('=='$board['child_level']-1) . '=&gt; ' ''$board['name'], '</option>';
echo '
</optgroup>'
;
}

echo '
</select>
</dd>'
;

// Disable the reason textarea when the postRedirect checkbox is unchecked...
echo '
</dl>
<label for="reset_subject"><input type="checkbox" name="reset_subject" id="reset_subject" onclick="document.getElementById(\'subjectArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '
$txt['moveTopic2'], '.</label><br />
<fieldset id="subjectArea" style="display: none;">
<dl class="settings">
<dt><strong>'
$txt['moveTopic3'], ':</strong></dt>
<dd><input type="text" name="custom_subject" size="30" value="'
$context['subject'], '" class="input_text" /></dd>
</dl>
<label for="enforce_subject"><input type="checkbox" name="enforce_subject" id="enforce_subject" class="input_check" /> '
$txt['moveTopic4'], '.</label>
</fieldset>
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" '
$context['is_approved'] ? 'checked="checked"' ''' onclick="'$context['is_approved'] ? '' 'if (this.checked && !confirm(\'' $txt['move_topic_unapproved_js'] . '\')) return false; ''document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '$txt['moveTopic1'], '.</label>
<fieldset id="reasonArea" style="margin-top: 1ex;'
$context['is_approved'] ? '' 'display: none;''">
<dl class="settings">
<dt>
'
$txt['moved_why'], '
</dt>
<dd>
<textarea name="reason" rows="3" cols="40">'
$txt['movetopic_default'], '</textarea>
</dd>
</dl>
</fieldset>'
;

// PM Notification text.
                    if($context['allow_notify'])
echo'<br class="clear" /><label for="postNotify"><input type="checkbox" name="postNotify" id="postNotify" onclick="document.getElementById(\'notifyArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '$txt['moveTopic5'], '.</label>
<fieldset id="notifyArea" style="margin-top: 1ex; display: none;">
<dl class="settings">
<dt>
'
$txt['movetopic_notify_desc'], '
</dt>
<dd>
<textarea name="notify" rows="3" cols="40">'
$txt['movetopic_notify_default'], '</textarea>
</dd>
</dl>
</fieldset>'
;
echo'
<div class="righttext">
<input type="submit" value="'
$txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />
</div>
</div>
</div>
<span class="botslice"><span></span></span>
</div>'
;

if ($context['back_to_topic'])
echo '
<input type="hidden" name="goback" value="1" />'
;

echo '
<input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
<input type="hidden" name="seqnum" value="'
$context['form_sequence_number'], '" />
</form>
</div>'
;
}

?>


How can i add this edit then?:


</div>
<br />';
// PM Notification text.
if($context['allow_notify'])
echo '
<label for="postNotify"><input type="checkbox" name="postNotify" id="postNotify" checked="checked" onclick="document.getElementById(\'notifyArea\').style.display = this.checked ? \'block\' : \'none\';" class="check" /> ', $txt['moveTopic5'], '.</label><br />
<div id="notifyArea" style="margin-top: 1ex;">
', $txt['movetopic_notify_desc'], '<br />
<textarea name="notify" rows="5" cols="40">', $txt['movetopic_notify_default'], '</textarea><br />
</div>
<br />';
echo '

FragaCampos

Quote from: Autumn13 on March 25, 2010, 02:00:46 AM
This is a very helpful mod for my forum and it does work... but often when doing this I get the error "Hacking attempt...". The error log says this

x'ing out personal info

INSERT INTO smf_personal_messages
         (ID_MEMBER_FROM, deletedBySender, fromName, msgtime, subject, body)
      VALUES (316, 1, SUBSTRING('xxxxx', 1, 255), 1269496452, SUBSTRING('xthreadx', 1, 255), SUBSTRING('The topic you created at [url=http://www.xxxxx.com/index.php?board=48]xBoardx[/url] named xthreadx has been moved to [url=http://www.xxxxx.com/index.php?board=88]xBoardx[/url]. Please understand that this has been done to keep order in the forum..

[iurl=http://www.xxxxxxx.com/index.php?topic=38525.0]http://www.xxxxxx.com/index.php?topic=38525.0[/iurl]', 1, 65534))
File: /home/xxxxx/public_html/Sources/Subs-Post.php
Line: 845'


Any advice/help would be appreciated.

I have this mod installed a month or so ago and it worked flawlessly, but this week i received the same message and i'm unable to move the topic in question.
Any word on this?

MrCreatoR

Nibogo & Bugo
In the russian translation there is one small mistake:

Quote....на форуме должен поддерживаться порядок.' . ".\n\n"....

there is two dots generated when the PM is sent :)

And one more issue - is there any plans to use $txt['movetopic_notify_subject']? it would be usefull to set different title for the PMs instead of only moved topic subject. But also the data in $txt['movetopic_notify_subject'] should accept all variables (commands) to make the PM subject be more informative.

~Chad

Quote from: frozenas on July 30, 2010, 02:00:27 PM
Hi, i cannot find this code:


</div>
<br />
.

There is move.topic.template.php file:

<?php
// Version: 2.0 RC3; MoveTopic

// Show an interface for selecting which board to move a post to.
function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<div id="move_topic" class="lower_padding">
<form action="'
$scripturl'?action=movetopic2;topic='$context['current_topic'], '.0" method="post" accept-charset="'$context['character_set'], '" onsubmit="submitonce(this);">
<div class="cat_bar">
<h3 class="catbg">'
$txt['move_topic'], '</h3>
</div>
<div class="windowbg centertext">
<span class="topslice"><span></span></span>
<div class="content">
<div class="move_topic">
<dl class="settings">
<dt>
<strong>'
$txt['move_to'], ':</strong>
</dt>
<dd>
<select name="toboard">'
;

foreach ($context['categories'] as $category)
{
echo '
<optgroup label="'
$category['name'], '">';

foreach ($category['boards'] as $board)
echo '
<option value="'
$board['id'], '"'$board['selected'] ? ' selected="selected"' ''$board['id'] == $context['current_board'] ? ' disabled="disabled"' '''>'$board['child_level'] > str_repeat('=='$board['child_level']-1) . '=&gt; ' ''$board['name'], '</option>';
echo '
</optgroup>'
;
}

echo '
</select>
</dd>'
;

// Disable the reason textarea when the postRedirect checkbox is unchecked...
echo '
</dl>
<label for="reset_subject"><input type="checkbox" name="reset_subject" id="reset_subject" onclick="document.getElementById(\'subjectArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '
$txt['moveTopic2'], '.</label><br />
<fieldset id="subjectArea" style="display: none;">
<dl class="settings">
<dt><strong>'
$txt['moveTopic3'], ':</strong></dt>
<dd><input type="text" name="custom_subject" size="30" value="'
$context['subject'], '" class="input_text" /></dd>
</dl>
<label for="enforce_subject"><input type="checkbox" name="enforce_subject" id="enforce_subject" class="input_check" /> '
$txt['moveTopic4'], '.</label>
</fieldset>
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" '
$context['is_approved'] ? 'checked="checked"' ''' onclick="'$context['is_approved'] ? '' 'if (this.checked && !confirm(\'' $txt['move_topic_unapproved_js'] . '\')) return false; ''document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '$txt['moveTopic1'], '.</label>
<fieldset id="reasonArea" style="margin-top: 1ex;'
$context['is_approved'] ? '' 'display: none;''">
<dl class="settings">
<dt>
'
$txt['moved_why'], '
</dt>
<dd>
<textarea name="reason" rows="3" cols="40">'
$txt['movetopic_default'], '</textarea>
</dd>
</dl>
</fieldset>'
;

// PM Notification text.
                    if($context['allow_notify'])
echo'<br class="clear" /><label for="postNotify"><input type="checkbox" name="postNotify" id="postNotify" onclick="document.getElementById(\'notifyArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> '$txt['moveTopic5'], '.</label>
<fieldset id="notifyArea" style="margin-top: 1ex; display: none;">
<dl class="settings">
<dt>
'
$txt['movetopic_notify_desc'], '
</dt>
<dd>
<textarea name="notify" rows="3" cols="40">'
$txt['movetopic_notify_default'], '</textarea>
</dd>
</dl>
</fieldset>'
;
echo'
<div class="righttext">
<input type="submit" value="'
$txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />
</div>
</div>
</div>
<span class="botslice"><span></span></span>
</div>'
;

if ($context['back_to_topic'])
echo '
<input type="hidden" name="goback" value="1" />'
;

echo '
<input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
<input type="hidden" name="seqnum" value="'
$context['form_sequence_number'], '" />
</form>
</div>'
;
}

?>


How can i add this edit then?:


</div>
<br />';
// PM Notification text.
if($context['allow_notify'])
echo '
<label for="postNotify"><input type="checkbox" name="postNotify" id="postNotify" checked="checked" onclick="document.getElementById(\'notifyArea\').style.display = this.checked ? \'block\' : \'none\';" class="check" /> ', $txt['moveTopic5'], '.</label><br />
<div id="notifyArea" style="margin-top: 1ex;">
', $txt['movetopic_notify_desc'], '<br />
<textarea name="notify" rows="5" cols="40">', $txt['movetopic_notify_default'], '</textarea><br />
</div>
<br />';
echo '

Same problem.. How to fix this? :)

FragaCampos

Quote from: FragaCampos on July 31, 2010, 08:57:06 AM
Quote from: Autumn13 on March 25, 2010, 02:00:46 AM
This is a very helpful mod for my forum and it does work... but often when doing this I get the error "Hacking attempt...". The error log says this

x'ing out personal info

INSERT INTO smf_personal_messages
         (ID_MEMBER_FROM, deletedBySender, fromName, msgtime, subject, body)
      VALUES (316, 1, SUBSTRING('xxxxx', 1, 255), 1269496452, SUBSTRING('xthreadx', 1, 255), SUBSTRING('The topic you created at [url=http://www.xxxxx.com/index.php?board=48]xBoardx[/url] named xthreadx has been moved to [url=http://www.xxxxx.com/index.php?board=88]xBoardx[/url]. Please understand that this has been done to keep order in the forum..

[iurl=http://www.xxxxxxx.com/index.php?topic=38525.0]http://www.xxxxxx.com/index.php?topic=38525.0[/iurl]', 1, 65534))
File: /home/xxxxx/public_html/Sources/Subs-Post.php
Line: 845'


Any advice/help would be appreciated.

I have this mod installed a month or so ago and it worked flawlessly, but this week i received the same message and i'm unable to move the topic in question.
Any word on this?

Bump :P

floydpink

Quote from: Rav33n on April 08, 2010, 02:11:14 AM
Bug report:
QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Power Fan' Header', 1, 255), SUBSTRING('This is an automated message to inform y' at line 3
File: /home/gamerlk/gamer.lk/Sources/Subs-Post.php
Line: 863
The topic title has a apostrophe in it ('). Title is [HELP] 'Power Fan' Header
As well as ' in the subject not inserting, " also doesn't get inserted correctly and displays as &quot;

Here is a fix:
./Sources/MoveTopic.php
Find:            $pm_move_topic_body = preg_replace('~<br(?: /)?' . '>~', "\n", $pm_move_topic_body);
            $pm_move_topic_body = un_htmlspecialchars($pm_move_topic_body);     

Add after:            // floydpink EDIT - re format " and ' so they insert into database
            $subject = un_htmlspecialchars($subject);
            $subject = preg_replace("/'/",'&#039;',$subject);

FragaCampos


HunterP

Quote from: FragaCampos on October 16, 2010, 07:19:56 PMThanks for this fix, floydpink.

As far as I can see, $txt['movetopic_notify_subject'] isn't used, but the actual topic subject.

I've just installed this on my testforum, posted a message "test" and moved it as admin.

The email subject says "New Personal Message: test"
And ofcourse the PM subject says "test"

This, in stead of the variable in the XML.

I'd like to see the variable before the actual subject, so a notification for a moved topic named "test" will become "Moved topic : test".

Is this possible?

floydpink

I've cobbled together some code to do a similar thing when a post is merged: Merge Post Notification by PM
It might make an interesting addition to the next release of Move Topic Notification.
;)

sharks

I got the same errors again, and several of the moderators on my forum also. I am using SMF 1.1.11

Hacking attempt...

INSERT INTO smf_personal_messages
(ID_MEMBER_FROM, deletedBySender, fromName, msgtime, subject, body)
VALUES (670, 1, SUBSTRING('crazyer', 1, 255), 1291600677, SUBSTRING('A'IE Delight with electric CBT', 1, 255), SUBSTRING('The topic you created at general named A\'IE Delight with electric CBT has been moved to the Bin. Please understand that this has been done to keep order in the forum..
The image is not working.', 1, 65534))
File: /home/sharks/sea/smf/Sources/Subs-Post.php
Line: 831


This is getting so annoying. The error above doesn't happen every time a topic is moved, but it seems random. The only way to be able to move a topic when you see that error is to log out, and then back in again. Sometimes you need to do that several times and clear the browser cache and cookies, in order to get that topic finally moved. As the admin of my forum, i am under a lot of pressure to fix that annoying error that is plaguing the normal operation of my forum. Moving topics is important, as i have other 200k topics and my team needs to keep the forum tidy. PLEASE HELP!

Hopefully someone will fix the package and re-upload it as an attachment so that all those who are having this problem can get their forum back to being properly moderated.

FragaCampos

Yes, it is annoying, although it doens't happen for some time now in my forum. When it does, i just move it in the normal way and send a PM to the author...

sharks

Quote from: FragaCampos on December 06, 2010, 09:18:58 AM
Yes, it is annoying, although it doens't happen for some time now in my forum. When it does, i just move it in the normal way and send a PM to the author...

So, there still exists no solution this problem? Amazing... With all the talent on this, nobody has yet been able to figure this out.


sharks

Quote from: Nibogo on December 06, 2010, 10:49:59 AM
I'll try to fix it as soon as possible, I have several issues in my real life at the moment, so please have some patience.
It's been more than a month since your last reply, and my forum is still crippled with these "hacked" errors as my forum moderators can't move topics without fearing that they are breaking the forum. Can you please fix this serious bug, ASAP?


sharks


Advertisement: