Browse Source

You can now create, modify, delete, list and view posts

Klectik 7 years ago
parent
commit
ed2c60a8d1
13 changed files with 134 additions and 129 deletions
  1. 20 20
      admin/admin.php
  2. 27 27
      admin/comments.php
  3. 2 2
      admin/index.php
  4. 6 6
      api.php
  5. 38 38
      archive.php
  6. 1 1
      classes/comments.class.php
  7. 1 1
      classes/feeds.class.php
  8. 3 3
      classes/gelato.class.php
  9. 6 5
      classes/mysql_connection.class.php
  10. 4 0
      config.php
  11. 5 5
      index.php
  12. 11 11
      rss.php
  13. 10 10
      sitemap.php

+ 20 - 20
admin/admin.php View File

31
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.tablesorter.min.js"></script>
31
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.tablesorter.min.js"></script>
32
 		<script type="text/javascript">
32
 		<script type="text/javascript">
33
 		$(document).ready(function(){
33
 		$(document).ready(function(){
34
-			$("#admin-table").tablesorter({        
35
-				headers: {            
36
-					2: {sorter: false},            
37
-					3: {sorter: false} 
38
-				} 
39
-			}); 			
34
+			$("#admin-table").tablesorter({
35
+				headers: {
36
+					2: {sorter: false},
37
+					3: {sorter: false}
38
+				}
39
+			});
40
 			$("#divMessages").fadeOut(5000,function(){
40
 			$("#divMessages").fadeOut(5000,function(){
41
 				$("#divMessages").css({display:"none"});
41
 				$("#divMessages").css({display:"none"});
42
 			});
42
 			});
43
 		});
43
 		});
44
 		</script>
44
 		</script>
45
-		<style type="text/css" media="screen">	
45
+		<style type="text/css" media="screen">
46
 			@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
46
 			@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
47
 		</style>
47
 		</style>
48
 	</head>
48
 	</head>
49
-	
49
+
50
 	<body>
50
 	<body>
51
 		<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
51
 		<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
52
 		<div id="cont">
52
 		<div id="cont">
57
 					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato; ?>/admin/ajax.php?action=close');"><?php echo __("Log out")?></a></li>
57
 					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato; ?>/admin/ajax.php?action=close');"><?php echo __("Log out")?></a></li>
58
 			  	</ul>
58
 			  	</ul>
59
 			</div>
59
 			</div>
60
-			<div id="main">				
61
-				
60
+			<div id="main">
61
+
62
 				<div class="box">
62
 				<div class="box">
63
 					<ul class="menu manage">
63
 					<ul class="menu manage">
64
 					<h3>Manage</h3>
64
 					<h3>Manage</h3>
69
 					<li class="selected"><a><?php echo __("Users")?></a></li>
69
 					<li class="selected"><a><?php echo __("Users")?></a></li>
70
 					</ul>
70
 					</ul>
71
 					<p>&nbsp;</p>
71
 					<p>&nbsp;</p>
72
-<?php	
72
+<?php
73
                         if (isset($_GET["added"])) {
73
                         if (isset($_GET["added"])) {
74
                             if ($_GET["added"]=="true") {
74
                             if ($_GET["added"]=="true") {
75
                                 echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
75
                                 echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
76
                             }
76
                             }
77
                         }
77
                         }
78
-                        
78
+
79
     if (isset($_GET["delete"])) {
79
     if (isset($_GET["delete"])) {
80
         if ($_GET["delete"]=="true") {
80
         if ($_GET["delete"]=="true") {
81
             echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
81
             echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
82
         }
82
         }
83
     }
83
     }
84
-                        
84
+
85
     if (isset($_GET["modified"])) {
85
     if (isset($_GET["modified"])) {
86
         if ($_GET["modified"]=="true") {
86
         if ($_GET["modified"]=="true") {
87
             echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
87
             echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
88
         }
88
         }
89
     }
89
     }
90
-                        
90
+
91
     if (isset($_GET["error"])) {
91
     if (isset($_GET["error"])) {
92
         if ($_GET["error"]==1) {
92
         if ($_GET["error"]==1) {
93
             echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
93
             echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
94
         } elseif ($_GET["error"]==2) {
94
         } elseif ($_GET["error"]==2) {
95
             echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
95
             echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
96
         }
96
         }
97
-    } ?>						
97
+    } ?>
98
 						<div class="tabla">
98
 						<div class="tabla">
99
 						<table border="0" cellpadding="0" cellspacing="0" id="admin-table">
99
 						<table border="0" cellpadding="0" cellspacing="0" id="admin-table">
100
 							<thead>
100
 							<thead>
110
                     $odd=false;
110
                     $odd=false;
111
     $rs = $user->getUsers();
111
     $rs = $user->getUsers();
