pecesama il y a 15 ans
Parent
révision
67e1a2cd5f
1 fichiers modifiés avec 51 ajouts et 50 suppressions
  1. 51 50
      api.php

+ 51 - 50
api.php Voir le fichier

17
 	require('entry.php');
17
 	require('entry.php');
18
 	global $user, $conf, $tumble;
18
 	global $user, $conf, $tumble;
19
 	$f = new feeds();
19
 	$f = new feeds();
20
-	
21
-	$theme = new themes;
20
+	
21
+	$theme = new themes;
22
 
22
 
23
 	if (isset($_GET["action"]) && $_GET["action"] == "read") {
23
 	if (isset($_GET["action"]) && $_GET["action"] == "read") {
24
 		if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; }
24
 		if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; }
27
 		if ($total > 50) { $total = 50; }
27
 		if ($total > 50) { $total = 50; }
28
 		$user = new user();
28
 		$user = new user();
29
 		$userData = $user->getUserByID(1);
29
 		$userData = $user->getUserByID(1);
30
-		$username = ($userData["name"] == "") ? "gelato" : $userData["name"];
31
-
32
-		$theme->set("username",$username);
33
-		$theme->set("conf",array(
34
-			"offsetCity"=>$conf->offsetCity,
35
-			"title"=>$conf->title,
36
-			"description"=>$conf->description
30
+		$username = ($userData["name"] == "") ? "gelato" : $userData["name"];
31
+
32
+		$theme->set("username",$username);
33
+		$theme->set("conf",array(
34
+			"offsetCity"=>$conf->offsetCity,
35
+			"title"=>$conf->title,
36
+			"description"=>$conf->description
37
 		));
37
 		));
38
-
39
-		$feeds = array();
		$actual_feeds = $f->getFeedList();
38
+
39
+		$feeds = array();
40
+		$actual_feeds = $f->getFeedList();
40
 		foreach($actual_feeds as $feed){
41
 		foreach($actual_feeds as $feed){
41
-			$error_text = ($feed["error"]>0) ? "false" : "true";
42
-			$feed['url'] = htmlspecialchars($feed['url']);
43
-			$feed['type'] = util::type2Text($feed['type']);
44
-			$feed['getNextUpdate'] = $f->getNextUpdate($feed['id_feed']);
45
-			$feed['title'] = htmlspecialchars($feed['title']);
46
-			$feed['error_text'] = $error_text;
47
-			$feeds[] = $feed;
48
-		}
49
-		
42
+			$error_text = ($feed["error"]>0) ? "false" : "true";
43
+			$feed['url'] = htmlspecialchars($feed['url']);
44
+			$feed['type'] = util::type2Text($feed['type']);
45
+			$feed['getNextUpdate'] = $f->getNextUpdate($feed['id_feed']);
46
+			$feed['title'] = htmlspecialchars($feed['title']);
47
+			$feed['error_text'] = $error_text;
48
+			$feeds[] = $feed;
49
+		}
50
+		
50
 		$theme->set("feeds",$feeds);
51
 		$theme->set("feeds",$feeds);
51
 
52
 
52
 		if ($hasType) {
53
 		if ($hasType) {
53
 			$postType = type2Number($_GET["type"]);
54
 			$postType = type2Number($_GET["type"]);
54
 		}
55
 		}
55
-		$rs = $tumble->getPosts($total, $start);
56
-
57
-		$totalRegistros = $db->contarRegistros();
58
-		$theme->set("totalRegistros",$totalRegistros);
56
+		$rs = $tumble->getPosts($total, $start);
57
+
58
+		$totalRegistros = $db->contarRegistros();
59
+		$theme->set("totalRegistros",$totalRegistros);
59
 
60
 
