pecesama 17 years ago
parent
commit
12a7f489fa

+ 4 - 1
admin/admin.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -11,6 +12,7 @@
11 12
 <?php
12 13
 require_once('../config.php');
13 14
 include("../classes/user.class.php");
15
+include("../classes/functions.php");
14 16
 require_once("../classes/configuration.class.php");
15 17
 
16 18
 $user = new user();
@@ -24,6 +26,7 @@ if ($user->isAdmin()) {
24 26
 	<head>
25 27
 		<title>gelato :: admin users</title>
26 28
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
29
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
27 30
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
28 31
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
29 32
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>

+ 2 - 1
admin/ajax.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)

+ 47 - 36
admin/close.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -10,55 +11,65 @@
10 11
 ?>
11 12
 <?php
12 13
 require_once('../config.php');
14
+include("../classes/functions.php");
13 15
 include("../classes/user.class.php");
16
+require_once("../classes/configuration.class.php");
14 17
 
15 18
 session_start();
16 19
 $user = new user();
20
+$conf = new configuration();
17 21
 $user->closeSession()
18 22
 ?>
19
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
20
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
21
-<head>
22
-	<title>gelato</title>
23
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
24
-	<link rel="shortcut icon" href="../images/favicon.ico" />
25
-	<meta http-equiv="Refresh" content="3;URL=../login.php" />
26
-	<style type="text/css" media="screen">	
27
-		@import "css/style-codice.css";
28
-	</style>
29
-</head>	
23
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
24
+	<html xmlns="http://www.w3.org/1999/xhtml">
25
+	<head>
26
+		<title>gelato :: logout</title>
27
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
29
+		<meta http-equiv="Refresh" content="3;URL=../login.php" />
30
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
31
+		<style type="text/css" media="screen">	
32
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
33
+		</style>
34
+	</head>
30 35
 <body>
31
-
32
-	<div id="titulo">
33
-		<img src="../images/logo.jpg" alt="gelato CMS" title="gelato CMS" />	
34
-	</div>
35
-
36
-	<div id="contenido">
37
-		<div class="piccola">
38
-			<div  class="ventana">
39
-				<p class="titulo"><span class="handle" style="cursor:move;">Closing session</span></p>
40
-				<p>
36
+<div id="cont">
37
+			<div id="head">
38
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
39
+				<ul id="nav">
40
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
41
+			  	</ul>
42
+			</div>
43
+			<div id="main">				
44
+				
45
+				<div class="box">
46
+					<ul class="menu manage">
47
+					<h3>Closing session</h3>
48
+					<li class="selected"><a>logoff</a></li>
49
+					</ul>
50
+				
51
+					<div class="tabla">
52
+						<p>
41 53
 <?php
42
-if (@session_destroy()) {
43
-?>
44
-		</p>
45
-				<h3>Ending session...</h3>
54
+						if (@session_destroy()) {
55
+?>		
56
+							<h2>Ending session...</h2>
46 57
 <?php
47
-} else {	
58
+						} else {	
48 59
 ?>
49
-		<h3>Has happened an error when closing the session.</h3>
60
+							<h2>Has happened an error when closing the session.</h2>
50 61
 <?php
51
-}	
62
+						}	
52 63
 ?> 
53
-				</p>
64
+						</p>
65
+					</div>
66
+
67
+					<div class="footer-box">&nbsp;</div>
68
+				</div>
54 69
 			</div>
55
-		</div>
56
-		<div id="pie">
57
-			<p>
70
+			<div id="foot">
58 71
 				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
59
-			</p>
72
+			</div>
60 73
 		</div>
61
-	</div>	
62
-</div>
63 74
 </body>
64 75
 </html>

+ 2 - 1
admin/css/style.css View File