112
     if ($db->contarRegistros()>0) {
112
     if ($db->contarRegistros()>0) {
113
-        while ($register = mysql_fetch_array($rs)) {
113
+        while ($register = $rs->fetch()) {
114
             ?>
114
             ?>
115
 							<tr <?php if ($odd) {
115
 							<tr <?php if ($odd) {
116
                 echo 'class="odd"';
116
                 echo 'class="odd"';
118
             $odd=!$odd; ?>>
118
             $odd=!$odd; ?>>
119
 								<td><?php echo $register["login"]."\n"; ?></td>
119
 								<td><?php echo $register["login"]."\n"; ?></td>
120
 								<td><?php echo $register["name"]."\n"; ?></td>
120
 								<td><?php echo $register["name"]."\n"; ?></td>
121
-								<td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td>								
121
+								<td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td>
122
 								<td><?php if ($_SESSION["user_id"] != $register["id_user"]) {
122
 								<td><?php if ($_SESSION["user_id"] != $register["id_user"]) {
123
-                ?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php 
123
+                ?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php
124
             } ?>&nbsp;</td>
124
             } ?>&nbsp;</td>
125
-								
125
+
126
 							</tr>
126
 							</tr>
127
 <?php
127
 <?php
128
 
128
 
129
         }
129
         }
130
     } else {
130
     } else {
131
         ?>
131
         ?>
132
-						<tr> 
132
+						<tr>
133
 							<td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
133
 							<td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
134
 						</tr>
134
 						</tr>
135
 <?php
135
 <?php

+ 27 - 27
admin/comments.php View File

22
 $isAdmin = $user->isAdmin();
22
 $isAdmin = $user->isAdmin();
23
 $isEdition = isset($_GET["edit"]);
23
 $isEdition = isset($_GET["edit"]);
24
 $commentId = ($isEdition) ? $_GET["edit"] : null;
24
 $commentId = ($isEdition) ? $_GET["edit"] : null;
25
-    
25
+
26
 if (isset($_POST["btnAdd"])) {
26
 if (isset($_POST["btnAdd"])) {
27
     unset($_POST["btnAdd"]);
27
     unset($_POST["btnAdd"]);
28
-    
28
+
29
     $_POST["username"] = strip_tags($_POST["username"]);
29
     $_POST["username"] = strip_tags($_POST["username"]);
30
     $_POST["email"] =  strip_tags($_POST["email"]);
30
     $_POST["email"] =  strip_tags($_POST["email"]);
31
     $_POST["web"] = strip_tags($_POST["web"]);
31
     $_POST["web"] = strip_tags($_POST["web"]);
32
     $_POST["content"] = util::removeBadTags($_POST["content"], true);
32
     $_POST["content"] = util::removeBadTags($_POST["content"], true);
33
-        
33
+
34
     if (isset($_POST["id_comment"])) {
34
     if (isset($_POST["id_comment"])) {
35
         if ($isAdmin) {
35
         if ($isAdmin) {
36
             if ($comment->modifyComment($_POST, $_POST["id_comment"])) {
36
             if ($comment->modifyComment($_POST, $_POST["id_comment"])) {
45
         $comment->generateCookie($_POST);
45
         $comment->generateCookie($_POST);
46
         $_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";
46
         $_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";
47
         $_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
47
         $_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
48
-        
48
+
49
         $strEnd=($conf->urlFriendly) ? "/" : "";
49
         $strEnd=($conf->urlFriendly) ? "/" : "";
50
         if ($comment->addComment($_POST)) {
50
         if ($comment->addComment($_POST)) {
51
             header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
51
             header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
83
 			});
83
 			});
84
 		});
84
 		});
85
 		</script>
85
 		</script>
86
-		<style type="text/css" media="screen">	
86
+		<style type="text/css" media="screen">
87
 			@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
87
 			@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
88
 		</style>
88
 		</style>
89
 	</head>
89
 	</head>
90
-	
90
+
91
 	<body>
91
 	<body>
92
 		<div id="div-process" style="display:none;"><?=__("Processing request&hellip;"); ?></div>
92
 		<div id="div-process" style="display:none;"><?=__("Processing request&hellip;"); ?></div>
93
 		<div id="cont">
93
 		<div id="cont">
97
 					<li><a href="<?php echo $conf->urlGelato; ?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li>
97
 					<li><a href="<?php echo $conf->urlGelato; ?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li>
98
 			  	</ul>
98
 			  	</ul>
99
 			</div>
99
 			</div>
100
-			<div id="main">				
101
-				
100
+			<div id="main">
101
+
102
 				<div class="box">
102
 				<div class="box">
103
 					<ul class="menu manage">
103
 					<ul class="menu manage">
104
 						<h3><?=__("Manage comments")?></h3>
104
 						<h3><?=__("Manage comments")?></h3>
105
 						<li><a href="index.php"><?=__("Posts")?></a></li>
105
 						<li><a href="index.php"><?=__("Posts")?></a></li>
106
 						<li <?php if (isset($_GET["spam"])) {
106
 						<li <?php if (isset($_GET["spam"])) {
107
-        ?> class="selected" <?php 
107
+        ?> class="selected" <?php
108
     } ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li>
108
     } ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li>
109
 						<li <?php if (!isset($_GET["spam"])) {
109
 						<li <?php if (!isset($_GET["spam"])) {
110
-        ?> class="selected" <?php 
110
+        ?> class="selected" <?php
111
     } ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li>
111
     } ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li>
112
 					</ul>
112
 					</ul>
113
-					<p>&nbsp;</p>					
114
-<?php	
113
+					<p>&nbsp;</p>
114
+<?php
115
                     if (isset($_GET["deleted"])) {
115
                     if (isset($_GET["deleted"])) {
116
                         if ($_GET["deleted"]=="true") {
116
                         if ($_GET["deleted"]=="true") {
117
                             echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been eliminated successfully.")."</div>";
117
                             echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been eliminated successfully.")."</div>";
120
                             echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been eliminated.")."</div>";
120
                             echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been eliminated.")."</div>";
121
                         }
121
                         }
122
                     }
122
                     }
123
-                    
123
+
124
     if (isset($_GET["modified"])) {
124
     if (isset($_GET["modified"])) {
125
         if ($_GET["modified"]=="true") {
125
         if ($_GET["modified"]=="true") {
126
             echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been modified successfully.")."</div>";
126
             echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been modified successfully.")."</div>";
129
             echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been modified.")."</div>";
129
             echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been modified.")."</div>";
130
         }
130
         }
131
     } ?>
131
     } ?>
132
-					<div class="tabla">						
132
+					<div class="tabla">
133
 <?php
133
 <?php
134
                         if ($isEdition) {
134
                         if ($isEdition) {
135
                             $row = $comment->getComment($_GET["edit"]);
135
                             $row = $comment->getComment($_GET["edit"]);
136
                             $date = strtotime($row["comment_date"]);
136
                             $date = strtotime($row["comment_date"]);
137
-                            
137
+
138
                             $input = array("{User}", "{Email}", "{Web}", "{Comment}", "{Id_Post}", "{Date_Added}", "{Id_Comment}", "{Form_Action}");
138
                             $input = array("{User}", "{Email}", "{Web}", "{Comment}", "{Id_Post}", "{Date_Added}", "{Id_Comment}", "{Form_Action}");
139
                             $output = array($row["username"], $row["email"], $row["web"], $row["content"], $row["id_post"], $date, $row["id_comment"], $conf->urlGelato."/admin/comments.php");
139
                             $output = array($row["username"], $row["email"], $row["web"], $row["content"], $row["id_post"], $date, $row["id_comment"], $conf->urlGelato."/admin/comments.php");
140
-                            
140
+
141
                             $template->cargarPlantilla($input, $output, "template_comment_post");
141
                             $template->cargarPlantilla($input, $output, "template_comment_post");
142
                             $template->mostrarPlantilla();
142
                             $template->mostrarPlantilla();
143
                         } else {
143
                         } else {
146
                             } else {
146
                             } else {
147
                                 $page_num = null;
147
                                 $page_num = null;
148
                             }
148
                             }
149
-                            
149
+
150
                             $limit=$conf->postLimit;
150
                             $limit=$conf->postLimit;
151
-                            
151
+
152
                             if (isset($page_num) && is_numeric($page_num) && $page_num>0) {
152
                             if (isset($page_num) && is_numeric($page_num) && $page_num>0) {
153
                                 $from = (($page_num-1) * $limit);
153
                                 $from = (($page_num-1) * $limit);
154
                             } else {
154
                             } else {
155
                                 $from = 0;
155
                                 $from = 0;
156
                             }
156
                             }
157
-                            
157
+
158
                             if (isset($_GET["spam"]) && $_GET["spam"]=="true") {
158
                             if (isset($_GET["spam"]) && $_GET["spam"]=="true") {
159
                                 $sp = "1";
159
                                 $sp = "1";
160
                             } else {
160
                             } else {
161
                                 $sp = null;
161
                                 $sp = null;
162
                             }
162
                             }
163
-                            
163
+
164
                             $rs = $comment->getComments(null, $limit, $from, $sp);
164
                             $rs = $comment->getComments(null, $limit, $from, $sp);
165
-                    
165
+
166
                             if ($db->contarRegistros()>0) {
166
                             if ($db->contarRegistros()>0) {
167
-                                while ($rowComment = mysql_fetch_array($rs)) {
167
+                                while ($rowComment = $rs->fetch()) {
168
                                     $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"]  : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];
168
                                     $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"]  : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];
169
-                                    
169
+
170
                                     $input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}");
170
                                     $input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}");
171
                                     $output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]);
171
                                     $output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]);
172
-                                    
172
+
173
                                     $template->cargarPlantilla($input, $output, "template_comment");
173
                                     $template->cargarPlantilla($input, $output, "template_comment");
174
                                     $template->mostrarPlantilla();
174
                                     $template->mostrarPlantilla();
175
                                 }
175
                                 }
176
-                                
176
+
177
                                 $p = new pagination;
177
                                 $p = new pagination;
178
                                 $p->items($comment->countComments());
178
                                 $p->items($comment->countComments());
179
                                 $p->limit($limit);
179
                                 $p->limit($limit);
180
                                 $p->currentPage(isset($page_num) ? $page_num : 1);
180
                                 $p->currentPage(isset($page_num) ? $page_num : 1);
181
                                 $p->show();
181
                                 $p->show();
182
                             }
182
                             }
