Browse Source

First changes on architecture

pecesama 15 years ago
parent
commit
f95f856b49
22 changed files with 332 additions and 379 deletions
  1. 2 2
      admin/admin.php
  2. 0 1
      admin/ajax.php
  3. 7 7
      admin/bm.php
  4. 1 1
      admin/close.php
  5. 3 3
      admin/comments.php
  6. 1 2
      admin/feeds.php
  7. 7 7
      admin/index.php
  8. 1 1
      admin/options.php
  9. 169 169
      admin/plugins.php
  10. 3 3
      admin/settings.php
  11. 1 3
      admin/user.php
  12. 3 3
      api.php
  13. 5 5
      archive.php
  14. 18 14
      classes/comments.class.php
  15. 24 24
      classes/gelato.class.php
  16. 10 15
      classes/templates.class.php
  17. 22 20
      classes/user.class.php
  18. 36 46
      classes/util.class.php
  19. 6 40
      entry.php
  20. 8 8
      index.php
  21. 1 1
      login.php
  22. 4 4
      rss.php

+ 2 - 2
admin/admin.php View File

@@ -22,7 +22,7 @@ if ($user->isAdmin()) {
22 22
 	<head>
23 23
 		<title>gelato :: <?php echo __("admin users")?></title>
24 24
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
25
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
25
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
26 26
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
27 27
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
28 28
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
@@ -108,7 +108,7 @@ if ($user->isAdmin()) {
108 108
 <?php
109 109
 					$odd=false;
110 110
 					$rs = $user->getUsers();
111
-					if ($user->contarRegistros()>0) {
111
+					if ($db->contarRegistros()>0) {
112 112
 						while($register = mysql_fetch_array($rs)) {
113 113
 ?>
114 114
 							<tr <?php if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>

+ 0 - 1
admin/ajax.php View File

@@ -19,7 +19,6 @@ if(!defined('entry'))define('entry', true);
19 19
 		if ($_GET["action"]) {
20 20
 			
21 21
 			if ($_GET["action"] == "close") {
22
-				session_start();
23 22
 				if ($user->closeSession()) {
24 23
 					echo __("&nbsp;ending session&hellip;");
25 24
 				} else {

+ 7 - 7
admin/bm.php View File

@@ -29,11 +29,11 @@ if ($user->isAdmin()) {
29 29
 					header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
30 30
 					die();
31 31
 				}
32
-				$_POST["url"] = "../uploads/".sanitizeName($photoName);
32
+				$_POST["url"] = "../uploads/".util::sanitizeName($photoName);
33 33
 			}
34 34
 
35 35
 			if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
36
-				$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
36
+				$_POST["url"] = "../uploads/".util::sanitizeName($_FILES['photo']['name']);
37 37
 			}
38 38
 
39 39
 			unset($_POST["photo"]);
@@ -80,13 +80,13 @@ if ($user->isAdmin()) {
80 80
 		}
81 81
 		if (isset($url)) {
82 82
 
83
-			if (isMP3($url)) {
83
+			if (util::isMP3($url)) {
84 84
 				$postType = "mp3";
85
-			} elseif (isGoEar($url)) {
85
+			} elseif (util::isGoEar($url)) {
86 86
 				$postType = "mp3";
87
-			} elseif (isImageFile($url)) {
87
+			} elseif (util::isImageFile($url)) {
88 88
 				$postType = "photo";
89
-			} elseif (isVideo($url)) {
89
+			} elseif (util::isVideo($url)) {
90 90
 				$postType = "video";
91 91
 			} else {
92 92
 				if (isset($_GET["sel"]) && !$_GET["sel"]=="" ) {
@@ -104,7 +104,7 @@ if ($user->isAdmin()) {
104 104
 	<html xmlns="http://www.w3.org/1999/xhtml">
105 105
 	<head>
106 106
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
107
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
107
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
108 108
 		<title>gelato :: <?php echo __("bookmarklet")?></title>
109 109
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
110 110
         <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>

+ 1 - 1
admin/close.php View File

@@ -22,7 +22,7 @@ $closed = $user->closeSession();
22 22
 	<head>
23 23
 		<title>gelato :: <?php echo __("logout")?></title>
24 24
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
25
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
25
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
26 26
 		<meta http-equiv="Refresh" content="3;URL=../login.php" />
27 27
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
28 28
 		<style type="text/css" media="screen">	

+ 3 - 3
admin/comments.php View File

@@ -27,7 +27,7 @@ if(isset($_POST["btnAdd"]))	{
27 27
 	$_POST["username"] = strip_tags($_POST["username"]);
28 28
 	$_POST["email"] =  strip_tags($_POST["email"]);
29 29
 	$_POST["web"] = strip_tags($_POST["web"]);
30
-	$_POST["content"] = removeBadTags($_POST["content"], true);
30
+	$_POST["content"] = util::removeBadTags($_POST["content"], true);
31 31
 		
32 32
 	if (isset($_POST["id_comment"])) {
33 33
 		if ($isAdmin) {
@@ -73,7 +73,7 @@ if ($isAdmin) {
73 73
 	<head>
74 74
 		<title>gelato :: <?php echo __("comments")?></title>
75 75
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
76
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
76
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
77 77
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
78 78
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
79 79
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
@@ -160,7 +160,7 @@ if ($isAdmin) {
160 160
 							
161 161
 							$rs = $comment->getComments(null, $limit, $from, $sp);
162 162
 					
163
-							if ($comment->contarRegistros()>0) {				
163
+							if ($db->contarRegistros()>0) {				
164 164
 								while($rowComment = mysql_fetch_array($rs)) {	
165 165
 							
166 166
 									$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"]  : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];

+ 1 - 2
admin/feeds.php View File

@@ -15,7 +15,6 @@ if(!defined('entry')) define('entry', true);
15 15
 require('../entry.php');
16 16
 global $user, $conf, $tumble;
17 17
 
18
-$user= new User();
19 18
 if ($user->isAdmin()) {
20 19
 	$message = '';
21 20
 	$f = new feeds();
@@ -40,7 +39,7 @@ if ($user->isAdmin()) {
40 39
 	<head>
41 40
 		<title>gelato :: <?php echo __("Feeds")?></title>
42 41
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
43
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
42
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
44 43
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
45 44
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
46 45
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>

+ 7 - 7
admin/index.php View File

@@ -105,7 +105,7 @@ if ($user->isAuthenticated()) {
105 105
 				$admin_includes = "";
106 106
 				$trigger->call('admin_includes');
107 107
                 $theme->set('admin_includes',$admin_includes);
108
-                $theme->set('version',version());
108
+                $theme->set('version',util::version());
109 109
                 $theme->set('conf', array(
110 110
                         'urlGelato'=>$conf->urlGelato,
111 111
                         'richText'=>$conf->richText
@@ -115,8 +115,8 @@ if ($user->isAuthenticated()) {
115 115
                 $theme->set('error',false);
116 116
 
117 117
                 if($conf->check_version){
118
-                        $present = version();
119
-                        $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
118
+                        $present = util::version();
119
+                        $lastest = util::_file_get_contents("http://www.gelatocms.com/vgel.txt");
120 120
                         if ($present < $lastest)
121 121
                                 $theme->set('information',__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>."));
122 122
                 }
@@ -225,14 +225,14 @@ if ($user->isAuthenticated()) {
225 225
                                 $from = 0;
226 226
 
227 227
                         $rs = $tumble->getPosts($limit, $from);
228
-                        $theme->set('Posts_Number',$tumble->contarRegistros());
228
+                        $theme->set('Posts_Number',$db->contarRegistros());
229 229
 
230 230
                         $rows = array();
231
-                        if ($tumble->contarRegistros()>0) {
231
+                        if ($db->contarRegistros()>0) {
232 232
                                 while($register = mysql_fetch_array($rs)) {
233
-                                        $row['postType'] = type2Text($tumble->getType($register["id_post"]));
233
+                                        $row['postType'] = util::type2Text($tumble->getType($register["id_post"]));
234 234
 
235
-                                        $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
235
+                                        $formatedDate = gmdate("M d", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
236 236
                                         $strEnd=($conf->urlFriendly) ? "/" : "";
237 237
 										$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
238 238
 

+ 1 - 1
admin/options.php View File

@@ -69,7 +69,7 @@ if ($user->isAdmin()) {
69 69
 	<head>
70 70
 		<title>gelato :: <?php echo __("options")?></title>
71 71
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
72
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
72
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
73 73
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
74 74
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
75 75
 		<script type="text/javascript">

+ 169 - 169
admin/plugins.php View File

@@ -1,170 +1,170 @@
1
-<?php
2
-if(!defined('entry')) define('entry',true);  
3
-/* ===========================
4
-
5
-  gelato CMS - A PHP based tumblelog CMS
6
-  development version
7
-  http://www.gelatocms.com/
8
-
9
-  gelato CMS is a free software licensed under the GPL 2.0
10
-  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11
-
12
-  =========================== */
13
-?>
14
-<?php
15
-require_once('../entry.php');
16
-global $user, $conf, $tumble;
17
-
18
-
19
-if ($user->isAdmin()) {
20
-	
21
-	
22
-	$plugins = array();
23
-	if ($handle = opendir(Absolute_Path."plugins")) {
24
-		while (false !== ($file = readdir($handle))) { 
25
-			if (substr($file, strlen($file)-4, 4) == ".php") {
26
-				$plugins[] = substr($file, 0, strlen($file)-4);
27
-			} 
28
-		} 
29
-		closedir($handle); 
30
-	}
31
-	
32
-	$actives = json_decode($conf->active_plugins,1);
33
-	$actives = $actives[1];
34
-	
35
-	if(isset($_POST["btnsubmit"]))	{
36
-		$actives = array();
37
-		foreach($_POST['plugins'] as $plugin => $val){
38
-			if($val != 'off'){
39
-				$file = $plugin.'.php';
40
-				$actives[$plugin] = $file;
41
-			}
42
-		}
43
-		if(!$tumble->saveOption(json_encode(array(array('total'=>count($actives)),$actives)), "active_plugins")){
44
-			header("Location: ".$conf->urlGelato."/admin/plugins.php?error=1&desc=".$conf->merror);
45
-			die();
46
-		}
47
-		header("Location: ".$conf->urlGelato."/admin/plugins.php?modified=true");
48
-		die();
49
-	} else {
50
-?>
51
-	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
52
-	<html xmlns="http://www.w3.org/1999/xhtml">
53
-	<head>
54
-		<title>gelato :: <?php echo __("Plugins")?></title>
55
-		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
57
-		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
58
-		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
59
-		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
60
-		<script type="text/javascript">
61
-		$(document).ready(function(){
62
-			$("#divMessages").fadeOut(5000,function(){
63
-				$("#divMessages").css({display:"none"});
64
-			});
65
-		});
66
-		</script>		
67
-		<style type="text/css" media="screen">	
68
-			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
69
-		</style>
70
-	</head>
71
-	
72
-	<body>
73
-		<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
74
-		<div id="cont">
75
-			<div id="head">
76
-				<h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
77
-				<ul id="nav">
78
-					<li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
79
-			  	</ul>
80
-			</div>
81
-			<div id="main">				
82
-				
83
-				<div class="box">
84
-					<ul class="menu manage">
85
-					<h3><?php echo __("Tumblelog options")?></h3>
86
-					<li><a href="index.php"><?php echo __("Post")?></a></li>
87
-					<li><a href="admin.php"><?php echo __("Users")?></a></li>
88
-					<li><a href="settings.php"><?php echo __("Settings")?></a></li>
89
-					<li><a href="options.php"><?php echo __("Options")?></a></li>
90
-					<li class="selected"><a href="plugins.php"><?php echo __("Plugins")?></a></li>
91
-					</ul>
92
-<?php
93
-					if (isset($_GET["modified"])) {
94
-						if ($_GET["modified"]=="true") {
95
-							echo "<div class=\"exito\" id=\"divMessages\">".__("The configuration has been modified successfully.")."</div>";
96
-						}
97
-					}					
98
-					if (isset($_GET["error"])) {
99
-						if ($_GET["error"]==1) {
100
-							echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server: ")."</strong>".$_GET["des"]."</div>";
101
-						}
102
-					}
103
-?>
104
-					<div class="tabla">
105
-
106
-						<form action="plugins.php" method="post" id="options_form" autocomplete="off" class="newpost">							
107
-							<fieldset>
108
-								<?php
109
-									if(count($plugins) == 0){
110
-										echo __('You dont have any plugin installed, get some <a href="http://www.gelatocms.com/">here</a>');
111
-									}else{
112
-										foreach ($plugins as $key => $plugin) {
113
-											
114
-											//FIXME terminar esto asi se lee la info desde el archivo 'a la' WP
115
-											/*
116
-											$plugin_data = implode( '', file( Absolute_Path."plugins/".$plugin.'.php' ));
117
-											preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
118
-											preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
119
-											preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
120
-											preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
121
-											preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
122
-
123
-											if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
124
-											$version = trim( $version[1] );
125
-											else
126
-											$version = '';
127
-
128
-											$plugin_data = array('Name' => trim($plugin_name[1]), 'URI' => trim($plugin_uri[1]), 'Description' => trim($description[1]), 'Author' => trim($author_name[1]), 'Author_uri' => trim($author_uri[1]), 'Version' => $version);
129
-*/
130
-											$desc = __("There is no info for this plugin jet");
131
-											$activated = array_key_exists($plugin, $actives);
132
-								?>								
133
-								<ul>	
134
-									<li class="select">
135
-										<label for="<?php echo $key;?>" title="<?php echo $desc; ?>" class="help"><?php echo $plugin;	?></label>
136
-										<select name="plugins[<?php echo $plugin;	?>]" id="<?php echo $key;?>">
137
-											<option value="on" <?php if($activated) echo 'selected="selected"'; ?>><?php echo __("On")?></option>
138
-											<option value="off" <?php if(!$activated) echo 'selected="selected"'; ?>><?php echo __("Off")?></option>
139
-										</select>
140
-										</li>
141
-									<?php
142
-										}
143
-									?>
144
-								</ul>
145
-								<?php
146
-									}
147
-								?>
148
-							</fieldset>
149
-							<p>
150
-								<input type="submit" name="btnsubmit" id="btnsubmit" value="<?php echo __("Modify")?>" class="submit"/>
151
-							</p>
152
-						</form>	
153
-								
154
-					</div>
155
-
156
-					<div class="footer-box">&nbsp;</div>
157
-				</div>
158
-			</div>
159
-			<div id="foot">
160
-				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
161
-			</div>
162
-		</div>
163
-	</body>
164
-	</html>
165
-<?php
166
-	}
167
-} else {
168
-	header("Location: ".$conf->urlGelato."/login.php");
169
-}
1
+<?php
2
+if(!defined('entry')) define('entry',true);  
3
+/* ===========================
4
+
5
+  gelato CMS - A PHP based tumblelog CMS
6
+  development version
7
+  http://www.gelatocms.com/
8
+
9
+  gelato CMS is a free software licensed under the GPL 2.0
10
+  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11
+
12
+  =========================== */
13
+?>
14
+<?php
15
+require_once('../entry.php');
16
+global $user, $conf, $tumble;
17
+
18
+
19
+if ($user->isAdmin()) {
20
+	
21
+	
22
+	$plugins = array();
23
+	if ($handle = opendir(Absolute_Path."plugins")) {
24
+		while (false !== ($file = readdir($handle))) { 
25
+			if (substr($file, strlen($file)-4, 4) == ".php") {
26
+				$plugins[] = substr($file, 0, strlen($file)-4);
27
+			} 
28
+		} 
29
+		closedir($handle); 
30
+	}
31
+	
32
+	$actives = json_decode($conf->active_plugins,1);
33
+	$actives = $actives[1];
34
+	
35
+	if(isset($_POST["btnsubmit"]))	{
36
+		$actives = array();
37
+		foreach($_POST['plugins'] as $plugin => $val){
38
+			if($val != 'off'){
39
+				$file = $plugin.'.php';
40
+				$actives[$plugin] = $file;
41
+			}
42
+		}
43
+		if(!$tumble->saveOption(json_encode(array(array('total'=>count($actives)),$actives)), "active_plugins")){
44
+			header("Location: ".$conf->urlGelato."/admin/plugins.php?error=1&desc=".$conf->merror);
45
+			die();
46
+		}
47
+		header("Location: ".$conf->urlGelato."/admin/plugins.php?modified=true");
48
+		die();
49
+	} else {
50
+?>
51
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
52
+	<html xmlns="http://www.w3.org/1999/xhtml">
53
+	<head>
54
+		<title>gelato :: <?php echo __("Plugins")?></title>
55
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
57
+		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
58
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
59
+		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
60
+		<script type="text/javascript">
61
+		$(document).ready(function(){
62
+			$("#divMessages").fadeOut(5000,function(){
63
+				$("#divMessages").css({display:"none"});
64
+			});
65
+		});
66
+		</script>		
67
+		<style type="text/css" media="screen">	
68
+			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
69
+		</style>
70
+	</head>
71
+	
72
+	<body>
73
+		<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
74
+		<div id="cont">
75
+			<div id="head">
76
+				<h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
77
+				<ul id="nav">
78
+					<li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
79
+			  	</ul>
80
+			</div>
81
+			<div id="main">				
82
+				
83
+				<div class="box">
84
+					<ul class="menu manage">
85
+					<h3><?php echo __("Tumblelog options")?></h3>
86
+					<li><a href="index.php"><?php echo __("Post")?></a></li>
87
+					<li><a href="admin.php"><?php echo __("Users")?></a></li>
88
+					<li><a href="settings.php"><?php echo __("Settings")?></a></li>
89
+					<li><a href="options.php"><?php echo __("Options")?></a></li>
90
+					<li class="selected"><a href="plugins.php"><?php echo __("Plugins")?></a></li>
91
+					</ul>
92
+<?php
93
+					if (isset($_GET["modified"])) {
94
+						if ($_GET["modified"]=="true") {
95
+							echo "<div class=\"exito\" id=\"divMessages\">".__("The configuration has been modified successfully.")."</div>";
96
+						}
97
+					}					
98
+					if (isset($_GET["error"])) {
99
+						if ($_GET["error"]==1) {
100
+							echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server: ")."</strong>".$_GET["des"]."</div>";
101
+						}
102
+					}
103
+?>
104
+					<div class="tabla">
105
+
106
+						<form action="plugins.php" method="post" id="options_form" autocomplete="off" class="newpost">							
107
+							<fieldset>
108
+								<?php
109
+									if(count($plugins) == 0){
110
+										echo __('You dont have any plugin installed, get some <a href="http://www.gelatocms.com/">here</a>');
111
+									}else{
112
+										foreach ($plugins as $key => $plugin) {
113
+											
114
+											//FIXME terminar esto asi se lee la info desde el archivo 'a la' WP
115
+											/*
116
+											$plugin_data = implode( '', file( Absolute_Path."plugins/".$plugin.'.php' ));
117
+											preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
118
+											preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
119
+											preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
120
+											preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
121
+											preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
122
+
123
+											if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
124
+											$version = trim( $version[1] );
125
+											else
126
+											$version = '';
127
+
128
+											$plugin_data = array('Name' => trim($plugin_name[1]), 'URI' => trim($plugin_uri[1]), 'Description' => trim($description[1]), 'Author' => trim($author_name[1]), 'Author_uri' => trim($author_uri[1]), 'Version' => $version);
129
+*/
130
+											$desc = __("There is no info for this plugin jet");
131
+											$activated = array_key_exists($plugin, $actives);
132
+								?>								
133
+								<ul>	
134
+									<li class="select">
135
+										<label for="<?php echo $key;?>" title="<?php echo $desc; ?>" class="help"><?php echo $plugin;	?></label>
136
+										<select name="plugins[<?php echo $plugin;	?>]" id="<?php echo $key;?>">
137
+											<option value="on" <?php if($activated) echo 'selected="selected"'; ?>><?php echo __("On")?></option>
138
+											<option value="off" <?php if(!$activated) echo 'selected="selected"'; ?>><?php echo __("Off")?></option>
139
+										</select>
140
+									</li>
141
+									<?php
142
+										}
143
+									?>
144
+								</ul>
145
+								<?php
146
+									}
147
+								?>
148
+							</fieldset>
149
+							<p>
150
+								<input type="submit" name="btnsubmit" id="btnsubmit" value="<?php echo __("Modify")?>" class="submit"/>
151
+							</p>
152
+						</form>	
153
+								
154
+					</div>
155
+
156
+					<div class="footer-box">&nbsp;</div>
157
+				</div>
158
+			</div>
159
+			<div id="foot">
160
+				<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
161
+			</div>
162
+		</div>
163
+	</body>
164
+	</html>
165
+<?php
166
+	}
167
+} else {
168
+	header("Location: ".$conf->urlGelato."/login.php");
169
+}
170 170
 ?>

+ 3 - 3
admin/settings.php View File

@@ -27,7 +27,7 @@ if ($user->isAdmin()) {
27 27
 	<head>
28 28
 		<title>gelato :: <?php echo __("settings")?></title>
29 29
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
30
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
30
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
31 31
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
32 32
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
33 33
 		<script type="text/javascript">
@@ -90,7 +90,7 @@ if ($user->isAdmin()) {
90 90
 									<li><label for="lang"><?php echo __("Language:")?></label>
91 91
 										<select id="lang" name="lang">
92 92
 <?php									
93
-										$langs = getLangs();
93
+										$langs = util::getLangs();
94 94
 										foreach ($langs as $key=>$lang) {
95 95
 											$active = ($conf->lang==$key) ? "selected" : "";
96 96
 											echo "<option value=\"".$key."\" ".$active.">".$lang."</option>\n";
@@ -102,7 +102,7 @@ if ($user->isAdmin()) {
102 102
 									<li><label for="template"><?php echo __("Template:")?></label>
103 103
 										<select id="template" name="template">
104 104
 <?php
105
-										$themes = getThemes();
105
+										$themes = util::getThemes();
106 106
 										foreach ($themes as $theme) {
107 107
 											$active = ($conf->template==$theme) ? "selected" : "";
108 108
 											echo "<option value=\"".$theme."\" ".$active.">".$theme."</option>\n";

+ 1 - 3
admin/user.php View File

@@ -15,8 +15,6 @@ if(!defined('entry')) define('entry', true);
15 15
 require('../entry.php');
16 16
 global $user, $conf, $tumble;
17 17
 
18
-$user = new user();
19
-$conf = new configuration();
20 18
 $isEdition = isset($_GET["edit"]);
21 19
 $userId = ($isEdition) ? $_GET["edit"] : NULL;
22 20
 if ($user->isAdmin()) {
@@ -50,7 +48,7 @@ if ($user->isAdmin()) {
50 48
 	<head>
51 49
 		<title>gelato :: <?php echo __("add user")?></title>
52 50
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
53
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
51
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
54 52
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
55 53
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
56 54
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>

+ 3 - 3
api.php View File

@@ -54,15 +54,15 @@ if(!defined('entry')) define('entry',true);
54 54
 			$postType = type2Number($_GET["type"]);
55 55
 		}
56 56
 		$rs = $tumble->getPosts($total, $start);
57
-		if ($tumble->contarRegistros()>0) {
57
+		if ($db->contarRegistros()>0) {
58 58
 ?>
59 59
 			<posts start="<?php echo $start; ?>" total="<?php echo $total; ?>">
60 60
 <?php 
61 61
 			while($register = mysql_fetch_array($rs)) {
62
-				$desc = trimString($register["description"]);				
62
+				$desc = util::trimString($register["description"]);				
63 63
 				$strEnd = ($conf->urlFriendly) ? "/" : "";
64 64
 				$url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd;
65
-				$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"]) + transform_offset($conf->offsetTime));
65
+				$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
66 66
 				
67 67
 				switch ($register["type"]) {
68 68
 					case "1":

+ 5 - 5
archive.php View File

@@ -23,11 +23,11 @@ $regular = array();
23 23
 $video = array();
24 24
 
25 25
 $rs = $tumble->getPosts($tumble->getPostsNumber());
26
-if ($tumble->contarRegistros()>0) {
26
+if ($db->contarRegistros()>0) {
27 27
     while($register = mysql_fetch_assoc($rs)) {
28 28
     	$output = handleNode($register);
29 29
     	
30
-		$theType = type2Text($register["type"]);
30
+		$theType = util::type2Text($register["type"]);
31 31
 		
32 32
     	switch($theType) {
33 33
 			case 'quote':
@@ -55,13 +55,13 @@ if ($tumble->contarRegistros()>0) {
55 55
 function handleNode($node) {
56 56
 		global $user, $tumble, $conf;
57 57
 		$dateTmp = null;
58
-		$formatedDate = gmdate("M d", strtotime($node["date"]) + transform_offset($conf->offsetTime));
58
+		$formatedDate = gmdate("M d", strtotime($node["date"]) + util::transform_offset($conf->offsetTime));
59 59
         
60 60
 		$output = array();		
61 61
 		$output['url'] = $tumble->getPermalink($node["id_post"]);
62 62
  		$output['date'] = $formatedDate;
63 63
  		
64
- 		$theType = type2Text($node["type"]);
64
+ 		$theType = util::type2Text($node["type"]);
65 65
  		
66 66
 		switch($theType) {
67 67
 			case 'quote':
@@ -111,7 +111,7 @@ function handleNode($node) {
111 111
 
112 112
 	<head>
113 113
     	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
114
-        <meta name="generator" content="gelato <?php echo codeName()." (".version().")"; ?>" />
114
+        <meta name="generator" content="gelato <?php echo util::codeName()." (".util::version().")"; ?>" />
115 115
         <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
116 116
         <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $conf->urlGelato.($conf->urlFriendly ? "/rss/" : "/rss.php"); ?>"/>
117 117
 		<title><?php echo $conf->title." &raquo; ".__(" archive"); ?></title>

+ 18 - 14
classes/comments.class.php View File

@@ -11,16 +11,20 @@ if(!defined('entry') || !entry) die('Not a valid page');
11 11
 
12 12
   =========================== */
13 13
 
14
-class comments extends Conexion_Mysql {
14
+class comments {
15
+	var $db;
15 16
 	var $conf;
16 17
 	
17 18
 	function comments() {
18
-		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
19
-		$this->conf = new configuration();
19
+		global $db;
20
+		global $conf;
21
+		
22
+		$this->db = $db;
23
+		$this->conf = $conf;
20 24
 	}
21 25
 	
22 26
 	function addComment($fieldsArray) {		
23
-		if ($this->insertarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray)) {
27
+		if ($this->db->insertarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray)) {
24 28
 			return true;
25 29
 		} else {
26 30
 			return false;
@@ -55,33 +59,33 @@ class comments extends Conexion_Mysql {
55 59
 	
56 60
 	function getComments($idPost=null, $limit=null, $from=null, $spam=null) {
57 61
 		if (isset($idPost)) {
58
-			$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0 order by comment_date ASC");
62
+			$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0 order by comment_date ASC");
59 63
 		} else {			
60 64
 			if (isset($limit) && isset($from)) {
61 65
 				$limit = " LIMIT $from, $limit";
62 66
 			} else { ""; }
63 67
 			if (isset($spam)) { $sp = "1"; } else { $sp = "0"; } 
64
-			$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=".$sp." order by comment_date ASC".$limit);
68
+			$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=".$sp." order by comment_date ASC".$limit);
65 69
 		}
66
-		return $this->mid_consulta;
70
+		return $this->db->mid_consulta;
67 71
 	}
68 72
 	
69 73
 	function getComment($id="") {
70
-		$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id);
71
-		return mysql_fetch_array($this->mid_consulta);
74
+		$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id);
75
+		return mysql_fetch_array($this->db->mid_consulta);
72 76
 	}
73 77
 	
74 78
 	function countComments($idPost=null) {
75 79
 		if (isset($idPost)) {
76
-			$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0");
80
+			$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0");
77 81
 		} else {
78
-			$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=0");
82
+			$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=0");
79 83
 		}		
80
-		return $this->contarRegistros();
84
+		return $this->db->contarRegistros();
81 85
 	}
82 86
 	
83 87
 	function deleteComment($idComment) {
84
-		if ($this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."comments WHERE id_comment=".$idComment)) {
88
+		if ($this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."comments WHERE id_comment=".$idComment)) {
85 89
 			return true;
86 90
 		} else {
87 91
 			return false;
@@ -89,7 +93,7 @@ class comments extends Conexion_Mysql {
89 93
 	}
90 94
 	
91 95
 	function modifyComment($fieldsArray, $id_comment) {
92
-		if ($this->modificarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray, "id_comment=$id_comment")) {
96
+		if ($this->db->modificarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray, "id_comment=$id_comment")) {
93 97
 			return true;
94 98
 		} else {
95 99
 			return false;

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

@@ -10,32 +10,32 @@ if(!defined('entry') || !entry) die('Not a valid page');
10 10
   Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11 11
 
12 12
   =========================== */
13
-?>
14
-<?php
15
-require_once("configuration.class.php");
16
-require_once("functions.php");
17 13
 
18
-class gelato extends Conexion_Mysql {
14
+class gelato {
15
+	var $db;
19 16
 	var $conf;
20 17
 
21 18
 	function gelato() {
22
-		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
23
-		$this->conf = new configuration();
19
+		global $db;
20
+		global $conf;
21
+		
22
+		$this->db = $db;
23
+		$this->conf = $conf;
24 24
 	}
25 25
 
26 26
 	function saveSettings($fieldsArray) {
27
-		if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) {
27
+		if ($this->db->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) {
28 28
 			header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true");
29 29
 			die();
30 30
 		} else {
31
-			header("Location: ".$this->conf->urlGelato."/admin/settings.php?error=1&des=".$this->merror);
31
+			header("Location: ".$this->conf->urlGelato."/admin/settings.php?error=1&des=".$this->db->merror);
32 32
 			die();
33 33
 		}
34 34
 	}
35 35
 
36 36
 	function saveOption($value, $name) {
37 37
 		$sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1";
38
-		if ($this->ejecutarConsulta($sqlStr)) {
38
+		if ($this->db->ejecutarConsulta($sqlStr)) {
39 39
 			return true;
40 40
 		} else {
41 41
 			return true;
@@ -43,7 +43,7 @@ class gelato extends Conexion_Mysql {
43 43
 	}
44 44
 
45 45
 	function addPost($fieldsArray) {
46
-		if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
46
+		if ($this->db->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
47 47
 			return true;
48 48
 		} else {
49 49
 			return false;
@@ -51,40 +51,40 @@ class gelato extends Conexion_Mysql {
51 51
 	}
52 52
 
53 53
 	function modifyPost($fieldsArray, $id_post) {
54
-		if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) {
54
+		if ($this->db->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) {
55 55
 			header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true");
56 56
 			die();
57 57
 		} else {
58
-			header("Location: ".$this->conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
58
+			header("Location: ".$this->conf->urlGelato."/admin/index.php?error=2&des=".$this->db->merror);
59 59
 			die();
60 60
 		}
61 61
 	}
62 62
 
63 63
 	function deletePost($idPost) {
64
-		$this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost);
64
+		$this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost);
65 65
 	}
66 66
 
67 67
 	function getPosts($limit="10", $from="0") {
68 68
 		$sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit";
69
-		$this->ejecutarConsulta($sqlStr);
70
-		return $this->mid_consulta;
69
+		$this->db->ejecutarConsulta($sqlStr);
70
+		return $this->db->mid_consulta;
71 71
 	}
72 72
 
73 73
 	function getPost($id="") {
74
-		$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
75
-		return mysql_fetch_array($this->mid_consulta);
74
+		$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
75
+		return mysql_fetch_array($this->db->mid_consulta);
76 76
 	}
77 77
 
78 78
 	function getPostsNumber() {
79
-		$this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
80
-		$row = mysql_fetch_assoc($this->mid_consulta);
79
+		$this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
80
+		$row = mysql_fetch_assoc($this->db->mid_consulta);
81 81
 		return $row['total'];
82 82
 	}
83 83
 
84 84
 	function getType($id) {
85
-		if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
86
-			if ($this->contarRegistros()>0) {
87
-				while($registro = mysql_fetch_array($this->mid_consulta)) {
85
+		if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
86
+			if ($this->db->contarRegistros()>0) {
87
+				while($registro = mysql_fetch_array($this->db->mid_consulta)) {
88 88
 					return $registro[0];
89 89
 				}
90 90
 			}
@@ -185,7 +185,7 @@ class gelato extends Conexion_Mysql {
185 185
 	}
186 186
 	function getMp3Player($url) {
187 187
 		if (isMP3($url)) {
188
-			$playerUrl = $this->conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url;
188
+			$playerUrl = $conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url;
189 189
 			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";
190 190
 		} elseif (isGoEar($url)) {
191 191
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/external.swf\" width=\"366\" height=\"130\"><param name=\"movie\" value=\"http://www.goear.com/files/external.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=".getGoEarCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";

+ 10 - 15
classes/templates.class.php View File

@@ -1,20 +1,15 @@
1 1
 <?php
2
- if(!defined('entry') || !entry) die('Not a valid page');
2
+if(!defined('entry') || !entry) die('Not a valid page'); 
3
+/* ===========================
3 4
 
4
-/**
5
- * version 0.0.1
6
- *
7
- * Clase plantillas
8
- *
9
- * @name Manejo de plantillas.
10
- * @version 0.0.1
11
- * @link http://www.pecesama.net/weblog/
12
- * @copyright MIT Licence
13
- * @author Pedro Santana [pecesama]
14
- */
15
-?>
16
-<?php
17
-require_once("functions.php");
5
+  gelato CMS - A PHP based tumblelog CMS
6
+  development version
7
+  http://www.gelatocms.com/
8
+
9
+  gelato CMS is a free software licensed under the GPL 2.0
10
+  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11
+
12
+  =========================== */
18 13
 
19 14
 class plantillas {
20 15
 

+ 22 - 20
classes/user.class.php View File

@@ -12,19 +12,21 @@ if(!defined('entry') || !entry) die('Not a valid page');
12 12
   =========================== */
13 13
 ?>
14 14
 <?php
15
-require_once("configuration.class.php");
16
-
17
-class user extends Conexion_Mysql {
15
+class user {
18 16
 	var $conf;
17
+	var $db;
19 18
 	var $cookieString;
20 19
 	var $cookieTime;
21 20
 	var $persist = false;
22 21
 
23 22
 	function user() {
24
-		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
23
+		global $db;
24
+		global $conf;
25
+		
26
+		$this->db = $db;
27
+		$this->conf = $conf;		
25 28
 		$this->cookie_life = 60*24*3600;
26 29
 		$this->cookieTime = time();
27
-		$this->conf = new configuration();
28 30
 	}
29 31
 
30 32
 	function isAdmin() {		
@@ -47,9 +49,9 @@ class user extends Conexion_Mysql {
47 49
 
48 50
 	function validateUser($username="", $password="") {
49 51
 
50
-		if ($this->ejecutarConsulta("SELECT id_user, login, password  FROM ".$this->conf->tablePrefix."users WHERE login='".$this->sql_escape($username)."' AND password='".$password."'")) {
51
-			if ($this->contarRegistros()>0) {
52
-				$register=$this->obtenerRegistro();
52
+		if ($this->db->ejecutarConsulta("SELECT id_user, login, password  FROM ".$this->conf->tablePrefix."users WHERE login='".$this->db->sql_escape($username)."' AND password='".$password."'")) {
53
+			if ($this->db->contarRegistros()>0) {
54
+				$register = $this->db->obtenerRegistro();
53 55
 				$_SESSION['user_id']=$register["id_user"];
54 56
 				$_SESSION['user_login']=$register["login"];
55 57
 				$_SESSION['authenticated'] = true;
@@ -72,8 +74,8 @@ class user extends Conexion_Mysql {
72 74
 	}
73 75
 
74 76
 	function userExist($user="") {
75
-		if ($this->ejecutarConsulta("SELECT * FROM ".$this->conf->tablePrefix."users WHERE login='".$user."'")) {
76
-			if ($this->contarRegistros()>0) {
77
+		if ($this->db->ejecutarConsulta("SELECT * FROM ".$this->conf->tablePrefix."users WHERE login='".$user."'")) {
78
+			if ($this->db->contarRegistros()>0) {
77 79
 				return true;
78 80
 			} else {
79 81
 				return false;
@@ -86,11 +88,11 @@ class user extends Conexion_Mysql {
86 88
 	}
87 89
 
88 90
 	function addUser($fieldsArray) {
89
-		if ($this->ejecutarConsulta("SELECT id_user FROM ".$this->conf->tablePrefix."users WHERE login='".$fieldsArray['login']."'")) {
90
-			if ($this->contarRegistros()==0) {
91
+		if ($this->db->ejecutarConsulta("SELECT id_user FROM ".$this->conf->tablePrefix."users WHERE login='".$fieldsArray['login']."'")) {
92
+			if ($this->db->contarRegistros()==0) {
91 93
 				$realPassword = ($fieldsArray["password"]);
92 94
 				$fieldsArray["password"] = md5($fieldsArray["password"]);
93
-				if ($this->insertarDeFormulario($this->conf->tablePrefix."users", $fieldsArray)) {
95
+				if ($this->db->insertarDeFormulario($this->conf->tablePrefix."users", $fieldsArray)) {
94 96
 					$this->confirmationEmail($fieldsArray['email'], $fieldsArray['login'], $realPassword);
95 97
 					header("Location: ".$this->conf->urlGelato."/admin/admin.php?added=true");
96 98
 					die();
@@ -107,7 +109,7 @@ class user extends Conexion_Mysql {
107 109
 
108 110
 	function modifyUser($fieldsArray, $id_user) {
109 111
 		$fieldsArray["password"] = md5($fieldsArray["password"]);
110
-		if ($this->modificarDeFormulario($this->conf->tablePrefix."users", $fieldsArray, "id_user=$id_user")) {
112
+		if ($this->db->modificarDeFormulario($this->conf->tablePrefix."users", $fieldsArray, "id_user=$id_user")) {
111 113
 			header("Location: ".$this->conf->urlGelato."/admin/admin.php?modified=true");
112 114
 			die();
113 115
 		} else {
@@ -117,19 +119,19 @@ class user extends Conexion_Mysql {
117 119
 	}
118 120
 
119 121
 	function deleteUser($idUser) {
120
-		$this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."users WHERE id_user=".$idUser);
122
+		$this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."users WHERE id_user=".$idUser);
121 123
 	}
122 124
 
123 125
 	function getUsers($show="10", $from="0") {
124 126
 		$sqlStr = "select * from ".$this->conf->tablePrefix."users ORDER BY id_user DESC LIMIT $from,$show";
125
-		$this->ejecutarConsulta($sqlStr);
126
-		return $this->mid_consulta;
127
+		$this->db->ejecutarConsulta($sqlStr);
128
+		return $this->db->mid_consulta;
127 129
 	}
128 130
 
129 131
 	function getUserByID($idUser) {
130
-		if ($this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."users where id_user=".$idUser)) {
131
-			if ($this->contarRegistros()>0) {
132
-				return $registro=$this->obtenerRegistro();
132
+		if ($this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."users where id_user=".$idUser)) {
133
+			if ($this->db->contarRegistros()>0) {
134
+				return $registro=$this->db->obtenerRegistro();
133 135
 			} else {
134 136
 				return false;
135 137
 			}

classes/functions.php → classes/util.class.php View File

@@ -1,5 +1,5 @@
1 1
 <?php
2
-if(!defined('entry') || !entry) die('Not a valid page');
2
+if(!defined('entry') || !entry) die('Not a valid page'); 
3 3
 /* ===========================
4 4
 
5 5
   gelato CMS - A PHP based tumblelog CMS
@@ -12,6 +12,8 @@ if(!defined('entry') || !entry) die('Not a valid page');
12 12
   =========================== */
13 13
 ?>
14 14
 <?php
15
+class util {
16
+	
15 17
 	function version() {
16 18
 		return "1.0";
17 19
 	}
@@ -34,7 +36,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
34 36
 	}
35 37
 
36 38
 	function isMP3($fileUrl) {
37
-		if (endsWith($fileUrl, ".mp3")) {
39
+		if (util::endsWith($fileUrl, ".mp3")) {
38 40
 			return true;
39 41
 		} else {
40 42
 			return false;
@@ -42,15 +44,15 @@ if(!defined('entry') || !entry) die('Not a valid page');
42 44
 	}
43 45
 
44 46
 	function getMP3File($remoteFileName) {
45
-		if (isMP3($remoteFileName)) {
46
-			if (getFile($remoteFileName)) {
47
+		if (util::isMP3($remoteFileName)) {
48
+			if (util::getFile($remoteFileName)) {
47 49
 				return true;
48 50
 			} else {
49 51
 				return false;
50 52
 			}
51
-		} elseif (isGoEar($remoteFileName)) {
53
+		} elseif (util::isGoEar($remoteFileName)) {
52 54
 			return true;
53
-		} elseif (isOdeo($remoteFileName)) {
55
+		} elseif (util::isOdeo($remoteFileName)) {
54 56
 			return true;
55 57
 		} else {
56 58
 			return false;
@@ -65,14 +67,14 @@ if(!defined('entry') || !entry) die('Not a valid page');
65 67
 	}
66 68
 
67 69
 	function isGoEar($songUrl) {
68
-		if (beginsWith($songUrl, "http://www.goear.com/listen.php?v=") || beginsWith($songUrl, "http://goear.com/listen.php?v="))
70
+		if (util::beginsWith($songUrl, "http://www.goear.com/listen.php?v=") || util::beginsWith($songUrl, "http://goear.com/listen.php?v="))
69 71
 			return true;
70 72
 		else
71 73
 			return false;
72 74
 	}
73 75
 
74 76
 	function isOdeo($songUrl){
75
-		if (beginsWith($songUrl, "http://odeo.com/audio/") || beginsWith($songUrl, "http://www.odeo.com/audio/"))
77
+		if (util::beginsWith($songUrl, "http://odeo.com/audio/") || util::beginsWith($songUrl, "http://www.odeo.com/audio/"))
76 78
 			return true;
77 79
 		else
78 80
 			return false;
@@ -85,15 +87,15 @@ if(!defined('entry') || !entry) die('Not a valid page');
85 87
 	}
86 88
 
87 89
 	function isImageFile($photoUrl) {
88
-		if (endsWith($photoUrl, ".jpg")) { return true; }
89
-		elseif (endsWith($photoUrl, ".gif")) { return true; }
90
-		elseif (endsWith($photoUrl, ".png")) { return true; }
90
+		if (util::endsWith($photoUrl, ".jpg")) { return true; }
91
+		elseif (util::endsWith($photoUrl, ".gif")) { return true; }
92
+		elseif (util::endsWith($photoUrl, ".png")) { return true; }
91 93
 		else { return false; }
92 94
 	}
93 95
 
94 96
 	function getPhotoFile($remoteFileName) {
95
-		if (isImageFile($remoteFileName)) {
96
-			if (getFile($remoteFileName)) {
97
+		if (util::isImageFile($remoteFileName)) {
98
+			if (util::getFile($remoteFileName)) {
97 99
 				return true;
98 100
 			} else {
99 101
 				return false;
@@ -104,8 +106,8 @@ if(!defined('entry') || !entry) die('Not a valid page');
104 106
 	}
105 107
 
106 108
 	function getFile($remoteFileName) {
107
-		$fileName = "../uploads/".sanitizeName(getFileName($remoteFileName));
108
-		$str = _file_get_contents($remoteFileName);
109
+		$fileName = "../uploads/".util::sanitizeName(util::getFileName($remoteFileName));
110
+		$str = util::_file_get_contents($remoteFileName);
109 111
 		if (!$handle = fopen($fileName, 'w')) {
110 112
 			//die("no se abrio de escritura");
111 113
 			return false;
@@ -120,7 +122,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
120 122
 	}
121 123
 
122 124
 	function isVimeoVideo($videoUrl) {
123
-		if (beginsWith($videoUrl, "http://vimeo.com/") || beginsWith($videoUrl, "http://www.vimeo.com/"))
125
+		if (util::beginsWith($videoUrl, "http://vimeo.com/") || util::beginsWith($videoUrl, "http://www.vimeo.com/"))
124 126
 			return true;
125 127
 		else
126 128
 			return false;
@@ -135,7 +137,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
135 137
 
136 138
 	function isYoutubeVideo($videoUrl) {
137 139
 		$url = explode("?", $videoUrl);
138
-		if((beginsWith($url[0], "http://") && endsWith($url[0], ".youtube.com/watch")) || beginsWith($url[0], "http://youtube.com/watch"))
140
+		if((util::beginsWith($url[0], "http://") && util::endsWith($url[0], ".youtube.com/watch")) || util::beginsWith($url[0], "http://youtube.com/watch"))
139 141
 			return true;
140 142
 		else
141 143
 			return false;
@@ -148,7 +150,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
148 150
 	}
149 151
 	
150 152
 	function isYahooVideo($videoUrl){
151
-		if (beginsWith($videoUrl, "http://video.yahoo.com/watch/") || beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
153
+		if (util::beginsWith($videoUrl, "http://video.yahoo.com/watch/") || util::beginsWith($videoUrl, "http://www.video.yahoo.com/watch/"))
152 154
 			return true;
153 155
 		else
154 156
 			return false;
@@ -163,7 +165,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
163 165
 	}
164 166
 
165 167
 	function isGoogleVideoUrl($videoUrl){
166
-		if (beginsWith($videoUrl, "http://video.google.com/videoplay?")){
168
+		if (util::beginsWith($videoUrl, "http://video.google.com/videoplay?")){
167 169
 			return true;
168 170
 		} else {
169 171
 			return false;
@@ -177,7 +179,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
177 179
 	}
178 180
 	
179 181
 	function isMTVVideoUrl($videoUrl){
180
-		if (beginsWith($videoUrl, "http://www.mtvmusic.com/video/?id=") || beginsWith($videoUrl, "http://mtvmusic.com/video/?id=")){
182
+		if (util::beginsWith($videoUrl, "http://www.mtvmusic.com/video/?id=") || util::beginsWith($videoUrl, "http://mtvmusic.com/video/?id=")){
181 183
 			return true;
182 184
 		} else {
183 185
 			return false;
@@ -191,7 +193,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
191 193
 	}
192 194
 
193 195
 	function isDailymotionVideo($videoUrl) {
194
-		if (beginsWith($videoUrl, "http://www.dailymotion.com/video/") || beginsWith($videoUrl, "http://dailymotion.com/video/"))
196
+		if (util::beginsWith($videoUrl, "http://www.dailymotion.com/video/") || util::beginsWith($videoUrl, "http://dailymotion.com/video/"))
195 197
 			return true;
196 198
 		else
197 199
 			return false;
@@ -204,7 +206,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
204 206
 	}
205 207
 
206 208
 	function isSlideSharePresentation($videoUrl) {
207
-		if (beginsWith($videoUrl, "[slideshare id="))
209
+		if (util::beginsWith($videoUrl, "[slideshare id="))
208 210
 			return true;
209 211
 		else
210 212
 			return false;
@@ -218,13 +220,13 @@ if(!defined('entry') || !entry) die('Not a valid page');
218 220
 	}
219 221
 
220 222
 	function isVideo($url) {
221
-		if (isYoutubeVideo($url)) { return true; }
222
-		elseif (isVimeoVideo($url)) { return true; }
223
-		elseif (isDailymotionVideo($url)) { return true; }
224
-		elseif (isYahooVideo($url)) { return true; }
225
-		elseif (isSlideSharePresentation($url)) { return true; }
226
-		elseif (isGoogleVideoUrl($url)) { return true; }
227
-		elseif (isMTVVideoUrl($url)) { return true; }
223
+		if (util::isYoutubeVideo($url)) { return true; }
224
+		elseif (util::isVimeoVideo($url)) { return true; }
225
+		elseif (util::isDailymotionVideo($url)) { return true; }
226
+		elseif (util::isYahooVideo($url)) { return true; }
227
+		elseif (util::isSlideSharePresentation($url)) { return true; }
228
+		elseif (util::isGoogleVideoUrl($url)) { return true; }
229
+		elseif (util::isMTVVideoUrl($url)) { return true; }
228 230
 		else { return false; }
229 231
 	}
230 232
 
@@ -295,7 +297,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
295 297
 				return false;
296 298
 			}
297 299
 		} else {
298
-			if (extension_loaded('curl') && version_compare(get_curl_version(), '7.10.5', '>=')) {
300
+			if (extension_loaded('curl') && version_compare(util::get_curl_version(), '7.10.5', '>=')) {
299 301
 				$ch = curl_init();
300 302
 				$timeout = 5;
301 303
 				curl_setopt ($ch, CURLOPT_URL, $path);
@@ -417,7 +419,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
417 419
 							}
418 420
 							if (preg_match('|\.mo$|', $directory2)){
419 421
 								if(!in_array($directory2,$dirs)){
420
-									$dirs[$directory]=displayLanguage(trim($directory));
422
+									$dirs[$directory]=util::displayLanguage(trim($directory));
421 423
 									$i++;
422 424
 								}
423 425
 							}
@@ -653,29 +655,17 @@ if(!defined('entry') || !entry) die('Not a valid page');
653 655
 		$actives = json_decode($conf->active_plugins,1);
654 656
 		$actives = $actives[1];
655 657
         foreach ($actives as $index => $plugin) {
656
-			//echo "[".$index."] => ".$plugin."<br />";
657 658
             if (!file_exists(Absolute_Path."plugins/".$plugin)) {
658
-				//echo "\tNo existe el archivo<br />";
659 659
                 unset($actives[$index]);
660 660
                 continue;
661 661
             }else{
662 662
 				require_once(Absolute_Path.'plugins/'.$plugin);
663
-			}
664
-			//echo "\tSi existe el archivo<br />";
665
-            
663
+			}            
666 664
 			if (!class_exists($index)) {
667
-				//echo "\tNo existe la clase<br />";
668 665
                 continue;
669 666
 			}
670
-			//echo "\tSi existe la clase<br />";
671
-
672 667
 			plugins::$instances[$index] = new $index;
673
-			//print_r(plugins::$instances[$index]);
674
-			//echo "<br />";
675 668
         }
676
-		/*echo "<br /><br />";
677
-		print_r(plugins::$instances);
678
-		echo "<br />";
679
-		die();*/
680 669
 	}
681
-	?>
670
+}
671
+?>

+ 6 - 40
entry.php View File

@@ -1,30 +1,7 @@
1 1
 <?php
2 2
 ob_start();
3 3
 if(!defined('entry') || !entry) die('Not a valid page');
4
-/*
5
- * Created on Sep 15, 2007
6
- * Modified on Oct 30, 2008
7
- *
8
- * Known Entry Points
9
- * api.php
10
- * archive.php
11
- * install.php
12
- * index.php
13
- * login.php
14
- * update.php
15
- * rss.php
16
- * admin/bm.php
17
- * admin/index.php
18
- * admin/close.php
19
- * admin/ajax.php
20
- * admin/settings.php
21
- * admin/options.php
22
- * admin/admin.php
23
- * admin/comments.php
24
- * admin/user.php
25
- * admin/feeds.php
26
- * classes/imgsize.php
27
- */
4
+
28 5
 
29 6
 error_reporting (E_ALL);
30 7
 ini_set('display_errors', '1');
@@ -57,7 +34,8 @@ if($installed) {
57 34
 }
58 35
 
59 36
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'configuration.class.php');
60
-require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'functions.php');
37
+require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'util.class.php');
38
+//require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'functions.php');
61 39
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gelato.class.php');
62 40
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'templates.class.php');
63 41
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'themes.class.php');
@@ -76,27 +54,15 @@ if($installed){
76 54
 
77 55
 	// Globals to be used throughout the application
78 56
 	$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
79
-	$user = new user();
57
+	$conf = new configuration();
80 58
 	$tumble = new gelato();
81
-	$conf = new configuration();	
59
+	$user = new user();
82 60
 
83 61
 	session_start();
84 62
 	
85
-	//print_r($conf->plugins);
86
-	//die();
87
-	init_plugins();
63
+	util::init_plugins();
88 64
 	$trigger = plugin::instance();
89 65
 	
90
-	//echo "plugins.instances: ";
91
-	//print_r(plugins::$instances);
92
-	//echo "<br />";
93
-	//die();
94
-	
95
-	//echo "plugin.actions: ";
96
-	//$plugEngine = plugin::instance();
97
-	//print_r($plugEngine->actions);
98
-	//die();
99
-	
100 66
 	$trigger->call('gelato_init');	
101 67
 
102 68
 	$feeds = new feeds();

+ 8 - 8
index.php View File

@@ -13,7 +13,7 @@ if(!defined('entry'))define('entry', true);
13 13
 ?>
14 14
 <?php
15 15
 
16
-// Received a valid request, better start setting globals we'll need throughout the app in entry.php
16
+// Received a valid request
17 17
 require_once('entry.php');
18 18
 global $user, $tumble, $conf;
19 19
 
@@ -50,7 +50,7 @@ $theme = new themes;
50 50
 
51 51
 		$feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
52 52
 
53
-		$gelato_includes = "<meta name=\"generator\" content=\"gelato ".codeName()." (".version().")\" />\n";
53
+		$gelato_includes = "<meta name=\"generator\" content=\"gelato ".util::codeName()." (".util::version().")\" />\n";
54 54
 		$gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
55 55
 
56 56
 		$page_title = $conf->title;
@@ -100,10 +100,10 @@ $theme = new themes;
100 100
 
101 101
 				$rs = $tumble->getPosts($limit, $from);
102 102
 
103
-				if ($tumble->contarRegistros()>0) {
103
+				if ($db->contarRegistros()>0) {
104 104
 						$dateTmp = null;
105 105
 						while($register = mysql_fetch_assoc($rs)) {
106
-								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
106
+								$formatedDate = gmdate("M d", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
107 107
 								if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
108 108
 
109 109
 								$permalink = $tumble->getPermalink($register["id_post"]);
@@ -115,7 +115,7 @@ $theme = new themes;
115 115
 
116 116
 								$row['Date_Added'] = $formatedDate;
117 117
 								$row['Permalink'] = $permalink;
118
-								$row['postType'] = type2Text($register["type"]);
118
+								$row['postType'] = util::type2Text($register["type"]);
119 119
 
120 120
 								switch ($register['type']){
121 121
 										case "1":
@@ -199,7 +199,7 @@ $theme = new themes;
199 199
 			} else {
200 200
 				$register = $tumble->getPost($id_post);
201 201
 
202
-				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
202
+				$formatedDate = gmdate("M d", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
203 203
 				$permalink = $tumble->getPermalink($register["id_post"]);
204 204
 
205 205
 				$conversation = $register["description"];
@@ -211,7 +211,7 @@ $theme = new themes;
211 211
 
212 212
 				$row['Date_Added'] = $formatedDate;
213 213
 				$row['Permalink'] = $permalink;
214
-				$row['postType'] = type2Text($register["type"]);
214
+				$row['postType'] = util::type2Text($register["type"]);
215 215
 
216 216
 				switch ($register['type']) {
217 217
 						case "1":
@@ -289,7 +289,7 @@ $theme = new themes;
289 289
 
290 290
 						$answers['Id_Comment'] = $rowComment["id_comment"];
291 291
 						$answers['Comment_Author'] = $commentAuthor;
292
-						$answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime));
292
+						$answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"]) + util::transform_offset($conf->offsetTime));
293 293
 						$answers['Comment'] = nl2br($rowComment["content"]);
294 294
 
295 295
 						$comments[] = $answers;

+ 1 - 1
login.php View File

@@ -40,7 +40,7 @@ if ($user->isAuthenticated()) {
40 40
 	<head>
41 41
 		<title>gelato :: <?php echo __("login screen")?></title>
42 42
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
43
-		<meta name="generator" content="gelato cms <?php echo version();?>" />
43
+		<meta name="generator" content="gelato cms <?php echo util::version();?>" />
44 44
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
45 45
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
46 46
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.validate.min.js"></script>

+ 4 - 4
rss.php View File

@@ -28,7 +28,7 @@ if(!defined('entry')) define('entry',true);
28 28
 		<title><?php echo htmlspecialchars($conf->title);?></title>
29 29
 		<link><?php echo $conf->urlGelato;?></link>
30 30
 		<description><?php echo htmlspecialchars($conf->description);?></description>
31
-		<generator>gelato CMS <?php echo codeName()." (".version().")"; ?></generator>        
31
+		<generator>gelato CMS <?php echo util::codeName()." (".util::version().")"; ?></generator>        
32 32
 		<image>
33 33
 			<url><?php echo $conf->urlGelato;?>/images/information.png</url>
34 34
 			<title><?php echo htmlspecialchars($conf->description);?></title>
@@ -36,7 +36,7 @@ if(!defined('entry')) define('entry',true);
36 36
 		</image>
37 37
 <?php
38 38
 	$rs = $tumble->getPosts("20");
39
-	if ($tumble->contarRegistros()>0) {		
39
+	if ($db->contarRegistros()>0) {		
40 40
 
41 41
 		while($register = mysql_fetch_array($rs)) {
42 42
 			$register["description"] = $register["description"];
@@ -76,10 +76,10 @@ if(!defined('entry')) define('entry',true);
76 76
 					$desc = $tumble->getMp3Player($register["url"]);
77 77
 					break;
78 78
 			}
79
-			$tit = trimString($tit);
79
+			$tit = util::trimString($tit);
80 80
 			$strEnd = ($conf->urlFriendly) ? "/" : "";
81 81
 			$url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd;
82
-			$formatedDate = gmdate("r", strtotime($register["date"]) + transform_offset($conf->offsetTime));
82
+			$formatedDate = gmdate("r", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
83 83
 ?>
84 84
 			<item>
85 85
 				<title><?php echo $tit;?></title>