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

+ 27 - 27
admin/comments.php View File

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

+ 2 - 2
admin/index.php View File

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

+ 6 - 6
api.php View File

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

+ 38 - 38
archive.php View File

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

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

@@ -99,7 +99,7 @@ class comments
99 99
     public function getComment($id="")
100 100
     {
101 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 105
     public function countComments($idPost=null)

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

@@ -169,7 +169,7 @@ class feeds extends Conexion_Mysql
169 169
         $timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
170 170
         $delta = time() - strtotime($timeToUpdate);
171 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 173
         return $time[0];
174 174
     }
175 175
 }

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

@@ -83,13 +83,13 @@ class gelato
83 83
     public function getPost($id="")
84 84
     {
85 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 89
     public function getPostsNumber()
90 90
     {
91 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 93
         return $row['total'];
94 94
     }
95 95
 
@@ -97,7 +97,7 @@ class gelato
97 97
     {
98 98
         if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
99 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 101
                     return $registro[0];
102 102
                 }
103 103
             }

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

@@ -15,9 +15,9 @@
15 15
  */
16 16
 
17 17
 // constantes
18
-define('MYSQL_TYPES_NUMERIC', 'int real ');
18
+define('MYSQL_TYPES_NUMERIC', 'int real tiny long ');
19 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 22
 class Conexion_Mysql
23 23
 {
@@ -119,7 +119,7 @@ class Conexion_Mysql
119 119
             $sqlValues .= "'$valor',";
120 120
          } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
121 121
              $valor = $this->sql_escape($valor);
122
-             $sqlValues .= "'$valor',";
122
+             $sqlValues .= "$valor,";
123 123
          }
124 124
         }
125 125
         $cols = rtrim($cols, ',').')';
@@ -127,6 +127,7 @@ class Conexion_Mysql
127 127
 
128 128
           // inserta los valores en la DB
129 129
           $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
130
+
130 131
         return $this->ejecutarConsulta($sql);
131 132
     }
132 133
 
@@ -168,7 +169,7 @@ class Conexion_Mysql
168 169
             $sql .= "'$valor',";
169 170
             } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
170 171
                 $valor = $this->sql_escape($valor);
171
-                $sql .= "'$valor',";
172
+                $sql .= "$valor,";
172 173
             }
173 174
         }
174 175
         $sql = rtrim($sql, ','); // elimina la ultima coma
@@ -201,7 +202,7 @@ class Conexion_Mysql
201 202
             return false;
202 203
         }
203 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,3 +14,7 @@ if (!defined('entry') || !entry) {
14 14
   =========================== */
15 15
 
16 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,7 +56,7 @@ $util_class = new util();
56 56
 
57 57
         $feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
58 58
 
59
-        
59
+
60 60
 
61 61
         $gelato_includes = "<meta name=\"generator\" content=\"gelato ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
62 62
         $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
@@ -110,7 +110,7 @@ $util_class = new util();
110 110
 
111 111
             if ($db->contarRegistros()>0) {
112 112
                 $dateTmp = null;
113
-                while ($register = mysql_fetch_assoc($rs)) {
113
+                while ($register = $rs->fetch()) {
114 114
                     $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
115 115
                     if ($dateTmp != null && $formatedDate == $dateTmp) {
116 116
                         $formatedDate = "";
@@ -189,7 +189,7 @@ $util_class = new util();
189 189
 
190 190
                     $rows[] = $row;
191 191
                 }
192
-                        
192
+
193 193
                 $trigger->call('post_content');
194 194
                 $theme->set('rows', $rows);
195 195
 
@@ -296,7 +296,7 @@ $util_class = new util();
296 296
             if ($conf->allowComments) {
297 297
                 $rsComments = $comment->getComments($register["id_post"]);
298 298
                 $comments = array();
299
-                while ($rowComment = mysql_fetch_assoc($rsComments)) {
299
+                while ($rowComment = $rsComments->fetch()) {
300 300
                     $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
301 301
 
302 302
                     $answers['Id_Comment'] = $rowComment["id_comment"];
@@ -319,7 +319,7 @@ $util_class = new util();
319 319
             }
320 320
 
321 321
             $rows[] = $row;
322
-                
322
+
323 323
             $trigger->call('post_content');
324 324
             $theme->set('rows', $rows);
325 325
         }

+ 11 - 11
rss.php View File

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

+ 10 - 10
sitemap.php View File

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