183
-                        } ?>							
183
+                        } ?>
184
 					</div>
184
 					</div>
185
 
185
 
186
 					<div class="footer-box">&nbsp;</div>
186
 					<div class="footer-box">&nbsp;</div>
197
 } else {
197
 } else {
198
     header("Location: ".$conf->urlGelato."/login.php");
198
     header("Location: ".$conf->urlGelato."/login.php");
199
 }
199
 }
200
-?>
200
+?>

+ 2 - 2
admin/index.php View File

107
         $admin_includes = "";
107
         $admin_includes = "";
108
         $trigger->call('admin_includes');
108
         $trigger->call('admin_includes');
109
         $theme->set('admin_includes', $admin_includes);
109
         $theme->set('admin_includes', $admin_includes);
110
-        
110
+
111
         $theme->set('version', $util_class->version());
111
         $theme->set('version', $util_class->version());
112
         $theme->set('conf', array(
112
         $theme->set('conf', array(
113
                         'urlGelato'=>$conf->urlGelato,
113
                         'urlGelato'=>$conf->urlGelato,
240
 
240
 
241
             $rows = array();
241
             $rows = array();
242
             if ($db->contarRegistros()>0) {
242
             if ($db->contarRegistros()>0) {
243
-                while ($register = mysql_fetch_array($rs)) {
243
+                while ($register = $rs->fetch()) {
244
                     $row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"]));
244
                     $row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"]));
245
 
245
 
246
                     $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
246
                     $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));

+ 6 - 6
api.php View File

15
 ?>
15
 ?>
16
 <?php
16
 <?php
17
     $isFeed = true;
17
     $isFeed = true;
18
-    
18
+
19
     require('entry.php');
19
     require('entry.php');
20
     global $user, $conf, $tumble;
20
     global $user, $conf, $tumble;
21
     $f = new feeds();
21
     $f = new feeds();
22
-    
22
+
23
     $theme = new themes;
23
     $theme = new themes;
24
 
24
 
25
     if (isset($_GET["action"]) && $_GET["action"] == "read") {
25
     if (isset($_GET["action"]) && $_GET["action"] == "read") {
63
             $feed['error_text'] = $error_text;
63
             $feed['error_text'] = $error_text;
64
             $feeds[] = $feed;
64
             $feeds[] = $feed;
65
         }
65
         }
66
-        
66
+
67
         $theme->set("feeds", $feeds);
67
         $theme->set("feeds", $feeds);
68
 
68
 
69
         if ($hasType) {
69
         if ($hasType) {
78
             $theme->set("start", $start);
78
             $theme->set("start", $start);
79
             $theme->set("total", $total);
79
             $theme->set("total", $total);
80
 
80
 
81
-            while ($post = mysql_fetch_assoc($rs)) {
81
+            while ($post = $rs->fetch()) {
82
                 $post['desc'] = util::trimString($post["description"]);
82
                 $post['desc'] = util::trimString($post["description"]);
83
                 $strEnd = ($conf->urlFriendly) ? "/" : "";
83
                 $strEnd = ($conf->urlFriendly) ? "/" : "";
84
                 $post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
84
                 $post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
85
                 $post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
85
                 $post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
86
-                
86
+
87
                 $post["type"] = util::type2Text($post["type"]);
87
                 $post["type"] = util::type2Text($post["type"]);
88
-                
88
+
89
                 switch ($post["type"]) {
89
                 switch ($post["type"]) {
90
                     case "post":
90
                     case "post":
91
                         $post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);
91
                         $post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);

+ 38 - 38
archive.php View File

29
 $dates = array();
29
 $dates = array();
30
 $rs = $tumble->getPosts($tumble->getPostsNumber());
30
 $rs = $tumble->getPosts($tumble->getPostsNumber());
31
 if ($db->contarRegistros()>0) {
31
 if ($db->contarRegistros()>0) {
32
-    while ($register = mysql_fetch_assoc($rs)) {
32
+    while ($register = $rs->fetch()) {
33
         $date = strtotime($register['date']);
33
         $date = strtotime($register['date']);
34
         $year = date('Y', $date);
34
         $year = date('Y', $date);
35
         $month = date('M', $date);
35
         $month = date('M', $date);
36
         $day = date('d', $date);
36
         $day = date('d', $date);
37
         $dates[$year][$month][$day] = true;
37
         $dates[$year][$month][$day] = true;
38
         $output = handleNode($register);
38
         $output = handleNode($register);
39
-        
39
+
40
         $theType = $util_class->type2Text($register["type"]);
40
         $theType = $util_class->type2Text($register["type"]);
41
-        
41
+
42
         switch ($theType) {
42
         switch ($theType) {
43
             case 'quote':
43
             case 'quote':
44
                 $quote[] = $output;
44
                 $quote[] = $output;
68
     global $user, $tumble, $conf;
68
     global $user, $tumble, $conf;
69
     $dateTmp = null;
69
     $dateTmp = null;
70
     $formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime));
70
     $formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime));
71
-        
71
+
72
     $output = array();
72
     $output = array();
73
     $output['url'] = $tumble->getPermalink($node["id_post"]);
73
     $output['url'] = $tumble->getPermalink($node["id_post"]);
74
     $output['date'] = $formatedDate;
74
     $output['date'] = $formatedDate;
77
     $year = date('Y', $date);
77
     $year = date('Y', $date);
78
     $month = date('M', $date);
78
     $month = date('M', $date);
79
     $day = date('d', $date);
79
     $day = date('d', $date);
80
-        
80
+
81
     $output['full_date'] = $day.' '.$month.' '.$year;
81
     $output['full_date'] = $day.' '.$month.' '.$year;
82
     $theType = $util_class->type2Text($node["type"]);
82
     $theType = $util_class->type2Text($node["type"]);
83
-        
83
+
84
     switch ($theType) {
84
     switch ($theType) {
85
             case 'quote':
85
             case 'quote':
86
                 $output['quote'] = $node["description"];
86
                 $output['quote'] = $node["description"];
135
 		<title><?php echo $conf->title." &raquo; ".__(" archive"); ?></title>
135
 		<title><?php echo $conf->title." &raquo; ".__(" archive"); ?></title>
136
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
136
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
137
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.scrollTo-min.js"></script>
137
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.scrollTo-min.js"></script>
138
-		<link href="<?php echo $conf->urlGelato;?>/admin/css/archive.css" type="text/css" rel="stylesheet">		
138
+		<link href="<?php echo $conf->urlGelato;?>/admin/css/archive.css" type="text/css" rel="stylesheet">
139
 		<script type='text/javascript'>
139
 		<script type='text/javascript'>
140
 			function select(object) {
140
 			function select(object) {
141
 				var sel_id = object.id;
141
 				var sel_id = object.id;
146
 			 	$("li.selected").removeClass('selected');
146
 			 	$("li.selected").removeClass('selected');
147
 				$("#"+sel_id+"_content").show();
147
 				$("#"+sel_id+"_content").show();
148
 				$('#user_hover').hide();
148
 				$('#user_hover').hide();
149
-				
149
+
150
 			};
150
 			};
151
-			
151
+
152
 			$(function(){
152
 			$(function(){
153
 				$("#timeline li").hover(function(){
153
 				$("#timeline li").hover(function(){
154
 					$(this).css('cursor','pointer');
154
 					$(this).css('cursor','pointer');
173
 						$("#bubble").text('Not found');
173
 						$("#bubble").text('Not found');
174
 					}
174
 					}
175
 				});
175
 				});
176
-				
176
+
177
 				$('#user_hover').hover(function(){},function(){ $(this).hide(); });
177
 				$('#user_hover').hover(function(){},function(){ $(this).hide(); });
178
-				
178
+
179
 				$('.item').hover(function(e){
179
 				$('.item').hover(function(e){
180
 					var item = $(this);
180
 					var item = $(this);
181
 					$('#user_hover').css({top:$(this).offset().top,left:$(this).offset().left}).show().unbind('click').click(function(){
181
 					$('#user_hover').css({top:$(this).offset().top,left:$(this).offset().left}).show().unbind('click').click(function(){
184
 					$('#user_hover h3').text($(this).attr('rel'));
184
 					$('#user_hover h3').text($(this).attr('rel'));
185
 				},function(e){});
185
 				},function(e){});
186
 			});
186
 			});
187
-			
187
+
188
 			function wrap () {
188
 			function wrap () {
189
 					var elems = $("li.selected");
189
 					var elems = $("li.selected");
190
 					var list = $("#content > div:visible ul.item_list > li");
190
 					var list = $("#content > div:visible ul.item_list > li");
201
 					$(elems).eq(0).append("<div class='crnr wn'>&nbsp;</div>").append("<div class='crnr ws'>&nbsp;</div>");
201
 					$(elems).eq(0).append("<div class='crnr wn'>&nbsp;</div>").append("<div class='crnr ws'>&nbsp;</div>");
202
 					$(elems).eq(l-1).append("<div class='crnr en'>&nbsp;</div>").append("<div class='crnr es'>&nbsp;</div>");
202
 					$(elems).eq(l-1).append("<div class='crnr en'>&nbsp;</div>").append("<div class='crnr es'>&nbsp;</div>");
203
 			 }
203
 			 }
204
-			
204
+
205
 		</script>
205
 		</script>
206
 	</head>
206
 	</head>
207
-	
207
+
208
 	<body>
208
 	<body>
209
 		<div id='dash'>
209
 		<div id='dash'>
210
 			<div id='options'>
210
 			<div id='options'>
216
 					<li><a href='#' id='quote' class='option' onclick="select(this);">Quotes</a></li>
216
 					<li><a href='#' id='quote' class='option' onclick="select(this);">Quotes</a></li>
217
 					<li><a href='#' id='video' class='option' onclick="select(this);">Videos</a></li>
217
 					<li><a href='#' id='video' class='option' onclick="select(this);">Videos</a></li>
218
 				</ul>
218
 				</ul>
219
-			</div>		
219
+			</div>
220
 		<div id="timeline">
220
 		<div id="timeline">
221
 			<div id="timewrap">
221
 			<div id="timewrap">
222
 				<div id="bubble"></div>
222
 				<div id="bubble"></div>
239
                     }
239
                     }
240
                     ?>
240
                     ?>
241
 				</ul>
241
 				</ul>
242
-			</div>		
242
+			</div>
243
 		</div>
243
 		</div>
244
-					
245
 
244
 
246
-			
247
-			
245
+
246
+
247
+
248
 			<div id='content'>
248
 			<div id='content'>
249
 				<div id='msg' style="display:none;">&nbsp;</div>
249
 				<div id='msg' style="display:none;">&nbsp;</div>
250
-				
250
+
251
 				<div id='conversation_content'>
251
 				<div id='conversation_content'>
252
 					<ul class='item_list'>
252
 					<ul class='item_list'>
253
 					<?php foreach ($conversation as $item) {
253
 					<?php foreach ($conversation as $item) {
259
 								</ul>
259
 								</ul>
260
 							</div>
260
 							</div>
261
 						</li>
261
 						</li>
262
-					<?php 
262
+					<?php
263
                     } ?>
263
                     } ?>
264
 					</ul>
264
 					</ul>
265
 				</div>
265
 				</div>
266
-				
266
+
267
 				<div id='quote_content' style='display:none;'>
267
 				<div id='quote_content' style='display:none;'>
268
 					<ul class='item_list'>
268
 					<ul class='item_list'>
269
 					<?php foreach ($quote as $item) {
269
 					<?php foreach ($quote as $item) {
276
 								</ul>
276
 								</ul>
277
 							</div>
277
 							</div>
278
 						</li>
278
 						</li>
279
-					<?php 
279
+					<?php
280
                     } ?>
280
                     } ?>
281
 					</ul>
281
 					</ul>
282
 				</div>
282
 				</div>
283
-				
283
+
284
 				<div id='link_content' style='display:none;'>
284
 				<div id='link_content' style='display:none;'>
285
 					<ul class='item_list'>
285
 					<ul class='item_list'>
286
 					<?php foreach ($link as $item) {
286
 					<?php foreach ($link as $item) {
292
 								</ul>
292
 								</ul>
293
 							</div>
293
 							</div>
294
 						</li>
294
 						</li>
295
-					<?php 
295
+					<?php
296
                     } ?>
296
                     } ?>
297
 					</ul>
297
 					</ul>
298
 				</div>
298
 				</div>
299
-				
299
+
300
 				<div id='photo_content' style='display:none;'>
300
 				<div id='photo_content' style='display:none;'>
301
 					<ul class='item_list'>
301
 					<ul class='item_list'>
302
 						<?php foreach ($photo as $item) {
302
 						<?php foreach ($photo as $item) {
303
                         ?>
303
                         ?>
304
-								
305
-								<?php 
304
+
305
+								<?php
306
                                 /*
306
                                 /*
307
                                 echo "<pre>";
307
                                 echo "<pre>";
308
                                 print_r($item);
308
                                 print_r($item);
309
-                                echo "</pre>"; 
309
+                                echo "</pre>";
310
                                 */
310
                                 */
311
-                                ?>                                
311
+                                ?>
312
 						<li>
312
 						<li>
313
 							<div class='item' style="background-image:url('<?php echo $item['photo']; ?>')"  rel='<?php echo $item['full_date'] ?>' title="<?php echo strftime("%b %d, %G", strtotime($item['date'])); ?>" onclick="location.href='<?php echo $item['url'] ?>';"></div>
313
 							<div class='item' style="background-image:url('<?php echo $item['photo']; ?>')"  rel='<?php echo $item['full_date'] ?>' title="<?php echo strftime("%b %d, %G", strtotime($item['date'])); ?>" onclick="location.href='<?php echo $item['url'] ?>';"></div>
314
 						</li>
314
 						</li>
315
-					<?php 
315
+					<?php
316
                     } ?>
316
                     } ?>
317
 					</ul>
317
 					</ul>
318
 				</div>
318
 				</div>
319
-				
320
-				<div id='regular_content' style='display:none;'>	
319
+
320
+				<div id='regular_content' style='display:none;'>
321
 					<ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
321
 					<ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
322
 						<?php foreach ($regular as $item) {
322
 						<?php foreach ($regular as $item) {
323
                         ?>
323
                         ?>
327
 								<p><?php echo $item['body']; ?></p>
327
 								<p><?php echo $item['body']; ?></p>
328
 							</div>
328
 							</div>
329
 						</li>
329
 						</li>
330
-					<?php 
330
+					<?php
331
                     } ?>
331
                     } ?>
332
 					</ul>
332
 					</ul>
333
 				</div>
333
 				</div>
334
-				
334
+
335
 				<div id='video_content' style='display:none;'>
335
 				<div id='video_content' style='display:none;'>
336
 					<ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
336
 					<ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
337
 					<?php foreach ($video as $item) {
337
 					<?php foreach ($video as $item) {
341
 								<?php echo  $item['embed']; //$item['caption']?>
341
 								<?php echo  $item['embed']; //$item['caption']?>
342
 							</div>
342
 							</div>
343
 						</li>
343
 						</li>
344
-					<?php 
344
+					<?php
345
                     } ?>
345
                     } ?>
346
 					</ul>
346
 					</ul>
347
 				</div>
347
 				</div>
348
 			<p style="clear:both">&nbsp;</p>
348
 			<p style="clear:both">&nbsp;</p>
349
 			</div>
349
 			</div>
350
-			
350
+
351
 			<br clear='both' />
351
 			<br clear='both' />
352
 			<div id='user_hover'><h3>&nbsp;</h3></div>
352
 			<div id='user_hover'><h3>&nbsp;</h3></div>
353
 
353
 
354
 		</div>
354
 		</div>
355
-		
355
+
356
 	</body>
356
 	</body>
357
 
357
 
358
 </html>
358
 </html>

+ 1 - 1
classes/comments.class.php View File

99
     public function getComment($id="")
99
     public function getComment($id="")
100
     {
100
     {
101
         $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id);
101
         $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id);
102
-        return mysql_fetch_array($this->db->mid_consulta);
102
+        return $this->db->mid_consulta->fetch();
103
     }
103
     }
104
 
104
 
105
     public function countComments($idPost=null)
105
     public function countComments($idPost=null)

+ 1 - 1
classes/feeds.class.php View File

169
         $timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
169
         $timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
170
         $delta = time() - strtotime($timeToUpdate);
170
         $delta = time() - strtotime($timeToUpdate);
171
         $this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW())  FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id);
171
         $this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW())  FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id);
172
-        $time = mysql_fetch_array($this->mid_consulta);
172
+        $time = $this->mid_consulta->fetch();
173
         return $time[0];
173
         return $time[0];
174
     }
174
     }
175
 }
175
 }

+ 3 - 3
classes/gelato.class.php View File

83
     public function getPost($id="")
83
     public function getPost($id="")
84
     {
84
     {
85
         $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
85
         $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
86
-        return mysql_fetch_array($this->db->mid_consulta);
86
+        return $this->db->mid_consulta->fetch();
87
     }
87
     }
88
 
88
 
89
     public function getPostsNumber()
89
     public function getPostsNumber()
90
     {
90
     {
91
         $this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
91
         $this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
92
-        $row = mysql_fetch_assoc($this->db->mid_consulta);
92
+        $row = $this->db->mid_consulta->fetch();
93
         return $row['total'];
93
         return $row['total'];
94
     }
94
     }
95
 
95
 
97
     {
97
     {
98
         if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
98
         if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
99
             if ($this->db->contarRegistros()>0) {
99
             if ($this->db->contarRegistros()>0) {
100
-                while ($registro = mysql_fetch_array($this->db->mid_consulta)) {
100
+                while ($registro = $this->db->mid_consulta->fetch()) {
101
                     return $registro[0];
101
                     return $registro[0];
102
                 }
102
                 }
103
             }
103
             }

+ 6 - 5
classes/mysql_connection.class.php View File

15
  */
15
  */
16
 
16
 
17
 // constantes
17
 // constantes
18
-define('MYSQL_TYPES_NUMERIC', 'int real ');
18
+define('MYSQL_TYPES_NUMERIC', 'int real tiny long ');
19
 define('MYSQL_TYPES_DATE', 'datetime timestamp year date time ');
19
 define('MYSQL_TYPES_DATE', 'datetime timestamp year date time ');
20
-define('MYSQL_TYPES_STRING', 'string blob ');
20
+define('MYSQL_TYPES_STRING', 'string blob var_string ');
21
 
21
 
22
 class Conexion_Mysql
22
 class Conexion_Mysql
23
 {
23
 {
119
             $sqlValues .= "'$valor',";
119
             $sqlValues .= "'$valor',";
120
          } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
120
          } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
121
              $valor = $this->sql_escape($valor);
121
              $valor = $this->sql_escape($valor);
122
-             $sqlValues .= "'$valor',";
122
+             $sqlValues .= "$valor,";
123
          }
123
          }
124
         }
124
         }
125
         $cols = rtrim($cols, ',').')';
125
         $cols = rtrim($cols, ',').')';
127
 
127
 
128
           // inserta los valores en la DB
128
           // inserta los valores en la DB
129
           $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
129
           $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
130
+
130
         return $this->ejecutarConsulta($sql);
131
         return $this->ejecutarConsulta($sql);
131
     }
132
     }