@@ -1,6 +1,7 @@
1 1
 /* ===========================
2 2
 
3
-  gelato CMS development version
3
+  gelato CMS - A PHP based tumblelog CMS
4
+  development version
4 5
   http://www.gelatocms.com/
5 6
 
6 7
   gelato CMS is a free software licensed under GPL (General public license)

+ 11 - 4
admin/index.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -12,7 +13,7 @@
12 13
 require_once('../config.php');
13 14
 include("../classes/functions.php");
14 15
 include("../classes/user.class.php");
15
-include("../classes/pagination.php");
16
+include("../classes/pagination.class.php");
16 17
 include("../classes/gelato.class.php");
17 18
 include("../classes/textile.class.php");
18 19
 include("../classes/templates.class.php");
@@ -98,6 +99,7 @@ if ($user->isAdmin()) {
98 99
 	<html xmlns="http://www.w3.org/1999/xhtml">
99 100
 	<head>
100 101
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
102
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
101 103
 		<title>gelato :: control panel</title>
102 104
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
103 105
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
@@ -315,6 +317,7 @@ if ($user->isAdmin()) {
315 317
 					<ul class="menu manage">
316 318
 					<h3>Manage</h3>
317 319
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php">Settings</a></li>
320
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/options.php">Options</a></li>
318 321
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php">Users</a></li>
319 322
 					<li class="selected"><a>Posts</a></li>
320 323
 					</ul>
@@ -407,8 +410,12 @@ if ($user->isAdmin()) {
407 410
 									break;
408 411
 							}
409 412
 						}
410
-			
411
-						echo pagination($tumble->getPostsNumber(), $limit, isset($page_num) ? $page_num : 1, "index.php", 2);
413
+
414
+						$p = new pagination;
415
+						$p->items($tumble->getPostsNumber());
416
+						$p->limit($limit);
417
+						$p->currentPage(isset($page_num) ? $page_num : 1);
418
+						$p->show();
412 419
 			
413 420
 			
414 421
 					} else {

+ 128 - 0
admin/options.php View File

@@ -0,0 +1,128 @@
1
+<?php
2
+/* ===========================
3
+
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
6
+  http://www.gelatocms.com/
7
+
8
+  gelato CMS is a free software licensed under GPL (General public license)
9
+
10
+  =========================== */
11
+?>
12
+<?php
13
+require_once('../config.php');
14
+include("../classes/functions.php");
15
+include("../classes/user.class.php");
16
+include("../classes/gelato.class.php");
17
+require_once("../classes/configuration.class.php");
18
+
19
+$user = new user();
20
+$tumble = new gelato();
21
+$conf = new configuration();
22
+
23
+if ($user->isAdmin()) {
24
+	
25
+	if(isset($_POST["btnsubmit"]))	{		
26
+		unset($_POST["btnsubmit"]);		
27
+		$tumble->saveOption($_POST["rich_text"], "rich_text");
28
+		$tumble->saveOption($_POST["urlFriendly"], "rich_text");
29
+	} else {
30
+?>
31
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
+	<html xmlns="http://www.w3.org/1999/xhtml">
33
+	<head>
34
+		<title>gelato :: options</title>
35
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
36
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
37
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
38
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
39
+		<script type="text/javascript">
40
+		<!--
41
+			window.onload = function() {
42
+				contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
43
+					function() {
44
+						document.getElementById('divMessages').style.display="none";
45
+					}
46
+				});
47
+				contenedor.custom(1,0);
48
+			}
49
+		-->
50
+		</script>	
51
+		<style type="text/css" media="screen">	
52
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
53
+		</style>
54
+	</head>
55
+	
56
+	<body>
57
+		<div id="div-process" style="display:none;">Processing request...</div>
58
+		<div id="cont">
59
+			<div id="head">
60
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
61
+				<ul id="nav">
62
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
63
+			  	</ul>
64
+			</div>
65
+			<div id="main">				
66
+				
67
+				<div class="box">
68
+					<ul class="menu manage">
69
+					<h3>Tumblelog options</h3>
70
+					<li><a href="index.php">Post</a></li>
71
+					<li><a href="admin.php">Users</a></li>
72
+					<li><a href="settings.php">Settings</a></li>
73
+					<li class="selected"><a>Options</a></li>
74
+					</ul>
75
+					<p>&nbsp;</p>
76
+<?php
77
+					if (isset($_GET["modified"])) {
78
+						if ($_GET["modified"]=="true") {
79
+							echo "<div class=\"exito\" id=\"divMessages\">The configuration has been modified successfully.</div>";
80
+						}
81
+					}					
82
+					if (isset($_GET["error"])) {
83
+						if ($_GET["error"]==1) {
84
+							echo "<div class=\"error\" id=\"divMessages\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
85
+						}
86
+					}
87
+?>
88
+					<div class="tabla">
89
+
90
+						<form action="options.php" method="post" id="options_form" autocomplete="off" class="newpost">							
91
+							<fieldset>								
92
+								<ul>																	
93
+									<li><label for="rich_text">Rich text editor:</label>
94
+										<select name="rich_text" id="rich_text">										
95
+											<option value="1" <?php if($conf->richText) echo "selected"; ?>>Active</option>
96
+											<option value="0" <?php if(!$conf->richText) echo "selected"; ?>>Deactive</option>
97
+										</select>
98
+									</li>
99
+									<li><label for="rich_text">URL friendly:</label>
100
+										<select name="url_friendly" id="url_friendly">
101
+											<option value="1" <?php if($conf->urlFriendly) echo "selected"; ?>>Active</option>
102
+											<option value="0" <?php if(!$conf->urlFriendly) echo "selected"; ?>>Deactive</option>
103
+										</select>
104
+									</li>
105
+								</ul>
106
+							</fieldset>
107
+							<p>
108
+								<input type="submit" name="btnsubmit" id="btnsubmit" value="Modify" class="submit"/>
109
+							</p>
110
+						</form>	
111
+								
112
+					</div>
113
+
114
+					<div class="footer-box">&nbsp;</div>
115
+				</div>
116
+			</div>
117
+			<div id="foot">
118
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
119
+			</div>
120
+		</div>
121
+	</body>
122
+	</html>
123
+<?php
124
+	}
125
+} else {
126
+	header("Location: ".$conf->urlGelato."/login.php");
127
+}
128
+?>

