Selaa lähdekoodia

Checking url-friendly when redirect

vbracco 16 vuotta sitten
vanhempi
commit
178101dc04
2 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 5 1
      admin/comments.php
  2. 2 2
      admin/index.php

+ 5 - 1
admin/comments.php Näytä tiedosto

@@ -44,8 +44,12 @@ if(isset($_POST["btnAdd"]))	{
44 44
 		$_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";		
45 45
 		$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
46 46
 		
47
+		$strEnd=($conf->urlFriendly) ? "/" : "";
47 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 53
 			die();
50 54
 		}
51 55
 	}		

+ 2 - 2
admin/index.php Näytä tiedosto

@@ -365,8 +365,8 @@ if ($user->isAuthenticated()) {
365 365
 					if ($tumble->contarRegistros()>0) {				
366 366
 						while($register = mysql_fetch_array($rs)) {			
367 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 370
 							$register["title"] = stripslashes($register["title"]);
371 371
 							$register["description"] = stripslashes($register["description"]);
372 372