From 178101dc04b274018b42caf6fecbd374aa7f9d67 Mon Sep 17 00:00:00 2001 From: vbracco Date: Mon, 27 Oct 2008 12:09:20 +0000 Subject: [PATCH] Checking url-friendly when redirect --- admin/comments.php | 6 +++++- admin/index.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/admin/comments.php b/admin/comments.php index ae43344..770a3f5 100644 --- a/admin/comments.php +++ b/admin/comments.php @@ -44,8 +44,12 @@ if(isset($_POST["btnAdd"])) { $_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0"; $_POST["ip_user"] = $_SERVER["REMOTE_ADDR"]; + $strEnd=($conf->urlFriendly) ? "/" : ""; if ($comment->addComment($_POST)) { - header("Location: ".$conf->urlGelato."/index.php/post/".$_POST["id_post"]); + header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd); + die(); + } else { + header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd); die(); } } diff --git a/admin/index.php b/admin/index.php index df72262..4e28865 100644 --- a/admin/index.php +++ b/admin/index.php @@ -365,8 +365,8 @@ if ($user->isAuthenticated()) { if ($tumble->contarRegistros()>0) { while($register = mysql_fetch_array($rs)) { $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); - $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/"; - + $strEnd=($conf->urlFriendly) ? "/" : ""; + $permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd; $register["title"] = stripslashes($register["title"]); $register["description"] = stripslashes($register["description"]);