60
-		if ($db->contarRegistros()>0) {
61
-			$theme->set("start",$start);
62
-			$theme->set("total",$total);
63
-
64
-			while($post = mysql_fetch_assoc($rs)){
61
+		if ($db->contarRegistros()>0) {
62
+			$theme->set("start",$start);
63
+			$theme->set("total",$total);
64
+
65
+			while($post = mysql_fetch_assoc($rs)){
65
 				$post['desc'] = util::trimString($post["description"]);				
66
 				$post['desc'] = util::trimString($post["description"]);				
66
 				$strEnd = ($conf->urlFriendly) ? "/" : "";
67
 				$strEnd = ($conf->urlFriendly) ? "/" : "";
67
 				$post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
68
 				$post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
68
 				$post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
69
 				$post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
69
-				
70
-				$post['type'] = util::type2Text($post["type"]);
71
-
72
-				switch ($post["type"]) {
73
-					case "post":
74
-						$post['tit'] = (empty($post["title"])) ? $desc : strip_tags($post["title"]);
70
+				
71
+				$post["type"] = util::type2Text($post["type"]);
72
+				
73
+				switch ($post["type"]) {				
74
+					case "post":
75
+						$post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);
75
 						break;
76
 						break;
76
 					case "photo":
77
 					case "photo":
77
-						$post['photoPath'] = str_replace("../", $conf->urlGelato."/", $post["url"]);
78
-						$post['tit'] = stripslashes(((empty($post["description"])) ? "Photo" : $post['desc']));
78
+						$post['photoPath'] = str_replace("../", $conf->urlGelato."/", $post["url"]);
79
+						$post['tit'] = stripslashes(((empty($post["description"])) ? "Photo" : $post['desc']));
79
 						break;
80
 						break;
80
 					case "quote":
81
 					case "quote":
81
-						$post['title'] = strip_tags($post["title"]);
82
+						$post['title'] = strip_tags($post["title"]);
82
 						break;
83
 						break;
83
 					case "url":
84
 					case "url":
84
 						$post['tit'] = (empty($post["title"])) ? $post["url"] : strip_tags($post["title"]);
85
 						$post['tit'] = (empty($post["title"])) ? $post["url"] : strip_tags($post["title"]);
85
 						break;
86
 						break;
86
 					case "conversation":
87
 					case "conversation":
87
-						$lines = explode("\n", $desc);
88
+						$lines = explode("\n", $post['desc']);
88
 						$line = $lines[0];
89
 						$line = $lines[0];
89
 						$post['tit'] = (empty($post["title"])) ? trimString($line) : $post["title"];
90
 						$post['tit'] = (empty($post["title"])) ? trimString($line) : $post["title"];
90
-						$post['desc'] = $tumble->formatConversation($desc);
91
-						$post['descAPIFormat'] = $tumble->formatConversation($desc);
91
+						$post['desc'] = $tumble->formatConversation($post['desc']);
92
+						$post['descAPIFormat'] = $tumble->formatConversation($post['desc']);
92
 						break;
93
 						break;
93
 					case "video":
94
 					case "video":
94
-						$post['tit'] = (empty($post["description"])) ? "Video" : $desc;
95
+						$post['tit'] = (empty($post["description"])) ? "Video" : $post['desc'];
95
 						$post['desc'] = htmlspecialchars($tumble->getVideoPlayer($post["url"]));
96
 						$post['desc'] = htmlspecialchars($tumble->getVideoPlayer($post["url"]));
96
 						break;
97
 						break;
97
 					case "mp3":
98
 					case "mp3":
98
-						$post['tit'] = (empty($post["description"])) ? "Audio" : $desc;
99
-						$desc = htmlspecialchars($tumble->getMp3Player($post["url"]));
99
+						$post['tit'] = (empty($post["description"])) ? "Audio" : $post['desc'];
100
+						$post['desc'] = htmlspecialchars($tumble->getMp3Player($post["url"]));
100
 						break;
101
 						break;
101
-				}				
102
-				$posts[] = $post;
103
-			}
104
-			$theme->set("posts",$posts);
105
-		}
102
+				}				
103
+				$posts[] = $post;
104
+			}
105
+			$theme->set("posts",$posts);
106
+		}
106
 		$theme->display(Absolute_Path.'admin/themes/admin/api.xml');
107
 		$theme->display(Absolute_Path.'admin/themes/admin/api.xml');
107
 	}
108
 	}
108
-?>
109
+?>