Browse Source

Checking url-friendly when redirect

vbracco 16 years ago
parent
commit
178101dc04
2 changed files with 7 additions and 3 deletions
  1. 5 1
      admin/comments.php
  2. 2 2
      admin/index.php

+ 5 - 1
admin/comments.php View File

44
 		$_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";		
44
 		$_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";		
45
 		$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
45
 		$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
46
 		
46
 		
47
+		$strEnd=($conf->urlFriendly) ? "/" : "";
47
 		if ($comment->addComment($_POST)) {
48
 		if ($comment->addComment($_POST)) {
48
-			header("Location: ".$conf->urlGelato."/index.php/post/".$_POST["id_post"]);
49
+			header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
50
+			die();
51
+		} else {
52
+			header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
49
 			die();
53
 			die();
50
 		}
54
 		}
51
 	}		
55
 	}		

+ 2 - 2
admin/index.php View File

365
 					if ($tumble->contarRegistros()>0) {				
365
 					if ($tumble->contarRegistros()>0) {				
366
 						while($register = mysql_fetch_array($rs)) {			
366
 						while($register = mysql_fetch_array($rs)) {			
367
 							$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
367
 							$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
368
-							$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
369
-							
368
+							$strEnd=($conf->urlFriendly) ? "/" : "";
369
+							$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
370
 							$register["title"] = stripslashes($register["title"]);
370
 							$register["title"] = stripslashes($register["title"]);
371
 							$register["description"] = stripslashes($register["description"]);
371
 							$register["description"] = stripslashes($register["description"]);
372
 							
372