+ 8 - 12
admin/settings.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -32,6 +33,7 @@ if ($user->isAdmin()) {
32 33
 	<head>
33 34
 		<title>gelato :: settings</title>
34 35
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
36
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
35 37
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
36 38
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
37 39
 		<script type="text/javascript">
@@ -67,6 +69,7 @@ if ($user->isAdmin()) {
67 69
 					<h3>Tumblelog configuration</h3>
68 70
 					<li><a href="index.php">Post</a></li>
69 71
 					<li><a href="admin.php">Users</a></li>
72
+					<li><a href="options.php">Options</a></li>
70 73
 					<li class="selected"><a>Settings</a></li>
71 74
 					</ul>
72 75
 					<p>&nbsp;</p>
@@ -104,24 +107,17 @@ if ($user->isAdmin()) {
104 107
 										<select id="template" name="template">
105 108
 <?php
106 109
 										$themes = getThemes();
107
-										foreach ($themes as $theme) {									
108
-											echo "<option value=\"".$theme."\" selected=\"true\">".$theme."</option>\n";
110
+										foreach ($themes as $theme) {
111
+											$active = ($conf->template) ? "selected" : "";
112
+											echo "<option value=\"".$theme."\" ".$active.">".$theme."</option>\n";
109 113
 											
110 114
 										}
111 115
 ?>
112 116
 										</select>
113 117
 									</li>									
114
-									<li><label for="rich_text">Rich text editor:</label>
115
-										<select name="rich_text" id="rich_text">
116
-											<option value="1" <?php if($conf->richText) echo "selected"; ?>>Active</option>
117
-											<option value="0" <?php if(!$conf->richText) echo "selected"; ?>>Deactive</option>
118
-										</select>
119
-									</li>
120 118
 								</ul>
121 119
 							</fieldset>
122
-							<p>								
123
-								
124
-								<input type="hidden" name="url_friendly" id="url_friendly" value="0" />								
120
+							<p>
125 121
 								<input type="submit" name="btnsubmit" id="btnsubmit" value="Modify" class="submit"/>
126 122
 							</p>
127 123
 						</form>	

+ 3 - 1
admin/user.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -53,6 +54,7 @@ if ($user->isAdmin()) {
53 54
 	<head>
54 55
 		<title>gelato :: add user</title>
55 56
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
57
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
56 58
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
57 59
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
58 60
 		<script language="javascript" type="text/javascript">								

+ 39 - 15
classes/configuration.class.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -17,29 +18,52 @@ class configuration extends Conexion_Mysql {
17 18
 	var $postLimit;
18 19
 	var $title;
19 20
 	var $description;
20
-	var $lang;
21
+	var $lang;	
22
+	var $template;
21 23
 	var $urlFriendly;
22 24
 	var $richText;
23
-	var $template;
24 25
 	
25 26
 	
26 27
 	function configuration() {
27 28
 		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
28 29
 		
29
-		if ($this->ejecutarConsulta("SELECT *  FROM ".Table_prefix."config")) {
30
-			if ($this->contarRegistros()>0) {
31
-				$register=$this->obtenerRegistro();
32
-				$this->tablePrefix = Table_prefix;
33
-				$this->urlGelato = $register['url_installation'];				
34
-				$this->postLimit = $register['posts_limit'];
35
-				$this->title = $register['title'];
36
-				$this->description = $register['description'];
37
-				$this->lang = $register['lang'];
38
-				$this->urlFriendly = $register['url_friendly'];
39
-				$this->richText = $register['rich_text'];
40
-				$this->template = $register['template'];
30
+		global $isFeed;
31
+		
32
+		if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
33
+			$row=$this->obtenerRegistro();
34
+			$this->tablePrefix = Table_prefix;
35
+			$this->urlGelato = $row['url_installation'];				
36
+			$this->postLimit = $row['posts_limit'];
37
+			$this->title = $row['title'];
38
+			$this->description = $row['description'];
39
+			$this->lang = $row['lang'];				
40
+			$this->template = $row['template'];
41
+
42
+			$this->urlFriendly = $this->get_option("url_friendly");
43
+			$this->richText = $this->get_option("rich_text");
44
+		} else {
45
+			if($isFeed) {
46
+				header("HTTP/1.0 503 Service Unavailable"); 
47
+				header("Retry-After: 60"); 
48
+				exit();
49
+			} else {				
50
+				$message = "
51
+				<h3 class=\"important\">Error establishing a database connection</h3>
52
+				<p>The configuration info is not available.</p>";
53
+				die($message);	
41 54
 			}
42 55
 		}
43 56
 	}
57
+	
58
+	function get_option($name){
59
+		$sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
60
+		$this->ejecutarConsulta($sql);
61
+		if ($this->contarRegistros()>0) {
62
+			$row=$this->obtenerRegistro();
63
+			return $row['val'];
64
+		} else {
65
+			return "0";
66
+		}
67
+	}
44 68
 }
45 69
 ?>

+ 3 - 2
classes/functions.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -10,7 +11,7 @@
10 11
 ?>
11 12
 <?php
12 13
 	function version() {
13
-		return "0.8";
14
+		return "0.85";
14 15
 	}
15 16
 	
16 17
 	function beginsWith($str, $sub) {

+ 13 - 1
classes/gelato.class.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -30,6 +31,17 @@ class gelato extends Conexion_Mysql {
30 31
 		}
31 32
 	}
32 33
 	
34
+	function saveOption($value, $name) {
35
+		$sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1";		
36
+		if ($this->ejecutarConsulta($sqlStr)) {
37
+			header("Location: ".$this->conf->urlGelato."/admin/options.php?modified=true");
38
+			die();
39
+		} else {
40
+			header("Location: ".$this->conf->urlGelato."/admin/options.php?error=1&des=".$this->merror);
41
+			die();
42
+		}
43
+	}
44
+	
33 45
 	function addPost($fieldsArray) {		
34 46
 		if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
35 47
 			return true;

+ 195 - 0
classes/pagination.class.php View File

@@ -0,0 +1,195 @@
1
+<?php
2
+class pagination{
3
+/*
4
+Script Name: *Digg Style Paginator Class
5
+Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
6
+Description: Class in PHP that allows to use a pagination like a digg or sabrosus style.
7
+Script Version: 0.3
8
+Author: Victor De la Rocha
9
+Author URI: http://www.mis-algoritmos.com
10
+*/
11
+		/*Default values*/
12
+		var $total_pages = null;
13
+		var $limit = null;
14
+		var $target = ""; 
15
+		var $page = 1;
16
+		var $adjacents = 2;
17
+		var $showCounter = false;
18
+		var $className = "pagination";
19
+		var $parameterName = "page";
20
+		var $urlF = false;//urlFriendly
21
+
22
+		/*Buttons next and previous*/
23
+		var $nextT = "Next";
24
+		var $nextI = "&#187;"; //&#9658;
25
+		var $prevT = "Previous";
26
+		var $prevI = "&#171;"; //&#9668;
27
+
28
+		/*****/
29
+		var $calculate = false;
30
+		
31
+		#Total items
32
+		function items($value){$this->total_pages = intval($value);}
33
+		
34
+		#how many items to show per page
35
+		function limit($value){$this->limit = intval($value);}
36
+		
37
+		#Page to sent the page value
38
+		function target($value){$this->target = $value;}
39
+		
40
+		#Current page
41
+		function currentPage($value){$this->page = intval($value);}
42
+		
43
+		#How many adjacent pages should be shown on each side of the current page?
44
+		function adjacents($value){$this->adjacents = intval($value);}
45
+		
46
+		#show counter?
47
+		function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
48
+
49
+		#to change the class name of the pagination div
50
+		function changeClass($value=""){$this->className=$value;}
51
+
52
+		function nextLabel($value){$this->nextT = $value;}
53
+		function nextIcon($value){$this->nextI = $value;}
54
+		function prevLabel($value){$this->prevT = $value;}
55
+		function prevIcon($value){$this->prevI = $value;}
56
+
57
+		#to change the class name of the pagination div
58
+		function parameterName($value=""){$this->parameterName=$value;}
59
+
60
+		#to change urlFriendly
61
+		function urlFriendly($value="%"){
62
+				if(eregi('^ *$',$value)){
63
+						$this->urlF=false;
64
+						return false;
65
+					}
66
+				$this->urlF=$value;
67
+			}
68
+		
69
+		var $pagination;
70
+
71
+		function pagination(){}
72
+		function show(){
73
+				if(!$this->calculate)
74
+					if($this->calculate())
75
+						echo "<div class=\"$this->className\">$this->pagination</div>";
76
+			}
77
+		function get_pagenum_link($id){
78
+				if(strpos($this->target,'?')===false)
79
+						if($this->urlF)
80
+								return str_replace($this->urlF,$id,$this->target);
81
+							else
82
+								return "$this->target?$this->parameterName=$id";
83
+					else
84
+						return "$this->target&$this->parameterName=$id";
85
+			}
86
+		
87
+		function calculate(){
88
+				$this->pagination = "";
89
+				$this->calculate == true;
90
+				$error = false;
91
+				if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
92
+						//Es necesario especificar el comodin para sustituir
93
+						echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
94
+						$error = true;
95
+					}elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
96
+						echo "Es necesario especificar en el target el comodin % para sustituir el número de página<br />";
97
+						$error = true;
98
+					}
99
+				if($this->total_pages == null){
100
+						echo "It is necessary to specify the <strong>number of pages</strong> (\$class->items(1000))<br />";
101
+						$error = true;
102
+					}
103
+				if($this->limit == null){
104
+						echo "It is necessary to specify the <strong>limit of items</strong> to show per page (\$class->limit(10))<br />";
105
+						$error = true;
106
+					}
107
+				if($error)return false;
108
+				
109
+				$n = trim($this->nextT.' '.$this->nextI);
110
+				$p = trim($this->prevI.' '.$this->prevT);
111
+				
112
+				/* Setup vars for query. */
113
+				if($this->page) 
114
+					$start = ($this->page - 1) * $this->limit;             //first item to display on this page
115
+				else
116
+					$start = 0;                                //if no page var is given, set start to 0
117
+			
118
+				/* Setup page vars for display. */
119
+				if ($this->page == 0) $this->page = 1;                    //if no page var is given, default to 1.
120
+				$prev = $this->page - 1;                            //previous page is page - 1
121
+				$next = $this->page + 1;                            //next page is page + 1
122
+				$lastpage = ceil($this->total_pages/$this->limit);        //lastpage is = total pages / items per page, rounded up.
123
+				$lpm1 = $lastpage - 1;                        //last page minus 1
124
+				
125
+				/* 
126
+					Now we apply our rules and draw the pagination object. 
127
+					We're actually saving the code to a variable in case we want to draw it more than once.
128
+				*/
129
+				
130
+				if($lastpage > 1){
131
+						//anterior button
132
+						if($this->page > 1)
133
+								$this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\">$p</a>";
134
+							else
135
+								$this->pagination .= "<span class=\"disabled\">$p</span>";
136
+						//pages	
137
+						if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
138
+								for ($counter = 1; $counter <= $lastpage; $counter++){
139
+										if ($counter == $this->page)
140
+												$this->pagination .= "<span class=\"current\">$counter</span>";
141
+											else
142
+												$this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
143
+									}
144
+							}
145
+						elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
146
+								//close to beginning; only hide later pages
147
+								if($this->page < 1 + ($this->adjacents * 2)){
148
+										for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
149
+												if ($counter == $this->page)
150
+														$this->pagination .= "<span class=\"current\">$counter</span>";
151
+													else
152
+														$this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
153
+											}
154
+										$this->pagination .= "...";
155
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
156
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
157
+									}
158
+								//in middle; hide some front and some back
159
+								elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
160
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
161
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
162
+										$this->pagination .= "...";
163
+										for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
164
+											if ($counter == $this->page)
165
+													$this->pagination .= "<span class=\"current\">$counter</span>";
166
+												else
167
+													$this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
168
+										$this->pagination .= "...";
169
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
170
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
171
+									}
172
+								//close to end; only hide early pages
173
+								else{
174
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
175
+										$this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
176
+										$this->pagination .= "...";
177
+										for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
178
+											if ($counter == $this->page)
179
+													$this->pagination .= "<span class=\"current\">$counter</span>";
180
+												else
181
+													$this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
182
+									}
183
+							}
184
+						//siguiente button
185
+						if ($this->page < $counter - 1)
186
+								$this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\">$n</a>";
187
+							else
188
+								$this->pagination .= "<span class=\"disabled\">$n</span>";
189
+							if($this->showCounter)$this->pagination .= "<div class=\"pagination_data\">($this->total_pages Pages)</div>";
190
+					}
191
+
192
+				return true;
193
+			}
194
+	}
195
+?>

+ 0 - 138
classes/pagination.php View File

@@ -1,138 +0,0 @@
1
-<?php
2
-/*
3
-	Digg-Style Pagination
4
-	
5
-	Autor: jason (http://www.strangerstudios.com/blog/2006/12/29/pagination-update/)
6
-	Update: Victor De la Rocha (http://www.mis-algoritmos.com/2006/11/23/paginacion-al-estilo-digg-y-sabrosus/)
7
-*/
8
-function pagination($total_pages,$limit,$page=1,$pagina="default.php",$adjacents=2){
9
-	/*
10
-		$adjacents -> How many adjacent pages should be shown on each side?
11
-		$total_pages -> items
12
-		$limit  -> how many items to show per page
13
-		$page -> Current page
14
-		$pagina -> Pagina
15
-	*/
16
-		if(!is_array($pagina)&&!strstr($pagina,"?"))
17
-			$pagina = $pagina."?";
18
-			
19
-		/* Setup vars for query. */
20
-		if($page) 
21
-			$start = ($page - 1) * $limit; 			//first item to display on this page
22
-		else
23
-			$start = 0;								//if no page var is given, set start to 0
24
-	
25
-		/* Setup page vars for display. */
26
-		if ($page == 0) $page = 1;					//if no page var is given, default to 1.
27
-		$prev = $page - 1;							//previous page is page - 1
28
-		$next = $page + 1;							//next page is page + 1
29
-		$lastpage = ceil($total_pages/$limit);		//lastpage is = total pages / items per page, rounded up.
30
-		$lpm1 = $lastpage - 1;						//last page minus 1
31
-		
32
-		/* 
33
-			Now we apply our rules and draw the pagination object. 
34
-			We're actually saving the code to a variable in case we want to draw it more than once.
35
-		*/
36
-		$pagination = "";
37
-		if($lastpage > 1)
38
-		{	
39
-			$pagination .= "<div class=\"pagination\">";
40
-			//previous button
41
-			if ($page > 1){
42
-				$pagina_uf = is_array($pagina)?str_replace($pagina[1],$prev,$pagina[0]):$pagina."&page=$prev";
43
-				$pagination.= "<a href=\"".$pagina_uf."\"> Previous</a>";
44
-			}else
45
-				$pagination.= "<span class=\"disabled\"> Previous</span>";	
46
-			
47
-			//pages	
48
-			if ($lastpage < 7 + ($adjacents * 2))	//not enough pages to bother breaking it up
49
-			{	
50
-				for ($counter = 1; $counter <= $lastpage; $counter++)
51
-				{
52
-					if ($counter == $page)
53
-						$pagination.= "<span class=\"current\">$counter</span>";
54
-					else{
55
-							$pagina_uf = is_array($pagina)?str_replace($pagina[1],$counter,$pagina[0]):$pagina."&page=$counter";
56
-							$pagination.= "<a href=\"".$pagina_uf."\">$counter</a>";					
57
-						}
58
-				}
59
-			}
60
-			elseif($lastpage > 5 + ($adjacents * 2))	//enough pages to hide some
61
-			{
62
-				//close to beginning; only hide later pages
63
-				if($page < 1 + ($adjacents * 2))		
64
-				{
65
-					for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
66
-					{
67
-						if ($counter == $page)
68
-							$pagination.= "<span class=\"current\">$counter</span>";
69
-						else{
70
-								$pagina_uf = is_array($pagina)?str_replace($pagina[1],$counter,$pagina[0]):$pagina."&page=$counter";
71
-								$pagination.= "<a href=\"".$pagina_uf."\">$counter</a>";					
72
-							}
73
-					}
74
-					$pagination.= "...";
75
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],$lpm1,$pagina[0]):$pagina."&page=$lpm1";
76
-					$pagination.= "<a href=\"".$pagina_uf."\">$lpm1</a>";
77
-				
78
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],$counter,$pagina[0]):$pagina."&page=$counter";
79
-					$pagination.= "<a href=\"".$pagina_uf."\">$lastpage</a>";		
80
-				}
81
-				//in middle; hide some front and some back
82
-				elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
83
-				{
84
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],1,$pagina[0]):$pagina."&page=1";
85
-					$pagination.= "<a href=\"".$pagina_uf."\">1</a>";
86
-
87
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],2,$pagina[0]):$pagina."&page=2";
88
-					$pagination.= "<a href=\"".$pagina_uf."\">2</a>";
89
-					$pagination.= "...";
90
-					for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
91
-					{
92
-						if ($counter == $page)
93
-								$pagination.= "<span class=\"current\">$counter</span>";
94
-							else{
95
-								$pagina_uf = is_array($pagina)?str_replace($pagina[1],$counter,$pagina[0]):$pagina."&page=$counter";
96
-								$pagination.= "<a href=\"".$pagina_uf."\">$counter</a>";					
97
-							}
98
-					}
99
-					$pagination.= "...";
100
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],$lpm1,$pagina[0]):$pagina."&page=$lpm1";
101
-					$pagination.= "<a href=\"".$pagina_uf."\">$lpm1</a>";
102
-					
103
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],$lastpage,$pagina[0]):$pagina."&page=$lastpage";
104
-					$pagination.= "<a href=\"".$pagina_uf."\">$lastpage</a>";		
105
-				}
106
-				//close to end; only hide early pages
107
-				else
108
-				{
109
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],1,$pagina[0]):$pagina."&page=1";
110
-					$pagination.= "<a href=\"".$pagina_uf."&page=1\">1</a>";
111
-					
112
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],2,$pagina[0]):$pagina."&page=2";
113
-					$pagination.= "<a href=\"".$pagina_uf."&page=2\">2</a>";
114
-					$pagination.= "...";
115
-					for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
116
-					{
117
-						if ($counter == $page)
118
-							$pagination.= "<span class=\"current\">$counter</span>";
119
-						else{
120
-								$pagina_uf = is_array($pagina)?str_replace($pagina[1],$counter,$pagina[0]):$pagina."&page=$counter";
121
-								$pagination.= "<a href=\"".$pagina_uf."\">$counter</a>";					
122
-							}
123
-					}
124
-				}
125
-			}
126
-			
127
-			//next button
128
-			if ($page < $counter - 1) {
129
-					$pagina_uf = is_array($pagina)?str_replace($pagina[1],$next,$pagina[0]):$pagina."&page=$next";
130
-					$pagination.= "<a href=\"".$pagina_uf."\">Next </a>";
131
-				}
132
-			else
133
-				$pagination.= "<span class=\"disabled\">Next </span>";
134
-			$pagination.= "</div>\n";		
135
-		}
136
-		return $pagination;
137
-	}
138
-?>

