瀏覽代碼

Checking url-friendly when redirect

vbracco 15 年之前
父節點
當前提交
178101dc04
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 5 1
      admin/comments.php
  2. 2 2
      admin/index.php

+ 5 - 1
admin/comments.php 查看文件

@@ -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 查看文件

@@ -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