132
 
133
 
168
             $sql .= "'$valor',";
169
             $sql .= "'$valor',";
169
             } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
170
             } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
170
                 $valor = $this->sql_escape($valor);
171
                 $valor = $this->sql_escape($valor);
171
-                $sql .= "'$valor',";
172
+                $sql .= "$valor,";
172
             }
173
             }
173
         }
174
         }
174
         $sql = rtrim($sql, ','); // elimina la ultima coma
175
         $sql = rtrim($sql, ','); // elimina la ultima coma
201
             return false;
202
             return false;
202
         }
203
         }
203
         $r->closeCursor();
204
         $r->closeCursor();
204
-        return $ret;
205
+        return strtolower($ret['native_type']);
205
     }
206
     }
206
 
207
 
207
     /**
208
     /**

+ 4 - 0
config.php View File

14
   =========================== */
14
   =========================== */
15
 
15
 
16
 define('Table_prefix', 'gel_');
16
 define('Table_prefix', 'gel_');
17
+define('DB_Server', 'localhost');
18
+define('DB_name', 'gelatocms');
19
+define('DB_User', 'gelatocms');
20
+define('DB_Password', 'testpassword');

+ 5 - 5
index.php View File

56
 
56
 
57
         $feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
57
         $feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
58
 
58
 
