Browse Source

adding Permalink function.

vbracco 16 years ago
parent
commit
3471ee1993
2 changed files with 12 additions and 5 deletions
  1. 9 1
      classes/gelato.class.php
  2. 3 4
      index.php

+ 9 - 1
classes/gelato.class.php View File

191
 		} else {
191
 		} else {
192
 			return "This URL is not an MP3 file.";
192
 			return "This URL is not an MP3 file.";
193
 		}		
193
 		}		
194
-	}	
194
+	}
195
+
196
+	function getPermalink($post_id){
197
+		$strEnd = ($this->conf->urlFriendly) ? "/" : "";
198
+		$out = $this->conf->urlGelato;
199
+		$out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post=";
200
+		$out .= $post_id.$strEnd;
201
+		return $out;
202
+	}
195
 } 
203
 } 
196
 ?>
204
 ?>

+ 3 - 4
index.php View File

107
                         while($register = mysql_fetch_assoc($rs)) {
107
                         while($register = mysql_fetch_assoc($rs)) {
108
 								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
108
 								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
109
                                 if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
109
                                 if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
110
-								$strEnd=($conf->urlFriendly) ? "/" : "";
111
-								$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
110
+								
111
+								$permalink = $tumble->getPermalink($register["id_post"]);
112
 
112
 
113
 								$conversation = $register["description"];
113
 								$conversation = $register["description"];
114
 
114
 
204
                 $register = $tumble->getPost($id_post);
204
                 $register = $tumble->getPost($id_post);
205
 
205
 
206
 				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
206
 				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
207
-				$strEnd=($conf->urlFriendly) ? "/" : "";
208
-				$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
207
+				$permalink = $tumble->getPermalink($register["id_post"]);
209
 
208
 
210
 				$conversation = $register["description"];
209
 				$conversation = $register["description"];
211
 
210