From f95f856b49571c82910712b7a4aa3099293e9b34 Mon Sep 17 00:00:00 2001 From: pecesama Date: Tue, 4 Nov 2008 01:59:30 +0000 Subject: [PATCH] First changes on architecture --- admin/admin.php | 4 +- admin/ajax.php | 1 - admin/bm.php | 14 +- admin/close.php | 2 +- admin/comments.php | 6 +- admin/feeds.php | 3 +- admin/index.php | 14 +- admin/options.php | 2 +- admin/plugins.php | 338 +++++++++++----------- admin/settings.php | 6 +- admin/user.php | 4 +- api.php | 6 +- archive.php | 10 +- classes/comments.class.php | 32 +- classes/gelato.class.php | 48 +-- classes/templates.class.php | 25 +- classes/user.class.php | 42 +-- classes/{functions.php => util.class.php} | 82 +++--- entry.php | 46 +-- index.php | 16 +- login.php | 2 +- rss.php | 8 +- 22 files changed, 332 insertions(+), 379 deletions(-) rename classes/{functions.php => util.class.php} (85%) diff --git a/admin/admin.php b/admin/admin.php index 75822a4..4ce06e2 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -22,7 +22,7 @@ if ($user->isAdmin()) { gelato :: <?php echo __("admin users")?> - + @@ -108,7 +108,7 @@ if ($user->isAdmin()) { getUsers(); - if ($user->contarRegistros()>0) { + if ($db->contarRegistros()>0) { while($register = mysql_fetch_array($rs)) { ?> > diff --git a/admin/ajax.php b/admin/ajax.php index e8c90fd..f8c54bc 100644 --- a/admin/ajax.php +++ b/admin/ajax.php @@ -19,7 +19,6 @@ if(!defined('entry'))define('entry', true); if ($_GET["action"]) { if ($_GET["action"] == "close") { - session_start(); if ($user->closeSession()) { echo __(" ending session…"); } else { diff --git a/admin/bm.php b/admin/bm.php index 6c8ae50..a7f0825 100644 --- a/admin/bm.php +++ b/admin/bm.php @@ -29,11 +29,11 @@ if ($user->isAdmin()) { header("Location: ".$conf->urlGelato."/admin/index.php?photo=false"); die(); } - $_POST["url"] = "../uploads/".sanitizeName($photoName); + $_POST["url"] = "../uploads/".util::sanitizeName($photoName); } if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) { - $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']); + $_POST["url"] = "../uploads/".util::sanitizeName($_FILES['photo']['name']); } unset($_POST["photo"]); @@ -80,13 +80,13 @@ if ($user->isAdmin()) { } if (isset($url)) { - if (isMP3($url)) { + if (util::isMP3($url)) { $postType = "mp3"; - } elseif (isGoEar($url)) { + } elseif (util::isGoEar($url)) { $postType = "mp3"; - } elseif (isImageFile($url)) { + } elseif (util::isImageFile($url)) { $postType = "photo"; - } elseif (isVideo($url)) { + } elseif (util::isVideo($url)) { $postType = "video"; } else { if (isset($_GET["sel"]) && !$_GET["sel"]=="" ) { @@ -104,7 +104,7 @@ if ($user->isAdmin()) { - + gelato :: <?php echo __("bookmarklet")?> diff --git a/admin/close.php b/admin/close.php index 2d17adb..1023e03 100644 --- a/admin/close.php +++ b/admin/close.php @@ -22,7 +22,7 @@ $closed = $user->closeSession(); gelato :: <?php echo __("logout")?> - + - - - - -
- -
- -
- -".__("The configuration has been modified successfully.")."
"; - } - } - if (isset($_GET["error"])) { - if ($_GET["error"]==1) { - echo "
".__("Error on the database server: ")."".$_GET["des"]."
"; - } - } -?> -
- -
-
- here'); - }else{ - foreach ($plugins as $key => $plugin) { - - //FIXME terminar esto asi se lee la info desde el archivo 'a la' WP - /* - $plugin_data = implode( '', file( Absolute_Path."plugins/".$plugin.'.php' )); - preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name ); - preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri ); - preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); - preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); - preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); - - if ( preg_match( "|Version:(.*)|i", $plugin_data, $version )) - $version = trim( $version[1] ); - else - $version = ''; - - $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); -*/ - $desc = __("There is no info for this plugin jet"); - $activated = array_key_exists($plugin, $actives); - ?> -
    -
  • - - -
  • - -
- -
-

- " class="submit"/> -

-
- -
- - -
-
- - - - -urlGelato."/login.php"); -} + + + =========================== */ +?> +isAdmin()) { + + + $plugins = array(); + if ($handle = opendir(Absolute_Path."plugins")) { + while (false !== ($file = readdir($handle))) { + if (substr($file, strlen($file)-4, 4) == ".php") { + $plugins[] = substr($file, 0, strlen($file)-4); + } + } + closedir($handle); + } + + $actives = json_decode($conf->active_plugins,1); + $actives = $actives[1]; + + if(isset($_POST["btnsubmit"])) { + $actives = array(); + foreach($_POST['plugins'] as $plugin => $val){ + if($val != 'off'){ + $file = $plugin.'.php'; + $actives[$plugin] = $file; + } + } + if(!$tumble->saveOption(json_encode(array(array('total'=>count($actives)),$actives)), "active_plugins")){ + header("Location: ".$conf->urlGelato."/admin/plugins.php?error=1&desc=".$conf->merror); + die(); + } + header("Location: ".$conf->urlGelato."/admin/plugins.php?modified=true"); + die(); + } else { +?> + + + + gelato :: <?php echo __("Plugins")?> + + + + + + + + + + + +
+ +
+ +
+ +".__("The configuration has been modified successfully.")."
"; + } + } + if (isset($_GET["error"])) { + if ($_GET["error"]==1) { + echo "
".__("Error on the database server: ")."".$_GET["des"]."
"; + } + } +?> +
+ +
+
+ here'); + }else{ + foreach ($plugins as $key => $plugin) { + + //FIXME terminar esto asi se lee la info desde el archivo 'a la' WP + /* + $plugin_data = implode( '', file( Absolute_Path."plugins/".$plugin.'.php' )); + preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name ); + preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri ); + preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); + preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); + preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); + + if ( preg_match( "|Version:(.*)|i", $plugin_data, $version )) + $version = trim( $version[1] ); + else + $version = ''; + + $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); +*/ + $desc = __("There is no info for this plugin jet"); + $activated = array_key_exists($plugin, $actives); + ?> +
    +
  • + + +
  • + +
+ +
+

+ " class="submit"/> +

+
+ +
+ + +
+
+ + + + +urlGelato."/login.php"); +} ?> \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php index 7783e7d..213f8dd 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -27,7 +27,7 @@ if ($user->isAdmin()) { gelato :: <?php echo __("settings")?> - + diff --git a/api.php b/api.php index e7cde67..6922f24 100644 --- a/api.php +++ b/api.php @@ -54,15 +54,15 @@ if(!defined('entry')) define('entry',true); $postType = type2Number($_GET["type"]); } $rs = $tumble->getPosts($total, $start); - if ($tumble->contarRegistros()>0) { + if ($db->contarRegistros()>0) { ?> urlFriendly) ? "/" : ""; $url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd; - $formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"]) + transform_offset($conf->offsetTime)); + $formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"]) + util::transform_offset($conf->offsetTime)); switch ($register["type"]) { case "1": diff --git a/archive.php b/archive.php index 72f4583..a208bdd 100644 --- a/archive.php +++ b/archive.php @@ -23,11 +23,11 @@ $regular = array(); $video = array(); $rs = $tumble->getPosts($tumble->getPostsNumber()); -if ($tumble->contarRegistros()>0) { +if ($db->contarRegistros()>0) { while($register = mysql_fetch_assoc($rs)) { $output = handleNode($register); - $theType = type2Text($register["type"]); + $theType = util::type2Text($register["type"]); switch($theType) { case 'quote': @@ -55,13 +55,13 @@ if ($tumble->contarRegistros()>0) { function handleNode($node) { global $user, $tumble, $conf; $dateTmp = null; - $formatedDate = gmdate("M d", strtotime($node["date"]) + transform_offset($conf->offsetTime)); + $formatedDate = gmdate("M d", strtotime($node["date"]) + util::transform_offset($conf->offsetTime)); $output = array(); $output['url'] = $tumble->getPermalink($node["id_post"]); $output['date'] = $formatedDate; - $theType = type2Text($node["type"]); + $theType = util::type2Text($node["type"]); switch($theType) { case 'quote': @@ -111,7 +111,7 @@ function handleNode($node) { - " /> + " /> "/> <?php echo $conf->title." » ".__(" archive"); ?> diff --git a/classes/comments.class.php b/classes/comments.class.php index d5089d9..2388f47 100644 --- a/classes/comments.class.php +++ b/classes/comments.class.php @@ -11,16 +11,20 @@ if(!defined('entry') || !entry) die('Not a valid page'); =========================== */ -class comments extends Conexion_Mysql { +class comments { + var $db; var $conf; function comments() { - parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password); - $this->conf = new configuration(); + global $db; + global $conf; + + $this->db = $db; + $this->conf = $conf; } function addComment($fieldsArray) { - if ($this->insertarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray)) { + if ($this->db->insertarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray)) { return true; } else { return false; @@ -55,33 +59,33 @@ class comments extends Conexion_Mysql { function getComments($idPost=null, $limit=null, $from=null, $spam=null) { if (isset($idPost)) { - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0 order by comment_date ASC"); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0 order by comment_date ASC"); } else { if (isset($limit) && isset($from)) { $limit = " LIMIT $from, $limit"; } else { ""; } if (isset($spam)) { $sp = "1"; } else { $sp = "0"; } - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=".$sp." order by comment_date ASC".$limit); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=".$sp." order by comment_date ASC".$limit); } - return $this->mid_consulta; + return $this->db->mid_consulta; } function getComment($id="") { - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id); - return mysql_fetch_array($this->mid_consulta); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id); + return mysql_fetch_array($this->db->mid_consulta); } function countComments($idPost=null) { if (isset($idPost)) { - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0"); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_post=".$idPost." AND spam=0"); } else { - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=0"); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE spam=0"); } - return $this->contarRegistros(); + return $this->db->contarRegistros(); } function deleteComment($idComment) { - if ($this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."comments WHERE id_comment=".$idComment)) { + if ($this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."comments WHERE id_comment=".$idComment)) { return true; } else { return false; @@ -89,7 +93,7 @@ class comments extends Conexion_Mysql { } function modifyComment($fieldsArray, $id_comment) { - if ($this->modificarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray, "id_comment=$id_comment")) { + if ($this->db->modificarDeFormulario($this->conf->tablePrefix."comments", $fieldsArray, "id_comment=$id_comment")) { return true; } else { return false; diff --git a/classes/gelato.class.php b/classes/gelato.class.php index 2e99a36..d57865a 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -10,32 +10,32 @@ if(!defined('entry') || !entry) die('Not a valid page'); Copyright (C) 2007 by Pedro Santana =========================== */ -?> -conf = new configuration(); + global $db; + global $conf; + + $this->db = $db; + $this->conf = $conf; } function saveSettings($fieldsArray) { - if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) { + if ($this->db->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) { header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true"); die(); } else { - header("Location: ".$this->conf->urlGelato."/admin/settings.php?error=1&des=".$this->merror); + header("Location: ".$this->conf->urlGelato."/admin/settings.php?error=1&des=".$this->db->merror); die(); } } function saveOption($value, $name) { $sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1"; - if ($this->ejecutarConsulta($sqlStr)) { + if ($this->db->ejecutarConsulta($sqlStr)) { return true; } else { return true; @@ -43,7 +43,7 @@ class gelato extends Conexion_Mysql { } function addPost($fieldsArray) { - if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) { + if ($this->db->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) { return true; } else { return false; @@ -51,40 +51,40 @@ class gelato extends Conexion_Mysql { } function modifyPost($fieldsArray, $id_post) { - if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) { + if ($this->db->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) { header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true"); die(); } else { - header("Location: ".$this->conf->urlGelato."/admin/index.php?error=2&des=".$this->merror); + header("Location: ".$this->conf->urlGelato."/admin/index.php?error=2&des=".$this->db->merror); die(); } } function deletePost($idPost) { - $this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost); + $this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost); } function getPosts($limit="10", $from="0") { $sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit"; - $this->ejecutarConsulta($sqlStr); - return $this->mid_consulta; + $this->db->ejecutarConsulta($sqlStr); + return $this->db->mid_consulta; } function getPost($id="") { - $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); - return mysql_fetch_array($this->mid_consulta); + $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); + return mysql_fetch_array($this->db->mid_consulta); } function getPostsNumber() { - $this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); - $row = mysql_fetch_assoc($this->mid_consulta); + $this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); + $row = mysql_fetch_assoc($this->db->mid_consulta); return $row['total']; } function getType($id) { - if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { - if ($this->contarRegistros()>0) { - while($registro = mysql_fetch_array($this->mid_consulta)) { + if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { + if ($this->db->contarRegistros()>0) { + while($registro = mysql_fetch_array($this->db->mid_consulta)) { return $registro[0]; } } @@ -185,7 +185,7 @@ class gelato extends Conexion_Mysql { } function getMp3Player($url) { if (isMP3($url)) { - $playerUrl = $this->conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url; + $playerUrl = $conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url; return "\t\t\t\n"; } elseif (isGoEar($url)) { return "\t\t\t\n"; diff --git a/classes/templates.class.php b/classes/templates.class.php index b6d1682..eb65659 100644 --- a/classes/templates.class.php +++ b/classes/templates.class.php @@ -1,20 +1,15 @@ - + + =========================== */ class plantillas { diff --git a/classes/user.class.php b/classes/user.class.php index 9cc8945..70dec9b 100644 --- a/classes/user.class.php +++ b/classes/user.class.php @@ -12,19 +12,21 @@ if(!defined('entry') || !entry) die('Not a valid page'); =========================== */ ?> db = $db; + $this->conf = $conf; $this->cookie_life = 60*24*3600; $this->cookieTime = time(); - $this->conf = new configuration(); } function isAdmin() { @@ -47,9 +49,9 @@ class user extends Conexion_Mysql { function validateUser($username="", $password="") { - if ($this->ejecutarConsulta("SELECT id_user, login, password FROM ".$this->conf->tablePrefix."users WHERE login='".$this->sql_escape($username)."' AND password='".$password."'")) { - if ($this->contarRegistros()>0) { - $register=$this->obtenerRegistro(); + if ($this->db->ejecutarConsulta("SELECT id_user, login, password FROM ".$this->conf->tablePrefix."users WHERE login='".$this->db->sql_escape($username)."' AND password='".$password."'")) { + if ($this->db->contarRegistros()>0) { + $register = $this->db->obtenerRegistro(); $_SESSION['user_id']=$register["id_user"]; $_SESSION['user_login']=$register["login"]; $_SESSION['authenticated'] = true; @@ -72,8 +74,8 @@ class user extends Conexion_Mysql { } function userExist($user="") { - if ($this->ejecutarConsulta("SELECT * FROM ".$this->conf->tablePrefix."users WHERE login='".$user."'")) { - if ($this->contarRegistros()>0) { + if ($this->db->ejecutarConsulta("SELECT * FROM ".$this->conf->tablePrefix."users WHERE login='".$user."'")) { + if ($this->db->contarRegistros()>0) { return true; } else { return false; @@ -86,11 +88,11 @@ class user extends Conexion_Mysql { } function addUser($fieldsArray) { - if ($this->ejecutarConsulta("SELECT id_user FROM ".$this->conf->tablePrefix."users WHERE login='".$fieldsArray['login']."'")) { - if ($this->contarRegistros()==0) { + if ($this->db->ejecutarConsulta("SELECT id_user FROM ".$this->conf->tablePrefix."users WHERE login='".$fieldsArray['login']."'")) { + if ($this->db->contarRegistros()==0) { $realPassword = ($fieldsArray["password"]); $fieldsArray["password"] = md5($fieldsArray["password"]); - if ($this->insertarDeFormulario($this->conf->tablePrefix."users", $fieldsArray)) { + if ($this->db->insertarDeFormulario($this->conf->tablePrefix."users", $fieldsArray)) { $this->confirmationEmail($fieldsArray['email'], $fieldsArray['login'], $realPassword); header("Location: ".$this->conf->urlGelato."/admin/admin.php?added=true"); die(); @@ -107,7 +109,7 @@ class user extends Conexion_Mysql { function modifyUser($fieldsArray, $id_user) { $fieldsArray["password"] = md5($fieldsArray["password"]); - if ($this->modificarDeFormulario($this->conf->tablePrefix."users", $fieldsArray, "id_user=$id_user")) { + if ($this->db->modificarDeFormulario($this->conf->tablePrefix."users", $fieldsArray, "id_user=$id_user")) { header("Location: ".$this->conf->urlGelato."/admin/admin.php?modified=true"); die(); } else { @@ -117,19 +119,19 @@ class user extends Conexion_Mysql { } function deleteUser($idUser) { - $this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."users WHERE id_user=".$idUser); + $this->db->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."users WHERE id_user=".$idUser); } function getUsers($show="10", $from="0") { $sqlStr = "select * from ".$this->conf->tablePrefix."users ORDER BY id_user DESC LIMIT $from,$show"; - $this->ejecutarConsulta($sqlStr); - return $this->mid_consulta; + $this->db->ejecutarConsulta($sqlStr); + return $this->db->mid_consulta; } function getUserByID($idUser) { - if ($this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."users where id_user=".$idUser)) { - if ($this->contarRegistros()>0) { - return $registro=$this->obtenerRegistro(); + if ($this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."users where id_user=".$idUser)) { + if ($this->db->contarRegistros()>0) { + return $registro=$this->db->obtenerRegistro(); } else { return false; } diff --git a/classes/functions.php b/classes/util.class.php similarity index 85% rename from classes/functions.php rename to classes/util.class.php index e2c1371..2f5aec2 100644 --- a/classes/functions.php +++ b/classes/util.class.php @@ -1,5 +1,5 @@ =')) { + if (extension_loaded('curl') && version_compare(util::get_curl_version(), '7.10.5', '>=')) { $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $path); @@ -417,7 +419,7 @@ if(!defined('entry') || !entry) die('Not a valid page'); } if (preg_match('|\.mo$|', $directory2)){ if(!in_array($directory2,$dirs)){ - $dirs[$directory]=displayLanguage(trim($directory)); + $dirs[$directory]=util::displayLanguage(trim($directory)); $i++; } } @@ -653,29 +655,17 @@ if(!defined('entry') || !entry) die('Not a valid page'); $actives = json_decode($conf->active_plugins,1); $actives = $actives[1]; foreach ($actives as $index => $plugin) { - //echo "[".$index."] => ".$plugin."
"; if (!file_exists(Absolute_Path."plugins/".$plugin)) { - //echo "\tNo existe el archivo
"; unset($actives[$index]); continue; }else{ require_once(Absolute_Path.'plugins/'.$plugin); - } - //echo "\tSi existe el archivo
"; - + } if (!class_exists($index)) { - //echo "\tNo existe la clase
"; continue; } - //echo "\tSi existe la clase
"; - plugins::$instances[$index] = new $index; - //print_r(plugins::$instances[$index]); - //echo "
"; } - /*echo "

"; - print_r(plugins::$instances); - echo "
"; - die();*/ } - ?> \ No newline at end of file +} +?> \ No newline at end of file diff --git a/entry.php b/entry.php index 4dbbb02..4b63061 100644 --- a/entry.php +++ b/entry.php @@ -1,30 +1,7 @@ plugins); - //die(); - init_plugins(); + util::init_plugins(); $trigger = plugin::instance(); - //echo "plugins.instances: "; - //print_r(plugins::$instances); - //echo "
"; - //die(); - - //echo "plugin.actions: "; - //$plugEngine = plugin::instance(); - //print_r($plugEngine->actions); - //die(); - $trigger->call('gelato_init'); $feeds = new feeds(); diff --git a/index.php b/index.php index 742b3ac..a7d49f8 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ if(!defined('entry'))define('entry', true); ?> urlGelato.($conf->urlFriendly?"/rss/":"/rss.php"); - $gelato_includes = "\n"; + $gelato_includes = "\n"; $gelato_includes .= "\turlGelato."/images/favicon.ico\" />"; $page_title = $conf->title; @@ -100,10 +100,10 @@ $theme = new themes; $rs = $tumble->getPosts($limit, $from); - if ($tumble->contarRegistros()>0) { + if ($db->contarRegistros()>0) { $dateTmp = null; while($register = mysql_fetch_assoc($rs)) { - $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); + $formatedDate = gmdate("M d", strtotime($register["date"]) + util::transform_offset($conf->offsetTime)); if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; } $permalink = $tumble->getPermalink($register["id_post"]); @@ -115,7 +115,7 @@ $theme = new themes; $row['Date_Added'] = $formatedDate; $row['Permalink'] = $permalink; - $row['postType'] = type2Text($register["type"]); + $row['postType'] = util::type2Text($register["type"]); switch ($register['type']){ case "1": @@ -199,7 +199,7 @@ $theme = new themes; } else { $register = $tumble->getPost($id_post); - $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); + $formatedDate = gmdate("M d", strtotime($register["date"]) + util::transform_offset($conf->offsetTime)); $permalink = $tumble->getPermalink($register["id_post"]); $conversation = $register["description"]; @@ -211,7 +211,7 @@ $theme = new themes; $row['Date_Added'] = $formatedDate; $row['Permalink'] = $permalink; - $row['postType'] = type2Text($register["type"]); + $row['postType'] = util::type2Text($register["type"]); switch ($register['type']) { case "1": @@ -289,7 +289,7 @@ $theme = new themes; $answers['Id_Comment'] = $rowComment["id_comment"]; $answers['Comment_Author'] = $commentAuthor; - $answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime)); + $answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"]) + util::transform_offset($conf->offsetTime)); $answers['Comment'] = nl2br($rowComment["content"]); $comments[] = $answers; diff --git a/login.php b/login.php index 86222c2..4c39a39 100644 --- a/login.php +++ b/login.php @@ -40,7 +40,7 @@ if ($user->isAuthenticated()) { gelato :: <?php echo __("login screen")?> - + diff --git a/rss.php b/rss.php index 4c348f2..48c69c3 100644 --- a/rss.php +++ b/rss.php @@ -28,7 +28,7 @@ if(!defined('entry')) define('entry',true); <?php echo htmlspecialchars($conf->title);?> urlGelato;?> description);?> - gelato CMS + gelato CMS urlGelato;?>/images/information.png <?php echo htmlspecialchars($conf->description);?> @@ -36,7 +36,7 @@ if(!defined('entry')) define('entry',true); getPosts("20"); - if ($tumble->contarRegistros()>0) { + if ($db->contarRegistros()>0) { while($register = mysql_fetch_array($rs)) { $register["description"] = $register["description"]; @@ -76,10 +76,10 @@ if(!defined('entry')) define('entry',true); $desc = $tumble->getMp3Player($register["url"]); break; } - $tit = trimString($tit); + $tit = util::trimString($tit); $strEnd = ($conf->urlFriendly) ? "/" : ""; $url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd; - $formatedDate = gmdate("r", strtotime($register["date"]) + transform_offset($conf->offsetTime)); + $formatedDate = gmdate("r", strtotime($register["date"]) + util::transform_offset($conf->offsetTime)); ?> <?php echo $tit;?>