59
-        
59
+
60
 
60
 
61
         $gelato_includes = "<meta name=\"generator\" content=\"gelato ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
61
         $gelato_includes = "<meta name=\"generator\" content=\"gelato ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
62
         $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
62
         $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
110
 
110
 
111
             if ($db->contarRegistros()>0) {
111
             if ($db->contarRegistros()>0) {
112
                 $dateTmp = null;
112
                 $dateTmp = null;
113
-                while ($register = mysql_fetch_assoc($rs)) {
113
+                while ($register = $rs->fetch()) {
114
                     $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
114
                     $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
115
                     if ($dateTmp != null && $formatedDate == $dateTmp) {
115
                     if ($dateTmp != null && $formatedDate == $dateTmp) {
116
                         $formatedDate = "";
116
                         $formatedDate = "";
189
 
189
 
190
                     $rows[] = $row;
190
                     $rows[] = $row;
191
                 }
191
                 }
192
-                        
192
+
193
                 $trigger->call('post_content');
193
                 $trigger->call('post_content');
194
                 $theme->set('rows', $rows);
194
                 $theme->set('rows', $rows);
195
 
195
 
296
             if ($conf->allowComments) {
296
             if ($conf->allowComments) {
297
                 $rsComments = $comment->getComments($register["id_post"]);
297
                 $rsComments = $comment->getComments($register["id_post"]);
298
                 $comments = array();
298
                 $comments = array();
299
-                while ($rowComment = mysql_fetch_assoc($rsComments)) {
299
+                while ($rowComment = $rsComments->fetch()) {
300
                     $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
300
                     $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
301
 
301
 
302
                     $answers['Id_Comment'] = $rowComment["id_comment"];
302
                     $answers['Id_Comment'] = $rowComment["id_comment"];
319
             }
319
             }
320
 
320
 
321
             $rows[] = $row;
321
             $rows[] = $row;
322
-                
322
+
323
             $trigger->call('post_content');
323
             $trigger->call('post_content');
324
             $theme->set('rows', $rows);
324
             $theme->set('rows', $rows);
325
         }
325
         }

+ 11 - 11
rss.php View File

16
 <?php
16
 <?php
17
     require('entry.php');
17
     require('entry.php');
18
     $trigger->call('feed_header');
18
     $trigger->call('feed_header');
19
-    
19
+
20
     header("Content-type: text/xml; charset=utf-8");
20
     header("Content-type: text/xml; charset=utf-8");
21
     $isFeed = true;
21
     $isFeed = true;
22
-    
22
+
23
     global $conf, $tumble;
23
     global $conf, $tumble;
24
-    
24
+
25
     $util_class = new util();
25
     $util_class = new util();
26
-    
26
+
27
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
27
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
28
-?>	
28
+?>
29
 	<rss version="2.0">
29
 	<rss version="2.0">
30
 	<channel>
30
 	<channel>
31
 		<title><?php echo htmlspecialchars($conf->title);?></title>
31
 		<title><?php echo htmlspecialchars($conf->title);?></title>
32
 		<link><?php echo $conf->urlGelato;?></link>
32
 		<link><?php echo $conf->urlGelato;?></link>
33
 		<description><?php echo htmlspecialchars($conf->description);?></description>
33
 		<description><?php echo htmlspecialchars($conf->description);?></description>
34
-		<generator>gelato CMS <?php echo $util_class->codeName()." (".$util_class->version().")"; ?></generator>        
34
+		<generator>gelato CMS <?php echo $util_class->codeName()." (".$util_class->version().")"; ?></generator>
35
 		<image>
35
 		<image>
36
 			<url><?php echo $conf->urlGelato;?>/images/information.png</url>
36
 			<url><?php echo $conf->urlGelato;?>/images/information.png</url>
37
 			<title><?php echo htmlspecialchars($conf->description);?></title>
37
 			<title><?php echo htmlspecialchars($conf->description);?></title>
40
 <?php
40
 <?php
41
     $rs = $tumble->getPosts("20");
41
     $rs = $tumble->getPosts("20");
42
     if ($db->contarRegistros()>0) {
42
     if ($db->contarRegistros()>0) {
43
-        while ($register = mysql_fetch_array($rs)) {
43
+        while ($register = $rs->fetch()) {
44
             $register["description"] = $register["description"];
44
             $register["description"] = $register["description"];
45
-            
45
+
46
             switch ($register["type"]) {
46
             switch ($register["type"]) {
47
                 case "1":
47
                 case "1":
48
                     $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
48
                     $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
86
 				<title><?php echo $tit; ?></title>
86
 				<title><?php echo $tit; ?></title>
87
 				<description><![CDATA[<?php echo $desc; ?>]]></description>
87
 				<description><![CDATA[<?php echo $desc; ?>]]></description>
88
 				<link><?php echo $url; ?></link>
88
 				<link><?php echo $url; ?></link>
89
-				<guid isPermaLink="true"><?php echo $url; ?></guid>				
90
-				<pubDate><?php echo $formatedDate; ?></pubDate>				
89
+				<guid isPermaLink="true"><?php echo $url; ?></guid>
90
+				<pubDate><?php echo $formatedDate; ?></pubDate>
91
 			</item>
91
 			</item>
92
 
92
 
93
-<?php	
93
+<?php
94
         }
94
         }
95
     }
95
     }
96
 ?>
96
 ?>

+ 10 - 10
sitemap.php View File

16
 <?php
16
 <?php
17
     require('entry.php');
17
     require('entry.php');
18
     global $conf, $tumble, $db;
18
     global $conf, $tumble, $db;
19
-    
19
+
20
     // Code modified from the one at http://paste.ubuntu-nl.org/44548/
20
     // Code modified from the one at http://paste.ubuntu-nl.org/44548/
21
     header("Content-type: text/xml; charset=utf-8");
21
     header("Content-type: text/xml; charset=utf-8");
22
     $isFeed = true;
22
     $isFeed = true;
23
-    
23
+
24
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
24
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
25
     echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n";
25
     echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n";
26
-    
26
+
27
     $rs = $tumble->getPosts(1);
27
     $rs = $tumble->getPosts(1);
28
 ?>
28
 ?>
29
 <!-- generator="gelato CMS" -->
29
 <!-- generator="gelato CMS" -->
30
-<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">	
30
+<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
31
 	<url>
31
 	<url>
32
-		<loc><?php echo $conf->urlGelato;?></loc>        		
32
+		<loc><?php echo $conf->urlGelato;?></loc>
33
 <?php
33
 <?php
34
         if ($db->contarRegistros()>0) {
34
         if ($db->contarRegistros()>0) {
35
-            $register = mysql_fetch_array($rs);
35
+            $register = $rs->fetch();
36
             $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
36
             $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
37
             echo "\n\t<lastmod>".$formatedDate."</lastmod>";
37
             echo "\n\t<lastmod>".$formatedDate."</lastmod>";
38
         }
38
         }
42
 	</url>
42
 	</url>
43
 
43
 
44
 
44
 
45
-<?php	
45
+<?php
46
     $rs = $tumble->getPosts($tumble->getPostsNumber());
46
     $rs = $tumble->getPosts($tumble->getPostsNumber());
47
     if ($db->contarRegistros()>0) {
47
     if ($db->contarRegistros()>0) {
48
-        while ($register = mysql_fetch_array($rs)) {
48
+        while ($register = $rs->fetch()) {
49
             $url = $tumble->getPermalink($register["id_post"]);
49
             $url = $tumble->getPermalink($register["id_post"]);
50
             $formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?>
50
             $formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?>
51
 	<url>
51
 	<url>
52
-		<loc><?php echo $url; ?></loc>        
52
+		<loc><?php echo $url; ?></loc>
53
 		<lastmod><?php echo $formatedDate; ?></lastmod>
53
 		<lastmod><?php echo $formatedDate; ?></lastmod>
54
         <changefreq>daily</changefreq>
54
         <changefreq>daily</changefreq>
55
         <priority>0.7</priority>
55
         <priority>0.7</priority>
59
         }
59
         }
60
     }
60
     }
61
 ?>
61
 ?>
62
-</urlset>
62
+</urlset>