Browse Source

Plugin control panel

ravenlp 15 years ago
parent
commit
cc6ffa91d1

+ 1 - 0
admin/admin.php View File

@@ -60,6 +60,7 @@ if ($user->isAdmin()) {
60 60
 				<div class="box">
61 61
 					<ul class="menu manage">
62 62
 					<h3>Manage</h3>
63
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/plugins.php"><?php echo __("Plugins")?></a></li>
63 64
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
64 65
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/index.php"><?php echo __("Posts")?></a></li>
65 66
 					<li><a href="<?php echo $conf->urlGelato;?>/admin/user.php"><?php echo __("Add user")?></a></li>

+ 29 - 16
admin/css/style.css View File

@@ -29,14 +29,14 @@ fieldset{ border:none; margin:0; padding:0;}
29 29
 
30 30
 /*********** LAYOUT *************/
31 31
 
32
-body{ background: #fff; text-align:center; font-family:"Trebuchet Ms", Verdana, Tahoma; font-size:1em;}
32
+body{ background: #e0e0e0; text-align:center; font-family:"Trebuchet Ms", Verdana, Tahoma; font-size:1em;}
33 33
 
34
-#cont{ width:569px; margin:30px auto 10px auto; text-align:left;}
34
+#cont{ width:600px; margin:30px auto 20px auto; text-align:left; border: 1px solid #999;}
35 35
 
36
-#head{ background: transparent url(images/head_bg.png) bottom center no-repeat; position: relative; padding-bottom:20px; height:73px;}
36
+#head{ background: #fff url(images/head_bg.png) bottom center no-repeat; position: relative; padding:10px 0 20px 20px; height:73px;}
37 37
 	h1 a{ display:block; height:77px; width:161px; background:#fff url(images/gelato-logo.png) top left no-repeat; text-indent:-9999px; overflow:hidden;}
38 38
 
39
-#nav{ position:absolute; right:1px; font-size:0.75em; line-height:normal; margin:0; padding:0 10px 0 0; list-style:none;bottom:34px;}
39
+#nav{ position:absolute; right:1px; font-size:0.75em; line-height:normal; margin:0; padding:0 20px 0 0; list-style:none;bottom:34px;}
40 40
 
41 41
 	#nav li{  margin:0; padding:0; text-align:right;}
42 42
 
@@ -48,28 +48,42 @@ body{ background: #fff; text-align:center; font-family:"Trebuchet Ms", Verdana,
48 48
 	h2{ font-size:1.56em; margin:4px; text-indent:20px;}
49 49
 	h3{font-size:1.12em; margin:4px; color:#333333; text-indent:20px;}
50 50
 	
51
-.box{ background:#efefef url(images/bg-box.png) left top repeat-y;}
52
-.footer-box{background:#fff url(images/bg-foot-box.png) top center no-repeat;}	
51
+.box{ background:#fff url(images/bg-box.png) center top repeat-y; width:600px;}
52
+.footer-box{background:#fff url(images/bg-foot-box.png) center top no-repeat;}	
53 53
 
54
-.box h3{float:left; color:#FFFFFF; font-weight:bold; padding:5px 10px 0 0;}
55
-.menu{ background:#c1c7cd url(images/bg-top-box.png) top center no-repeat; height:40px; width:559px; list-style-type:none; padding-right:10px;}
54
+.box h3{float:left; color:#444444; font-weight:bold; padding:5px 10px 0 0;}
55
+.menu{ background:transparent url(images/bg-top-box.png) top center no-repeat; height:40px; width:570px; list-style-type:none; padding-right:30px;}
56 56
 .menu li{ display:inline;}
57
-.menu li.selected a{background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:none;}
57
+.menu li.selected a{background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:underline;}
58 58
 .menu li a{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.7em; display:block; float:right; height:28px; padding:12px 3px 0 3px;}
59
-.menu li a:hover{ background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:none;}
59
+.menu li a:hover{ background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:underline;}
60 60
 .menu li a img{border:none; vertical-align:bottom;}
61 61
 
62 62
 .manage li a{ padding:14px 6px 0 6px;}
63 63
 
64
+/* New post menu and form*/
65
+div.newpost{background:none;}
66
+div.newpost h3{color:#444; margin:10px 0 0 10px;}
67
+
68
+#post_types{ background: transparent url(images/new_post_nav.png) top center no-repeat; height:51px; position: relative; margin-bottom:20px;}
69
+#head_nav{ background: transparent url(images/head_nav.png) top center no-repeat; height:66px; width:80px; position:absolute; top:-7px; display:none;}
70
+#head_nav_sel{ display:none; background: transparent url(images/head_nav.png) bottom center no-repeat;height:66px; width:80px;}
71
+#post_types ul{ background:none; position: absolute; padding:5px 0 0 0;}
72
+#post_types ul li{}
73
+#post_types ul li.selected a{ background:none;}
74
+#post_types ul li a{ text-align: center; padding:0px 9px; height:auto;}
75
+#post_types ul li a:hover{ background:none;}
76
+#post_types ul li a img{ display: block;}
77
+
64 78
 #context_help{ display:block; margin:0; padding:5px; position: absolute; border: 1px solid #222; background-color: #444; color:#fff; font-size: 12px;}
65 79
 
66
-form.newpost{ width:500px; margin:0 auto; padding:0;}
80
+form.newpost{ width:500px; margin:20px auto 0 auto; padding:0;}
67 81
 form.newpost ul{ list-style-type:none; margin:20px 0 10px 0; padding:0;}
68 82
 form.newpost li{ margin:4px 0; padding:0; position:relative;}
69 83
 form.newpost li.select{ margin:6px 0;}
70 84
 form.newpost label{}
71 85
 form.newpost input{ margin-bottom:10px;}
72
-form.newpost input.txt{ background: #fff url(images/grad-small.png) top left repeat-x; height:15px; border:1px solid #999; width:490px; padding:5px;}
86
+form.newpost input.txt{ background: #fff url(images/grad-small.png) top left repeat-x; border:1px solid #999; width:490px; padding:5px;}
73 87
 form.newpost input.btn{ }
74 88
 form.newpost input.check{ vertical-align:middle;}
75 89
 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;}
@@ -81,7 +95,7 @@ fieldset.install{border:1px solid #dfdfdf; padding:10px;}
81 95
 fieldset.install input.txt{width:468px;}
82 96
 
83 97
 .tabla{  margin:15px 15px; }
84
-.entry{ background-color:#efefef; border:1px solid #ccc; margin:20px 15px;}
98
+.entry{ background-color:#efefef; border:1px solid #ccc; margin:20px auto; width:550px;}
85 99
 .info{ border-bottom:1px solid #aaa; position:relative; display:block; padding:4px 10px; height:20px; }
86 100
 .info p{font-size:0.8em; color:#297aab; display:inline;}
87 101
 
@@ -101,9 +115,8 @@ fieldset.install input.txt{width:468px;}
101 115
 .post .video{}
102 116
 .post .audio{}
103 117
 
104
-#foot{ background: transparent url(images/foot_bg.png) top center no-repeat; clear: both;}
105 118
 
106
-#foot { text-align:center; font-size: 10px; color: #000; }
119
+#foot { border-top:1px solid #999999; color:#000000; font-size:10px; padding:5px 10px; text-align:center;}
107 120
 
108 121
 	#footer a { color: #000; }
109 122
 	
@@ -163,7 +176,7 @@ div.conversation ul { list-style-type: none; margin: 0px; padding: 0px 0px 0px 1
163 176
 		div.conversation ul li.even { background-color: #e8e8e8; }
164 177
 
165 178
 /* Tables design */
166
-#admin-table {background-color:#F3F5F7; margin:0; width:100%; text-align:left; font-size:12px; border:1px solid #EAECEE;}
179
+#admin-table {background-color:#F3F5F7; margin:0 auto; width:95%; text-align:left; font-size:12px; border:1px solid #EAECEE;}
167 180
 	#admin-table thead tr th, #admin-table tfoot tr th {background-color:#BDD3E7; padding:6px;}
168 181
 	#admin-table thead tr .header {background-image: url(images/bg.gif); background-repeat: no-repeat;	background-position: center right;	cursor: pointer;}
169 182
 	#admin-table tbody td {color:#3D3D3D; padding:6px; background-color:#FFF; background: url(images/td_back.gif) repeat-x; vertical-align:top;}

+ 18 - 18
admin/options.php View File

@@ -98,9 +98,10 @@ if ($user->isAdmin()) {
98 98
 				<div class="box">
99 99
 					<ul class="menu manage">
100 100
 					<h3><?php echo __("Tumblelog options")?></h3>
101
-					<li><a href="index.php"><?php echo __("Post")?></a></li>
102
-					<li><a href="admin.php"><?php echo __("Users")?></a></li>
103
-					<li><a href="settings.php"><?php echo __("Settings")?></a></li>
101
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/index.php"><?php echo __("Post")?></a></li>
102
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php"><?php echo __("Users")?></a></li>
103
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/plugins.php"><?php echo __("Plugins")?></a></li>
104
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
104 105
 					<li class="selected"><a><?php echo __("Options")?></a></li>
105 106
 					</ul>
106 107
 <?php
@@ -210,21 +211,20 @@ if ($user->isAdmin()) {
210 211
 											<option value="0" <?php if(!$conf->shorten_links) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
211 212
 										</select>
212 213
 									</li>
213
-                                    <li class="select"><label for="rss_import_frec"><?php echo __("Import feeds every:")?></label>
214
-                                    	<select name="rss_import_frec" id="rss_import_frec">
215
-                                        
216
-                                        	<option value="5 minutes" <?php if($conf->rssImportFrec == '5 minutes') echo "selected=\"selected\""; ?>>5 <?php echo __("minutes");?></option>
217
-                                        	<option value="10 minutes" <?php if($conf->rssImportFrec == '10 minutes') echo "selected=\"selected\""; ?>>10 <?php echo __("minutes");?></option>
218
-                                            <option value="15 minutes" <?php if($conf->rssImportFrec == '15 minutes') echo "selected=\"selected\""; ?>>15 <?php echo __("minutes");?></option>
219
-                                            <option value="30 minutes" <?php if($conf->rssImportFrec == '30 minutes') echo "selected=\"selected\""; ?>>30 <?php echo __("minutes");?></option>
220
-                                            <option value="45 minutes" <?php if($conf->rssImportFrec == '45 minutes') echo "selected=\"selected\""; ?>>45 <?php echo __("minutes");?></option>
221
-                                            <option value="1 hour" <?php if($conf->rssImportFrec == '1 hour') echo "selected=\"selected\""; ?>>1 <?php echo __("hour");?></option>
222
-                                            <option value="2 hours" <?php if($conf->rssImportFrec == '2 hours') echo "selected=\"selected\""; ?>>2 <?php echo __("hours");?></option>
223
-                                            <option value="3 hours" <?php if($conf->rssImportFrec == '3 hours') echo "selected=\"selected\""; ?>>3 <?php echo __("hours");?></option>
224
-                                            <option value="4 hours" <?php if($conf->rssImportFrec == '4 hours') echo "selected=\"selected\""; ?>>4 <?php echo __("hours");?></option>
225
-                                            <option value="6 hours" <?php if($conf->rssImportFrec == '6 hours') echo "selected=\"selected\""; ?>>6 <?php echo __("hours");?></option>
226
-                                            <option value="12 hours" <?php if($conf->rssImportFrec == '12 hours') echo "selected=\"selected\""; ?>>12 <?php echo __("hours");?></option>
227
-                                            <option value="1 day" <?php if($conf->rssImportFrec == '1 day') echo "selected=\"selected\""; ?>>24 <?php echo __("hours");?></option>
214
+ 									<li class="select"><label for="rss_import_frec"><?php echo __("Import feeds every:")?></label>
215
+										<select name="rss_import_frec" id="rss_import_frec">
216
+											<option value="5 minutes" <?php if($conf->rssImportFrec == '5 minutes') echo "selected=\"selected\""; ?>>5 <?php echo __("minutes");?></option>
217
+											<option value="10 minutes" <?php if($conf->rssImportFrec == '10 minutes') echo "selected=\"selected\""; ?>>10 <?php echo __("minutes");?></option>
218
+											<option value="15 minutes" <?php if($conf->rssImportFrec == '15 minutes') echo "selected=\"selected\""; ?>>15 <?php echo __("minutes");?></option>
219
+											<option value="30 minutes" <?php if($conf->rssImportFrec == '30 minutes') echo "selected=\"selected\""; ?>>30 <?php echo __("minutes");?></option>
220
+											<option value="45 minutes" <?php if($conf->rssImportFrec == '45 minutes') echo "selected=\"selected\""; ?>>45 <?php echo __("minutes");?></option>
221
+											<option value="1 hour" <?php if($conf->rssImportFrec == '1 hour') echo "selected=\"selected\""; ?>>1 <?php echo __("hour");?></option>
222
+ 											<option value="2 hours" <?php if($conf->rssImportFrec == '2 hours') echo "selected=\"selected\""; ?>>2 <?php echo __("hours");?></option>
223
+											<option value="3 hours" <?php if($conf->rssImportFrec == '3 hours') echo "selected=\"selected\""; ?>>3 <?php echo __("hours");?></option>
224
+											<option value="4 hours" <?php if($conf->rssImportFrec == '4 hours') echo "selected=\"selected\""; ?>>4 <?php echo __("hours");?></option>
225
+ 											<option value="6 hours" <?php if($conf->rssImportFrec == '6 hours') echo "selected=\"selected\""; ?>>6 <?php echo __("hours");?></option>
226
+											<option value="12 hours" <?php if($conf->rssImportFrec == '12 hours') echo "selected=\"selected\""; ?>>12 <?php echo __("hours");?></option>
227
+											<option value="1 day" <?php if($conf->rssImportFrec == '1 day') echo "selected=\"selected\""; ?>>24 <?php echo __("hours");?></option>
228 228
 										</select>
229 229
 									</li>
230 230
 									<li class="select"><label for="check_version"><?php echo __("Check for updates:")?></label>

+ 170 - 0
admin/plugins.php View File

@@ -0,0 +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
+}
170
+?>

+ 4 - 3
admin/settings.php View File

@@ -56,9 +56,10 @@ if ($user->isAdmin()) {
56 56
 				<div class="box">
57 57
 					<ul class="menu manage">
58 58
 					<h3><?php echo __("Tumblelog configuration")?></h3>
59
-					<li><a href="index.php"><?php echo __("Post")?></a></li>
60
-					<li><a href="admin.php"><?php echo __("Users")?></a></li>
61
-					<li><a href="options.php"><?php echo __("Options")?></a></li>
59
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/index.php"><?php echo __("Post")?></a></li>
60
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php"><?php echo __("Users")?></a></li>
61
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/plugins.php"><?php echo __("Plugins")?></a></li>
62
+					<li><a href="<?php echo $conf->urlGelato;?>/admin/options.php"><?php echo __("Options")?></a></li>
62 63
 					<li class="selected"><a><?php echo __("Settings")?></a></li>
63 64
 					</ul>
64 65
 <?php

+ 2 - 1
admin/themes/admin/index.htm View File

@@ -102,7 +102,8 @@
102 102
 					<h3>{__('Manage')}</h3>
103 103
 					<li><a href="{conf.urlGelato}/admin/settings.php">{__("Settings")}</a></li>
104 104
 					<li><a href="{conf.urlGelato}/admin/options.php">{__("Options")}</a></li>
105
-                    			<li><a href="{conf.urlGelato}/admin/feeds.php">{__("Feeds")}</a></li>
105
+					<li><a href="{conf.urlGelato}/admin/plugins.php">{__("Plugins")}</a></li>
106
+					<li><a href="{conf.urlGelato}/admin/feeds.php">{__("Feeds")}</a></li>
106 107
 					<li><a href="{conf.urlGelato}/admin/admin.php">{__("Users")}</a></li>
107 108
 					<li><a href="{conf.urlGelato}/admin/comments.php">{__("Comments")}</a></li>
108 109
 					<li class="selected"><a>{__("Posts")}</a></li>

+ 6 - 3
classes/configuration.class.php View File

@@ -55,17 +55,20 @@ class configuration {
55 55
 			$this->shorten_links = $this->get_option("shorten_links");
56 56
 			$this->rssImportFrec = $this->get_option("rss_import_frec");
57 57
 			$this->check_version = $this->get_option("check_version");
58
+			$this->active_plugins = $this->get_option("active_plugins");
58 59
 			
59 60
 			//TODO: Soporte de los plugins desde BD activar/desactivar
60
-			if ($handle = opendir(Absolute_Path."plugins")) {				
61
+			//FIXME cambiar esto por el soporte por carpetas, mas organizado.
62
+			// asi se pueden estandarizar documentacion y thumbnails, 
63
+			/*if ($handle = opendir(Absolute_Path."plugins")) {
61 64
 				while (false !== ($file = readdir($handle))) { 
62 65
 					if (substr($file, strlen($file)-4, 4) == ".php") {
63 66
 						require_once(Absolute_Path."plugins/{$file}");
64
-						$this->plugins[] = substr($file, 0, strlen($file)-4);						
67
+						$this->plugins[] = substr($file, 0, strlen($file)-4);
65 68
 					} 
66 69
 				} 
67 70
 				closedir($handle); 
68
-			}			
71
+			}*/			
69 72
 		} else {
70 73
 			if($isFeed) {
71 74
 				header("HTTP/1.0 503 Service Unavailable"); 

+ 12 - 8
classes/functions.php View File

@@ -650,24 +650,28 @@ if(!defined('entry') || !entry) die('Not a valid page');
650 650
 	function init_plugins() {        
651 651
 		global $conf;
652 652
         
653
-        foreach ($conf->plugins as $index => $plugin) {
653
+		$actives = json_decode($conf->active_plugins,1);
654
+		$actives = $actives[1];
655
+        foreach ($actives as $index => $plugin) {
654 656
 			//echo "[".$index."] => ".$plugin."<br />";
655
-            if (!file_exists(Absolute_Path."plugins/".$plugin.".php")) {
657
+            if (!file_exists(Absolute_Path."plugins/".$plugin)) {
656 658
 				//echo "\tNo existe el archivo<br />";
657
-                unset($conf->plugins[$index]);
659
+                unset($actives[$index]);
658 660
                 continue;
659
-            }
661
+            }else{
662
+				require_once(Absolute_Path.'plugins/'.$plugin);
663
+			}
660 664
 			//echo "\tSi existe el archivo<br />";
661 665
             
662
-            if (!class_exists($plugin)) {
666
+			if (!class_exists($index)) {
663 667
 				//echo "\tNo existe la clase<br />";
664 668
                 continue;
665 669
 			}
666 670
 			//echo "\tSi existe la clase<br />";
667 671
 
668
-            plugins::$instances[$plugin] = new $plugin;
669
-			/*print_r(plugins::$instances[$plugin]);
670
-			echo "<br />";*/
672
+			plugins::$instances[$index] = new $index;
673
+			//print_r(plugins::$instances[$index]);
674
+			//echo "<br />";
671 675
         }
672 676
 		/*echo "<br /><br />";
673 677
 		print_r(plugins::$instances);

+ 11 - 14
classes/plugin.class.php View File

@@ -19,16 +19,16 @@ if(!defined('entry') || !entry) die('Not a valid page');
19 19
 	
20 20
 		function call($name) {            
21 21
 
22
-            if (!$this->exists($name)) {
23
-                return false;
22
+			if (!$this->exists($name)) {
23
+				return false;
24 24
 			}            
25
-            
26
-            /*echo "<br />==========<br />";
25
+
26
+ 			/*echo "<br />==========<br />";
27 27
 			echo $name;
28 28
 			echo "<br />";*/
29 29
 			
30 30
 			$index = 0;
31
-            foreach (plugins::$instances as $plugin) {
31
+			foreach (plugins::$instances as $plugin) {
32 32
 				if(array_key_exists($index,$this->actions[$name])){
33 33
 					$action = $this->actions[$name][$index][1]; 
34 34
 					if (is_callable(array($plugin, $action))) {
@@ -64,15 +64,12 @@ if(!defined('entry') || !entry) die('Not a valid page');
64 64
             return $this->exists[$name] = false;
65 65
         }		
66 66
         
67
-		function & instance()
68
-        {
69
-            static $instance;
70
-
71
-            if( !isset($instance) ) {
72
-                $instance = new self();
73
-            }
74
-
75
-            return $instance;
67
+		function & instance(){
68
+			static $instance;
69
+			if( !isset($instance) ) {
70
+				$instance = new self();
71
+			}
72
+			return $instance;
76 73
         }
77 74
 		
78 75
 	}

+ 1 - 0
db/gelato_db.sql View File

@@ -83,3 +83,4 @@ INSERT INTO `gel_options` VALUES ('offset_city', 'Mexico/General');
83 83
 INSERT INTO `gel_options` VALUES ('offset_time', '-6');
84 84
 INSERT INTO `gel_options` VALUES ('shorten_links', '0');
85 85
 INSERT INTO `gel_options` VALUES ('rss_import_frec', '5 minutes');
86
+INSERT INTO `gel_options` VALUES ('active_plugins', '[{"total":0},[]]');

+ 102 - 103
index.php View File

@@ -20,38 +20,38 @@ global $user, $tumble, $conf;
20 20
 $theme = new themes;
21 21
         // Our first approach to MVC... our second? visit http://www.flavorphp.com
22 22
 
23
-        if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
23
+		if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
24 24
 
25
-        if (isset($_GET["post"])) {
26
-                $id_post = $_GET["post"];
27
-                if (!is_numeric($id_post) || $id_post < 1 ){
25
+		if (isset($_GET["post"])) {
26
+				$id_post = $_GET["post"];
27
+				if (!is_numeric($id_post) || $id_post < 1 ){
28 28
                 	header("Location: index.php");
29
-                }
30
-        } else {
31
-                if (isset($param_url[1]) && $param_url[1]=="post") {
32
-                        $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
33
-                } else {
34
-                        $id_post = NULL;
35
-                }
36
-        }
29
+				}
30
+		} else {
31
+			if (isset($param_url[1]) && $param_url[1]=="post") {
32
+ 				$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
33
+			} else {
34
+				$id_post = NULL;
35
+			}
36
+		}
37 37
 
38
-        $theme->set('id_post',$id_post);
38
+		$theme->set('id_post',$id_post);
39 39
 		$theme->set('error','');
40 40
 
41
-        if (isset($_GET["page"])) {
42
-                $page_num = $_GET["page"];
43
-        } else {
44
-                if (isset($param_url[1]) && $param_url[1]=="page") {
45
-                        $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
-                } else {
47
-                        $page_num = NULL;
48
-                }
49
-        }
41
+		if (isset($_GET["page"])) {
42
+			$page_num = $_GET["page"];
43
+		} else {
44
+			if (isset($param_url[1]) && $param_url[1]=="page") {
45
+				$page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
+			} else {
47
+				$page_num = NULL;
48
+			}
49
+		}
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";
54
-        $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
53
+		$gelato_includes = "<meta name=\"generator\" content=\"gelato ".codeName()." (".version().")\" />\n";
54
+		$gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
55 55
 
56 56
 		$page_title = $conf->title;
57 57
 		$page_title_divisor = " &raquo; "; // it should be set in configuration
@@ -83,54 +83,53 @@ $theme = new themes;
83 83
 		$theme->set('allowComments',$conf->allowComments);
84 84
 
85 85
 		$theme->set('isAuthenticated',$user->isAuthenticated());
86
-        if($user->isAuthenticated()){
86
+		if($user->isAuthenticated()){
87 87
 			$theme->set('User',$_SESSION["user_login"]);
88 88
 			$theme->set('URL_Tumble',$conf->urlGelato);
89
-        }
89
+		}
90 90
 
91 91
 		$rows = array();
92
-        if(!$id_post){
93
-                $limit=$conf->postLimit;
92
+		if(!$id_post){
93
+ 				$limit=$conf->postLimit;
94 94
 
95
-                if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
96
-                        $from = (($page_num-1) * $limit);
97
-                } else {
98
-                        $from = 0;
99
-                }
95
+				if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
96
+					$from = (($page_num-1) * $limit);
97
+				} else {
98
+					$from = 0;
99
+				}
100 100
 
101
-                $rs = $tumble->getPosts($limit, $from);
101
+				$rs = $tumble->getPosts($limit, $from);
102 102
 
103
-                if ($tumble->contarRegistros()>0) {
104
-                        $dateTmp = null;
105
-                        while($register = mysql_fetch_assoc($rs)) {
103
+				if ($tumble->contarRegistros()>0) {
104
+						$dateTmp = null;
105
+						while($register = mysql_fetch_assoc($rs)) {
106 106
 								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
107
-                                if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
107
+								if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
108 108
 
109 109
 								$permalink = $tumble->getPermalink($register["id_post"]);
110 110
 
111 111
 								$conversation = $register["description"];
112 112
 
113
-                                $register["title"] = stripslashes($register["title"]);
114
-                                $register["description"] = stripslashes($register["description"]);
113
+								$register["title"] = stripslashes($register["title"]);
114
+								$register["description"] = stripslashes($register["description"]);
115 115
 
116 116
 								$row['Date_Added'] = $formatedDate;
117 117
 								$row['Permalink'] = $permalink;
118 118
 								$row['postType'] = type2Text($register["type"]);
119 119
 
120
-                                switch ($register['type']){
121
-                                        case "1":
122
-                                        		$row['Title'] = $register["title"];
123
-                                        		$row['Body'] = $register["description"];
124
-                                                break;
125
-                                        case "2":
126
-                                                $fileName = "uploads/".getFileName($register["url"]);
127
-
128
-                                                $x = @getimagesize($fileName);
129
-                                                if ($x[0] > 500) {
120
+								switch ($register['type']){
121
+										case "1":
122
+											$row['Title'] = $register["title"];
123
+											$row['Body'] = $register["description"];
124
+											break;
125
+											case "2":
126
+											$fileName = "uploads/".getFileName($register["url"]);
127
+											$x = @getimagesize($fileName);
128
+												if ($x[0] > 500) {
130 129
 													$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
131
-                                                } else {
130
+												} else {
132 131
 													$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
133
-                                                }
132
+												}
134 133
 
135 134
 												$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
136 135
 
@@ -138,13 +137,13 @@ $theme = new themes;
138 137
 												$row['PhotoAlt'] = strip_tags($register["description"]);
139 138
 												$row['Caption'] = $register["description"];
140 139
 												$row['Effect'] = $effect;
141
-                                                break;
142
-                                        case "3":
143
-                                        		$row['Quote'] = $register["description"];
144
-                                        		$row['Source'] = $register["title"];
145
-                                                break;
140
+												break;
141
+										case "3":
142
+												$row['Quote'] = $register["description"];
143
+												$row['Source'] = $register["title"];
144
+												break;
146 145
                                         case "4":
147
-                                                if($conf->shorten_links){
146
+												if($conf->shorten_links){
148 147
 													$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
149 148
 												}
150 149
 												$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
@@ -152,20 +151,20 @@ $theme = new themes;
152 151
 												$row['URL'] = $register["url"];
153 152
 												$row['Name'] = $register["title"];
154 153
 												$row['Description'] = $register["description"];
155
-                                                break;
156
-                                        case "5":
157
-                                        		$row['Title'] = $register["title"];
158
-                                        		$row['Conversation'] = $tumble->formatConversation($conversation);
159
-                                                break;
160
-                                        case "6":
161
-                                        		$row['Video'] = $tumble->getVideoPlayer($register["url"]);
162
-                                        		$row['Caption'] = $register["description"];
163
-                                                break;
164
-                                        case "7":
165
-                                        		$row['Mp3'] = $tumble->getMp3Player($register["url"]);
166
-                                        		$row['Caption'] = $register["description"];
167
-                                                break;
168
-                                }
154
+												break;
155
+												case "5":
156
+												$row['Title'] = $register["title"];
157
+												$row['Conversation'] = $tumble->formatConversation($conversation);
158
+												break;
159
+										case "6":
160
+												$row['Video'] = $tumble->getVideoPlayer($register["url"]);
161
+												$row['Caption'] = $register["description"];
162
+												break;
163
+										case "7":
164
+												$row['Mp3'] = $tumble->getMp3Player($register["url"]);
165
+												$row['Caption'] = $register["description"];
166
+												break;
167
+								}
169 168
 
170 169
 								$comment = new comments();
171 170
 								$noComments = $comment->countComments($register["id_post"]);
@@ -182,23 +181,23 @@ $theme = new themes;
182 181
 						$trigger->call('post_content');
183 182
 						$theme->set('rows',$rows);
184 183
 
185
-                        $p = new pagination;
186
-                        $p->Items($tumble->getPostsNumber());
187
-                        $p->limit($limit);
184
+						$p = new pagination;
185
+						$p->Items($tumble->getPostsNumber());
186
+						$p->limit($limit);
188 187
 						if($conf->urlFriendly){
189 188
 								$p->urlFriendly('[...]');
190 189
 								$p->target($conf->urlGelato."/page/[...]");
191
-							}else
190
+							}else{
192 191
 								$p->target($conf->urlGelato);
192
+							}
193 193
 
194
-                        $p->currentPage(isset($page_num) ? $page_num : 1);
195
-
196
-                        $theme->set('pagination',$p->getPagination());
197
-                } else {
198
-                        $theme->set('error','No posts in this tumblelog.');
199
-                }
200
-        } else {
201
-                $register = $tumble->getPost($id_post);
194
+						$p->currentPage(isset($page_num) ? $page_num : 1);
195
+						$theme->set('pagination',$p->getPagination());
196
+					} else {
197
+						$theme->set('error','No posts in this tumblelog.');
198
+					}
199
+			} else {
200
+				$register = $tumble->getPost($id_post);
202 201
 
203 202
 				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
204 203
 				$permalink = $tumble->getPermalink($register["id_post"]);
@@ -208,26 +207,26 @@ $theme = new themes;
208 207
 				$register["description"] = $register["description"];
209 208
 
210 209
 				$register["title"] = stripslashes($register["title"]);
211
-                $register["description"] = stripslashes($register["description"]);
210
+				$register["description"] = stripslashes($register["description"]);
212 211
 
213 212
 				$row['Date_Added'] = $formatedDate;
214 213
 				$row['Permalink'] = $permalink;
215 214
 				$row['postType'] = type2Text($register["type"]);
216 215
 
217
-                switch ($register['type']) {
218
-                        case "1":
216
+				switch ($register['type']) {
217
+						case "1":
219 218
 								$row['Title'] = $register["title"];
220 219
 								$row['Body'] = $register["description"];
221
-                                break;
222
-                        case "2":
223
-                                $fileName = "uploads/".getFileName($register["url"]);
220
+								break;
221
+						case "2":
222
+								$fileName = "uploads/".getFileName($register["url"]);
224 223
 
225
-                                $x = @getimagesize($fileName);
226
-                                if ($x[0] > 500) {
224
+								$x = @getimagesize($fileName);
225
+								if ($x[0] > 500) {
227 226
                                         $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
228
-                                } else {
227
+								} else {
229 228
 										$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
230
-                                }
229
+								}
231 230
 
232 231
 								$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
233 232
 
@@ -235,20 +234,20 @@ $theme = new themes;
235 234
 								$row['PhotoAlt'] = strip_tags($register["description"]);
236 235
 								$row['Caption'] = $register["description"];
237 236
 								$row['Effect'] = $effect;
238
-                                break;
239
-                        case "3":
237
+								break;
238
+						case "3":
240 239
 								$row['Quote'] = $register["description"];
241
-                                $row['Source'] = $register["title"];
242
-                                break;
243
-                        case "4":
244
-                                if($conf->shorten_links){
240
+								$row['Source'] = $register["title"];
241
+								break;
242
+						case "4":
243
+							if($conf->shorten_links){
245 244
 									$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
246 245
 								}
247 246
 								$row['URL'] = $register["url"];
248 247
 								$row['Name'] = $register["title"];
249 248
 								$row['Description'] = $register["description"];
250
-                                break;
251
-                        case "5":
249
+								break;
250
+						case "5":
252 251
 								$row['Title'] = $register["title"];
253 252
 								$row['Conversation'] = $tumble->formatConversation($conversation);
254 253
 								break;
@@ -313,6 +312,6 @@ $theme = new themes;
313 312
 				$theme->set('rows',$rows);
314 313
         }
315 314
 
316
-        $theme->set('URL_Tumble',$conf->urlGelato);
315
+		$theme->set('URL_Tumble',$conf->urlGelato);
317 316
 		$theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
318 317
 ?>

+ 9 - 9
update.php View File

@@ -16,22 +16,22 @@ if(!defined('entry')) define('entry',true);
16 16
 require('entry.php');
17 17
 global $configFile, $db;
18 18
 
19
-if (!file_exists($configFile)) {
20
-	$mensaje = "
21
-			<h3 class=\"important\">Error reading configuration file</h3>
22
-			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
23
-			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
19
+if (!file_exists($configFile) || true) {
20
+	$mensaje = '
21
+			<h3 class="importan">'.__("Error reading configuration file").'</h3>
22
+			<p>'.__("There does not seem to be a <code>config.php</code> file. I need this before we can get started.").'</p>
23
+			<p>'.__("This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.").'</p>';
24 24
 	die($mensaje);
25 25
 } else {
26 26
 	require_once($configFile);
27 27
 }
28 28
 
29
-$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1');";
29
+$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1'), ('active_plugins', '[{\"total\":0},[]]');";
30 30
 
31 31
 $db->ejecutarConsulta($sqlStr);
32 32
 
33
-echo "<p><em>Finished!</em></p>";
34
-echo "<p>Now you are running on the new <strong>gelato vaniglia</strong> version!!!</p>";
35
-echo "<p><a href="index.php">Return to your tumblelog</a></p>";
33
+echo '<p><em>'.__("Finished!").'</em></p>';
34
+echo '<p>'.__("Now you are running on the new <strong>gelato vaniglia</strong> version!!!").'</p>';
35
+echo '<p><a href="index.php">'.__("Return to your tumblelog").'</a></p>';
36 36
 
37 37
 ?>