Browse Source

New feature: Feed importer, there's some changes in the Db, so you must update, don't forget to chmod(777) the uploads/CACHE dir

ravenlp 17 years ago
parent
commit
f0524983d9
12 changed files with 6115 additions and 290 deletions
  1. 11 0
      admin/css/style.css
  2. 138 0
      admin/feeds.php
  3. 1 0
      admin/index.php
  4. 24 2
      admin/options.php
  5. 4 2
      classes/configuration.class.php
  6. 141 0
      classes/feeds.class.php
  7. 293 279
      classes/install.class.php
  8. 5449 0
      classes/simplepie.class.php
  9. 16 1
      db/gelato_db.sql
  10. 6 1
      entry.php
  11. 3 3
      readme.txt
  12. 29 2
      update.php

+ 11 - 0
admin/css/style.css View File

@@ -69,6 +69,7 @@ form.newpost label{}
69 69
 form.newpost input{ margin-bottom:10px;}
70 70
 form.newpost input.txt{ background: #fff url(images/grad-small.png) top left repeat-x; height:15px; border:1px solid #999; width:490px; padding:5px;}
71 71
 form.newpost input.btn{ }
72
+form.newpost input.check{ vertical-align:middle;}
72 73
 form.newpost textarea{background: #fff url(images/grad-big.png) top left repeat-x; height:190px; border:1px solid #999; width:490px; padding:5px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.8em;}
73 74
 form.newpost select{ position:absolute; right:10px; top:1px;}
74 75
 html > body form.newpost select{min-width:100px;}
@@ -107,6 +108,16 @@ legend.install{font: normal 16.5px/17px georgia, "times new roman", serif; borde
107 108
 a.linkFrm, a.linkFrm:link, a.linkFrm:visited, a.linkFrm:active{ color:#297aab; text-decoration:none; outline:none;}
108 109
 a.linkFrm:hover{ text-decoration:underline; color:#297aab;  outline:none;}
109 110
 
111
+/* Feeds */
112
+
113
+#feedlist{}
114
+#feedlist ul{ list-style-type:none;}
115
+#feedlist li{ border-bottom:1px solid #999; font-size:12px; padding:2px 4px 2px 4px; margin:0 2px 0 2px;}
116
+#feedlist li span{ font-weight:bold;}
117
+#feedlist li.feederror{ background-color:#FFCCCC;}
118
+#feedlist li.feederror span{ color:#CC0000;}
119
+#feedlist li a img{border:none; padding:0 2px 2px 2px; vertical-align:middle;}
120
+
110 121
 /* User messages */
111 122
 
112 123
 .error { width:80%; background: #FFF7F2 url('../../images/error.png') 15px center no-repeat; border-top: 2px solid #CC0000; border-bottom: 2px solid #CC0000; margin: 0 auto; padding: 5px 20px 5px 45px; }

+ 138 - 0
admin/feeds.php View File

@@ -0,0 +1,138 @@
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, $conf, $tumble;
17
+$template = new plantillas("admin");
18
+
19
+
20
+$user= new User();
21
+if ($user->isAdmin()) {
22
+	$message = '';
23
+	$f = new feeds();
24
+	if(isset($_POST['add'], $_POST['url'])){
25
+		 $credits =(isset($_POST['credits']))? 1 : 0;
26
+		if($f->addFeed($_POST['url'],$_POST['type'],$_POST['source'], $credits)){
27
+			$message = __('Feed added');
28
+			$messageStatus = 'exito';
29
+		}
30
+	}
31
+	
32
+	if(isset($_GET['delete']) && is_numeric($_GET['delete'])){
33
+		if($f->removeFeed((int)$_GET['delete'])){
34
+			$message = __('Feed deleted');
35
+			$messageStatus = 'error';
36
+		}
37
+	}
38
+	
39
+?>
40
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41
+	<html xmlns="http://www.w3.org/1999/xhtml">
42
+	<head>
43
+		<title>gelato :: <?php echo __("Feeds")?></title>
44
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
45
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
46
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
47
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
48
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
49
+		<style type="text/css" media="screen">	
50
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
51
+		</style>
52
+	</head>
53
+	
54
+	<body>
55
+		<div id="cont">
56
+			<div id="head">
57
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
58
+				<ul id="nav">
59
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
60
+			  	</ul>
61
+			</div>
62
+			<div id="main">				
63
+				
64
+				<div class="box">
65
+					<h3><?php echo __("Configure your feeds")?></h3>
66
+					<ul class="menu manage">
67
+					<li><a href="index.php"><?php echo __("Post")?></a></li>
68
+                    <li><a href="options.php"><?php echo __("Options")?></a></li>
69
+					</ul>
70
+					
71
+					<?php echo (!(empty($message))? '<div class="'.$messageStatus.'" id="divMessages"> '.$message.'</div>' : ''); ?>
72
+
73
+					<div class="tabla">
74
+
75
+						<form action="feeds.php" method="post" class="newpost">
76
+						<fieldset>
77
+						<ul>
78
+							<li>
79
+								<label for="source"><?php echo __("Import data from:")?></label>
80
+								<select name="source" id="source" onchange="selectFeedType('<?php echo __("Feed Url:")?>','<?php echo __(" username:")?>' )">
81
+                                	<option value="Rss" selected="selected">Rss/atom Feed</option>
82
+                                 	<option value="Flickr">Flickr</option>
83
+                                    <option value="Twitter">Twitter</option>
84
+                                    <option value="Youtube">Youtube</option>
85
+                                    <option value="Last.fm">Last.fm</option>
86
+                                    <option value="Tumblr">Tumblr</option>
87
+                                    <option value="Wordpress.com">Wordpress.com</option>
88
+                                    <option value="Blogger">Blogger</option>
89
+                                    <option value="VOX">VOX</option>
90
+                                </select>
91
+							</li>
92
+							<li id="import_as"><label for="type"><?php echo __("Import As:")?></label>
93
+                                    <select name="type" id="type">
94
+                                    	<option value="1" selected="selected"><?php echo __("Text")?></option>
95
+                                    	<option value="2"><?php echo __("Photos")?></option>
96
+                                    </select>
97
+							</li>
98
+							<li>
99
+								<label for="url" id="url_label"><?php echo __("Feed Url (double check):")?></label>
100
+									<input type="text" name="url" id="url" class="txt" />
101
+							</li>
102
+                            <li><label for="credits"><?php echo __('Show credits on each post?')?></label><input type="checkbox" name="credits" checked="checked" class="check" /></li>
103
+							<li>
104
+								<input name="add" type="submit" value="<?php echo __("Add"); ?>" />
105
+							</li>
106
+						</ul>
107
+						</fieldset>
108
+						</form>
109
+						<div id="feedlist">						  
110
+						  <ul>
111
+						    <?php
112
+							$actual_feeds = $f->getFeedList();
113
+							foreach($actual_feeds as $feed){
114
+								if($feed['error']>0){
115
+									echo '<li class="feederror"><a href="feeds.php?delete='.$feed['id_feed'].'" title="'.__('Delete this Feed').'" class="action"><img title="" alt="" src="css/images/delete.png"/></a><span class="status">'.__('Error updating').'</span> '.((!empty($feed['title']))? $feed['title'] : $feed['url']).'</li>';
116
+								}else{
117
+									echo '<li><a href="feeds.php?delete='.$feed['id_feed'].'" title="'.__('Delete this Feed').'" class="action"><img title="" alt="" src="css/images/delete.png"/></a><span class="status" title="'.__('Last update').': '.$feed['updated_at'].'">'.__('Importing').'</span> '.((!empty($feed['title']))? $feed['title'] : $feed['url']).'</li>';
118
+								}
119
+							}
120
+						?>
121
+					      </ul>
122
+					    </div>
123
+				  </div>
124
+
125
+					<div class="footer-box">&nbsp;</div>
126
+				</div>
127
+			</div>
128
+			<div id="foot">
129
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
130
+			</div>
131
+		</div>
132
+	</body>
133
+	</html>
134
+<?php
135
+} else {
136
+	header("Location: ".$conf->urlGelato."/login.php");
137
+}
138
+?>

+ 1 - 0
admin/index.php View File

@@ -317,6 +317,7 @@ if ($user->isAdmin()) {
317 317
 					<h3>Manage</h3>
318 318
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
319 319
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/options.php"><?php echo __("Options")?></a></li>
320
+                    <li><a href="<?php echo $conf->urlGelato;?>/admin/feeds.php"><?php echo __("Feeds")?></a></li>
320 321
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php"><?php echo __("Users")?></a></li>
321 322
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/comments.php"><?php echo __("Comments")?></a></li>
322 323
 					<li class="selected"><a><?php echo __("Posts")?></a></li>

+ 24 - 2
admin/options.php View File

@@ -53,6 +53,11 @@ if ($user->isAdmin()) {
53 53
 			die();
54 54
 		}
55 55
 		
56
+		if (!$tumble->saveOption($_POST["rss_import_frec"], "rss_import_frec")) {
57
+			header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
58
+			die();
59
+		}
60
+
56 61
 		header("Location: ".$conf->urlGelato."/admin/options.php?modified=true");
57 62
 		die();
58 63
 	} else {
@@ -203,8 +208,25 @@ if ($user->isAdmin()) {
203 208
 									</li>
204 209
 									<li class="select"><label for="shorten_links"><?php echo __("Shorten long URLs:")?></label>
205 210
 										<select name="shorten_links" id="shorten_links">
206
-											<option value="1" <?php if($conf->shorten_links) echo "selected"; ?>><?php echo __("Active")?></option>
207
-											<option value="0" <?php if(!$conf->shorten_links) echo "selected"; ?>><?php echo __("Deactive")?></option>
211
+											<option value="1" <?php if($conf->shorten_links) echo "selected=\"selected\""; ?>><?php echo __("Active")?></option>
212
+											<option value="0" <?php if(!$conf->shorten_links) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
213
+										</select>
214
+									</li>
215
+                                    <li class="select"><label for="rss_import_frec"><?php echo __("Import feeds every:")?></label>
216
+                                    	<select name="rss_import_frec" id="rss_import_frec">
217
+                                        
218
+                                        	<option value="5 minutes" <?php if($conf->rssImportFrec == '5 minutes') echo "selected=\"selected\""; ?>>5 <?php echo __("minutes");?></option>
219
+                                        	<option value="10 minutes" <?php if($conf->rssImportFrec == '10 minutes') echo "selected=\"selected\""; ?>>10 <?php echo __("minutes");?></option>
220
+                                            <option value="15 minutes" <?php if($conf->rssImportFrec == '15 minutes') echo "selected=\"selected\""; ?>>15 <?php echo __("minutes");?></option>
221
+                                            <option value="30 minutes" <?php if($conf->rssImportFrec == '30 minutes') echo "selected=\"selected\""; ?>>30 <?php echo __("minutes");?></option>
222
+                                            <option value="45 minutes" <?php if($conf->rssImportFrec == '45 minutes') echo "selected=\"selected\""; ?>>45 <?php echo __("minutes");?></option>
223
+                                            <option value="1 hour" <?php if($conf->rssImportFrec == '1 hour') echo "selected=\"selected\""; ?>>1 <?php echo __("hour");?></option>
224
+                                            <option value="2 hours" <?php if($conf->rssImportFrec == '2 hours') echo "selected=\"selected\""; ?>>2 <?php echo __("hours");?></option>
225
+                                            <option value="3 hours" <?php if($conf->rssImportFrec == '3 hours') echo "selected=\"selected\""; ?>>3 <?php echo __("hours");?></option>
226
+                                            <option value="4 hours" <?php if($conf->rssImportFrec == '4 hours') echo "selected=\"selected\""; ?>>4 <?php echo __("hours");?></option>
227
+                                            <option value="6 hours" <?php if($conf->rssImportFrec == '6 hours') echo "selected=\"selected\""; ?>>6 <?php echo __("hours");?></option>
228
+                                            <option value="12 hours" <?php if($conf->rssImportFrec == '12 hours') echo "selected=\"selected\""; ?>>12 <?php echo __("hours");?></option>
229
+                                            <option value="1 day" <?php if($conf->rssImportFrec == '1 day') echo "selected=\"selected\""; ?>>24 <?php echo __("hours");?></option>
208 230
 										</select>
209 231
 									</li>
210 232
 								</ul>

+ 4 - 2
classes/configuration.class.php View File

@@ -29,8 +29,8 @@ class configuration extends Conexion_Mysql {
29 29
 	var $offset_city;
30 30
 	var $offset_time;
31 31
 	var $shorten_links;
32
-	
33
-	
32
+	var $rssImportFrec;
33
+		
34 34
 	function configuration() {
35 35
 		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
36 36
 		
@@ -54,6 +54,8 @@ class configuration extends Conexion_Mysql {
54 54
 			$this->offsetTime = $this->get_option("offset_time");
55 55
 			$this->allowComments = $this->get_option("allow_comments");
56 56
 			$this->shorten_links = $this->get_option("shorten_links");
57
+			$this->rssImportFrec = $this->get_option("rss_import_frec");
58
+			
57 59
 		} else {
58 60
 			if($isFeed) {
59 61
 				header("HTTP/1.0 503 Service Unavailable"); 

+ 141 - 0
classes/feeds.class.php View File

@@ -0,0 +1,141 @@
1
+<?php
2
+if(!defined('entry') || !entry) die('Not a valid page'); 
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_once("configuration.class.php");
16
+require_once("simplepie.class.php");
17
+
18
+class feeds extends Conexion_Mysql {
19
+	var $conf;
20
+	
21
+	
22
+	function feeds() {
23
+		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
24
+		$this->conf = new configuration();
25
+	}
26
+	
27
+	function addFeed($url, $type, $source, $credits){
28
+		$f = array();
29
+		$f['updated_at'] = '0000-00-00 00:00:00';
30
+		$f['error']	= 0;
31
+		$f['title'] = '';
32
+		$f['url'] = '';
33
+		$f['credits'] = $credits;
34
+		$f['site_url'] = '';
35
+		$f['id_user'] = $_SESSION['user_id'];
36
+		switch($source){
37
+			case 'Rss': $f['url'] = $url;  $f['type'] = $type; break;
38
+			case 'VOX': 	$f['url'] = 'http://{{username}}.vox.com/library/posts/atom.xml'; $f['type'] = 1; break;
39
+			case 'Digg': 	$f['url'] = 'http://digg.com/rss/{{username}}/index2.xml'; $f['type'] = 1; break;
40
+			case 'Tumblr': 	$f['url'] = 'http://{{username}}.tumblr.com/rss'; $f['type'] = 1; break;
41
+/*>>*/		case 'Flickr': 	$f['url'] = 'http:/flickr.com/photos/{{username}}'; $f['type'] = 2; break; 
42
+/*>>*/		case 'Twitter': $f['url'] = 'http://twitter.com/{{username}}'; $f['type'] = 1; break;
43
+			case 'Last.fm': $f['url'] = 'http://ws.audioscrobbler.com/1.0/user/{{username}}/recenttracks.rss'; $f['type'] = 1; break;
44
+			case 'Blogger': $f['url'] = 'http://{{username}}.blogspot.com/feeds/posts/default'; $f['type'] = 1; break;
45
+			case 'Youtube': $f['url'] = 'http://www.youtube.com/rss/user/{{username}}/videos.rss'; $f['type'] = 1; break;
46
+			case 'Wordpress.com': $f['url'] = 'http://{{username}}.wordpress.com/feed/'; $f['type'] = 1; break;
47
+			default : $f['url'] = ''; break;
48
+		}
49
+		if(!empty($f['url'])){
50
+			$f['url'] = str_replace('{{username}}',$url,$f['url']);
51
+			return ($this->insertarDeFormulario($this->conf->tablePrefix."feeds", $f));
52
+		}
53
+		print_r($_POST);
54
+		print_r($f);
55
+	}
56
+	
57
+	function removeFeed($id){
58
+		return ($this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."feeds WHERE id_feed=".$id));
59
+	}
60
+	
61
+	function updateFeeds(){
62
+			$timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
63
+			$feeds = $this->getFeedList("WHERE updated_at <  '".date("Y-m-d H:i:s",strtotime($timeToUpdate))."'");
64
+			foreach($feeds as $feed){
65
+				$data = new SimplePie();
66
+				$data->feed_url($feed['url']);
67
+				$data->cache_location(Absolute_Path."/uploads/CACHE");
68
+				$data->init();
69
+				$temp = array();
70
+				$temp['updated_at'] = date("Y-m-d H:i:s");
71
+				if (!empty($data->error)){
72
+					// Error report
73
+					$temp['error'] = 1;
74
+					$this->modificarDeFormulario($this->conf->tablePrefix."feeds", $temp, 'id_feed = '.$feed['id_feed']);
75
+				}else{
76
+
77
+					if($data->data){ 
78
+						$timeFilter = strtotime($timeToUpdate);
79
+						foreach($data->get_items() as $post){
80
+							if (strtotime($post->get_date("Y-m-d H:i:s")) > strtotime($feed['updated_at'])) {
81
+								$newPost = array();
82
+								$newPost['id_user'] = $feed['id_user'];
83
+								$newPost['title'] = $post->get_title();
84
+								$newPost['date'] = $post->get_date("Y-m-d H:i:s");
85
+								if($feed['type'] == 1){ //TEXT
86
+									$newPost['type'] = 1;
87
+									if($post->get_title()  != $post->get_description()){
88
+										if(strpos($feed['url'],'twitter.com') <= 0){
89
+											$newPost['description'] = $post->get_description();
90
+										}
91
+									}
92
+								}elseif($feed['type'] == 2){ //IMAGES
93
+									$ma = array();
94
+									$url_image = '';
95
+									@preg_match_all('/\<img ([^\>]+)/',$post->get_description(), $ma);
96
+									@preg_match_all('/src\=\"([^\"]+)\"/',$ma[0][0], $ma);
97
+									$url_image = $ma[1][0];
98
+									
99
+									if(empty($url_image)){
100
+										/* Theres no image, lets make a text post */
101
+										$newPost['type'] = 1;
102
+										if($post->get_title()  != $post->get_description()){
103
+											if(strpos($feed['url'],'twitter.com') <= 0){
104
+												$newPost['description'] = $post->get_description();
105
+											}
106
+										}
107
+									}else{
108
+										$newPost['type'] = 2;
109
+										$newPost['url'] = $url_image;
110
+										$newPost['description'] = $post->get_title();
111
+									}
112
+								}
113
+								if($feed['credits'] == 1 && !empty($feed['title'])){
114
+									$newPost['description'] .= '<p class="rss-credits">(via <a href="'.((empty($feed['site_url']))? $feed['url'] : $feed['site_url']).'" title="'.$feed['title'].'">'.$feed['title'].'</a>)</p>';
115
+								}
116
+								$this->insertarDeFormulario($this->conf->tablePrefix."data", $newPost);
117
+							}	
118
+						}
119
+					$temp['title'] = (!empty($data->data['info']['title']))? $data->data['info']['title'] : '';
120
+					$temp['site_url'] = (!empty($data->data['info']['link']['alternate'][0]))? $data->data['info']['link']['alternate'][0] :  $data->data['info']['link'];
121
+					$temp['error'] = 0;
122
+					$this->modificarDeFormulario($this->conf->tablePrefix."feeds", $temp, 'id_feed = '.$feed['id_feed']);
123
+	
124
+					}
125
+				}
126
+			}
127
+
128
+	}
129
+	
130
+	
131
+	function getFeedList($condition = ''){
132
+		$feeds = array();
133
+		$this->ejecutarConsulta('SELECT * FROM '.$this->conf->tablePrefix.'feeds '.$condition.' ORDER BY id_feed DESC');
134
+		while($feed = mysql_fetch_assoc($this->mid_consulta)){
135
+			$feeds[] = $feed;
136
+		}
137
+		return $feeds;
138
+	}
139
+	
140
+}
141
+?>

+ 293 - 279
classes/install.class.php View File

@@ -1,280 +1,294 @@
1
-<?php
2
-if(!defined('entry') || !entry) die('Not a valid page'); 
3
-require('classes/mysql_connection.class.php');
4
-
5
-class Install {
6
-	var $data = null;
7
-	var $errors = null;
8
-	var $showForm;
9
-	var $errors_d = array();
10
-	
11
-	function Install(){
12
-		$this->errors_d[1]="The login field cannot be empty";
13
-		$this->errors_d[2]="The password field cannot be empty";
14
-		$this->errors_d[3]="Password does not match the confirm password";
15
-		$this->errors_d[4]="The e-mail field cannot be empty";
16
-		$this->errors_d[5]="The installation URL field cannot be empty";
17
-		$this->errors_d[6]="Error establishing a database connection";
18
-		$this->errors_d[7]="Please add a hostname for the database server";
19
-		$this->errors_d[8]="Please name the database";
20
-	}
21
-	
22
-    function run() {
23
-    	
24
-    	if (empty($this->data)) false;
25
-    	
26
-    	if (!$this->create_config()) return false;
27
-    	
28
-    	$this->create_db();
29
-    	
30
-    	if (!$this->install_db()) return false;
31
-		
32
-		return true;
33
-    }
34
-    
35
-    function create_db(){
36
-		
37
-	    $link =  mysql_connect($this->data['db_host'], $this->data['db_login'], $this->data['db_password']);
38
-		if (!$link) {
39
-		    die('Could not connect: ' . mysql_error());
40
-		}
41
-		
42
-		$sql = 'CREATE DATABASE ' . $this->data['db_name'];
43
-		if (!mysql_query($sql, $link)) {
44
-			$link = mysql_close($link);
45
-			return false;
46
-		} 
47
-		
48
-		return true;    	
49
-    }
50
-    
51
-	function install_db(){
52
-		require('config.php');
53
-		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);	
54
-		$sqlStr = array();
55
-		
56
-		$sqlStr[] = "CREATE TABLE `".Table_prefix."data` (
57
-			  `id_post` int(11) NOT NULL auto_increment,
58
-			  `title` text NULL,
59
-			  `url` varchar(250)  default NULL,
60
-			  `description` text NULL,
61
-			  `type` tinyint(4) NOT NULL default '1',
62
-			  `date` datetime NOT NULL,
63
-			  `id_user` int(10) NOT NULL,
64
-			  PRIMARY KEY  (`id_post`)
65
-			) ENGINE = MYISAM ;";
66
-
67
-		$sqlStr[] = "CREATE TABLE `".Table_prefix."users` (
68
-			  `id_user` int(10) unsigned NOT NULL auto_increment,
69
-			  `name` varchar(100) default NULL,
70
-			  `login` varchar(100) NOT NULL default '',
71
-			  `password` varchar(64) NOT NULL default '',
72
-			  `email` varchar(100) default NULL,
73
-			  `website` varchar(150) default NULL,
74
-			  `about` text,
75
-			  PRIMARY KEY  (`id_user`)
76
-			) ENGINE = MYISAM;";
77
-
78
-		$sqlStr[] = "CREATE TABLE `".Table_prefix."config` (
79
-			  `posts_limit` int(3) NOT NULL,
80
-			  `title` varchar(250) NOT NULL,
81
-			  `description` text NOT NULL,
82
-			  `lang` varchar(10) NOT NULL,
83
-			  `template` varchar(100) NOT NULL,
84
-			  `url_installation` varchar(250) NOT NULL,
85
-			  PRIMARY KEY  (`title`)
86
-			) ENGINE = MYISAM ;";
87
-			
88
-
89
-		
90
-		$sqlStr[] = "CREATE TABLE `".Table_prefix."options` (
91
-		  `name` varchar(100) NOT NULL,
92
-		  `val` varchar(255) NOT NULL,
93
-		  PRIMARY KEY  (`name`)
94
-		) ENGINE = MYISAM ;";
95
-
96
-		
97
-		$sqlStr[] = "CREATE TABLE `".Table_prefix."comments` (
98
-		  `id_comment` int(11) NOT NULL auto_increment,
99
-		  `id_post` int(11) NOT NULL,
100
-		  `username` varchar(50) NOT NULL,
101
-		  `email` varchar(100) NOT NULL,
102
-		  `web` varchar(250) default NULL,
103
-		  `content` text NOT NULL,
104
-		  `ip_user` varchar(50) NOT NULL,
105
-		  `comment_date` datetime NOT NULL,
106
-		  `spam` tinyint(4) NOT NULL,
107
-		  PRIMARY KEY  (`id_comment`)
108
-		) ENGINE = MYISAM ;";
109
-					
110
-		$sqlStr[] = "INSERT INTO `".Table_prefix."config` VALUES (". $this->data['posts_limit'] .", '".$this->data['title']."', '".$this->data['description']."', '".$this->data['lang']."', '".$this->data['template']."', '".$this->data['url_installation']."');";		
111
-		$sqlStr[] = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$this->data['login']."', '".md5($this->data['password'])."', '".$this->data['email']."', '".$this->data['website']."', '".$this->data['about']."');";
112
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '1');";
113
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";		
114
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
115
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_city', '".$this->data['offset_city']."');";		
116
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_time', '".$this->data['offset_time']."');";
117
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
118
-		foreach($sqlStr as $key => $query){
119
-			if(!$db->ejecutarConsulta($query)){
120
-				return false;
121
-			}
122
-		}
123
-
124
-		return true;
125
-	}
126
-	
127
-	function inerrors($n) {
128
-		if ( strpos($this->errors,$n)===false) {
129
-			return false;
130
-		} else {
131
-			return true;
132
-		}
133
-	}
134
-	
135
-	function mostrarerror($n) {
136
-		if ($this->inerrors($n)) {
137
-			return '<span class="error">'.$this->errors_d[$n].'</span>';
138
-		} else {
139
-			return "";
140
-		}
141
-	}
142
-	
143
-	function is_gelato_installed(){
144
-		if (!$this->check_for_config()){ 
145
-			return false; 
146
-		} else {/*
147
-			if (!$this->is_db_installed()){
148
-				return false;
149
-			}
150
-			*/
151
-		}
152
-		
153
-		return true;
154
-	}
155
-	/*
156
-	function is_db_installed(){
157
-	
158
-			global $db;	
159
-			
160
-			if (function_exists($db->ejecutarConsulta)){
161
-				$sqlStr = "SELECT * FROM `".Table_prefix."config`";
162
-				if($db->ejecutarConsulta($sqlStr)) {
163
-					return ($db->contarRegistros() > 0);
164
-				}
165
-			} else {
166
-				false;
167
-			}
168
-	
169
-	}
170
-	*/
171
-	function check_for_config(){
172
-		if(!file_exists('config.php')) return false;
173
-		if(!defined('DB_Server')) return false;
174
-		if(!defined('DB_name')) return false;
175
-		if(!defined('DB_User')) return false;
176
-		if(!defined('DB_Password')) return false;
177
-		
178
-		return true;
179
-	}
180
-	
181
-	function create_config(){
182
-		$config = fopen("config.php", 'w+');
183
-		$contents = '<?php
184
-if(!defined(\'entry\') || !entry) die(\'Not a valid page\'); 
185
-/* ===========================
186
-
187
-  gelato CMS - A PHP based tumblelog CMS
188
-  development version
189
-  http://www.gelatocms.com/
190
-
191
-  gelato CMS is a free software licensed under the GPL 2.0
192
-  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
193
-
194
-  =========================== */
195
-
196
-define(\'DB_Server\', \''. $this->data['db_host'] . '\');
197
-define(\'DB_name\', \''. $this->data['db_name'] . '\');
198
-define(\'DB_User\', \''. $this->data['db_login'] . '\');
199
-define(\'DB_Password\', \''. $this->data['db_password'] . '\'); 
200
-define(\'Table_prefix\', \'gel_\');
201
-define(\'Absolute_Path\', dirname(__FILE__).DIRECTORY_SEPARATOR);
202
-
203
-?>';
204
-
205
-	    if (fwrite($config, $contents) === FALSE) {
206
-	        $this->errors = "Could not write config file to directory";
207
-	        return false;
208
-	    } 
209
-	    fclose($config);
210
-	    return true;		
211
-	}
212
-	
213
-	function check_form(){
214
-
215
-		$action="";
216
-		
217
-		if (isset($this->data['action'])){
218
-			$action=$this->data['action'];
219
-		}
220
-		
221
-		if (!$this->is_gelato_installed()){
222
-			
223
-		$this->showForm = true;
224
-			
225
-		
226
-			if ($action=="config") {
227
-				
228
-				$sep_err="";
229
-				$this->errors = false;
230
-				
231
-				if (!$this->data['login'] || !$this->data['db_login']) {
232
-					$this->errors =$this->errors.$sep_err."1";
233
-					$sep_err="|";
234
-				}
235
-				if (!$this->data['password'] ||  !$this->data['db_password']) {
236
-					$this->errors=$this->errors.$sep_err."2";
237
-					$sep_err="|";
238
-				}
239
-				if (!$this->data['email']) {
240
-					$this->errors=$this->errors.$sep_err."4";
241
-					$sep_err="|";
242
-				}
243
-				if (!$this->data['url_installation'] ) {
244
-					$this->errors=$this->errors.$sep_err."5";
245
-					$sep_err="|";
246
-				}
247
-				if (!$this->data['db_host'] ) {
248
-					$this->errors=$this->errors.$sep_err."7";
249
-					$sep_err="|";
250
-				}
251
-				if (!$this->data['db_name'] ) {
252
-					$this->errors=$this->errors.$sep_err."8";
253
-					$sep_err="|";
254
-				}
255
-				if ($this->data['password']!=$_POST['password2'] ||  $_POST['db_password']!=$_POST['db_password2'] ) {
256
-					$this->errors=$this->errors.$sep_err."3";
257
-					$sep_err="|";
258
-				}
259
-				$off_r= split("," , $this->data['time_offsets']);
260
-				$this->data['offset_time'] = $off_r[0];
261
-				$this->data['offset_city'] = $off_r[1];
262
-				unset($this->data['time_offsets']);
263
-				
264
-				if (!$this->errors) {
265
-							
266
-					if ($this->run($this->data)) {
267
-						$this->showForm=false;
268
-					} else {
269
-						$this->errors=$this->errors.$sep_err."6";
270
-						$sep_err="|";
271
-						$this->showForm=true;
272
-					}		
273
-				} else {
274
-					$this->showForm=true;
275
-				}
276
-			}
277
-		}	
278
-	}	
279
-}
1
+<?php
2
+if(!defined('entry') || !entry) die('Not a valid page'); 
3
+require('classes/mysql_connection.class.php');
4
+
5
+class Install {
6
+	var $data = null;
7
+	var $errors = null;
8
+	var $showForm;
9
+	var $errors_d = array();
10
+	
11
+	function Install(){
12
+		$this->errors_d[1]="The login field cannot be empty";
13
+		$this->errors_d[2]="The password field cannot be empty";
14
+		$this->errors_d[3]="Password does not match the confirm password";
15
+		$this->errors_d[4]="The e-mail field cannot be empty";
16
+		$this->errors_d[5]="The installation URL field cannot be empty";
17
+		$this->errors_d[6]="Error establishing a database connection";
18
+		$this->errors_d[7]="Please add a hostname for the database server";
19
+		$this->errors_d[8]="Please name the database";
20
+	}
21
+	
22
+    function run() {
23
+    	
24
+    	if (empty($this->data)) false;
25
+    	
26
+    	if (!$this->create_config()) return false;
27
+    	
28
+    	$this->create_db();
29
+    	
30
+    	if (!$this->install_db()) return false;
31
+		
32
+		return true;
33
+    }
34
+    
35
+    function create_db(){
36
+		
37
+	    $link =  mysql_connect($this->data['db_host'], $this->data['db_login'], $this->data['db_password']);
38
+		if (!$link) {
39
+		    die('Could not connect: ' . mysql_error());
40
+		}
41
+		
42
+		$sql = 'CREATE DATABASE ' . $this->data['db_name'];
43
+		if (!mysql_query($sql, $link)) {
44
+			$link = mysql_close($link);
45
+			return false;
46
+		} 
47
+		
48
+		return true;    	
49
+    }
50
+    
51
+	function install_db(){
52
+		require('config.php');
53
+		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);	
54
+		$sqlStr = array();
55
+		
56
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."data` (
57
+			  `id_post` int(11) NOT NULL auto_increment,
58
+			  `title` text NULL,
59
+			  `url` varchar(250)  default NULL,
60
+			  `description` text NULL,
61
+			  `type` tinyint(4) NOT NULL default '1',
62
+			  `date` datetime NOT NULL,
63
+			  `id_user` int(10) NOT NULL,
64
+			  PRIMARY KEY  (`id_post`)
65
+			) ENGINE = MYISAM ;";
66
+
67
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."users` (
68
+			  `id_user` int(10) unsigned NOT NULL auto_increment,
69
+			  `name` varchar(100) default NULL,
70
+			  `login` varchar(100) NOT NULL default '',
71
+			  `password` varchar(64) NOT NULL default '',
72
+			  `email` varchar(100) default NULL,
73
+			  `website` varchar(150) default NULL,
74
+			  `about` text,
75
+			  PRIMARY KEY  (`id_user`)
76
+			) ENGINE = MYISAM;";
77
+
78
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."config` (
79
+			  `posts_limit` int(3) NOT NULL,
80
+			  `title` varchar(250) NOT NULL,
81
+			  `description` text NOT NULL,
82
+			  `lang` varchar(10) NOT NULL,
83
+			  `template` varchar(100) NOT NULL,
84
+			  `url_installation` varchar(250) NOT NULL,
85
+			  PRIMARY KEY  (`title`)
86
+			) ENGINE = MYISAM ;";
87
+			
88
+
89
+		
90
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."options` (
91
+		  `name` varchar(100) NOT NULL,
92
+		  `val` varchar(255) NOT NULL,
93
+		  PRIMARY KEY  (`name`)
94
+		) ENGINE = MYISAM ;";
95
+
96
+		
97
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."comments` (
98
+		  `id_comment` int(11) NOT NULL auto_increment,
99
+		  `id_post` int(11) NOT NULL,
100
+		  `username` varchar(50) NOT NULL,
101
+		  `email` varchar(100) NOT NULL,
102
+		  `web` varchar(250) default NULL,
103
+		  `content` text NOT NULL,
104
+		  `ip_user` varchar(50) NOT NULL,
105
+		  `comment_date` datetime NOT NULL,
106
+		  `spam` tinyint(4) NOT NULL,
107
+		  PRIMARY KEY  (`id_comment`)
108
+		) ENGINE = MYISAM ;";
109
+		
110
+		$sqlStr[] = "CREATE TABLE `".Table_prefix."feeds` (
111
+			`id_feed` int(11) NOT NULL auto_increment,
112
+			`url` varchar(255) NOT NULL,
113
+			`title` varchar(255) NOT NULL,
114
+			`type` tinyint(4) NOT NULL default '1',
115
+			`updated_at` datetime NOT NULL,
116
+			`error` tinyint(1) NOT NULL default '0',
117
+			`credits` int(1) NOT NULL default '0',
118
+			`site_url` varchar(255) NOT NULL,
119
+			`id_user` int(10) NOT NULL,
120
+			PRIMARY KEY  (`id_feed`)
121
+			) ENGINE=MyISAM ;";
122
+
123
+					
124
+		$sqlStr[] = "INSERT INTO `".Table_prefix."config` VALUES (". $this->data['posts_limit'] .", '".$this->data['title']."', '".$this->data['description']."', '".$this->data['lang']."', '".$this->data['template']."', '".$this->data['url_installation']."');";		
125
+		$sqlStr[] = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$this->data['login']."', '".md5($this->data['password'])."', '".$this->data['email']."', '".$this->data['website']."', '".$this->data['about']."');";
126
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '1');";
127
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";		
128
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
129
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_city', '".$this->data['offset_city']."');";		
130
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_time', '".$this->data['offset_time']."');";
131
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
132
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
133
+
134
+		foreach($sqlStr as $key => $query){
135
+			if(!$db->ejecutarConsulta($query)){
136
+				return false;
137
+			}
138
+		}
139
+
140
+		return true;
141
+	}
142
+	
143
+	function inerrors($n) {
144
+		if ( strpos($this->errors,$n)===false) {
145
+			return false;
146
+		} else {
147
+			return true;
148
+		}
149
+	}
150
+	
151
+	function mostrarerror($n) {
152
+		if ($this->inerrors($n)) {
153
+			return '<span class="error">'.$this->errors_d[$n].'</span>';
154
+		} else {
155
+			return "";
156
+		}
157
+	}
158
+	
159
+	function is_gelato_installed(){
160
+		if (!$this->check_for_config()){ 
161
+			return false; 
162
+		} else {
163
+			if (!$this->is_db_installed()){
164
+				return false;
165
+			}
166
+			
167
+		}
168
+		
169
+		return true;
170
+	}
171
+	
172
+	function is_db_installed(){
173
+			global $db;	
174
+			if (function_exists($db->ejecutarConsulta)){
175
+				$sqlStr = "SELECT * FROM `".Table_prefix."config`";
176
+				if($db->ejecutarConsulta($sqlStr)) {
177
+					return ($db->contarRegistros() > 0);
178
+				}
179
+			} else {
180
+				false;
181
+			}
182
+	
183
+	}
184
+	
185
+	function check_for_config(){
186
+		if(!file_exists('config.php')) return false;
187
+		if(!defined('DB_Server')) return false;
188
+		if(!defined('DB_name')) return false;
189
+		if(!defined('DB_User')) return false;
190
+		if(!defined('DB_Password')) return false;
191
+		
192
+		return true;
193
+	}
194
+	
195
+	function create_config(){
196
+		$config = fopen("config.php", 'w+');
197
+		$contents = '<?php
198
+if(!defined(\'entry\') || !entry) die(\'Not a valid page\'); 
199
+/* ===========================
200
+
201
+  gelato CMS - A PHP based tumblelog CMS
202
+  development version
203
+  http://www.gelatocms.com/
204
+
205
+  gelato CMS is a free software licensed under the GPL 2.0
206
+  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
207
+
208
+  =========================== */
209
+
210
+define(\'DB_Server\', \''. $this->data['db_host'] . '\');
211
+define(\'DB_name\', \''. $this->data['db_name'] . '\');
212
+define(\'DB_User\', \''. $this->data['db_login'] . '\');
213
+define(\'DB_Password\', \''. $this->data['db_password'] . '\'); 
214
+define(\'Table_prefix\', \'gel_\');
215
+define(\'Absolute_Path\', dirname(__FILE__).DIRECTORY_SEPARATOR);
216
+
217
+?>';
218
+
219
+	    if (fwrite($config, $contents) === FALSE) {
220
+	        $this->errors = "Could not write config file to directory";
221
+	        return false;
222
+	    } 
223
+	    fclose($config);
224
+	    return true;		
225
+	}
226
+	
227
+	function check_form(){
228
+
229
+		$action="";
230
+		
231
+		if (isset($this->data['action'])){
232
+			$action=$this->data['action'];
233
+		}
234
+		
235
+		if (!$this->is_gelato_installed()){
236
+			
237
+		$this->showForm = true;
238
+			
239
+		
240
+			if ($action=="config") {
241
+				
242
+				$sep_err="";
243
+				$this->errors = false;
244
+				
245
+				if (!$this->data['login'] || !$this->data['db_login']) {
246
+					$this->errors =$this->errors.$sep_err."1";
247
+					$sep_err="|";
248
+				}
249
+				if (!$this->data['password'] ||  !$this->data['db_password']) {
250
+					$this->errors=$this->errors.$sep_err."2";
251
+					$sep_err="|";
252
+				}
253
+				if (!$this->data['email']) {
254
+					$this->errors=$this->errors.$sep_err."4";
255
+					$sep_err="|";
256
+				}
257
+				if (!$this->data['url_installation'] ) {
258
+					$this->errors=$this->errors.$sep_err."5";
259
+					$sep_err="|";
260
+				}
261
+				if (!$this->data['db_host'] ) {
262
+					$this->errors=$this->errors.$sep_err."7";
263
+					$sep_err="|";
264
+				}
265
+				if (!$this->data['db_name'] ) {
266
+					$this->errors=$this->errors.$sep_err."8";
267
+					$sep_err="|";
268
+				}
269
+				if ($this->data['password']!=$_POST['password2'] ||  $_POST['db_password']!=$_POST['db_password2'] ) {
270
+					$this->errors=$this->errors.$sep_err."3";
271
+					$sep_err="|";
272
+				}
273
+				$off_r= split("," , $this->data['time_offsets']);
274
+				$this->data['offset_time'] = $off_r[0];
275
+				$this->data['offset_city'] = $off_r[1];
276
+				unset($this->data['time_offsets']);
277
+				
278
+				if (!$this->errors) {
279
+							
280
+					if ($this->run($this->data)) {
281
+						$this->showForm=false;
282
+					} else {
283
+						$this->errors=$this->errors.$sep_err."6";
284
+						$sep_err="|";
285
+						$this->showForm=true;
286
+					}		
287
+				} else {
288
+					$this->showForm=true;
289
+				}
290
+			}
291
+		}	
292
+	}	
293
+}
280 294
 ?>

File diff suppressed because it is too large
+ 5449 - 0
classes/simplepie.class.php


+ 16 - 1
db/gelato_db.sql View File

@@ -51,6 +51,20 @@ CREATE TABLE `gel_comments` (
51 51
   PRIMARY KEY  (`id_comment`)
52 52
 ) ENGINE = MYISAM ;
53 53
 
54
+CREATE TABLE `gel_feeds` (
55
+	`id_feed` int(11) NOT NULL auto_increment,
56
+	`url` varchar(255) NOT NULL,
57
+	`title` varchar(255) NOT NULL,
58
+	`type` tinyint(4) NOT NULL default '1',
59
+	`updated_at` datetime NOT NULL,
60
+	`error` tinyint(1) NOT NULL default '0',
61
+	`credits` int(1) NOT NULL default '0',
62
+	`site_url` varchar(255) NOT NULL,
63
+	`id_user` int(10) NOT NULL,
64
+	PRIMARY KEY  (`id_feed`)
65
+) ENGINE=MyISAM1 ;
66
+
67
+
54 68
 -- Example data for table `gel_config`
55 69
 
56 70
 INSERT INTO `gel_config` VALUES (10, 'Tumble title', 'tumble description', 'en', 'tumblr', 'http://localhost/gelato');
@@ -66,4 +80,5 @@ INSERT INTO `gel_options` VALUES ('url_friendly', '1');
66 80
 INSERT INTO `gel_options` VALUES ('rich_text', '0');
67 81
 INSERT INTO `gel_options` VALUES ('allow_comments', '0');
68 82
 INSERT INTO `gel_options` VALUES ('offset_city', 'Mexico/General');
69
-INSERT INTO `gel_options` VALUES ('offset_time', '-6');
83
+INSERT INTO `gel_options` VALUES ('offset_time', '-6');
84
+INSERT INTO `gel_options` VALUES ('rss_import_frec', '5 minutes');

+ 6 - 1
entry.php View File

@@ -19,8 +19,8 @@
19 19
  * admin/admin.php
20 20
  * admin/comments.php
21 21
  * admin/users.php
22
- * admin/form.autosave.php
23 22
  * classes/imgsize.php 
23
+ * admin/feeds.php
24 24
  */
25 25
 
26 26
  
@@ -43,6 +43,7 @@ require_once("classes/templates.class.php");
43 43
 require_once("classes/pagination.class.php");
44 44
 require_once("classes/user.class.php");
45 45
 require_once("classes/comments.class.php");
46
+require_once("classes/feeds.class.php");
46 47
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'mysql_connection.class.php');
47 48
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'streams.class.php');
48 49
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
@@ -55,4 +56,8 @@ $tumble = new gelato();
55 56
 
56 57
 session_start();
57 58
 
59
+$feeds = new feeds();
60
+$feeds->updateFeeds();
61
+unset($feeds);
62
+
58 63
 ?>

+ 3 - 3
readme.txt View File

@@ -5,7 +5,7 @@
5 5
 3) Run the gelato installation script by accessing install.php in your favorite web browser.
6 6
 	* If you installed gelato in the root directory, you should visit: http://example.com/install.php
7 7
           * If you installed gelato in its own subdirectory called tumblelog, for example, you should visit: http://example.com/tumblelog/install.php 
8
-4) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'
8
+4) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads' and the folder 'uploads/CACHE'
9 9
 
10 10
 That's it! gelato should now be installed.   
11 11
 
@@ -20,7 +20,7 @@ That's it! gelato should now be installed.
20 20
 	Note: The test data on the script /db/gelato_db.sql use the table prefix 'gel_'
21 21
 6) Place the gelato files in the desired location on your web server.
22 22
 	Note: The test data on the script /db/gelato_db.sql point the installation to http://localhost/gelato
23
-7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'
23
+7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads' and the folder 'uploads/CACHE'
24 24
 
25 25
 That's it! gelato should now be installed.
26 26
 	Demo user: admin
@@ -33,7 +33,7 @@ That's it! gelato should now be installed.
33 33
 3) Replace all the old files with those from the new 0.90 EXCEPT for the file config.php
34 34
 	3.1) If you do replace it by error, use the backup you create during step two.
35 35
 4) Execute the update.php file.
36
-7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'
36
+7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'  and the folder 'uploads/CACHE'
37 37
 
38 38
 That's it! gelato should now be updated.
39 39
 

+ 29 - 2
update.php View File

@@ -27,7 +27,7 @@ if (!file_exists($configFile)) {
27 27
 
28 28
 $db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
29 29
 
30
-$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
30
+/*$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
31 31
 		
32 32
 $db->ejecutarConsulta($sqlStr);
33 33
 
@@ -43,7 +43,34 @@ $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');"
43 43
 		
44 44
 $db->ejecutarConsulta($sqlStr);
45 45
 
46
+ AFTER v0.90 */
47
+ 
48
+$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
49
+		
50
+$db->ejecutarConsulta($sqlStr);
51
+
52
+
53
+$sqlStr = "CREATE TABLE `".Table_prefix."feeds` (
54
+  `id_feed` int(11) NOT NULL auto_increment,
55
+  `url` varchar(255) NOT NULL,
56
+  `title` varchar(255) NOT NULL,
57
+  `type` tinyint(4) NOT NULL default '1',
58
+  `updated_at` datetime NOT NULL,
59
+  `error` tinyint(1) NOT NULL default '0',
60
+  `credits` int(1) NOT NULL default '0',
61
+  `site_url` varchar(255) NOT NULL,
62
+  `id_user` int(10) NOT NULL,
63
+  PRIMARY KEY  (`id_feed`)
64
+) ENGINE=MyISAM ;";
65
+
66
+$db->ejecutarConsulta($sqlStr);
67
+
68
+if(!is_dir('upload/CACHE')){
69
+	mkdir('upload/CACHE');
70
+	chmod('upload/CACHE',777);
71
+}
72
+
46 73
 echo "<p><em>Finished!</em></p>";
47
-echo "<p>Now you are running on the new <strong>0.90</strong> version!!!</p>";
74
+echo "<p>Now you are running on the new <strong>After 0.90</strong> version!!!</p>";
48 75
 
49 76
 ?>