+ 2 - 1
classes/user.class.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)

+ 2 - 1
config-sample.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)

+ 29 - 4
db/gelato_db.sql View File

@@ -1,3 +1,5 @@
1
+-- DB Gelato CMS v0.85
2
+
1 3
 CREATE TABLE `gel_data` (
2 4
   `id_post` int(11) NOT NULL auto_increment,
3 5
   `title` text NULL,
@@ -27,15 +29,38 @@ CREATE TABLE `gel_config` (
27 29
   `lang` varchar(10) NOT NULL,
28 30
   `template` varchar(100) NOT NULL,
29 31
   `url_installation` varchar(250) NOT NULL,
30
-  `url_friendly` tinyint(1) NOT NULL,
31
-  `rich_text` tinyint(1) NOT NULL,
32 32
   PRIMARY KEY  (`title`)
33 33
 ) ENGINE = MYISAM ;
34 34
 
35
+CREATE TABLE `gel_options` (
36
+  `name` varchar(100) NOT NULL,
37
+  `val` varchar(255) NOT NULL,
38
+  PRIMARY KEY  (`name`)
39
+) ENGINE = MYISAM ;
40
+
41
+CREATE TABLE `gel_comments` (
42
+  `id_comment` int(11) NOT NULL auto_increment,
43
+  `id_post` int(11) NOT NULL,
44
+  `username` varchar(50) NOT NULL,
45
+  `email` varchar(100) NOT NULL,
46
+  `web` varchar(250) default NULL,
47
+  `content` text NOT NULL,
48
+  `ip_user` varchar(50) NOT NULL,
49
+  `comment_date` datetime NOT NULL,
50
+  `spam` tinyint(4) NOT NULL,
51
+  PRIMARY KEY  (`id_comment`)
52
+) ENGINE = MYISAM ;
53
+
35 54
 -- Example data for table `gel_config`
36 55
 
37
-INSERT INTO `gel_config` VALUES (10, 'Tumble title', 'tumble description', 'en', 'tumblr', 'http://localhost/gelato', 1, 1);
56
+INSERT INTO `gel_config` VALUES (10, 'Tumble title', 'tumble description', 'en', 'tumblr', 'http://localhost/gelato');
38 57
 
58
+-- Example data for table `gel_users`
39 59
 --  The password is "demo" without the "
40 60
 
41
-INSERT INTO `gel_users` VALUES (1, 'System administrator', 'admin', 'fe01ce2a7fbac8fafaed7c982a04e229', 'correo@correo.com', 'page', 'about');
61
+INSERT INTO `gel_users` VALUES (1, 'System administrator', 'admin', 'fe01ce2a7fbac8fafaed7c982a04e229', 'correo@correo.com', 'page', 'about');
62
+
63
+-- Example data for table `gel_options`
64
+
65
+INSERT INTO `gel_options` VALUES ('url_friendly', '1');
66
+INSERT INTO `gel_options` VALUES ('rich_text', '0');

+ 18 - 7
index.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -27,7 +28,7 @@
27 28
 	include("classes/textile.class.php");
28 29
 	include("classes/gelato.class.php");	
29 30
 	include("classes/templates.class.php");
30
-	include("classes/pagination.php");
31
+	include("classes/pagination.class.php");
31 32
 	include("classes/user.class.php");
32 33
 		
33 34
 	$user = new user();
@@ -57,12 +58,14 @@
57 58
 		}
