Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: kesulin - kesäkuu 18, 2019, 06:32:12 AP

Otsikko: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 18, 2019, 06:32:12 AP
Hi everyone,

I have the same problem as this guy:

https://www.simplemachines.org/community/index.php?topic=528844.msg3753125#msg3753125 (https://www.simplemachines.org/community/index.php?topic=528844.msg3753125#msg3753125)

Lainaa
Recently I have a problem with my SMF forum. When you view a topic and read user's posts, you can click "quote" to make a quoted post. BUT - and here is the problem - when you view a topic and click REPLY to post a reply, then when scrolling down to view other posts and click Insert Quote... nothing happens. There is no code going in the text field of my reply and that means nobody can make quotes inside a reply.

I have not made any changes and this occurred suddenly. Any thoughts?

I can't find any solution for this, and I don't want uninstall any mod because most of them required fix some bugs for my SMF versión. I need some explanation about how InsertQuoteFast function works and where would be the bug.

Thanks in advance.

I running SMF 2.0.15.

Mods installed:
1.   SMF 2.0.X - PHP 7.2+ Compatibility   1.3
2.   Dice Roller BBcode   1.3     
4.   Ohara YouTube Embed   1.2.10
5.   Tapatalk SMF 2.0 Plugin   4.5.2
6.   Spoiler Tag   0.7.2a
7.   Tabbed smileys   0.3.7
9.   Menu_Icons   1.0 
10.   Board Icons   1.0 
11.   Random BBCode   2.0.0 
12.   Downloads System   3.0.4c
13.   Favicon   1.3     
14.   SMFPacks Shoutbox   1.1
15.   SA Chat   1.0a1 Rev120
16.   Hall Of Fame   1.2     
17.   Say Thanks   1.3.6     
19.   Member NotePad   2.0.3 
22.   Custom BBCodes Manager   2.8 
23.   Post and PM Inline Attachments   6.15 
24.   Recent Topics by 24h 48h 72h Filter   1.0 
25.   List aleatoria   2.0.0     
28.   BBCode with style   1.5.1
29.   RandomG BBCode   2.0.0
30.   Post Scheduler   1.0.1 
31.   Previous and Next Links for Page Index   2.1.204     
33.   Bot Recuento   1.0.0     
34.   Bot Guardar   1.0.0     
35.   Bot Mazo de cartas   1.0.0 
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 18, 2019, 08:47:51 AP
I have the Post.template.php like original.

function insertQuoteFast(messageid)
{
if (window.XMLHttpRequest)
getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
else
reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
return true;
}
function onDocReceived(XMLDoc)
{
var text = \'\';
for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);
}


I try to debug javascript with Chrome, enter insertquotefast but never arrive at OnDocRecieved.
I try to change theme too, but still no works. Then, I think this file is ok and bug is in another place.

I need help with it, no idea where is the problem.

Thanks,
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: Kindred - kesäkuu 18, 2019, 08:52:46 AP
You have several mods which may be interfering with javascript...

you also have the 7.2 mod installed.... I don't think php is the problem... but SMF doesn't officially support php 7.2, so if that's the problem, you may have other issues as well
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: drewactual - kesäkuu 18, 2019, 08:12:35 IP
jQuery conflicts... I've been fighting it for a while.  At some point I fully intend to migrate to latest while addressing the changes from stem to stern with both SMF, WP, AND jQuery... I was told several times by a premium SMF provider they used noConflict in their script- but- there are plenty of conflicts... to be fair, using mods or themes from other providers may not be helping either... 

are you using a theme or have a plugin or mod that calls to another version of jQuery? If so, unless noConflict is used properly, you're gonna have some funky behavior from the scripts running. (hint: #14).  now you can comment out a particular line and force the intended quote to take the user to the 'full' comment page, but.... that is a hack, and something i'm thinking was the beginning of the issues both of us are facing in the first place.  the solution is to use jQuery migrate and top off all the jQueries into one call- which will make your page faster WHILE it fixes your issues.
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 03:01:34 AP
Thanks for the comment. I try to install a new installation in a subdominion of my server:
http://test.castronegro.net/index.php (http://test.castronegro.net/index.php)

Just installed I try "insert quote" and no works. But then install mod php 7.2 compatibility and now works.
We are comparing the files between installations to find the problem. When I find it return here with the solution.
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 04:31:17 AP
The problem is "getXMLDocument" function not trigger "onDocReceived" function.
How it works?

Both function ara the same in both installations, any change on this code. How is posible?
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 04:51:57 AP
Lainaus käyttäjältä: kesulin - kesäkuu 19, 2019, 04:31:17 AP
The problem is "getXMLDocument" function not trigger "onDocReceived" function.
How it works?

Both function ara the same in both installations, any change on this code. How is posible?
Well, GetXmlDocument not trigger OnDocRecieved because xml is null. I try get the url and no works

Please, see the error:
http://castronegro.net/index.php?action=quotefast;quote=1342;xml;pb=message;mode=0 (http://castronegro.net/index.php?action=quotefast;quote=1342;xml;pb=message;mode=0)

In the new installation it works:
http://test.castronegro.net/index.php?action=quotefast;quote=1;xml;pb=message;mode=0 (http://test.castronegro.net/index.php?action=quotefast;quote=1;xml;pb=message;mode=0)

Then, the problem are in xml construct, I think the constructor write two times xml declaration. Well, Where xml constructs? Someone knows it?
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 05:04:44 AP
Lainaus käyttäjältä: kesulin - kesäkuu 19, 2019, 04:51:57 AP
Then, the problem are in xml construct, I think the constructor write two times xml declaration. Well, Where xml constructs? Someone knows it?
I think the code is in Post.php. But the "quoteFast" function is exactly the same in both installations, then I am lose again.
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 05:32:59 AP
I find two templates in Xml.template.php

function template_quotefast()
{
global $context, $settings, $options, $txt;

echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>
<quote>', cleanXml($context['quote']['xml']), '</quote>
</smf>';
}

function template_modifyfast()
{
global $context, $settings, $options, $txt;

echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>
<subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>
<message id="msg_', $context['message']['id'], '"><![CDATA[', cleanXml($context['message']['body']), ']]></message>
</smf>';

}


Both functions are the same in new installation.

Another function I find is "template_quotefast" in Post.template.php, without changes too.

Any idea where is the problem?
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 05:47:12 AP
I try in Internet explorer, in this browser I can see the xml message:
Lainaa
<?xml version="1.0" encoding="UTF-8"?>
<smf>
   <quote>
Lainaus käyttäjältä: admin - kesäkuu 13, 2019, 10:59:02 AP
[mazo=nombre]contenido[/mazo]
</quote>
</smf>

There are a blank line before xml declaration. This is the problem. Where SMF construct xml message?
Otsikko: Re: Problem with quotes inside reply posts
Kirjoitti: kesulin - kesäkuu 19, 2019, 06:01:17 AP
Ok, ¡I find the bug!

No problem with xml constructor, no problem with xml templates. The bug are empty line before php declaration in Subs.php

One mod installed wrong and add text before php declaration. I fix it but remain empty line before. Insert quote use this to xml message and add this empty line before the xml message.

Some admin can close this. Thanks.