pollywatt Posted January 30, 2014 Share Posted January 30, 2014 Hi...We are having a problem with updating CMS pages as it says the 'content is not valid'. We didn't have this problem before when using 1.5.2 but have recently updated to 1.5.6.1 and now receive this message every time we try to save changes. Would updating again solve this? Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2014 Share Posted January 31, 2014 it's because your cms page contents contains forbidden markups. go to preferences > general and accept this option: if this will not help, it mean that you use other forbidden markups and you have to change the validate function, or just remove forbidden markups from cms page content. Link to comment Share on other sites More sharing options...
pollywatt Posted January 31, 2014 Author Share Posted January 31, 2014 thank you for your response. we've changed our preferences as you suggested but are still getting the same message, even when i copy our existing HTML (which works) and just change the URLs to the new ones... and the URLs are correct and functioning, so i'm not sure where to look for faults? Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2014 Share Posted January 31, 2014 it's probably because you use other not accepted anymore html / js syntax can you show code of description ? Link to comment Share on other sites More sharing options...
pollywatt Posted February 7, 2014 Author Share Posted February 7, 2014 for example, this is our existing code : <a title="Fromagerie de Beaucoudray" href="http://gourmandenormande.com/index.php?id_cms=49&controller=cms"><img title="Fromagerie de Beaucoudray" onmouseover="this.src='http://www.gourmandenormande.com/img/cms/suppliersonrollover/onrollover125fromageriedebeacoudray.jpg';" onmouseout="this.src='http://www.gourmandenormande.com/img/cms/suppliersoriginalimage/originalimage125fromageriedebeacoudray.jpg';" src="http://www.gourmandenormande.com/img/cms/suppliersoriginalimage/originalimage125fromageriedebeacoudray.jpg" alt="Fromagerie de Beaucoudray" width="150" height="150" /></a> and i'm trying to replace it with this, simply to change the images (so the only change is the URLs for the images) : <a title="Fromagerie de Beaucoudray" href="http://gourmandenormande.com/index.php?id_cms=49&controller=cms"><img title="Fromagerie de Beaucoudray" onmouseover="this.src='http://gourmandenormande.com/img/cms/suppliersonrollover/onrollover125fromageriedebeaucoudray.jpg';" onmouseout="this.src='http://gourmandenormande.com/img/cms/suppliersoriginalimage/originalimage125fromageriedebeaucoudray.jpg';" src="http://gourmandenormande.com/img/cms/suppliersoriginalimage/originalimage125fromageriedebeaucoudray.jpg" alt="Fromagerie de Beaucoudray" width="150" height="150" /></a> the image changes on screen but just won't save. i get the same error message whether i try to add a new page or edit an existing page. Link to comment Share on other sites More sharing options...
vekia Posted February 7, 2014 Share Posted February 7, 2014 you use not accepted js syntax like onmouseover etc. you have to extend tinymce object features and also change validate function to accept these denied js tags. Link to comment Share on other sites More sharing options...
pollywatt Posted February 7, 2014 Author Share Posted February 7, 2014 ok, thank you... i am very new to this, so i may be asking obvious/ridiculous questions here but we don't use tinymce -i'm entering code directly into the PrestaShop HTML page, so when you say 'extend tinymce object features and also change validate function to accept these denied js tags', is this something i can do within PrestaShop? should i re-name/re-upload the images? and is there a reason why eg. 'onmouseover' would stop working when it has worked ok until now? Link to comment Share on other sites More sharing options...
vekia Posted February 8, 2014 Share Posted February 8, 2014 directly into the PrestaShop HTML page can you elaborate a bit? what you mean this? you changing some files? or what? Link to comment Share on other sites More sharing options...
pollywatt Posted February 11, 2014 Author Share Posted February 11, 2014 (edited) this is where i'm editing and the code is as shown below... and even if i try to delete code the error message is the same. ?? Edited February 11, 2014 by pollywatt (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted February 11, 2014 Share Posted February 11, 2014 guide to tinymce: tinymce - accept js tags guide to validate function: validate class change to accept js scripts Link to comment Share on other sites More sharing options...
nayll Posted February 13, 2014 Share Posted February 13, 2014 (edited) I followed theses exactly but the validate.php mod seams to break prestashop, all pages related to presta return blank.? running 1.5.6.1 the tinyMCE mod seam to work, though I can not expand the window anymore here are the modified lines per instructions for the validate.php public static function isCleanHtml($html, $allow_iframe = false){ return true;} { $events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange'; $events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend'; $events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove'; $events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel'; $events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart'; $events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange'; $events .= '|onselectstart|onstart|onstop'; } and theis is the mod for 1.5.6.x /**if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) return false;*/ any insight as to what I'm doing wrong? I'm simply want to use some simple mouse over script in the CMS page and avoid the Property CMS->content is not validat line 878 in file classes/ObjectModel.php 872. 873. $message = $this->validateField($field, $value, $id_lang);874. if ($message !== true)875. {876. if ($die)877. throw new PrestaShopException($message);878. return $error_return ? $message : false;879. }880. }881. }882. ObjectModelCore->validateFieldsLang - [line 296 - classes/ObjectModel.php] - [0 Argument] ObjectModelCore->getFieldsLang - [line 634 - classes/ObjectModel.php] - [0 Argument] ObjectModelCore->update - [line 75 - classes/CMS.php] - [1 Arguments] CMSCore->update - [line 334 - controllers/admin/AdminCmsController.php] - [0 Argument] AdminCmsControllerCore->postProcess - [line 121 - controllers/admin/AdminCmsContentController.php] - [0 Argument] AdminCmsContentControllerCore->postProcess - [line 158 - classes/controller/Controller.php] - [0 Argument] ControllerCore->run - [line 348 - classes/Dispatcher.php] - [0 Argument] DispatcherCore->dispatch - [line 53 - admin123/index.php] - [0 Argument] thanks Edited February 13, 2014 by nayll (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted February 14, 2014 Share Posted February 14, 2014 you use wrong code. i never said that you have to use code like: public static function isCleanHtml($html, $allow_iframe = false){ return true;} { $events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange'; $events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend'; $events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove'; $events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel'; $events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart'; $events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange'; $events .= '|onselectstart|onstart|onstop'; } it's definitely bad! this is why you've got blank page. instead of this weirdy code you have to use only this: public static function isCleanHtml($html, $allow_iframe = false){ return true; } nothing more Link to comment Share on other sites More sharing options...
nayll Posted February 14, 2014 Share Posted February 14, 2014 (edited) Thanks for posting Milosz I agree I am probably using wrong code somewhere OK, but the weirdy code is what is in the original presta validate file. the stuff you comment out if you are using 1.5.5 or earlier according to the tutorial here http://mypresta.eu/en/art/developer/prestashop-product-page-full-rich-editor.html . No word wrap makes it look wierd. I should not have pasted that. these are the lines 396-403 basically between the 2 suggested changes, the return true statement and the commented out portion for the 1.5.6+ version I do have this for the change exactly public static function isCleanHtml($html, $allow_iframe = false){ return true; } and this code was for 1.5.6+ this just is commented out right? /**if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) return false;*/ this validate.php mod still causes the site to go blank to my confusion? any more insight. I know it must be a simple error jh Edited February 14, 2014 by nayll (see edit history) Link to comment Share on other sites More sharing options...
nayll Posted February 14, 2014 Share Posted February 14, 2014 it seams to be this code only that causes the problem with 1.5.6.1 going blank. Adding this kills it dead. public static function isCleanHtml($html, $allow_iframe = false){ return true; } commenting out the other lines doesn't seem to affect anything. Link to comment Share on other sites More sharing options...
vekia Posted February 14, 2014 Share Posted February 14, 2014 can you attach your file please? i will check it and send you proper version Link to comment Share on other sites More sharing options...
nayll Posted February 15, 2014 Share Posted February 15, 2014 (edited) Awesome, thanks! This is just so I can use JS in CMS editor etc. This is modified according to the Tut, (i believe?) jhValidate.php Edited February 15, 2014 by nayll (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted February 15, 2014 Share Posted February 15, 2014 Awesome, thanks! This is just so I can use JS in CMS editor etc. This is modified according to the Tut, (i believe?) jhValidate.php it isn't take a look: you've got code: /** * Check for HTML field validity (no XSS please !) * * @param string $html HTML field to validate * @return boolean Validity is ok or not */ public static function isCleanHtml($html, $allow_iframe = false){ return true; } { $events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange'; $events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend'; $events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove'; $events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel'; $events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart'; $events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange'; $events .= '|onselectstart|onstart|onstop'; /*if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) * return false;*/ if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html)) return false; return true; } it's definitely bad! use only this ias i suggested: public static function isCleanHtml($html, $allow_iframe = false){ return true; } this is proper file with valid modification: http://pastebin.com/Gk0rWdkJ# Link to comment Share on other sites More sharing options...
nayll Posted February 15, 2014 Share Posted February 15, 2014 yes, definitely bad on my part. I noticed you deleted all of this below, that wasn't clear to me in the TUT. It works now thank you so much!! this was part of the original 1.5.6.1 install so that threw me off. It works now, sort of, but it doesn't break the store. When hitting SAVE in the CMS BO the page goes blank but it is saved, just have to back button to get back to the CMS editor, no big problem. But I can add JS and stuff, very cool, thanks again, I would have pounded my head against the wall for a few days! $events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange'; $events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend'; $events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove'; $events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel'; $events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart'; $events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange'; $events .= '|onselectstart|onstart|onstop'; if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) return false; if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html)) return false; return true; } /** * Check for product reference validity * * @param string $reference Product reference to validate * @return boolean Validity is ok or not */ public static function isReference($reference) { return preg_match('/^[^<>;={}]*$/u', $reference); Link to comment Share on other sites More sharing options...
Acktarrus Posted February 22, 2014 Share Posted February 22, 2014 Works prefectly thank you ! Link to comment Share on other sites More sharing options...
bovario Posted July 5, 2014 Share Posted July 5, 2014 I have similar problem. I am unable to change content of the cms pages. I upgraded from 1.4.6.2 to 1.5.4.1 and now won't save changes. What ever change on the cms page stays as was before after clicked save. Link to comment Share on other sites More sharing options...
vekia Posted July 6, 2014 Share Posted July 6, 2014 turn on error reporting. then after save you will see information about what's going on there i bet that problem is related to some missed columns in database Link to comment Share on other sites More sharing options...
kollek Posted July 22, 2014 Share Posted July 22, 2014 I have similar problem with that code: <script> var yotpo_app_key = "******"; </script> <div class='yotpo testimonials' id='yotpo-testimonials-custom-tab' data-lang="{$yotpoLanguage|escape:'htmlall':'UTF-8'}"></div> When I accept TinyMCE is making something like this: <p> <script>// <![CDATA[ var yotpo_app_key = "******"; // ]]></script> </p> <div id="yotpo-testimonials-custom-tab" class="yotpo testimonials" data-lang="{$yotpoLanguage|escape:'htmlall':'UTF-8'}"> </div> Does anyone help me? Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2014 Share Posted July 23, 2014 you're trying to save {$yotpoLanguage|escape:'htmlall':'UTF-8'} in tinymce? it can't work, tinymce can't parse smarty language Link to comment Share on other sites More sharing options...
kollek Posted July 23, 2014 Share Posted July 23, 2014 so how can I show reviews on my webshop? This is the code what I got from yotpo. Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2014 Share Posted July 23, 2014 so you have to paste it to .tpl file, not to cms page editor in addition, you have to define variables somewhere in controllers {$yotpoLanguage|escape:'htmlall':'UTF-8'} you copied code from module? or what? Link to comment Share on other sites More sharing options...
kollek Posted July 25, 2014 Share Posted July 25, 2014 Thank U Milosz. I've copied this code from yotpo website - admin panel. On earlier ver. of Presta it works correctly. It's not working on 1.6.0.8. Link to comment Share on other sites More sharing options...
vekia Posted July 25, 2014 Share Posted July 25, 2014 you mean that code you use works in ps 1.5 well if you save it in tinymce editor? almost impossible Link to comment Share on other sites More sharing options...
kollek Posted July 26, 2014 Share Posted July 26, 2014 Before 1.6.0.8 I used 1.4.8.2. I'm not sure if code was the same. Maybe yotpo changed the code? I don't know but really I had a CMS page when you could see all reviews. Link to comment Share on other sites More sharing options...
kollek Posted July 26, 2014 Share Posted July 26, 2014 One more thing. I can paste this code into .tpl file but how can I find CMS page? Are CMS pages making "automaticly". Link to comment Share on other sites More sharing options...
Recommended Posts