Jump to content

[SOLVED]Adding a back button to CMS pages


Chillax86

Recommended Posts

Hi this is my first post of many, hope someone can help. The problem is I cannot input either of these methods in to a CMS page without an error.

 

<a href="#" onclick="history.go(-1);return false;">BACK</a>

 

<form><input type="button" value=" <-- BACK " onclick="history.go(-1);return false;" /></form>

 

The error I am getting is: The content field (English (United Kingdom)) is invalid.

 

What I would like to know is why is this error appearing?

 

How can I solve the problem?

 

P.S I don't want a back link on every CMS page.

Edited by Chillax86 (see edit history)
Link to comment
Share on other sites

go to classes/Validate 

 

there is a function: public static function isCleanHtml($html, $allow_iframe = false), change it to:

	public static function isCleanHtml($html, $allow_iframe = false)
	{
		$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('/<[ \t\n]*script/ims', $html) || preg_match('/('.$events.')[ \t\n]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
			//return false;

		//if (!$allow_iframe && preg_match('/<[ \t\n]*(i?frame|form|input|embed|object)/ims', $html))
			//return false;

		return true;
	}
  • Like 1
Link to comment
Share on other sites

  • 5 months later...
  • 4 weeks later...
  • 11 months later...

 

go to classes/Validate 

 

there is a function: public static function isCleanHtml($html, $allow_iframe = false), change it to:

	public static function isCleanHtml($html, $allow_iframe = false)
	{
		$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('/<[ \t\n]*script/ims', $html) || preg_match('/('.$events.')[ \t\n]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
			//return false;

		//if (!$allow_iframe && preg_match('/<[ \t\n]*(i?frame|form|input|embed|object)/ims', $html))
			//return false;

		return true;
	}

 

On PS 1.6.0.14 I edited this file (classes/Validate.php), and I edited also js/admin.js and js/tools.js, but I can't use onclick in html on CMS pages... If I insert correctly "onclick" on an A tag PS remove it.

Do I have to edit some other files? 

 

(I also disabled HTMLPurifier...) 

Link to comment
Share on other sites

  • 2 years later...

Only add Button to CMS content page :

 

                                                       <a class="button lnk_view btn btn-default back" title="Back"><span>Back</span></a>

 

then  added only   'back'   to class.

 

Function for this opration, exist in global.js       / theme / YourThemeName / js / global.js

 

 

line 78   :      $(document).on('click', '.back', function(e){
                              e.preventDefault();
                              history.back();
                      });

 

Enjoy :)

Edited by emadshay (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...