Browse Source

0.8 version

pecesama 17 years ago
parent
commit
47463b6544

+ 24 - 24
admin/admin.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once('../config.php');
13 13
 include("../classes/user.class.php");
14 14
 require_once("../classes/configuration.class.php");
@@ -24,9 +24,9 @@ if ($user->isAdmin()) {
24 24
 	<head>
25 25
 		<title>gelato :: admin users</title>
26 26
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
27
-		<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
28
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
29
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/sortable.js"></script>
27
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
28
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
29
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
30 30
 		<script type="text/javascript">
31 31
 		<!--
32 32
 			window.onload = function() {
@@ -40,7 +40,7 @@ if ($user->isAdmin()) {
40 40
 		-->
41 41
 		</script>
42 42
 		<style type="text/css" media="screen">	
43
-			@import "<?=$conf->urlGelato;?>/admin/css/style.css";
43
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
44 44
 		</style>
45 45
 	</head>
46 46
 	
@@ -48,10 +48,10 @@ if ($user->isAdmin()) {
48 48
 		<div id="div-process" style="display:none;">Processing request...</div>
49 49
 		<div id="cont">
50 50
 			<div id="head">
51
-				<h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
51
+				<h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
52 52
 				<ul id="nav">
53
-					<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
54
-					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
53
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
54
+					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
55 55
 			  	</ul>
56 56
 			</div>
57 57
 			<div id="main">				
@@ -59,13 +59,13 @@ if ($user->isAdmin()) {
59 59
 				<div class="box">
60 60
 					<ul class="menu manage">
61 61
 					<h3>Manage</h3>
62
-					<li><a href="#">Settings</a></li>
63
-					<li><a href="<?=$conf->urlGelato;?>/admin/index.php">Posts</a></li>
64
-					<li><a href="<?=$conf->urlGelato;?>/admin/user.php">Add user</a></li>
65
-					<li class="selected"><a href="#">Users</a></li>
62
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php">Settings</a></li>
63
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/index.php">Posts</a></li>
64
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/user.php">Add user</a></li>
65
+					<li class="selected"><a>Users</a></li>
66 66
 					</ul>
67 67
 					<p>&nbsp;</p>
68
-<?					
68
+<?php				
69 69
 						if (isset($_GET["added"])) {
70 70
 							if ($_GET["added"]=="true") {
71 71
 								echo "<div class=\"exito\" id=\"divMessages\">The user has been added successfully.</div>";
@@ -102,27 +102,27 @@ if ($user->isAdmin()) {
102 102
 								</tr>
103 103
 							</thead>
104 104
 							<tbody>
105
-<?	
105
+<?php
106 106
 					$odd=false;
107 107
 					$rs = $user->getUsers();
108 108
 					if ($user->contarRegistros()>0) {
109 109
 						while($register = mysql_fetch_array($rs)) {
110 110
 ?>
111
-							<tr <? if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
111
+							<tr <?php if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
112 112
 								<td>
113
-									<? echo $register["login"]."\n"; ?>
113
+									<?php echo $register["login"]."\n"; ?>
114 114
 								</td>
115 115
 								<td>
116
-									<? echo $register["name"]."\n"; ?>
116
+									<?php echo $register["name"]."\n"; ?>
117 117
 								</td>
118 118
 								<td>
119
-									<a href="user.php?edit=<?=$register["id_user"]; ?>">Edit</a>
119
+									<a href="user.php?edit=<?php echo $register["id_user"]; ?>">Edit</a>
120 120
 								</td>
121 121
 								<td>
122
-									<a href="user.php?delete=<?=$register["id_user"]; ?>">Delete</a>	
122
+									<a href="user.php?delete=<?php echo $register["id_user"]; ?>">Delete</a>	
123 123
 								</td>
124 124
 							</tr>
125
-<?
125
+<?php
126 126
 						}
127 127
 					}
128 128
 					else {
@@ -130,7 +130,7 @@ if ($user->isAdmin()) {
130 130
 						<tr> 
131 131
 							<td colspan="4"><div class="exito">No users available.</div></td>
132 132
 						</tr>
133
-<?
133
+<?php
134 134
 					}
135 135
 ?>
136 136
 							</tbody>
@@ -141,12 +141,12 @@ if ($user->isAdmin()) {
141 141
 				</div>
142 142
 			</div>
143 143
 			<div id="foot">
144
-				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
144
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
145 145
 			</div>
146 146
 		</div>
147 147
 	</body>
148 148
 	</html>
149
-<?
149
+<?php
150 150
 } else {
151 151
 	header("Location: ".$conf->urlGelato."/login.php");
152 152
 }

+ 2 - 2
admin/ajax.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 	require_once('../config.php');
13 13
 	include("../classes/user.class.php");
14 14
 	$user = new user();

+ 6 - 6
admin/close.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once('../config.php');
13 13
 include("../classes/user.class.php");
14 14
 
@@ -38,16 +38,16 @@ $user->closeSession()
38 38
 			<div  class="ventana">
39 39
 				<p class="titulo"><span class="handle" style="cursor:move;">Closing session</span></p>
40 40
 				<p>
41
-<?
41
+<?php
42 42
 if (@session_destroy()) {
43 43
 ?>
44 44
 		</p>
45 45
 				<h3>Ending session...</h3>
46
-<?	
46
+<?php
47 47
 } else {	
48 48
 ?>
49 49
 		<h3>Has happened an error when closing the session.</h3>
50
-<?	
50
+<?php
51 51
 }	
52 52
 ?> 
53 53
 				</p>
@@ -55,7 +55,7 @@ if (@session_destroy()) {
55 55
 		</div>
56 56
 		<div id="pie">
57 57
 			<p>
58
-				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
58
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
59 59
 			</p>
60 60
 		</div>
61 61
 	</div>	

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

@@ -14,9 +14,11 @@ div, p, ul, ol, li, h1, h2, h3, h4, h5, h6, h7,form, span, pre, a{margin:0; padd
14 14
 
15 15
 h1, h2, h3, h4, h5, h6, h7{ font-weight:normal;}
16 16
 
17
-a, a:link, a:visited, a:active{ color:#000; text-decoration:none; outline:none;}
17
+a, a:link, a:visited, a:active{ color:#000000; text-decoration:none; outline:none;}
18 18
 a:hover{ text-decoration:underline; color:#000000;  outline:none;}
19 19
 
20
+.inslnl { text-decoration:underline; }
21
+
20 22
 acronym{ border-bottom: 1px dotted #666; cursor:help;}
21 23
 fieldset{ border:none; margin:0; padding:0;}
22 24
 
@@ -66,6 +68,17 @@ form.newpost input.txt{ background: #fff url(images/grad-small.png) top left rep
66 68
 form.newpost input.btn{ }
67 69
 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;}
68 70
 
71
+legend.install{
72
+	font: normal 16.5px/17px georgia, "times new roman", serif;
73
+	border: 0;
74
+	margin-top: 0px;
75
+	padding-top:0;
76
+	margin-bottom: 0;
77
+	padding-bottom: 0;	
78
+	color: #c60;
79
+	margin-bottom: 10px;
80
+}
81
+
69 82
 .tabla{ background-color:#FFFBFF; margin:20px 15px; }
70 83
 .entry{ background-color:#efefef; border:1px solid #ccc; margin:20px 15px;}
71 84
 .info{ border-bottom:1px solid #aaa; position:relative; display:block; padding:4px 10px; height:20px; }
@@ -104,6 +117,12 @@ a.linkFrm:hover{ text-decoration:underline; color:#297aab;  outline:none;}
104 117
 .exito { width:80%; background: #F4FBF5 url('../../images/information.png') 15px center no-repeat; border-top: 2px solid #006600; border-bottom: 2px solid #006600; margin: 0 auto; padding: 5px 20px 5px 45px; }
105 118
 .information { width:80%; background: #FFF6BF url('../../images/icon_info.gif') 15px center no-repeat; border-top: 2px solid #FFD324; border-bottom: 2px solid #FFD324; margin: 0 auto;padding: 5px 20px 5px 45px; }
106 119
 
120
+#update { text-align:center; font-size: 10px; color: #000; }
121
+	#update a { color: #000; text-decoration:none; }
122
+	#update a:visited { color: #000; text-decoration:none; }
123
+	#update a:active { color: #000; text-decoration:none; }
124
+	#update a:hover { color: #000; text-decoration:underline; }
125
+
107 126
 /* Pagination */
108 127
 
109 128
 div.pagination { text-align:center; padding:3px; margin:3px; }

+ 123 - 61
admin/index.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,8 +8,9 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once('../config.php');
13
+include("../classes/functions.php");
13 14
 include("../classes/user.class.php");
14 15
 include("../classes/pagination.php");
15 16
 include("../classes/gelato.class.php");
@@ -22,9 +23,17 @@ $tumble = new gelato();
22 23
 $conf = new configuration();
23 24
 $template = new plantillas("admin");
24 25
 
26
+$isEdition = isset($_GET["edit"]);
27
+$postId = ($isEdition) ? $_GET["edit"] : NULL;
25 28
 
26 29
 if ($user->isAdmin()) {
27 30
 
31
+	if (isset($_GET["delete"])) {
32
+		$tumble->deletePost($_GET['delete']);
33
+		header("Location: index.php?deleted=true");
34
+		die();
35
+	}
36
+
28 37
 	if(isset($_POST["btnAdd"]))	{
29 38
 		unset($_POST["btnAdd"]);
30 39
 		
@@ -54,15 +63,14 @@ if ($user->isAdmin()) {
54 63
 				header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
55 64
 				die();
56 65
 			}
57
-			$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
58
-		}
66
+			if (isMP3($remoteFileName)) {
67
+				$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
68
+			}
69
+		}		
59 70
 		
60 71
 		if (get_magic_quotes_gpc()) {
61
-			$_POST["title"] = htmlspecialchars(stripslashes($_POST["title"]));
62
-			$_POST["description"] = htmlspecialchars(stripslashes($_POST["description"]));
63
-		} else {
64
-			$_POST["title"] = htmlspecialchars($_POST["title"]);
65
-			$_POST["description"] = htmlspecialchars($_POST["description"]);
72
+			$_POST["title"] = stripslashes($_POST["title"]);
73
+			$_POST["description"] = stripslashes($_POST["description"]);
66 74
 		}
67 75
 		
68 76
 		$_POST["title"] = strip_tags($_POST["title"]);
@@ -70,7 +78,7 @@ if ($user->isAdmin()) {
70 78
 		
71 79
 		
72 80
 		if (isset($_POST["id_post"])) {
73
-			//$tumble->modifyPost($_POST, $_POST["id_post"]);
81
+			$tumble->modifyPost($_POST, $_POST["id_post"]);
74 82
 		} else {			
75 83
 			if ($tumble->addPost($_POST)) {
76 84
 				header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
@@ -80,18 +88,22 @@ if ($user->isAdmin()) {
80 88
 				die();
81 89
 			}
82 90
 		}	
83
-	}
91
+	} else {
92
+		if ($isEdition) {
93
+			$post = $tumble->getPost($postId);
94
+		}
95
+	
84 96
 ?>	
85 97
 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
86 98
 	<html xmlns="http://www.w3.org/1999/xhtml">
87 99
 	<head>
88 100
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
89
-		<title>gelato :: Control panel</title>
90
-		<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
91
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/tools.js"></script>
92
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
93
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/slimbox.js"></script>
94
-		<script type="text/javascript">
101
+		<title>gelato :: control panel</title>
102
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
103
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
104
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
105
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/slimbox.js"></script>
106
+		<script language="javascript" type="text/javascript">
95 107
 		<!--
96 108
 			function exit(el, path) {
97 109
 				el = $(el);
@@ -117,8 +129,8 @@ if ($user->isAdmin()) {
117 129
 		-->
118 130
 		</script>
119 131
 		<style type="text/css" media="screen">	
120
-			@import "<?=$conf->urlGelato;?>/admin/css/style.css";
121
-			@import "<?=$conf->urlGelato;?>/admin/css/slimbox.css";
132
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
133
+			@import "<?php echo $conf->urlGelato;?>/admin/css/slimbox.css";
122 134
 		</style>
123 135
 	</head>
124 136
 	
@@ -126,41 +138,47 @@ if ($user->isAdmin()) {
126 138
 		<div id="div-process" style="display:none;">Processing request...</div>
127 139
 		<div id="cont">
128 140
 			<div id="head">
129
-				<h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
141
+				<h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
130 142
 				<ul id="nav">
131
-					<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
132
-					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
143
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
144
+					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
133 145
 			  	</ul>
134 146
 			</div>
135 147
 			<div id="main">
136 148
 				<div class="box">
137 149
 					<ul class="menu">
138 150
 					<h3>New Post</h3>					
139
-					<li <? echo ($_GET["new"]=="conversation") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> Chat</a></li>
140
-					<li <? echo ($_GET["new"]=="quote") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/quote.png" alt="New qoute" /> Quote</a></li>
141
-					<li <? echo ($_GET["new"]=="url") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> Link</a></li>
142
-					<li <? echo ($_GET["new"]=="mp3") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> Audio</a></li>
143
-					<li <? echo ($_GET["new"]=="video") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> Video</a></li>
144
-					<li <? echo ($_GET["new"]=="photo") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> Picture</a></li>
145
-					<li <? echo ($_GET["new"]=="post") ? "class=\"selected\"" : ""; echo (!isset($_GET["new"])) ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page.png" alt="New post" /> Regular</a></li>
151
+					<li<?php echo ($_GET["new"]=="conversation") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> Chat</a></li>
152
+					<li<?php echo ($_GET["new"]=="quote") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/quote.png" alt="New qoute" /> Quote</a></li>
153
+					<li<?php echo ($_GET["new"]=="url") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> Link</a></li>
154
+					<li<?php echo ($_GET["new"]=="mp3") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> Audio</a></li>
155
+					<li<?php echo ($_GET["new"]=="video") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> Video</a></li>
156
+					<li<?php echo ($_GET["new"]=="photo") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> Picture</a></li>
157
+					<li<?php echo ($_GET["new"]=="post") ? " class=\"selected\"" : ""; echo (!isset($_GET["new"])) ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page.png" alt="New post" /> Regular</a></li>
146 158
 					</ul>
147 159
 					<p>&nbsp;</p>					
148
-<?					
160
+<?php			
161
+					$present = version();
162
+					$lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
163
+					if ($present < $lastest) {
164
+						echo "<div class=\"information\" id=\"update\">A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>.</div>";
165
+					}
166
+					
149 167
 					if (isset($_GET["deleted"])) {
150 168
 						if ($_GET["deleted"]=="true") {
151
-							echo "<div class=\"exito\" id=\"divMessages\">The article has been eliminated successfully.</div>";
169
+							echo "<div class=\"exito\" id=\"divMessages\">The post has been eliminated successfully.</div>";
152 170
 						}
153 171
 					}
154 172
 					
155 173
 					if (isset($_GET["modified"])) {
156 174
 						if ($_GET["modified"]=="true") {
157
-							echo "<div class=\"exito\" id=\"divMessages\">The article has been modified successfully.</div>";
175
+							echo "<div class=\"exito\" id=\"divMessages\">The post has been modified successfully.</div>";
158 176
 						}
159 177
 					}
160 178
 					
161 179
 					if (isset($_GET["added"])) {
162 180
 						if ($_GET["added"]=="true") {
163
-							echo "<div class=\"exito\" id=\"divMessages\">The article has been added successfully.</div>";
181
+							echo "<div class=\"exito\" id=\"divMessages\">The post has been added successfully.</div>";
164 182
 						}
165 183
 					}
166 184
 					
@@ -180,64 +198,99 @@ if ($user->isAdmin()) {
180 198
 						if ($_GET["photo"]=="false") {
181 199
 							echo "<div class=\"error\" id=\"divMessages\">Not a photo file or an upload problem.</div>";
182 200
 						}
183
-					}
201
+					}					
184 202
 ?>					
185
-					<form action="index.php" method="post" <?=($_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
203
+					<form action="index.php" method="post" <?php echo ($_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
186 204
 						<fieldset>
187
-<?
205
+<?php
206
+							if ($isEdition) {
207
+?>
208
+								<input type="hidden" name="id_post" id="id_post" value="<?php echo $postId;?>" />
209
+<?php
210
+								switch ($post["type"]) {
211
+									case "1":
212
+										$_GET["new"] = "post";
213
+										break;
214
+									case "2":
215
+										$_GET["new"] = "photo";							   
216
+										break;
217
+									case "3":
218
+										$_GET["new"] = "quote";
219
+										break;
220
+									case "4":
221
+										$_GET["new"] = "url";
222
+										break;
223
+									case "5":
224
+										$_GET["new"] = "conversation";
225
+										break;
226
+									case "6":
227
+										$_GET["new"] = "video";
228
+										break;
229
+									case "7":
230
+										$_GET["new"] = "mp3";
231
+										break;								
232
+								}
233
+								
234
+							}
235
+							
236
+							$date = ($isEdition) ? strtotime($post["date"]) : time();
237
+							$title = ($isEdition) ? $post["title"] : "";
238
+							$body = ($isEdition) ? $post["description"] : "";
239
+							$url = ($isEdition) ? $post["url"] : "";
240
+							
188 241
 							switch ($_GET["new"]) {
189 242
 								case "post":
190
-									$input = array("{type}", "{date}", "{id_user}");
191
-									$output = array("1", time(), $_SESSION['user_id']);
243
+									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
244
+									$output = array("1", $date, $_SESSION['user_id'], $title, $body);
192 245
 									
193 246
 									$template->cargarPlantilla($input, $output, "template_add_post");
194 247
 									$template->mostrarPlantilla();
195 248
 									break;
196 249
 								case "photo":
197
-									$input = array("{type}", "{date}", "{id_user}");
198
-									$output = array("2", time(), $_SESSION['user_id']);
250
+									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
251
+									$output = array("2", $date, $_SESSION['user_id'], $url, $body);
199 252
 									
200 253
 									$template->cargarPlantilla($input, $output, "template_add_photo");
201 254
 									$template->mostrarPlantilla();							   
202 255
 									break;
203 256
 								case "quote":
204
-									$input = array("{type}", "{date}", "{id_user}");
205
-									$output = array("3", time(), $_SESSION['user_id']);
257
+									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
258
+									$output = array("3", $date, $_SESSION['user_id'], $title, $body);
206 259
 									
207 260
 									$template->cargarPlantilla($input, $output, "template_add_quote");
208 261
 									$template->mostrarPlantilla();
209 262
 									break;
210 263
 								case "url":
211
-									$input = array("{type}", "{date}", "{id_user}");
212
-									$output = array("4", time(), $_SESSION['user_id']);
264
+									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
265
+									$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
213 266
 									
214 267
 									$template->cargarPlantilla($input, $output, "template_add_link");
215 268
 									$template->mostrarPlantilla();
216 269
 									break;
217 270
 								case "conversation":
218
-									$input = array("{type}", "{date}", "{id_user}");
219
-									$output = array("5", time(), $_SESSION['user_id']);
271
+									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
272
+									$output = array("5", $date, $_SESSION['user_id'], $title, $body);
220 273
 									
221 274
 									$template->cargarPlantilla($input, $output, "template_add_conversation");
222 275
 									$template->mostrarPlantilla();
223 276
 									break;
224 277
 								case "video":
225
-									$input = array("{type}", "{date}", "{id_user}");
226
-									$output = array("6", time(), $_SESSION['user_id']);
278
+									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
279
+									$output = array("6", $date, $_SESSION['user_id'], $url, $body);
227 280
 									
228 281
 									$template->cargarPlantilla($input, $output, "template_add_video");
229 282
 									$template->mostrarPlantilla();
230 283
 									break;
231 284
 								case "mp3":
232
-									$input = array("{type}", "{date}", "{id_user}");
233
-									$output = array("7", time(), $_SESSION['user_id']);
285
+									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
286
+									$output = array("7", $date, $_SESSION['user_id'], $url, $body);
234 287
 									
235 288
 									$template->cargarPlantilla($input, $output, "template_add_mp3");
236 289
 									$template->mostrarPlantilla();
237 290
 									break;
238 291
 								default:
239
-									$input = array("{type}", "{date}", "{id_user}");
240
-									$output = array("1", time(), $_SESSION['user_id']);
292
+									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
293
+									$output = array("1", $date, $_SESSION['user_id'], $title, $body);
241 294
 									
242 295
 									$template->cargarPlantilla($input, $output, "template_add_post");
243 296
 									$template->mostrarPlantilla();
@@ -245,23 +298,28 @@ if ($user->isAdmin()) {
245 298
 							}
246 299
 ?>
247 300
 								<p>
248
-									<input class="btn" type="submit" name="btnAdd" value="Create post" />
301
+									<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> syntax is supported.</span>
302
+								</p>
303
+								<p>									
304
+									<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
249 305
 								</p>
250 306
 						</fieldset>
251 307
 					</form>
252 308
 					
253 309
 					<div class="footer-box">&nbsp;</div>
254 310
 				</div>
255
-				
311
+<?php
312
+				if (!$isEdition) {
313
+?>
256 314
 				<div class="box">
257 315
 					<ul class="menu manage">
258 316
 					<h3>Manage</h3>
259
-					<li><a href="#">Settings</a></li>
260
-					<li><a href="<?=$conf->urlGelato;?>/admin/admin.php">Users</a></li>
261
-					<li class="selected"><a href="#">Posts</a></li>
317
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php">Settings</a></li>
318
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php">Users</a></li>
319
+					<li class="selected"><a>Posts</a></li>
262 320
 					</ul>
263 321
 
264
-<?
322
+<?php
265 323
 					if (isset($_GET["page"])) {
266 324
 						$page_num = $_GET["page"];
267 325
 					} else {
@@ -284,7 +342,7 @@ if ($user->isAdmin()) {
284 342
 							$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
285 343
 							
286 344
 							$textile = new Textile;
287
-							$register["description"] = $textile->process(str_replace("&quot;", "\"", $register["description"]));
345
+							$register["description"] = $textile->process($register["description"]);
288 346
 							
289 347
 							switch ($tumble->getType($register["id_post"])) {
290 348
 								case "1":
@@ -361,13 +419,17 @@ if ($user->isAdmin()) {
361 419
 					<div class="footer-box">&nbsp;</div>
362 420
 				</div>
363 421
 			</div>
422
+<?php
423
+			}
424
+?>
364 425
 			<div id="foot">
365
-				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
426
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
366 427
 			</div>
367 428
 		</div>
368 429
 	</body>
369 430
 	</html>
370
-<?
431
+<?php
432
+	}
371 433
 } else {
372 434
 	header("Location: ".$conf->urlGelato."/login.php");
373 435
 }

+ 145 - 0
admin/settings.php View File

@@ -0,0 +1,145 @@
1
+<?php
2
+/* ===========================
3
+
4
+  gelato CMS development version
5
+  http://www.gelatocms.com/
6
+
7
+  gelato CMS is a free software licensed under GPL (General public license)
8
+
9
+  =========================== */
10
+?>
11
+<?php
12
+require_once('../config.php');
13
+include("../classes/functions.php");
14
+include("../classes/user.class.php");
15
+include("../classes/gelato.class.php");
16
+require_once("../classes/configuration.class.php");
17
+
18
+$user = new user();
19
+$tumble = new gelato();
20
+$conf = new configuration();
21
+
22
+if ($user->isAdmin()) {
23
+	
24
+	if(isset($_POST["btnsubmit"]))	{		
25
+		unset($_POST["btnsubmit"]);
26
+		$_POST["url_installation"] = (endsWith($_POST["url_installation"], "/")) ? substr($_POST["url_installation"], 0, strlen($_POST["url_installation"])-1) : $_POST["url_installation"] ;
27
+		$tumble->saveSettings($_POST);
28
+	} else {
29
+?>
30
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31
+	<html xmlns="http://www.w3.org/1999/xhtml">
32
+	<head>
33
+		<title>gelato :: settings</title>
34
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
35
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
36
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
37
+		<script type="text/javascript">
38
+		<!--
39
+			window.onload = function() {
40
+				contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
41
+					function() {
42
+						document.getElementById('divMessages').style.display="none";
43
+					}
44
+				});
45
+				contenedor.custom(1,0);
46
+			}
47
+		-->
48
+		</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="div-process" style="display:none;">Processing request...</div>
56
+		<div id="cont">
57
+			<div id="head">
58
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
59
+				<ul id="nav">
60
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
61
+			  	</ul>
62
+			</div>
63
+			<div id="main">				
64
+				
65
+				<div class="box">
66
+					<ul class="menu manage">
67
+					<h3>Tumblelog configuration</h3>
68
+					<li><a href="index.php">Post</a></li>
69
+					<li><a href="admin.php">Users</a></li>
70
+					<li class="selected"><a>Settings</a></li>
71
+					</ul>
72
+					<p>&nbsp;</p>
73
+<?php
74
+					if (isset($_GET["modified"])) {
75
+						if ($_GET["modified"]=="true") {
76
+							echo "<div class=\"exito\" id=\"divMessages\">The configuration has been modified successfully.</div>";
77
+						}
78
+					}					
79
+					if (isset($_GET["error"])) {
80
+						if ($_GET["error"]==1) {
81
+							echo "<div class=\"error\" id=\"divMessages\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
82
+						}
83
+					}
84
+?>
85
+					<div class="tabla">
86
+
87
+						<form action="settings.php" method="post" id="settings_form" autocomplete="off" class="newpost">							
88
+							<fieldset>								
89
+								<ul>							
90
+									<li><label for="title">Title:</label>
91
+										<input type="text" name="title" id="title" value="<?php echo $conf->title;?>" class="txt"/></li>
92
+									<li><label for="description">Description:</label>
93
+										<input type="text" name="description" id="description" value="<?php echo $conf->description;?>" class="txt"/></li>
94
+									<li><label for="url_installation">Installation URL</label>
95
+										<input type="text" name="url_installation" id="url_installation" value="<?php echo $conf->urlGelato;?>" class="txt"/></li>
96
+									<li><label for="posts_limit">Post limit:</label>
97
+										<input type="text" name="posts_limit" id="posts_limit" value="<?php echo $conf->postLimit;?>" class="txt"/></li>
98
+									<li><label for="lang">Language:</label>
99
+										<select id="lang" name="lang">
100
+											<option value="en" selected="selected">english</option>
101
+										</select>
102
+									</li>
103
+									<li><label for="template">Template:</label>
104
+										<select id="template" name="template">
105
+<?php
106
+										$themes = getThemes();
107
+										foreach ($themes as $theme) {									
108
+											echo "<option value=\"".$theme."\" selected=\"true\">".$theme."</option>\n";
109
+											
110
+										}
111
+?>
112
+										</select>
113
+									</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
+								</ul>
121
+							</fieldset>
122
+							<p>								
123
+								
124
+								<input type="hidden" name="url_friendly" id="url_friendly" value="0" />								
125
+								<input type="submit" name="btnsubmit" id="btnsubmit" value="Modify" class="submit"/>
126
+							</p>
127
+						</form>	
128
+								
129
+					</div>
130
+
131
+					<div class="footer-box">&nbsp;</div>
132
+				</div>
133
+			</div>
134
+			<div id="foot">
135
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
136
+			</div>
137
+		</div>
138
+	</body>
139
+	</html>
140
+<?php
141
+	}
142
+} else {
143
+	header("Location: ".$conf->urlGelato."/login.php");
144
+}
145
+?>

+ 3 - 3
admin/themes/admin/template_add_conversation.htm View File

@@ -1,6 +1,6 @@
1 1
 									<p>
2 2
 										<label for="title">Title <span class="option">(optional)</span></label>
3
-											<input class="txt" type="text" name="title" id="title" size="80" />
3
+											<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
4 4
 									</p>
5 5
 									<input type="hidden" name="url" id="url" value="" />
6 6
 									<p>
@@ -10,10 +10,10 @@
10 10
 											<span style="font-style: italic;">
11 11
 												Geek: Wow an open source tumblelog CMS!!.<br>
12 12
 												Normal: Tumble... what??<br>
13
-												Geek: Read the fucking wikipedia!!
13
+												Geek: Read the wikipedia!!
14 14
 											</span>
15 15
 										</div>
16
-											<textarea rows="12" cols="84" name="description" id="description"></textarea>
16
+											<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
17 17
 									</p>
18 18
 									<input type="hidden" name="type" id="type" value="{type}" />
19 19
 									<input type="hidden" name="date" id="date" value="{date}" />

+ 3 - 3
admin/themes/admin/template_add_link.htm View File

@@ -1,10 +1,10 @@
1 1
 									<p>
2 2
 										<label for="title">Name <span class="option">(optional)</span></label>			
3
-											<input class="txt" type="text" name="title" id="title" size="80" />
3
+											<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
4 4
 									</p>
5 5
 									<p>
6 6
 										<label for="url">URL</label>			
7
-											<input class="txt" type="text" name="url" id="url" size="80" />
7
+											<input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
8 8
 									</p>
9 9
 									<p>
10 10
 									<div id="add_link_description" style="margin-top:5px;">
@@ -12,7 +12,7 @@
12 12
 									</div>								
13 13
 									<div id="link_description" style="display:none;">
14 14
 										<label for="description">Description</label><br />								
15
-											<textarea rows="12" cols="84" name="description" id="description"></textarea>											
15
+											<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
16 16
 									</div>
17 17
 									</p>
18 18
 									<input type="hidden" name="type" id="type" value="{type}" />

+ 4 - 3
admin/themes/admin/template_add_mp3.htm View File

@@ -1,14 +1,15 @@
1 1
 									<input type="hidden" name="title" id="title" value="" />
2 2
 									<p>
3 3
 										<label for="url">MP3 URL</label>			
4
-											<input class="txt" type="text" name="url" id="url" size="80" />
4
+											<input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
5 5
 										<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
6
-											This is the MP3 file URL.
6
+											This is the MP3 file URL or a GoEar URL.<br>
7
+											<span style="font-size: 10px; font-weight: normal;">(ie. http://www.goear.com/listen.php?v=c0a2c85)</span>
7 8
 										</div>
8 9
 									</p>									
9 10
 									<p>
10 11
 										<label for="description">Caption <span class="option">(optional)</span></label><br />
11
-											<textarea rows="12" cols="84" name="description" id="description" tabindex="2"></textarea>											
12
+											<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>											
12 13
 									</p>
13 14
 									<input type="hidden" name="type" id="type" value="{type}" />
14 15
 									<input type="hidden" name="date" id="date" value="{date}" />

+ 2 - 2
admin/themes/admin/template_add_photo.htm View File

@@ -15,7 +15,7 @@
15 15
 									
16 16
 										<div id="photo_url" style="display:none;">
17 17
 											<label for="description">Photo URL</label>
18
-												<input class="input-text" type="text" name="url" id="url" size="80" />
18
+												<input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
19 19
 											<div style="font-size:11px; color:#666; margin-top:5px;">
20 20
 												The photo URL.</b>
21 21
 											</div>
@@ -23,7 +23,7 @@
23 23
 									</p>
24 24
 									<p>
25 25
 										<label for="description">Caption <span class="option">(optional)</span></label><br />
26
-											<textarea rows="12" cols="84" name="description" id="description"></textarea>											
26
+											<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
27 27
 									</p>
28 28
 									<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
29 29
 									<input type="hidden" name="type" id="type" value="{type}" />

+ 2 - 2
admin/themes/admin/template_add_post.htm View File

@@ -1,11 +1,11 @@
1 1
 									<p>
2 2
 										<label for="title">Title <span class="option">(optional)</span></label>
3
-											<input class="txt" type="text" name="title" id="title" size="80" />
3
+											<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
4 4
 									</p>
5 5
 									<input class="txt" type="hidden" name="url" id="url" value="" />
6 6
 									<p>
7 7
 										<label for="description">Body</label><br />
8
-											<textarea rows="12" cols="84" name="description" id="description"></textarea>											
8
+											<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
9 9
 									</p>
10 10
 									<input type="hidden" name="type" id="type" value="{type}" />
11 11
 									<input type="hidden" name="date" id="date" value="{date}" />

+ 2 - 2
admin/themes/admin/template_add_quote.htm View File

@@ -1,11 +1,11 @@
1 1
 									<input type="hidden" name="url" id="url" value="" />
2 2
 									<p>
3 3
 										<label for="description">Quote</label><br />
4
-											<textarea rows="12" cols="84" name="description" id="description"></textarea>											
4
+											<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
5 5
 									</p>
6 6
 									<p>
7 7
 										<label for="title">Source <span class="option">(optional)</span></label>
8
-											<input class="txt" type="text" name="title" id="title" size="80" />
8
+											<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
9 9
 									</p>
10 10
 									<input type="hidden" name="type" id="type" value="{type}" />
11 11
 									<input type="hidden" name="date" id="date" value="{date}" />

+ 3 - 3
admin/themes/admin/template_add_video.htm View File

@@ -1,15 +1,15 @@
1 1
 									<input type="hidden" name="title" id="title" value="" />
2 2
 									<p>
3 3
 										<label for="url">Video URL</label>			
4
-											<input class="txt" type="text" name="url" id="url" size="80" />
4
+											<input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
5 5
 										<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
6
-											This is a URL from the video sites YouTube, Vimeo or Google.<br>
6
+											This is the URL from the video sites YouTube or Vimeo.<br>
7 7
 											<span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span>
8 8
 										</div>
9 9
 									</p>									
10 10
 									<p>
11 11
 										<label for="description">Caption <span class="option">(optional)</span></label><br />
12
-											<textarea rows="12" cols="84" name="description" id="description" tabindex="2"></textarea>											
12
+											<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>											
13 13
 									</p>
14 14
 									<input type="hidden" name="type" id="type" value="{type}" />
15 15
 									<input type="hidden" name="date" id="date" value="{date}" />

+ 21 - 21
admin/user.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once('../config.php');
13 13
 include("../classes/functions.php");
14 14
 include("../classes/user.class.php");
@@ -53,8 +53,8 @@ if ($user->isAdmin()) {
53 53
 	<head>
54 54
 		<title>gelato :: add user</title>
55 55
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56
-		<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
57
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
56
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
57
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
58 58
 		<script language="javascript" type="text/javascript">								
59 59
 			function validateFrmAddUser() {
60 60
 				if ($('login').value == "") {
@@ -90,7 +90,7 @@ if ($user->isAdmin()) {
90 90
 			}
91 91
 		</script>
92 92
 		<style type="text/css" media="screen">	
93
-			@import "<?=$conf->urlGelato;?>/admin/css/style.css";
93
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
94 94
 		</style>
95 95
 	</head>
96 96
 	
@@ -98,9 +98,9 @@ if ($user->isAdmin()) {
98 98
 		<div id="div-process" style="display:none;">Processing request...</div>
99 99
 		<div id="cont">
100 100
 			<div id="head">
101
-				<h1><a href="<?=$conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
101
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
102 102
 				<ul id="nav">
103
-					<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
103
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
104 104
 			  	</ul>
105 105
 			</div>
106 106
 			<div id="main">				
@@ -110,7 +110,7 @@ if ($user->isAdmin()) {
110 110
 					<h3>Start session</h3>
111 111
 					<li><a href="index.php">Post</a></li>
112 112
 					<li><a href="admin.php">Users</a></li>
113
-					<li class="selected"><a href="#"><? echo ($isEdition) ? "Edit" : "Add"; ?></a></li>
113
+					<li class="selected"><a><?php echo ($isEdition) ? "Edit" : "Add"; ?></a></li>
114 114
 					</ul>
115 115
 				
116 116
 					<div class="tabla">
@@ -118,23 +118,23 @@ if ($user->isAdmin()) {
118 118
 						<form action="user.php" method="post" onSubmit="return validateFrmAddUser();" name="frm_add" class="newpost">
119 119
 						<fieldset>
120 120
 						<ul>
121
-<?
121
+<?php
122 122
 							if ($isEdition) {
123 123
 ?>
124
-							<input type="hidden" name="id_user" id="id_user" value="<?=$userId;?>" />
125
-<?
124
+							<input type="hidden" name="id_user" id="id_user" value="<?php echo $userId;?>" />
125
+<?php
126 126
 							}
127 127
 ?>
128 128
 							<li>
129 129
 								<label for="login">user:</label>
130
-									<input class="txt" name="login" id="login" type="text" autocomplete="off" value="<?=isset($register["login"])?$register["login"]:"";?>" />
131
-<?
130
+									<input class="txt" name="login" id="login" type="text" autocomplete="off" value="<?php echo isset($register["login"])?$register["login"]:"";?>" />
131
+<?php
132 132
 							if (!$isEdition) {
133 133
 ?>
134 134
 									<script language="javascript" type="text/javascript">						
135 135
 										document.write("<br /><input class='submit_normal_azul' name='btnVerifyUser' id='btnVerifyUser' type='button' value='Check availability' onclick='verifyExistingUser()' />");
136 136
 									</script>
137
-<?
137
+<?php
138 138
 							}
139 139
 ?>
140 140
 							</li>
@@ -151,22 +151,22 @@ if ($user->isAdmin()) {
151 151
 							</li>
152 152
 							<li>
153 153
 								<label for="name">name:</label>
154
-									<input class="txt" name="name" id="name" type="text" value="<?=isset($register["name"])?$register["name"]:"";?>" />
154
+									<input class="txt" name="name" id="name" type="text" value="<?php echo isset($register["name"])?$register["name"]:"";?>" />
155 155
 							</li>
156 156
 							<li>
157 157
 								<label for="email">e-mail:</label>
158
-									<input class="txt" name="email" id="email" type="text" value="<?=isset($register["email"])?$register["email"]:"";?>" />
158
+									<input class="txt" name="email" id="email" type="text" value="<?php echo isset($register["email"])?$register["email"]:"";?>" />
159 159
 							</li>
160 160
 							<li>
161 161
 								<label for="website">website:</label>
162
-									<input class="txt" name="website" id="website" type="text" value="<?=isset($register["website"])?$register["website"]:"";?>" />
162
+									<input class="txt" name="website" id="website" type="text" value="<?php echo isset($register["website"])?$register["website"]:"";?>" />
163 163
 							</li>								
164 164
 							<li>
165 165
 								<label for="about">about:</label><br />
166
-									<textarea rows="5" cols="50" name="about" id="about" tabindex="7"><?=isset($register["about"])?$register["about"]:"";?></textarea>									
166
+									<textarea rows="5" cols="50" name="about" id="about" tabindex="7"><?php echo isset($register["about"])?$register["about"]:"";?></textarea>									
167 167
 							</li>								
168 168
 							<li>
169
-								<input name="btnAdd" type="submit" value="<? echo ($isEdition) ? "Modify" : "Add"; ?> user" />
169
+								<input name="btnAdd" type="submit" value="<?php echo ($isEdition) ? "Modify" : "Add"; ?> user" />
170 170
 							</li>
171 171
 						</ul>
172 172
 						</fieldset>
@@ -178,12 +178,12 @@ if ($user->isAdmin()) {
178 178
 				</div>
179 179
 			</div>
180 180
 			<div id="foot">
181
-				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
181
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
182 182
 			</div>
183 183
 		</div>
184 184
 	</body>
185 185
 	</html>
186
-<?
186
+<?php
187 187
 	}
188 188
 } else {
189 189
 	header("Location: ".$conf->urlGelato."/login.php");

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

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 class configuration extends Conexion_Mysql {
13 13
 	
14 14
 	var $urlGelato;

+ 18 - 13
classes/functions.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,11 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12
+	function version() {
13
+		return "0.8";
14
+	}
15
+	
12 16
 	function beginsWith($str, $sub) {
13 17
 		return (strpos($str, $sub) === 0);
14 18
 	}
@@ -28,7 +32,7 @@
28 32
 		} else {
29 33
 			return false;
30 34
 		}
31
-	}
35
+	}	
32 36
 	
33 37
 	function getMP3File($remoteFileName) {
34 38
 		if (isMP3($remoteFileName)) {
@@ -37,11 +41,20 @@
37 41
 			} else {
38 42
 				return false;
39 43
 			}
44
+		} elseif (isGoEar($remoteFileName)) {
45
+			return true;
40 46
 		} else {
41 47
 			return false;
42 48
 		}
43 49
 	}
44 50
 	
51
+	function isGoEar($songUrl) {
52
+		if (beginsWith($songUrl, "http://www.goear.com/listen.php?v="))
53
+			return true;
54
+		else
55
+			return false;
56
+	}
57
+	
45 58
 	function isImageFile($photoUrl) {
46 59
 		if (endsWith($photoUrl, ".jpg")) { return true; }
47 60
 		elseif (endsWith($photoUrl, ".gif")) { return true; }
@@ -96,19 +109,11 @@
96 109
 		$params = explode("?v=", $videoUrl);
97 110
 		$params2 = explode("&",$params[1]);
98 111
 		return $params2[0];
99
-	}
100
-	
101
-	function isGoogleVideo($videoUrl) {
102
-		if (beginsWith($videoUrl, "http://video.google.com/videoplay?docid="))
103
-			return true;
104
-		else
105
-			return false;
106
-	}
112
+	}	
107 113
 	
108 114
 	function isVideo($url) {
109 115
 		if (isYoutubeVideo($url)) { return true; }
110 116
 		elseif (isVimeoVideo($url)) { return true; }
111
-		elseif (isGoogleVideo($url)) { return true; }
112 117
 		else { return false; }
113 118
 	}
114 119
 	
@@ -151,7 +156,7 @@
151 156
  		}
152 157
  		closedir($handle);
153 158
  		return $dirs;
154
- 	}
159
+ 	}	
155 160
 	
156 161
 	function _file_get_contents($path) {
157 162
 		// Modified function from: 

+ 32 - 29
classes/gelato.class.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once("configuration.class.php");
13 13
 require_once("functions.php");
14 14
 
@@ -20,12 +20,36 @@ class gelato extends Conexion_Mysql {
20 20
 		$this->conf = new configuration();		
21 21
 	}
22 22
 	
23
+	function saveSettings($fieldsArray) {
24
+		if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) {
25
+			header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true");
26
+			die();
27
+		} else {
28
+			header("Location: ".$this->conf->urlGelato."/admin/settings.php?error=1&des=".$this->merror);
29
+			die();
30
+		}
31
+	}
32
+	
23 33
 	function addPost($fieldsArray) {		
24 34
 		if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
25 35
 			return true;
26 36
 		} else {
27 37
 			return false;
28 38
 		}		
39
+	}
40
+	
41
+	function modifyPost($fieldsArray, $id_post) {
42
+		if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) {
43
+			header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true");
44
+			die();
45
+		} else {
46
+			header("Location: ".$this->conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
47
+			die();
48
+		}
49
+	}
50
+	
51
+	function deletePost($idPost) {
52
+		$this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost);
29 53
 	}	
30 54
 	
31 55
 	function getPosts($limit="10", $from="0") {
@@ -90,6 +114,8 @@ class gelato extends Conexion_Mysql {
90 114
 	function saveMP3($remoteFileName) {
91 115
 		if (getMP3File($remoteFileName)) {
92 116
 			return true;
117
+		} elseif (isGoEar($remoteFileName)) {
118
+			return true;
93 119
 		} else {
94 120
 			return false;
95 121
 		}
@@ -110,33 +136,8 @@ class gelato extends Conexion_Mysql {
110 136
 		} elseif (isVimeoVideo($url)) {
111 137
 			$id_video = getVimeoVideoUrl($url);
112 138
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";
113
-		} elseif (isGoogleVideo($url)) {
114
-			$html = trim(_file_get_contents($url));
115
-			$start_code = strpos($html, "var flashObj =\n    \"");
116
-			$end_code = strpos($html, "\";\n  flashObj = flashObj.replace");
117
-			$start_code = $start_code + strlen("var flashObj =\n    \"");
118
-			$video_code = substr($html, $start_code, $end_code - $start_code);	
119
-			$video_code = str_replace("\u003c", "<", $video_code);
120
-			$video_code = str_replace("\u003d", "=", $video_code);
121
-			$video_code = str_replace("\\\"", "\"", $video_code);
122
-			$video_code = str_replace("width:100%;height:100%;", "width:500px;height:393px", $video_code);
123
-			$video_code = str_replace("/googleplayer.swf", "http://video.google.com/googleplayer.swf", $video_code);
124
-			$video_code = str_replace("embed", "object", $video_code);
125
-			$video_code = str_replace("src=", "data=", $video_code);
126
-			$video_code = str_replace('align="middle"', "", $video_code);
127
-			$video_code = str_replace('allowScriptAccess="always"', "", $video_code);
128
-			$video_code = str_replace('quality="best"', "", $video_code);
129
-			$video_code = str_replace('bgcolor="#ffffff"', "", $video_code);
130
-			$video_code = str_replace('scale="noScale"', "", $video_code);
131
-			$video_code = str_replace('salign="TL"', "", $video_code);	
132
-			$video_code = str_replace('FlashVars="playerMode=normal&autoPlay=true&docid=-2519555829449987448&clickUrl="', "", $video_code);
133
-			$video_code = str_replace('          \\', " /", $video_code);
134
-			$video_code = str_replace('\></object\>', ' ></object>', $video_code);
135
-			$video_code = str_replace("id=\"VideoPlayback\"", "", $video_code);
136
-			$video_code = str_replace("&", "&amp;", $video_code);
137
-			return $video_code;
138 139
 		} else {
139
-			return "This URL is not a supported video (YouTube, Vimeo or Google Video)";
140
+			return "This URL is not a supported video (YouTube or Vimeo)";
140 141
 		}		
141 142
 	}
142 143
 	
@@ -144,8 +145,10 @@ class gelato extends Conexion_Mysql {
144 145
 		if (isMP3($url)) {
145 146
 			$playerUrl = $this->conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url;
146 147
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"" . $playerUrl . "\" width=\"290\" height=\"24\"><param name=\"movie\" value=\"" . $playerUrl . "\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
148
+		} elseif (isGoEar($url)) {
149
+			return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/localplayer.swf\" width=\"366\" height=\"75\"><param name=\"movie\" value=\"http://www.goear.com/files/localautoplayer.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=c0a2c85\" /></object>\n";
147 150
 		} else {
148
-			return "This URL is not a supported video (YouTube or Vimeo)";
151
+			return "This URL is not an MP3 file.";
149 152
 		}		
150 153
 	}	
151 154
 } 

+ 15 - 4
classes/mysql_connection.class.php View File

@@ -34,13 +34,23 @@ class Conexion_Mysql {
34 34
 		$this->musuario = $user;	
35 35
 		$this->mclave = $pass;
36 36
 		
37
-		$this->conectar();	
37
+		if (!$this->conectar()) {
38
+			$mensaje = "
39
+				<h3 class=\"important\">Error establishing a database connection</h3>
40
+				<p>This either means that the username and password information in your <code>config.php</code> file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down.</p>
41
+				<ul>
42
+					<li>Are you sure you have the correct username and password?</li>
43
+					<li>Are you sure that you have typed the correct hostname?</li>
44
+					<li>Are you sure that the database server is running?</li>
45
+				</ul>";
46
+			die($mensaje);			
47
+		}
38 48
 	}
39 49
 	
40 50
 	/** Conectar a la base de datos */	
41 51
 	function conectar() {		
42 52
 		// Conectamos al servidor		
43
-		$this->mid_conexion = mysql_connect($this->mservidor, $this->musuario, $this->mclave);		
53
+		$this->mid_conexion = @mysql_connect($this->mservidor, $this->musuario, $this->mclave);		
44 54
 		if (!$this->mid_conexion) {		
45 55
 			$this->merror = "No se logró realizar la conexión.";		
46 56
 			return false;
@@ -154,7 +164,7 @@ class Conexion_Mysql {
154 164
 			$sql .= "$valor,";
155 165
 			}
156 166
 			elseif (substr_count(MYSQL_TYPES_DATE, "$tipo_col ")) {
157
-			$valor = $this->sql_date_format($valor, $tipo_col); /// formatea las fechas
167
+			$valor = $this->formatearFecha($valor, $tipo_col); /// formatea las fechas
158 168
 			$sql .= "'$valor',";
159 169
 			}
160 170
 			elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
@@ -212,7 +222,8 @@ class Conexion_Mysql {
212 222
 	/*  if (gettype($valor) == 'string') $valor = strtotime($valor);
213 223
 	  return date('Y-m-d H:i:s', $valor);
214 224
 	*/
215
-	}
225
+	}	
226
+	
216 227
 	
217 228
 	/**
218 229
 	 * Obtiene el registro obtenido de una consulta.

+ 2 - 2
classes/templates.class.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /**
3 3
  * version 0.0.1
4 4
  *
@@ -11,7 +11,7 @@
11 11
  * @author Pedro Santana [pecesama]
12 12
  */
13 13
 ?>
14
-<?
14
+<?php
15 15
 class plantillas {
16 16
 
17 17
 	var $plantilla;

File diff suppressed because it is too large
+ 4081 - 4080
classes/textile.class.php


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

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 require_once("configuration.class.php");
13 13
 
14 14
 class user extends Conexion_Mysql {

+ 4 - 4
config-sample.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?	
11
+<?php
12 12
 	// MySql configuration
13 13
 	define('DB_Server', '[server]');			// Set the MySQL hostname (generally "localhost")
14 14
 	define('DB_name', '[database]');			// Set the MySQL database gelato should use
@@ -18,7 +18,7 @@
18 18
 
19 19
 	/* Do not edit below this line */
20 20
 
21
-	define('Absolute_Path', dirname(__FILE__).'/');	
21
+	define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);	
22 22
 	
23 23
 	session_start();
24 24
 	header("Expires: Mon, 26 Jul 1957 05:00:00 GMT");
@@ -26,5 +26,5 @@
26 26
 	header("Cache-Control: no-store, no-cache, must-revalidate");
27 27
 	header("Cache-Control: post-check=0, pre-check=0", false);
28 28
 	header("Pragma: no-cache");
29
-	require_once(Absolute_Path."classes/mysql_connection.class.php");
29
+	require_once(Absolute_Path."classes".DIRECTORY_SEPARATOR."mysql_connection.class.php");
30 30
 ?>

BIN
images/cita.gif View File


BIN
images/conversacion.gif View File


BIN
images/enlace.gif View File


BIN
images/foto.gif View File


BIN
images/logo.jpg View File


BIN
images/mp3.gif View File


BIN
images/post.gif View File


BIN
images/video.gif View File


+ 21 - 7
index.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,9 +8,21 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 	// My approach to MVC
13
-	require(dirname(__FILE__)."/config.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(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
24
+	}	
25
+	
14 26
 	include("classes/configuration.class.php");
15 27
 	include("classes/textile.class.php");
16 28
 	include("classes/gelato.class.php");	
@@ -76,13 +88,15 @@
76 88
 	
77 89
 		$rs = $tumble->getPosts($limit, $from);
78 90
 
79
-		if ($tumble->contarRegistros()>0) {				
91
+		if ($tumble->contarRegistros()>0) {
92
+			$fecha = null;		
80 93
 			while($register = mysql_fetch_array($rs)) {			
81 94
 				$formatedDate = date("M d", strtotime($register["date"]));
95
+				if ( $fecha != null && $formatedDate == $fecha ) { $formatedDate = ""; } else { $fecha = $formatedDate; }
82 96
 				$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
83 97
 				
84
-				$textile = new Textile;
85
- 				$register["description"] = $textile->process(str_replace("&quot;", "\"", $register["description"]));
98
+				$textile = new Textile; 				
99
+				$register["description"] = $textile->process($register["description"]);
86 100
 				
87 101
 				switch ($tumble->getType($register["id_post"])) {
88 102
 					case "1":
@@ -161,7 +175,7 @@
161 175
 		$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
162 176
 		
163 177
 		$textile = new Textile;
164
-		$register["description"] = $textile->process(str_replace("&quot;", "\"", $register["description"]));
178
+		$register["description"] = $textile->process($register["description"]);
165 179
 		
166 180
 		switch ($tumble->getType($register["id_post"])) {
167 181
 			case "1":

+ 259 - 0
install.php View File

@@ -0,0 +1,259 @@
1
+<?php
2
+/* ===========================
3
+
4
+  gelato CMS development version
5
+  http://www.gelatocms.com/
6
+
7
+  gelato CMS is a free software licensed under GPL (General public license)
8
+
9
+  =========================== */
10
+?>
11
+<?php
12
+
13
+$configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
14
+	
15
+if (!file_exists($configFile)) {
16
+	$mensaje = "
17
+			<h3 class=\"important\">Error reading configuration file</h3>			
18
+			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
19
+			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
20
+	die($mensaje);
21
+} else {
22
+	require(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
23
+	$showForm = true;
24
+}
25
+
26
+include("classes/functions.php");
27
+ 
28
+$errors_d=array();
29
+$errors_d[1]="The login field cannot be empty";
30
+$errors_d[2]="The password field cannot be empty";
31
+$errors_d[3]="Password does not match the confirm password";
32
+$errors_d[4]="The e-mail field cannot be empty";
33
+$errors_d[5]="The installation URL field cannot be empty";
34
+$errors_d[6]="Error establishing a database connection";
35
+
36
+$action="";
37
+$errors="";
38
+
39
+if (isset($_POST['action'])){
40
+	$action=$_POST['action'];
41
+}
42
+
43
+if ($action=="config") {
44
+	
45
+	$sep_err="";
46
+	
47
+	if (!$_POST['login']) {
48
+		$errors=$errors.$sep_err."1";
49
+		$sep_err="|";
50
+	}
51
+	if (!$_POST['password']) {
52
+		$errors=$errors.$sep_err."2";
53
+		$sep_err="|";
54
+	}
55
+	if (!$_POST['email']) {
56
+		$errors=$errors.$sep_err."4";
57
+		$sep_err="|";
58
+	}
59
+	if (!$_POST['url_installation']) {
60
+		$errors=$errors.$sep_err."5";
61
+		$sep_err="|";
62
+	}
63
+	if ($_POST['password']!=$_POST['password2']) {
64
+		$errors=$errors.$sep_err."3";
65
+		$sep_err="|";
66
+	}
67
+	
68
+	
69
+	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'])) {
72
+			$showForm=false;
73
+		} else {
74
+			$errors=$errors.$sep_err."6";
75
+			$sep_err="|";
76
+			$showForm=true;
77
+		}		
78
+	} else {
79
+		$showForm=true;
80
+	}
81
+}
82
+
83
+?>
84
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
85
+<html xmlns="http://www.w3.org/1999/xhtml">
86
+<head>
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();?>" />	
90
+	<link rel="shortcut icon" href="images/favicon.ico" />
91
+	<style type="text/css" media="screen">	
92
+		@import "admin/css/style.css";		
93
+	</style>		
94
+</head>
95
+<body>
96
+<div id="cont">
97
+	<div id="head">
98
+		<h1><a href="index.php" title="gelato :: home">gelato cms</a></h1>
99
+	</div>
100
+	
101
+	<div id="main">
102
+	
103
+<?
104
+
105
+	if ($showForm) {
106
+?>
107
+	
108
+	<div class="box">
109
+		<ul class="menu manage">
110
+		<h3>gelato :: installation</h3>
111
+
112
+		<li class="selected"><a>Install</a></li>
113
+		</ul>
114
+	
115
+		<div class="tabla">
116
+			<form action="install.php" method="post" id="config_form" autocomplete="off" class="newpost">
117
+				<fieldset>
118
+					<legend class="install">Admin user</legend>
119
+					<ul>
120
+						<li><label for="login">User:</label>
121
+							<input type="text" name="login" id="login" value="" class="txt"/><?php echo mostrarerror($errors,$errors_d,"1")?></li>
122
+						<li><label for="password">Password:</label>
123
+							<input type="password" name="password" id="password" value="" class="txt"/><?php echo mostrarerror($errors,$errors_d,"2")?></li>
124
+						<li><label for="password2">Re-type password:</label>
125
+							<input type="password" name="password2" id="password2" value="" class="txt"/><?php echo mostrarerror($errors,$errors_d,"3")?></li>						
126
+						<li><label for="email">E-mail:</label>
127
+							<input type="text" name="email" id="email" value="" class="txt"/><?php echo mostrarerror($errors,$errors_d,"4")?></li>						
128
+					</ul>
129
+				</fieldset><br  />
130
+				<fieldset>
131
+					<legend class="install">Tumblelog configuration</legend>
132
+					<ul>							
133
+						<li><label for="title">Title:</label>
134
+							<input type="text" name="title" id="title" value="" class="txt"/></li>
135
+						<li><label for="description">Description:</label>
136
+							<input type="text" name="description" id="description" value="" class="txt"/></li>
137
+						<li><label for="url_installation">Installation URL</label>
138
+							<input type="text" name="url_installation" id="url_installation" value="" class="txt"/><?php echo mostrarerror($errors,$errors_d,"5")?></li>
139
+						<li><label for="posts_limit">Post limit:</label>
140
+							<input type="text" name="posts_limit" id="posts_limit" value="10" class="txt"/></li>
141
+						<li><label for="lang">Language:</label>
142
+							<select id="lang" name="lang">
143
+								<option value="en" selected="selected">english</option>
144
+							</select>
145
+						</li>
146
+						<li><label for="template">Template:</label>
147
+							<select id="template" name="template">
148
+<?php
149
+							$themes = getThemes();
150
+							foreach ($themes as $theme) {									
151
+								echo "<option value=\"".$theme."\" selected=\"true\">".$theme."</option>\n";
152
+								
153
+							}
154
+?>
155
+							</select>
156
+						</li>
157
+					</ul>
158
+				</fieldset>
159
+				<p>	
160
+					<input type="hidden" name="website" id="website" value="" />
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
+					<input type="hidden" name="action" id="action" value="config" />
165
+					<input type="submit" name="btnsubmit" id="btnsubmit" value="<< Install >>" class="submit"/>
166
+				</p>
167
+			</form>		
168
+		</div>
169
+		<div class="footer-box">&nbsp;</div>
170
+	</div>
171
+	
172
+<?php
173
+	} else {
174
+		echo "<p><em>Finished!</em></p>";
175
+		echo "<p>Now you can <a href=\"login.php\" class=\"inslnl\">log in</a> with your <strong>username</strong> and <strong>password</strong></p>";
176
+	}
177
+
178
+?>
179
+	</div>
180
+	<div id="foot">
181
+		<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
182
+	</div>
183
+	
184
+</div>
185
+</body>
186
+</html>
187
+
188
+<?php
189
+function installdb($login, $password, $email, $title, $description, $url_installation, $posts_limit, $lang, $template, $website, $about, $url_friendly, $rich_text){
190
+
191
+		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);		
192
+		
193
+		$sqlStr = "CREATE TABLE `".Table_prefix."data` (
194
+			  `id_post` int(11) NOT NULL auto_increment,
195
+			  `title` text NULL,
196
+			  `url` varchar(250)  default NULL,
197
+			  `description` text NULL,
198
+			  `type` tinyint(4) NOT NULL default '1',
199
+			  `date` datetime NOT NULL,
200
+			  `id_user` int(10) NOT NULL,
201
+			  PRIMARY KEY  (`id_post`)
202
+			) ENGINE = MYISAM ;";
203
+		
204
+		$db->ejecutarConsulta($sqlStr);
205
+		
206
+		$sqlStr = "CREATE TABLE `".Table_prefix."users` (
207
+			  `id_user` int(10) unsigned NOT NULL auto_increment,
208
+			  `name` varchar(100) default NULL,
209
+			  `login` varchar(100) NOT NULL default '',
210
+			  `password` varchar(64) NOT NULL default '',
211
+			  `email` varchar(100) default NULL,
212
+			  `website` varchar(150) default NULL,
213
+			  `about` text,
214
+			  PRIMARY KEY  (`id_user`)
215
+			) ENGINE = MYISAM;";
216
+		
217
+		$db->ejecutarConsulta($sqlStr);
218
+			
219
+		$sqlStr = "CREATE TABLE `".Table_prefix."config` (
220
+			  `posts_limit` int(3) NOT NULL,
221
+			  `title` varchar(250) NOT NULL,
222
+			  `description` text NOT NULL,
223
+			  `lang` varchar(10) NOT NULL,
224
+			  `template` varchar(100) NOT NULL,
225
+			  `url_installation` varchar(250) NOT NULL,
226
+			  `url_friendly` tinyint(1) NOT NULL,
227
+			  `rich_text` tinyint(1) NOT NULL,
228
+			  PRIMARY KEY  (`title`)
229
+			) ENGINE = MYISAM ;";
230
+			
231
+		$db->ejecutarConsulta($sqlStr);
232
+				
233
+		$url_installation = (endsWith($url_installation, "/")) ? substr($url_installation, 0, strlen($url_installation)-1) : $url_installation ;
234
+		
235
+		$sqlStr = "INSERT INTO `".Table_prefix."config` VALUES (".$posts_limit.", '".$title."', '".$description."', '".$lang."', '".$template."', '".$url_installation."', ".$url_friendly.", ".$rich_text.");";		
236
+			
237
+		$db->ejecutarConsulta($sqlStr);
238
+		
239
+		$sqlStr = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$login."', '".md5($password)."', '".$email."', '".$website."', '".$about."');";
240
+			
241
+		$db->ejecutarConsulta($sqlStr);
242
+
243
+		return true;
244
+}
245
+
246
+function inerrors($errors,$n) {
247
+	if (strpos($errors,$n)===false)
248
+		return false;
249
+	else
250
+		return true;
251
+}
252
+
253
+function mostrarerror($errors,$errors_d,$n) {
254
+	if (inerrors($errors,$n))
255
+		return '<span class="error">'.$errors_d[$n].'</span>';
256
+	else
257
+		return "";
258
+}
259
+?>

+ 13 - 13
login.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,7 +8,7 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 header("Cache-Control: no-cache, must-revalidate");
13 13
 require( dirname(__FILE__) . '/config.php' );
14 14
 include(dirname(__FILE__)."/classes/user.class.php");
@@ -33,11 +33,11 @@ if ($user->isAdmin()) {
33 33
 	<head>
34 34
 		<title>gelato :: login screen</title>
35 35
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
36
-		<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
37
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
38
-		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/sortable.js"></script>
36
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
37
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
38
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
39 39
 		<style type="text/css" media="screen">	
40
-			@import "<?=$conf->urlGelato;?>/admin/css/style.css";
40
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
41 41
 		</style>
42 42
 	</head>
43 43
 	
@@ -45,9 +45,9 @@ if ($user->isAdmin()) {
45 45
 		<div id="div-process" style="display:none;">Processing request...</div>
46 46
 		<div id="cont">
47 47
 			<div id="head">
48
-				<h1><a href="<?=$conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
48
+				<h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
49 49
 				<ul id="nav">
50
-					<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
50
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
51 51
 			  	</ul>
52 52
 			</div>
53 53
 			<div id="main">				
@@ -73,21 +73,21 @@ if ($user->isAdmin()) {
73 73
 									</ul>
74 74
 									</fieldset>
75 75
 								</form>
76
-<?					
76
+<?php				
77 77
 								if (isset($_GET["error"])) {
78 78
 									if ($_GET["error"]==1) {
79 79
 ?>
80 80
 								<div class="error">
81 81
 									&nbsp;You must be registered to use gelato.
82 82
 								</div>
83
-<?
83
+<?php
84 84
 									}
85 85
 									elseif ($_GET["error"]==2) {
86 86
 ?>
87 87
 								<div class="error">
88 88
 									&nbsp;You must be logged on the system.
89 89
 								</div>
90
-<?
90
+<?php
91 91
 									}									
92 92
 								}
93 93
 ?>
@@ -97,12 +97,12 @@ if ($user->isAdmin()) {
97 97
 				</div>
98 98
 			</div>
99 99
 			<div id="foot">
100
-				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
100
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
101 101
 			</div>
102 102
 		</div>
103 103
 	</body>
104 104
 	</html>
105
-<?
105
+<?php
106 106
 	}
107 107
 }
108 108
 ?>

+ 16 - 1
readme.txt View File

@@ -1,4 +1,19 @@
1
-==== How to install gelato CMS developers preview =====
1
+==== How to install gelato CMS =====
2
+
3
+1) Download and unzip the gelato package, if you haven't already.
4
+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.
5
+3) Rename the config-sample.php file to config.php.
6
+4) Open config.php in your favorite text editor and fill in your database details.
7
+5) Place the gelato files in the desired location on your web server.
8
+6) Run the gelato installation script by accessing install.php in your favorite web browser.
9
+	* If you installed gelato in the root directory, you should visit: http://example.com/install.php
10
+          * If you installed gelato in its own subdirectory called tumblelog, for example, you should visit: http://example.com/tumblelog/install.php 
11
+7) Set CHMOD / permission ( Chmod 777 ) to the folder 'uploads'
12
+
13
+That's it! gelato should now be installed.   
14
+
15
+
16
+==== How to install gelato CMS (Manual) =====
2 17
 
3 18
 1) Download and unzip the gelato package, if you haven't already.
4 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.

+ 47 - 72
rss.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 /* ===========================
3 3
 
4 4
   gelato CMS development version
@@ -8,114 +8,89 @@
8 8
 
9 9
   =========================== */
10 10
 ?>
11
-<?
11
+<?php
12 12
 	header("Content-type: text/xml; charset=utf-8");
13 13
 		
14 14
 	require(dirname(__FILE__)."/config.php");
15 15
 	include("classes/configuration.class.php");
16 16
 	$conf = new configuration();
17 17
 	
18
-	echo "<?xml version=\"1.0\""." encoding=\"UTF-8\"?>\n";
18
+	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
19
+?>
19 20
 	
21
+	<rss version="2.0">
22
+	<channel>
23
+		<title><?php echo htmlspecialchars($conf->title);?></title>
24
+		<link><?php echo $conf->urlGelato;?></link>
25
+		<description><?php echo htmlspecialchars($conf->description);?></description>
26
+		<generator>gelato CMS</generator>
27
+		<image>
28
+			<url><?php echo $conf->urlGelato;?>/images/information.png</url>
29
+			<title><?php echo htmlspecialchars($conf->description);?></title>
30
+			<link><?php echo $conf->urlGelato;?></link>
31
+		</image>
32
+
33
+
34
+<?php
20 35
 	include("classes/gelato.class.php");
36
+	include("classes/textile.class.php");
21 37
 	$tumble = new gelato();
22 38
 	$rs = $tumble->getPosts("20");
23 39
 	if ($tumble->contarRegistros()>0) {		
24
-?>
25 40
 
26
-<rss version="2.0">
27
-	<channel>
28
-		<title><?=htmlspecialchars(replaceAccents($conf->title));?></title>
29
-		<link><?=$conf->urlGelato;?></link>
30
-		<description><?=htmlspecialchars(replaceAccents($conf->description));?></description>
31
-		<generator>gelato CMS</generator>
32
-		<image>
33
-			<url><?=$conf->urlGelato;?>/images/information.png</url>
34
-			<title><?=htmlspecialchars(replaceAccents($conf->description));?></title>
35
-			<link><?=$conf->urlGelato;?></link>
36
-		</image>
37
-<?
38 41
 		while($register = mysql_fetch_array($rs)) {
42
+			$textile = new Textile;
43
+			$register["description"] = $textile->process($register["description"]);
44
+			
39 45
 			switch ($register["type"]) {
40 46
 				case "1":
41
-					$tit = ($register["title"]=="") ? htmlspecialchars(strip_tags($register["description"])) : htmlspecialchars($register["title"]);
42
-					$desc = htmlspecialchars($register["description"]);
47
+					$tit = ($register["title"]=="") ? strip_tags($register["description"]) : $register["title"];
48
+					$desc = $register["description"];
43 49
 					break;
44 50
 				case "2":
45
-					$tit = ($register["description"]=="") ? "Photo" : htmlspecialchars(strip_tags($register["description"]));
51
+					$tit = ($register["description"]=="") ? "Photo" : strip_tags($register["description"]);
46 52
 					$desc = "<img src=\"".$register["url"]."\"/>";
47 53
 					break;
48 54
 				case "3":
49
-					$tit = "\"".htmlspecialchars(strip_tags($register["description"]))."\"";
50
-					$tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".htmlspecialchars($register["title"])."</em>" : "";
51
-					$desc = "\"".htmlspecialchars($register["description"])."\"".$tmpStr;
55
+					$tit = "\"".strip_tags($register["description"])."\"";
56
+					$tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
57
+					$desc = "\"".$register["description"]."\"".$tmpStr;
52 58
 					break;
53 59
 				case "4":
54
-					$tit = ($register["title"]=="") ? htmlspecialchars($register["url"]) : htmlspecialchars($register["title"]);
55
-					$tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".htmlspecialchars($register["description"])."</em>" : "";
56
-					$desc = "<a href=\"".htmlspecialchars($register["url"])."\">".$tit."</a>".$tmpStr;
60
+					$tit = ($register["title"]=="") ? $register["url"] : $register["title"];
61
+					$tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
62
+					$desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
57 63
 					break;
58 64
 				case "5":
59 65
 					$lines = explode("\n", $register["description"]);
60
-					$line = htmlspecialchars($lines[0]);
61
-					$tit = ($register["title"]=="") ? $line : htmlspecialchars($register["title"]);
62
-					$desc = $tumble->formatConversation(htmlspecialchars($register["description"]));
66
+					$line = $lines[0];
67
+					$tit = ($register["title"]=="") ? $line : $register["title"];
68
+					$desc = $tumble->formatConversation($register["description"]);
63 69
 					break;
64 70
 				case "6":
65
-					$tit = ($register["description"]=="") ? "Video" : htmlspecialchars(strip_tags($register["description"]));
66
-					$desc = $tumble->getVideoPlayer(htmlspecialchars($register["url"]));
71
+					$tit = ($register["description"]=="") ? "Video" : strip_tags($register["description"]);
72
+					$desc = $tumble->getVideoPlayer($register["url"]);
67 73
 					break;
68 74
 				case "7":
69
-					$tit = ($register["description"]=="") ? "MP3" : htmlspecialchars(strip_tags($register["description"]));
70
-					$desc = $tumble->getMp3Player(htmlspecialchars($register["url"]));
75
+					$tit = ($register["description"]=="") ? "MP3" : strip_tags($register["description"]);
76
+					$desc = $tumble->getMp3Player($register["url"]);
71 77
 					break;
72 78
 			}
73
-			$url = htmlspecialchars($conf->urlGelato."/index.php/post/".$register["id_post"]."/");
79
+			$url = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
74 80
 			$formatedDate = gmdate("D, d M Y H:i:s \G\M\T", strtotime($register["date"]));
75
-			?>
81
+?>
76 82
 
77 83
 			<item>
78
-				<title><?=replaceAccentsWithAmp($tit);?></title>
79
-				<description><![CDATA[<?=replaceAccentsWithAmp($desc);?>]]></description>
80
-				<link><?=$url;?></link>
81
-				<guid isPermaLink="true"><?=$conf->urlGelato."/index.php/post/".$register["id_post"]."/";?></guid>				
82
-				<pubDate><?=$formatedDate;?></pubDate>				
84
+				<title><?php echo $tit;?></title>
85
+				<description><![CDATA[<?php echo $desc;?>]]></description>
86
+				<link><?php echo $url;?></link>
87
+				<guid isPermaLink="true"><?php echo $conf->urlGelato."/index.php/post/".$register["id_post"]."/";?></guid>				
88
+				<pubDate><?php echo $formatedDate;?></pubDate>				
83 89
 			</item>
84 90
 
85
-<?		
91
+<?php	
86 92
 		}
87 93
 	}
88 94
 ?>
89 95
 	</channel>
90
-</rss>
91
-
92
-<?
93
-	function replaceAccents($texto="") {
94
-		$texto = str_replace("&Aacute;","A", $texto);
95
-		$texto = str_replace("&Eacute;","E", $texto);
96
-		$texto = str_replace("&Iacute;","I", $texto);
97
-		$texto = str_replace("&Oacute;","O", $texto);
98
-		$texto = str_replace("&Uacute;","U", $texto);
99
-		$texto = str_replace("&aacute;","a", $texto);
100
-		$texto = str_replace("&eacute;","e", $texto);
101
-		$texto = str_replace("&iacute;","i", $texto);
102
-		$texto = str_replace("&oacute;","o", $texto);
103
-		$texto = str_replace("&uacute;","u", $texto);
104
-		return $texto;
105
-	}
106
-	
107
-	function replaceAccentsWithAmp($texto="") {
108
-		$texto = str_replace("&amp;Aacute;","A", $texto);
109
-		$texto = str_replace("&amp;Eacute;","E", $texto);
110
-		$texto = str_replace("&amp;Iacute;","I", $texto);
111
-		$texto = str_replace("&amp;Oacute;","O", $texto);
112
-		$texto = str_replace("&amp;Uacute;","U", $texto);
113
-		$texto = str_replace("&amp;aacute;","a", $texto);
114
-		$texto = str_replace("&amp;eacute;","e", $texto);
115
-		$texto = str_replace("&amp;iacute;","i", $texto);
116
-		$texto = str_replace("&amp;oacute;","o", $texto);
117
-		$texto = str_replace("&amp;uacute;","u", $texto);
118
-		$texto = str_replace("&amp;#39;"," ", $texto);
119
-		return $texto;
120
-	}
121
-?>
96
+</rss>

+ 1 - 1
themes/tumblr/template_footer.htm View File

@@ -2,7 +2,7 @@
2 2
     </div>
3 3
     <div id="footer">
4 4
         subscribe via <a href="{URL_Tumble}/rss.php">rss</a> &nbsp;/&nbsp;
5
-        powered by <a href="http://www.gelatocms.com/" target="_blank">gelato cms</a>
5
+        powered by <a href="http://www.gelatocms.com/">gelato cms</a>
6 6
     </div>
7 7
 </body>
8 8
 </html>