Search
Other Sourcerer questions
Forum

Not Working After Update to J5.2.5

Hamish Dunn's Avatar Hamish Dunn
Hello, We use a contact us button with Sourcerer (12.0.2) and PHP (8.4.5) code to send the product our visitor is viewing to our contact form that is located on a separate page as part of the URL.

For example, if the visitor was on a page with a URL like
https://www.exampledomain.com/Example-Product-Name

and they clicked on the "Contact Us About This Product" button that normally sent the following URL to our contact page so that it is captured when they submit the rest of their information:
https://www.exampledomain.com/index.php/contact-us?requested_model=Example+Product+Name

This method was previously working well up until the recent update to Joomla 5.2.5 Any suggestions are very much appreciated.

Code we are using for the contact button that is no longer working:
<a class="btn btn-info goldbtn" href="index.php/contact-us?requested_model={source}[[?php $arrURI = explode('/', $_SERVER['REQUEST_URI']);
                        echo(urlencode(ucwords(str_replace('-', ' ', $arrURI[count($arrURI) - 1])))); ?]]{/source}" style="width: 100%; max-width: 400px;"><span class="fa fa-envelope-o"></span> Contact Us About This Product</a>

The resulting URL after the last update is now showing like this
https://www.exampleurl.com/index.php/contact-us?requested_model=[[?php%20$arrURI%20=%20explode(%27/%27,%20$_SERVER[%27REQUEST_URI%27]);%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20echo(urlencode(ucwords(str_replace(%27-%27,%20%27%20%27,%20$arrURI[count($arrURI)%20-%201]))));%20?]]
Peter van Westen's Avatar Peter van Westen ADMIN
As you can see in the release notes of version 12.0.0:
Security fix: removes ability to use [[...]] as an alternative syntax for html tags (like script tags)
regularlabs.com/sourcerer/changelog#v12.0.0

So the solution is to use normal <?php ... ?> tags.
Please post a rating at the Joomla! Extensions Directory
Hamish Dunn's Avatar Hamish Dunn
Thank you! I truly appreciate the fast reply. I tested it and that works as long as I save without opening the JCE editor tab. If I do swap to the Editor it changes the code. Hopefully this can disabled in JCE somewhere.
<p><a class="btn btn-info goldbtn" href="index.php/contact-us?requested_model={source}&lt;span data-mce-code=" php="">&lt;?php $arrURI = explode('/', $_SERVER['REQUEST_URI']);&lt;br /&gt; echo(urlencode(ucwords(str_replace('-', ' ', $arrURI[count($arrURI) - 1])))); ?&gt;{/source}" style="width: 100%; max-width: 400px;"&gt;<span class="fa fa-envelope-o"></span> CONTACT US ONLINE</a></p>
Hamish Dunn's Avatar Hamish Dunn
In the JCE settings under Editor Parameters, Advanced section of JCE I just tried enabling the "Protect Shortcode" setting but it still breaks the code when I switch to the Editor tab.

This is with the "Protect Shortcode" enabled using JCE Editor Pro 2.9.84
<a class="btn btn-info goldbtn" href="index.php/contact-us?requested_model=&lt;pre data-mce-code=" shortcode="" data-mce-label="sourcerer">{source}<?php $arrURI = explode('/', $_SERVER['REQUEST_URI']); echo(urlencode(ucwords(str_replace('-', ' ', $arrURI[count($arrURI) - 1])))); ?>{/source}" style="width: 100%; max-width: 400px;"&gt;<span class="fa fa-envelope-o"></span> CONTACT US ONLINE</a>
Peter van Westen's Avatar Peter van Westen ADMIN
Best to ask JCE support about this.
Please post a rating at the Joomla! Extensions Directory
Hamish Dunn's Avatar Hamish Dunn
Sure I will open a support ticket with them. I appreciate your replies. Sourcerer is a great extension, we have used it for many years now. Cheers!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription