Page 1 of 1

[solved] javascript in template gives 403 (edit template)

Posted: Mon Aug 06, 2007 9:21 pm
by cubitus
Hello,

I have a strange problem... a very very strange problem :

I try to edit and save a template. It works like a charm until I try to add the following code in the template

Code: Select all

<__script__ type="text/javascript">
 ... some javascript code here ...
</__script>
At this point, I get the following error while saving the tempate:

Code: Select all

You don't have permission to access /cms/admin/edittemplate.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 
When I do not code any javascript in my template, the template is correcty saved. 
I've chmod the edittempate.php to 777 and I still have this issue. I've modified the template through phpmyadmin (add the javascript code) and it works  ???

Of course, setting the debug mode to true won't work, because there are no debug's log on the 404 page  >:( I'm running 1.0.8

Do  you have any idea ? I'm running mself out of any idea !!

Thanks in advance for your help

Re: javascript in template gives 404 (edit template)

Posted: Mon Aug 06, 2007 10:25 pm
by Dr.CSS
try {literal} your code {/literal}

Re: javascript in template gives 404 (edit template)

Posted: Tue Aug 07, 2007 10:54 am
by cubitus
Thanls you mark for your answer but ... that doesn't help me, it doesn't work  :'(

In order for you to understand my problem I will explain it in more details.

When my template contains the following part

Code: Select all

...
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}

</head>
</__body>
...
I can save it without any error.

But when it contains that code

Code: Select all

...
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
{literal}
<__script__ language="JavaScript">
    <!--

    //-->
</__script>
{/literal}
</head>
</__body>
...
I get an 403 error  (see my first post). In fact it is a 403 and not a 404. Don't know why the message indicate a 404. The page's title is 403 Forbidden.

I'm just wondering if my hosting's company had implemented a kind of filter that will disallow inserting some javascript in the database.  ???

Re: javascript in template gives 404 (edit template)

Posted: Tue Aug 07, 2007 3:05 pm
by ironblaze94
have you tried linking to an external javascript file ?

Re: javascript in template gives 404 (edit template)

Posted: Tue Aug 07, 2007 7:21 pm
by cubitus
Thanks ironblaze94 for your idea.

But unfortunately it doesn't work either.

Weird. I've just installed a fresh version 1.1 on the server and I get the same problem. I cannot save the unmodified template "Left simple navigation + 1 column". When I remove the javascript code, I can save it.
I insert some javascript in some content and I get the same problem.

I think it has something to do with my server. During the install I have to modify the protection of some folder ands set it to 777 in order to achieve the install wizard. 777 means everyone has full access on my files. But as my server is running with phpsuexec, no one can access my file.

Do you think my main problem is related to this "nonconforming" server's setup ?

I'm going to post this question on the forum of my hosting company.

If you have any idea, do not hesitate to reply.

Re: javascript in template gives 404 (edit template)

Posted: Thu Aug 09, 2007 7:53 pm
by cubitus
Hello I'm back.

Ok, I've asked on their forum and the technical manager tell me to search any clues in the config's files and to give a look at the log's files.

Then I'm asking you (the guru of cmsms and/or linux) the following :

I've installed a fresh version on cmsms 1.1.0 on the following adresse: www.***.com/beta.
The admin's url is www.***.com/beta/admin.
The edit template is on http://www.***.com/beta/admin/edittemplate.php.
On the file system it is under /home/***/public_html/beta/admin/edittemplate.php
All files and directories are 777.

Php version is 5.2.3
Apache is 1.3.37

Saving a template that contains the javascript element (see my first post) will log the following line in the error's log file :

Thu Aug  9 19:18:15 2007] [error] [client xx.xxx.xx.xxx] File does not exist: /home/***/public_html/403.shtml

Do you have any idea what can be the problem ?

I'm ready to modify/code/debug the edittemplate.php if needed. I really would like to be able to continue working on cmsms because I think it is a very good product.

Please, can you give me any idea to try because I'm lost now.

Thanks in advance for your help.

Cubitus

Re: javascript in template gives 404 (edit template)

Posted: Thu Aug 09, 2007 9:59 pm
by Dr.CSS
What and how exactly are you calling it?...

I call them like so...





This is a default templates insertion of java for IEs lack of min/max width...

{literal}

=b){nw=b+"px";}if(w



#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}


{/literal}

Re: javascript in template gives 404 (edit template)

Posted: Sun Aug 12, 2007 9:01 am
by cubitus
Hi Mark,

Thank you for answering my post.


Ok, when I try to save the "original" template "CSSMenu top + 2 columns" I get the 403 error. In order to be able to save this template I have to remove the following code from the template, including the script tag but without removing the {literal}. Btw, I've tried many time with different configuration and I think it is the tag that is causing this error.

Code: Select all

<__script__ type="text/JavaScript">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
	var nw="auto",w=document.documentElement.clientWidth;
	if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
The answer is displayed in two differents way depending if I press on the Submit or Apply button.

A) By pressing on the submit button, I get a new page on my browser with the following html code

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<__html><HEAD>
<TITLE>403 Forbidden</TITLE>
</HEAD></__body>
<H1>Forbidden</H1>
You don't have permission to access /beta/admin/edittemplate.php
on this server.<P>
<P>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
<HR>
<ADDRESS>Apache/1.3.37 Server at www.***.com Port 80</ADDRESS>
<__body></__html>
B) By pressing on the Apply button I get a message box with the following content :
Could not save: 403 -- Forbidden
I've installed cmsms on my local windows and It works fine :) . But on the linux hosting's server I get the error. :(

Now I really would like to be able to run cmsms on the server. So what can I do in order to begin investigating. If you want Mark I can PM you the login/psw of the cmsms install that is running on the server.

Thanks in advance for your help.

Re: javascript in template gives 403 (edit template)

Posted: Sun Aug 12, 2007 4:51 pm
by Dr.CSS
Sounds like a permissions problem... check that the files/folders are set according to the instructions and you may have to talk to your hosting provider...

Re: javascript in template gives 403 (edit template)

Posted: Mon Jan 14, 2008 7:38 pm
by cubitus
Working now fine with cmsms 1.2.3  :)

No idea if the problem came from the hosting's company or from cmsms version 1.1.x  ???