|
@@ -0,0 +1,251 @@
|
|
1
|
+<?php
|
|
2
|
+if(!defined('entry'))define('entry', true);
|
|
3
|
+ /* ===========================
|
|
4
|
+
|
|
5
|
+ gelato CMS - A PHP based tumblelog CMS
|
|
6
|
+ development version
|
|
7
|
+ http://www.gelatocms.com/
|
|
8
|
+
|
|
9
|
+ gelato CMS is a free software licensed under the GPL 2.0
|
|
10
|
+ Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
|
|
11
|
+
|
|
12
|
+ =========================== */
|
|
13
|
+?>
|
|
14
|
+<?php
|
|
15
|
+require('entry.php');
|
|
16
|
+global $user, $tumble, $conf;
|
|
17
|
+
|
|
18
|
+$quote = array();
|
|
19
|
+$conversation = array();
|
|
20
|
+$link = array();
|
|
21
|
+$photo = array();
|
|
22
|
+$regular = array();
|
|
23
|
+$video = array();
|
|
24
|
+
|
|
25
|
+$rs = $tumble->getPosts($tumble->getPostsNumber());
|
|
26
|
+if ($tumble->contarRegistros()>0) {
|
|
27
|
+ while($register = mysql_fetch_assoc($rs)) {
|
|
28
|
+ $output = handleNode($register);
|
|
29
|
+
|
|
30
|
+ $theType = type2Text($register["type"]);
|
|
31
|
+
|
|
32
|
+ switch($theType) {
|
|
33
|
+ case 'quote':
|
|
34
|
+ $quote[] = $output;
|
|
35
|
+ continue;
|
|
36
|
+ case 'conversation':
|
|
37
|
+ $conversation[] = $output;
|
|
38
|
+ continue;
|
|
39
|
+ case 'url':
|
|
40
|
+ $link[] = $output;
|
|
41
|
+ continue;
|
|
42
|
+ case 'photo':
|
|
43
|
+ $photo[] = $output;
|
|
44
|
+ continue;
|
|
45
|
+ case 'post':
|
|
46
|
+ $regular[] = $output;
|
|
47
|
+ continue;
|
|
48
|
+ case 'video':
|
|
49
|
+ $video[] = $output;
|
|
50
|
+ continue;
|
|
51
|
+ }
|
|
52
|
+ }
|
|
53
|
+}
|
|
54
|
+
|
|
55
|
+function handleNode($node) {
|
|
56
|
+ global $user, $tumble, $conf;
|
|
57
|
+ $dateTmp = null;
|
|
58
|
+ $formatedDate = gmdate("M d", strtotime($node["date"]) + transform_offset($conf->offsetTime));
|
|
59
|
+
|
|
60
|
+ $output = array();
|
|
61
|
+ $output['url'] = $tumble->getPermalink($node["id_post"]);
|
|
62
|
+ $output['date'] = $formatedDate;
|
|
63
|
+
|
|
64
|
+ $theType = type2Text($node["type"]);
|
|
65
|
+
|
|
66
|
+ switch($theType) {
|
|
67
|
+ case 'quote':
|
|
68
|
+ $output['quote'] = $node["description"];
|
|
69
|
+ $output['source'] = $node["title"];
|
|
70
|
+ break;
|
|
71
|
+ case 'conversation':
|
|
72
|
+ $output['lines'] = $tumble->formatConversation($node["description"]);
|
|
73
|
+ break;
|
|
74
|
+ case 'url':
|
|
75
|
+ $node["title"] = (empty($node["title"]))? $node["url"] : $node["title"];
|
|
76
|
+ $output['text'] = $node["title"];
|
|
77
|
+ $output['link'] = $node["url"];
|
|
78
|
+ break;
|
|
79
|
+ case 'photo':
|
|
80
|
+ $fileName = "uploads/".getFileName($node["url"]);
|
|
81
|
+ $x = @getimagesize($fileName);
|
|
82
|
+ if ($x[0] > 500) {
|
|
83
|
+ $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$node["url"];
|
|
84
|
+ } else {
|
|
85
|
+ $photoPath = str_replace("../", $conf->urlGelato."/", $node["url"]);
|
|
86
|
+ }
|
|
87
|
+ $output['caption'] = $node["description"];
|
|
88
|
+ $output['photo'] = $photoPath;
|
|
89
|
+ break;
|
|
90
|
+ case 'post':
|
|
91
|
+ $output['title'] = $node["title"];
|
|
92
|
+ $output['body'] = $node["description"];
|
|
93
|
+ break;
|
|
94
|
+ case 'video':
|
|
95
|
+ $output['caption'] = $node["description"];
|
|
96
|
+ $temp = $tumble->getVideoPlayer($node["url"]);
|
|
97
|
+ $patterns[0] = "/width='[0-9]+'/";
|
|
98
|
+ $patterns[1] = "/height='[0-9]+'/";
|
|
99
|
+ $replace[0] = "width='100'";
|
|
100
|
+ $replace[1] = "height='75'";
|
|
101
|
+ $embed = preg_replace($patterns, $replace, $temp);
|
|
102
|
+ $output['embed'] = $embed;
|
|
103
|
+ }
|
|
104
|
+ return $output;
|
|
105
|
+ }
|
|
106
|
+?>
|
|
107
|
+
|
|
108
|
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
109
|
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
110
|
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
111
|
+
|
|
112
|
+ <head>
|
|
113
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
114
|
+ <meta name="generator" content="gelato <?php echo codeName()." (".version().")"; ?>" />
|
|
115
|
+ <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
|
|
116
|
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $conf->urlGelato.($conf->urlFriendly ? "/rss/" : "/rss.php"); ?>"/>
|
|
117
|
+ <title><?php echo $conf->title." » ".__(" archive"); ?></title>
|
|
118
|
+ <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
|
|
119
|
+ <link href="<?php echo $conf->urlGelato;?>/admin/css/archive.css" type="text/css" rel="stylesheet">
|
|
120
|
+ <script type='text/javascript'>
|
|
121
|
+ function select(object) {
|
|
122
|
+ var sel_id = object.id;
|
|
123
|
+ $("a.option").removeClass('selected');
|
|
124
|
+ $(object).addClass('selected');
|
|
125
|
+ $("#conversation_content, #quote_content, #link_content, #regular_content, #photo_content, #video_content").hide("slow");
|
|
126
|
+ $("#"+sel_id+"_content").show("slow");
|
|
127
|
+ };
|
|
128
|
+ </script>
|
|
129
|
+ </head>
|
|
130
|
+
|
|
131
|
+ <body>
|
|
132
|
+
|
|
133
|
+ <div id='dash'>
|
|
134
|
+
|
|
135
|
+ <div id='options'>
|
|
136
|
+ <ul id='option-list'>
|
|
137
|
+ <li><a href='#' id='conversation' class='option selected' onclick="select(this);">Conversations</a></li>
|
|
138
|
+ <li><a href='#' id='photo' class='option' onclick="select(this);">Photos</a></li>
|
|
139
|
+ <li><a href='#' id='link' class='option' onclick="select(this);">Links</a></li>
|
|
140
|
+ <li><a href='#' id='regular' class='option' onclick="select(this);">Posts</a></li>
|
|
141
|
+ <li><a href='#' id='quote' class='option' onclick="select(this);">Quotes</a></li>
|
|
142
|
+ <li><a href='#' id='video' class='option' onclick="select(this);">Videos</a></li>
|
|
143
|
+ </ul>
|
|
144
|
+ </div>
|
|
145
|
+
|
|
146
|
+ <div id='content'>
|
|
147
|
+ <div id='conversation_content'>
|
|
148
|
+ <?php foreach($conversation as $item) { ?>
|
|
149
|
+ <ul class='item_list'>
|
|
150
|
+ <li>
|
|
151
|
+ <div class='item'>
|
|
152
|
+ <ul>
|
|
153
|
+ <li><?php echo $item['lines']; ?></li>
|
|
154
|
+ </ul>
|
|
155
|
+ </div>
|
|
156
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
157
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
158
|
+ </div>
|
|
159
|
+ </li>
|
|
160
|
+ </ul>
|
|
161
|
+ <?php } ?>
|
|
162
|
+ </div>
|
|
163
|
+
|
|
164
|
+ <div id='quote_content' style='display:none;'>
|
|
165
|
+ <?php foreach($quote as $item) { ?>
|
|
166
|
+ <ul class='item_list'>
|
|
167
|
+ <li>
|
|
168
|
+ <div class='item'>
|
|
169
|
+ <ul>
|
|
170
|
+ <li><em>"<?php echo substr($item['quote'], 0, 50), "..."; ?>"</em></li>
|
|
171
|
+ <li>--<?php echo $item['source']; ?></li>
|
|
172
|
+ </ul>
|
|
173
|
+ </div>
|
|
174
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
175
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
176
|
+ </div>
|
|
177
|
+ </li>
|
|
178
|
+ </ul>
|
|
179
|
+ <?php } ?>
|
|
180
|
+ </div>
|
|
181
|
+
|
|
182
|
+ <div id='link_content' style='display:none;'>
|
|
183
|
+ <?php foreach($link as $item) { ?>
|
|
184
|
+ <ul class='item_list'>
|
|
185
|
+ <li>
|
|
186
|
+ <div class='item link'>
|
|
187
|
+ <ul>
|
|
188
|
+ <li><a href="<?php echo $item['link']; ?>"><?php echo $item['text']; ?></a></li>
|
|
189
|
+ </ul>
|
|
190
|
+ </div>
|
|
191
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
192
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
193
|
+ </div>
|
|
194
|
+ </li>
|
|
195
|
+ </ul>
|
|
196
|
+ <?php } ?>
|
|
197
|
+ </div>
|
|
198
|
+
|
|
199
|
+ <div id='photo_content' style='display:none;'>
|
|
200
|
+ <?php foreach($photo as $item) { ?>
|
|
201
|
+ <ul class='item_list'>
|
|
202
|
+ <li>
|
|
203
|
+ <div class='item' style="background-image:url('<?php echo $item['photo']; ?>')"></div>
|
|
204
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
205
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
206
|
+ </div>
|
|
207
|
+ </li>
|
|
208
|
+ </ul>
|
|
209
|
+ <?php } ?>
|
|
210
|
+ </div>
|
|
211
|
+
|
|
212
|
+ <div id='regular_content' style='display:none;'>
|
|
213
|
+ <?php foreach($regular as $item) { ?>
|
|
214
|
+ <ul class='item_list'>
|
|
215
|
+ <li>
|
|
216
|
+ <div class='item'>
|
|
217
|
+ <h4><?php echo $item['title']; ?></h4>
|
|
218
|
+ <p><?php echo $item['body']; ?></p>
|
|
219
|
+ </div>
|
|
220
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
221
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
222
|
+ </div>
|
|
223
|
+ </li>
|
|
224
|
+ </ul>
|
|
225
|
+ <?php } ?>
|
|
226
|
+ </div>
|
|
227
|
+
|
|
228
|
+ <div id='video_content' style='display:none;'>
|
|
229
|
+ <?php foreach($video as $item) { ?>
|
|
230
|
+ <ul class='item_list'>
|
|
231
|
+ <li>
|
|
232
|
+ <div class='item' style='text-align:center;'>
|
|
233
|
+ <?php echo $item['embed']; //$item['caption'] ?>
|
|
234
|
+ </div>
|
|
235
|
+ <div class='user_hover' onclick="location.href='<?php echo $item['url'] ?>';">
|
|
236
|
+ <h3><?php echo strftime("%b %d, %G", strtotime($item['date'])); ?></h3>
|
|
237
|
+ </div>
|
|
238
|
+ </li>
|
|
239
|
+ </ul>
|
|
240
|
+ <?php } ?>
|
|
241
|
+ </div>
|
|
242
|
+
|
|
243
|
+ </div>
|
|
244
|
+
|
|
245
|
+ <br clear='both' />
|
|
246
|
+
|
|
247
|
+ </div>
|
|
248
|
+
|
|
249
|
+ </body>
|
|
250
|
+
|
|
251
|
+</html>
|