58 59
 	}
59 60
 	
60
-	$gelato_includes = "<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/mootools.js\"></script>\n";
61
-	$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/slimbox.js\"></script>\n";
62
-	$gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/slimbox.css\" />\n";
61
+	$gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
62
+	$gelato_includes .= "\t<meta name=\"generator\" content=\"gelato cms ".version()."\" />\n";
63 63
 	$gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
64
+	$gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato."/rss.php\"/>\n";
64 65
 	$gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
65
-	$gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato."/rss.php\"/>";
66
+	$gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/slimbox.css\" />\n";	
67
+	$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/mootools.js\"></script>\n";
68
+	$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/slimbox.js\"></script>";
66 69
 	
67 70
 	$input = array("{Gelato_includes}","{Title}", "{Description}", "{URL_Tumble}", "{Template_name}");
68 71
 	$output = array($gelato_includes, $conf->title, $conf->description, $conf->urlGelato, $conf->template);
@@ -164,7 +167,15 @@
164 167
 				}
165 168
 			}
166 169
 
167
-			echo pagination($tumble->getPostsNumber(), $limit, isset($page_num) ? $page_num : 1, array($conf->urlGelato."/index.php/page/[...]/","[...]"), 2);
170
+			$p = new pagination;
171
+			$p->Items($tumble->getPostsNumber());
172
+			$p->limit($limit);
173
+			
174
+			$p->urlFriendly('[...]');
175
+			$p->target($conf->urlGelato."/index.php/page/[...]/");
176
+			
177
+			$p->currentPage(isset($page_num) ? $page_num : 1);
178
+			$p->show();
168 179
 
