Hi again,
I'm having another problem with UNP 1.0.4.
It's about the template section. I'm translating the whole thing to Spanish and when I want to update the news_newsbit_commentslink I get a server error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, hostmaster@misdns.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.0.52-CHS-1 (Unix) Server at saurom.com Port 80
I only get it when trying to update that one... the others are fine.
I'm not sure if I should ask for help here... I emailed my hosting provider as well, but it may be something to do with the code on the template.php file???
Thanks!
Hi,
I also notice it happens the same thing when trying to update or revert to orginial news_newsbit_readmorelink
...just in case it helps.
Thanks!
That's a strange error. Only updating those two templates causes that, no other templates?
Is this when you submit changes to the template, or when you click edit?
That's right, no other templates show this error.
It is only when I click on Submit Changes...
When I click on Submit Changes, I get the error message I posted above. But I have discovered that when I click on "revert to original" and then Yes, the error message it's much more complete. Here it goes:
======================================
Database error in Utopia News Pro:
Invalid SQL Query: UPDATE `unp_template` SET template='<a onClick='open("{$unpurl}/comments.php?action=list&newsid={$newsid}","View","width=550, height=580, top=20,left=20,scrollbars=yes, status=no, toolbar=no, menubar=no")' href="jvoid(0)"><font face="verdana, arial, helvetica" color="{$postdatetext}" size="1"><strong>Comments:</strong> {$comments}</font></a> <a onClick='open("{$unpurl}/comments.php?action=post&newsid={$newsid}","Post","width=550, height=580, top=20,left=20,scrollbars=yes, status=no, toolbar=no, menubar=no")' href="jvoid(0)"><font face="verdana, arial, helvetica" color="{$postdatetext}" size="1">(Add Comment)</font></a>' WHERE id='2'
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'open("{$unpurl}/comments.php?action=list&newsid={$newsid}","
MySQL Error Number: 1064
Date: December 7, 2007 07:02 PM
Script: /upload/templates.php?action=revert&tempid=2&verify=1
====================================================
My hosting provider told me it may be something to do with the server's firewall. But I'm just finding really strange that it only happens to those two. However, I don't think it has to do with UNP, because he also said he could activate something to make it work in that specific domain path.
What do you reckon anyway by looking at that error message?
Thanks a lot!
Good catch on that second error.
Find this in templates.php:
PHP Code:
$revertTemplate = $DB->query("UPDATE `unp_template` SET template='".$originalTemplate['template']."' WHERE id='$tempid'");
Replace with:
PHP Code:
$revertTemplate = $DB->query("UPDATE `unp_template` SET template='".mysql_escape_string($originalTemplate['template'])."' WHERE id='$tempid'");
I believe the first error is caused by the same thing that causes the second (the use of single quotes in the template), but I'm not sure if it's actually a UNP bug in the first instance. This would especially be the case if the above fix makes "revert template" have the same issue as "edit template" for those two. Still looking into it.
Hi there!
Again, thanks a lot for your help!!
Now, it lets me "revert to original" both of the templates but I can't edit them. I must say I'm a more a Graphic Designer than a Web Developer, so I don't know PHP, I'm just learning slowly by playing around with it.
So what I tried was to modify the piece of code in "line 45":
PHP Code:
$updateTemplate = $DB->query("UPDATE `unp_template` SET template='$template' WHERE id='$tempid'");
by replacing
for
PHP Code:
SET template='".mysql_escape_string($originalTemplate['template'])."'
from the piece of code you gave me. But it hasn't worked. Please forgive me if what I did was totally stupid!!! hhehe
Could you help me sorting out the edit bit??
Thanks!!
Well, by looking at the code you gave me, I'm guessing I did a VERY STUPID thing.
I believe this bit:
PHP Code:
SET template='".mysql_escape_string($originalTemplate['template'])."'
works only for "revert to original" because of the $originalTemplate code bit??
After that I was having problems with all the Templates hehehaha so... I just uploaded a non-hacked fresh version of the template.php file. As I keep getting the server error, I changed the piece of code you told me again, but as I mentioned before the edit isn't working.
Hope you can help.
Thanks a lot!
With the edit not working in that manner, it sounds like a server-side issue since I have no problems at all. It does not sound to me like it has to do with the server's firewall, but rather the PHP configuration. I'll continue to think about this, though.
Thanks for your help Brian.
I'll contact my hosting provider and tell them about it.
There is just one more thing... I changed yesterday the name of the folder containing UNP and since then I'm getting the following error when I try to submit anything... news, templates, styles....
Warning: feof(): supplied argument is not a valid stream resource in /home/chs/saurom.com/home/html/noticias/functions.inc.php on line 474
Warning: fread(): supplied argument is not a valid stream resource in /home/chs/saurom.com/home/html/noticias/functions.inc.php on line 476
Any suggestions?
Thanks a lot!
You'll need to go back to the settings page and update UNP directory and URL to Utopia News Pro Install.