169 180
 
170 181
 		} else {

+ 45 - 16
install.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -67,8 +68,7 @@ if ($action=="config") {
67 68
 	
68 69
 	
69 70
 	if (!$errors) {		
70
-		
71
-		if (installdb($_POST['login'], $_POST['password'], $_POST['email'], $_POST['title'], $_POST['description'], $_POST['url_installation'], $_POST['posts_limit'], $_POST['lang'], $_POST['template'], $_POST['website'], $_POST['about'], $_POST['url_friendly'], $_POST['rich_text'])) {
71
+		if (install_db($_POST['login'], $_POST['password'], $_POST['email'], $_POST['title'], $_POST['description'], $_POST['url_installation'], $_POST['posts_limit'], $_POST['lang'], $_POST['template'], $_POST['website'], $_POST['about'])) {
72 72
 			$showForm=false;
73 73
 		} else {
74 74
 			$errors=$errors.$sep_err."6";
@@ -85,8 +85,8 @@ if ($action=="config") {
85 85
 <html xmlns="http://www.w3.org/1999/xhtml">
86 86
 <head>
87 87
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
88
-	<title>gelato :: installation</title>
89
-	<meta name="generator" content="sabros.us <?php echo version();?>" />	
88
+	<meta name="generator" content="gelato cms <?php echo version();?>" />
89
+	<title>gelato :: installation</title>	
90 90
 	<link rel="shortcut icon" href="images/favicon.ico" />
91 91
 	<style type="text/css" media="screen">	
92 92
 		@import "admin/css/style.css";		
@@ -159,8 +159,6 @@ if ($action=="config") {
159 159
 				<p>	
160 160
 					<input type="hidden" name="website" id="website" value="" />
161 161
 					<input type="hidden" name="about" id="about" value="" />
162
-					<input type="hidden" name="url_friendly" id="url_friendly" value="0" />
163
-					<input type="hidden" name="rich_text" id="rich_text" value="0" />		
164 162
 					<input type="hidden" name="action" id="action" value="config" />
165 163
 					<input type="submit" name="btnsubmit" id="btnsubmit" value="<< Install >>" class="submit"/>
166 164
 				</p>
@@ -186,7 +184,7 @@ if ($action=="config") {
186 184
 </html>
187 185
 
188 186
 <?php
189
-function installdb($login, $password, $email, $title, $description, $url_installation, $posts_limit, $lang, $template, $website, $about, $url_friendly, $rich_text){
187
+function install_db($login, $password, $email, $title, $description, $url_installation, $posts_limit, $lang, $template, $website, $about){
190 188
 
191 189
 		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);		
192 190
 		
@@ -223,37 +221,68 @@ function installdb($login, $password, $email, $title, $description, $url_install
223 221
 			  `lang` varchar(10) NOT NULL,
224 222
 			  `template` varchar(100) NOT NULL,
225 223
 			  `url_installation` varchar(250) NOT NULL,
226
-			  `url_friendly` tinyint(1) NOT NULL,
227
-			  `rich_text` tinyint(1) NOT NULL,
228 224
 			  PRIMARY KEY  (`title`)
229 225
 			) ENGINE = MYISAM ;";
230 226
 			
231 227
 		$db->ejecutarConsulta($sqlStr);
228
+		
229
+		$sqlStr = "CREATE TABLE `".Table_prefix."options` (
230
+		  `name` varchar(100) NOT NULL,
231
+		  `val` varchar(255) NOT NULL,
232
+		  PRIMARY KEY  (`name`)
233
+		) ENGINE = MYISAM ;";
234
+		
235
+		$db->ejecutarConsulta($sqlStr);
236
+		
237
+		$sqlStr = "CREATE TABLE `".Table_prefix."comments` (
238
+		  `id_comment` int(11) NOT NULL auto_increment,
239
+		  `id_post` int(11) NOT NULL,
240
+		  `username` varchar(50) NOT NULL,
241
+		  `email` varchar(100) NOT NULL,
242
+		  `web` varchar(250) default NULL,
243
+		  `content` text NOT NULL,
244
+		  `ip_user` varchar(50) NOT NULL,
245
+		  `comment_date` datetime NOT NULL,
246
+		  `spam` tinyint(4) NOT NULL,
247
+		  PRIMARY KEY  (`id_comment`)
248
+		) ENGINE = MYISAM ;";
249
+		
250
+		$db->ejecutarConsulta($sqlStr);
232 251
 				
233 252
 		$url_installation = (endsWith($url_installation, "/")) ? substr($url_installation, 0, strlen($url_installation)-1) : $url_installation ;
234 253
 		
235
-		$sqlStr = "INSERT INTO `".Table_prefix."config` VALUES (".$posts_limit.", '".$title."', '".$description."', '".$lang."', '".$template."', '".$url_installation."', ".$url_friendly.", ".$rich_text.");";		
254
+		$sqlStr = "INSERT INTO `".Table_prefix."config` VALUES (".$posts_limit.", '".$title."', '".$description."', '".$lang."', '".$template."', '".$url_installation."');";		
236 255
 			
237 256
 		$db->ejecutarConsulta($sqlStr);
238 257
 		
239 258
 		$sqlStr = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$login."', '".md5($password)."', '".$email."', '".$website."', '".$about."');";
240 259
 			
260
+		$db->ejecutarConsulta($sqlStr);
261
+		
262
+		$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '1');";
263
+		
264
+		$db->ejecutarConsulta($sqlStr);
265
+		
266
+		$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";
267
+		
241 268
 		$db->ejecutarConsulta($sqlStr);
242 269
 
243 270
 		return true;
244 271
 }
245 272
 
246 273
 function inerrors($errors,$n) {
247
-	if (strpos($errors,$n)===false)
274
+	if (strpos($errors,$n)===false) {
248 275
 		return false;
249
-	else
276
+	} else {
250 277
 		return true;
278
+	}
251 279
 }
252 280
 
253 281
 function mostrarerror($errors,$errors_d,$n) {
254
-	if (inerrors($errors,$n))
282
+	if (inerrors($errors,$n)) {
255 283
 		return '<span class="error">'.$errors_d[$n].'</span>';
256
-	else
284
+	} else {
257 285
 		return "";
286
+	}
258 287
 }
259
-?>
288
+?>

+ 5 - 2
login.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -11,6 +12,7 @@
11 12
 <?php
12 13
 header("Cache-Control: no-cache, must-revalidate");
13 14
 require( dirname(__FILE__) . '/config.php' );
15
+include(dirname(__FILE__)."/classes/functions.php");
14 16
 include(dirname(__FILE__)."/classes/user.class.php");
15 17
 require_once(dirname(__FILE__)."/classes/configuration.class.php");
16 18
 
@@ -33,6 +35,7 @@ if ($user->isAdmin()) {
33 35
 	<head>
34 36
 		<title>gelato :: login screen</title>
35 37
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
38
+		<meta name="generator" content="gelato cms <?php echo version();?>" />
36 39
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
37 40
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
38 41
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
@@ -55,7 +58,7 @@ if ($user->isAdmin()) {
55 58
 				<div class="box">
56 59
 					<ul class="menu manage">
57 60
 					<h3>Start session</h3>
58
-					<li class="selected"><a href="#">Login</a></li>
61
+					<li class="selected"><a>Login</a></li>
59 62
 					</ul>
60 63
 				
61 64
 					<div class="tabla">

+ 13 - 2
readme.txt View File

@@ -13,7 +13,7 @@
13 13
 That's it! gelato should now be installed.   
14 14
 
15 15
 
16
-==== How to install gelato CMS (Manual) =====
16
+==== How to install gelato CMS (Manually) =====
17 17
 
18 18
 1) Download and unzip the gelato package, if you haven't already.
19 19
 2) Create a database for gelato on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.
@@ -27,4 +27,15 @@ That's it! gelato should now be installed.
27 27
 
28 28
 That's it! gelato should now be installed.
29 29
 	Demo user: admin
30
-	Demo pass: demo
30
+	Demo pass: demo
31
+
32
+==== How to update to v0.85 from any previous version =====
33
+
34
+1) Download and unzip the gelato package, if you haven't already.
35
+2) Create a backup of your config.php file.
36
+3) Replace all the old files with those from the new 0.85 EXCEPT for the file config.php
37
+	3.1) If you do replace it by error, use the backup you create during step two.
38
+4) Execute the update.php file.
39
+7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'
40
+
41
+That's it! gelato should now be updated.

+ 5 - 3
rss.php View File

@@ -1,7 +1,8 @@
1 1
 <?php
2 2
 /* ===========================
3 3
 
4
-  gelato CMS development version
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
5 6
   http://www.gelatocms.com/
6 7
 
7 8
   gelato CMS is a free software licensed under GPL (General public license)
@@ -9,10 +10,11 @@
9 10
   =========================== */
10 11
 ?>
11 12
 <?php
12
-	header("Content-type: text/xml; charset=utf-8");
13
-		
13
+	header("Content-type: text/xml; charset=utf-8");	
14
+	
14 15
 	require(dirname(__FILE__)."/config.php");
15 16
 	include("classes/configuration.class.php");
17
+	$isFeed = true;
16 18
 	$conf = new configuration();
17 19
 	
18 20
 	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

+ 1 - 2
themes/tumblr/template_header.htm View File

@@ -1,8 +1,7 @@
1 1
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 2
 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 3
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
-<head>    
5
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
4
+<head>	
6 5
 	{Gelato_includes}	
7 6
     <title>{Title}</title>
8 7
     <!--[if IE]>

+ 71 - 0
update.php View File

@@ -0,0 +1,71 @@
1
+<?php
2
+/* ===========================
3
+
4
+  gelato CMS - A PHP based tumblelog CMS
5
+  development version
6
+  http://www.gelatocms.com/
7
+
8
+  gelato CMS is a free software licensed under GPL (General public license)
9
+
10
+  =========================== */
11
+?>
12
+<?php
13
+
14
+$configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
15
+	
16
+if (!file_exists($configFile)) {
17
+	$mensaje = "
18
+			<h3 class=\"important\">Error reading configuration file</h3>			
19
+			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
20
+			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
21
+	die($mensaje);
22
+} else {
23
+	require($configFile);
24
+} 
25
+
26
+$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
27
+
28
+$sqlStr = "CREATE TABLE `".Table_prefix."comments` (
29
+  `id_comment` int(11) NOT NULL auto_increment,
30
+  `id_post` int(11) NOT NULL,
31
+  `username` varchar(50) NOT NULL,
32
+  `email` varchar(100) NOT NULL,
33
+  `web` varchar(250) default NULL,
34
+  `content` text NOT NULL,
35
+  `ip_user` varchar(50) NOT NULL,
36
+  `comment_date` datetime NOT NULL,
37
+  `spam` tinyint(4) NOT NULL,
38
+  PRIMARY KEY  (`id_comment`)
39
+) ENGINE = MYISAM ;";
40
+
41
+$db->ejecutarConsulta($sqlStr);
42
+
43
+$sqlStr = "CREATE TABLE `".Table_prefix."options` (
44
+  `name` varchar(100) NOT NULL,
45
+  `val` varchar(255) NOT NULL,
46
+  PRIMARY KEY  (`name`)
47
+) ENGINE = MYISAM ;";
48
+
49
+$db->ejecutarConsulta($sqlStr);
50
+
51
+$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '1');";
52
+		
53
+$db->ejecutarConsulta($sqlStr);
54
+
55
+$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";
56
+
57
+$db->ejecutarConsulta($sqlStr);
58
+
59
+$sqlStr = "ALTER TABLE ".Table_prefix."config DROP url_friendly";
60
+
61
+$db->ejecutarConsulta($sqlStr);
62
+
63
+$sqlStr = "ALTER TABLE ".Table_prefix."config DROP rich_text";
64
+
65
+$db->ejecutarConsulta($sqlStr);
66
+
67
+
68
+echo "<p><em>Finished!</em></p>";
69
+echo "<p>Now you are running on the new version!!!</p>";
70
+
71
+?>