You can now create, modify, delete, list and view posts

master
Klectik 2017-03-03 23:20:40 +01:00
parent 517481277d
commit ed2c60a8d1
13 changed files with 134 additions and 129 deletions

View File

@ -31,22 +31,22 @@ if ($user->isAdmin()) {
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.tablesorter.min.js"></script> <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.tablesorter.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("#admin-table").tablesorter({ $("#admin-table").tablesorter({
headers: { headers: {
2: {sorter: false}, 2: {sorter: false},
3: {sorter: false} 3: {sorter: false}
} }
}); });
$("#divMessages").fadeOut(5000,function(){ $("#divMessages").fadeOut(5000,function(){
$("#divMessages").css({display:"none"}); $("#divMessages").css({display:"none"});
}); });
}); });
</script> </script>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css"; @import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
</style> </style>
</head> </head>
<body> <body>
<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div> <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
<div id="cont"> <div id="cont">
@ -57,8 +57,8 @@ if ($user->isAdmin()) {
<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato; ?>/admin/ajax.php?action=close');"><?php echo __("Log out")?></a></li> <li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlGelato; ?>/admin/ajax.php?action=close');"><?php echo __("Log out")?></a></li>
</ul> </ul>
</div> </div>
<div id="main"> <div id="main">
<div class="box"> <div class="box">
<ul class="menu manage"> <ul class="menu manage">
<h3>Manage</h3> <h3>Manage</h3>
@ -69,32 +69,32 @@ if ($user->isAdmin()) {
<li class="selected"><a><?php echo __("Users")?></a></li> <li class="selected"><a><?php echo __("Users")?></a></li>
</ul> </ul>
<p>&nbsp;</p> <p>&nbsp;</p>
<?php <?php
if (isset($_GET["added"])) { if (isset($_GET["added"])) {
if ($_GET["added"]=="true") { if ($_GET["added"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>"; echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
} }
} }
if (isset($_GET["delete"])) { if (isset($_GET["delete"])) {
if ($_GET["delete"]=="true") { if ($_GET["delete"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>"; echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
} }
} }
if (isset($_GET["modified"])) { if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") { if ($_GET["modified"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>"; echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
} }
} }
if (isset($_GET["error"])) { if (isset($_GET["error"])) {
if ($_GET["error"]==1) { if ($_GET["error"]==1) {
echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>"; echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
} elseif ($_GET["error"]==2) { } elseif ($_GET["error"]==2) {
echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>"; echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
} }
} ?> } ?>
<div class="tabla"> <div class="tabla">
<table border="0" cellpadding="0" cellspacing="0" id="admin-table"> <table border="0" cellpadding="0" cellspacing="0" id="admin-table">
<thead> <thead>
@ -110,7 +110,7 @@ if ($user->isAdmin()) {
$odd=false; $odd=false;
$rs = $user->getUsers(); $rs = $user->getUsers();
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_array($rs)) { while ($register = $rs->fetch()) {
?> ?>
<tr <?php if ($odd) { <tr <?php if ($odd) {
echo 'class="odd"'; echo 'class="odd"';
@ -118,18 +118,18 @@ if ($user->isAdmin()) {
$odd=!$odd; ?>> $odd=!$odd; ?>>
<td><?php echo $register["login"]."\n"; ?></td> <td><?php echo $register["login"]."\n"; ?></td>
<td><?php echo $register["name"]."\n"; ?></td> <td><?php echo $register["name"]."\n"; ?></td>
<td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td> <td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td>
<td><?php if ($_SESSION["user_id"] != $register["id_user"]) { <td><?php if ($_SESSION["user_id"] != $register["id_user"]) {
?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php ?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php
} ?>&nbsp;</td> } ?>&nbsp;</td>
</tr> </tr>
<?php <?php
} }
} else { } else {
?> ?>
<tr> <tr>
<td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td> <td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
</tr> </tr>
<?php <?php

View File

@ -22,15 +22,15 @@ $template = new plantillas("admin");
$isAdmin = $user->isAdmin(); $isAdmin = $user->isAdmin();
$isEdition = isset($_GET["edit"]); $isEdition = isset($_GET["edit"]);
$commentId = ($isEdition) ? $_GET["edit"] : null; $commentId = ($isEdition) ? $_GET["edit"] : null;
if (isset($_POST["btnAdd"])) { if (isset($_POST["btnAdd"])) {
unset($_POST["btnAdd"]); unset($_POST["btnAdd"]);
$_POST["username"] = strip_tags($_POST["username"]); $_POST["username"] = strip_tags($_POST["username"]);
$_POST["email"] = strip_tags($_POST["email"]); $_POST["email"] = strip_tags($_POST["email"]);
$_POST["web"] = strip_tags($_POST["web"]); $_POST["web"] = strip_tags($_POST["web"]);
$_POST["content"] = util::removeBadTags($_POST["content"], true); $_POST["content"] = util::removeBadTags($_POST["content"], true);
if (isset($_POST["id_comment"])) { if (isset($_POST["id_comment"])) {
if ($isAdmin) { if ($isAdmin) {
if ($comment->modifyComment($_POST, $_POST["id_comment"])) { if ($comment->modifyComment($_POST, $_POST["id_comment"])) {
@ -45,7 +45,7 @@ if (isset($_POST["btnAdd"])) {
$comment->generateCookie($_POST); $comment->generateCookie($_POST);
$_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0"; $_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";
$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"]; $_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
$strEnd=($conf->urlFriendly) ? "/" : ""; $strEnd=($conf->urlFriendly) ? "/" : "";
if ($comment->addComment($_POST)) { if ($comment->addComment($_POST)) {
header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd); header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
@ -83,11 +83,11 @@ if ($isAdmin) {
}); });
}); });
</script> </script>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css"; @import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
</style> </style>
</head> </head>
<body> <body>
<div id="div-process" style="display:none;"><?=__("Processing request&hellip;"); ?></div> <div id="div-process" style="display:none;"><?=__("Processing request&hellip;"); ?></div>
<div id="cont"> <div id="cont">
@ -97,21 +97,21 @@ if ($isAdmin) {
<li><a href="<?php echo $conf->urlGelato; ?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li> <li><a href="<?php echo $conf->urlGelato; ?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li>
</ul> </ul>
</div> </div>
<div id="main"> <div id="main">
<div class="box"> <div class="box">
<ul class="menu manage"> <ul class="menu manage">
<h3><?=__("Manage comments")?></h3> <h3><?=__("Manage comments")?></h3>
<li><a href="index.php"><?=__("Posts")?></a></li> <li><a href="index.php"><?=__("Posts")?></a></li>
<li <?php if (isset($_GET["spam"])) { <li <?php if (isset($_GET["spam"])) {
?> class="selected" <?php ?> class="selected" <?php
} ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li> } ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li>
<li <?php if (!isset($_GET["spam"])) { <li <?php if (!isset($_GET["spam"])) {
?> class="selected" <?php ?> class="selected" <?php
} ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li> } ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li>
</ul> </ul>
<p>&nbsp;</p> <p>&nbsp;</p>
<?php <?php
if (isset($_GET["deleted"])) { if (isset($_GET["deleted"])) {
if ($_GET["deleted"]=="true") { if ($_GET["deleted"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been eliminated successfully.")."</div>"; echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been eliminated successfully.")."</div>";
@ -120,7 +120,7 @@ if ($isAdmin) {
echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been eliminated.")."</div>"; echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been eliminated.")."</div>";
} }
} }
if (isset($_GET["modified"])) { if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") { if ($_GET["modified"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been modified successfully.")."</div>"; echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been modified successfully.")."</div>";
@ -129,15 +129,15 @@ if ($isAdmin) {
echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been modified.")."</div>"; echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been modified.")."</div>";
} }
} ?> } ?>
<div class="tabla"> <div class="tabla">
<?php <?php
if ($isEdition) { if ($isEdition) {
$row = $comment->getComment($_GET["edit"]); $row = $comment->getComment($_GET["edit"]);
$date = strtotime($row["comment_date"]); $date = strtotime($row["comment_date"]);
$input = array("{User}", "{Email}", "{Web}", "{Comment}", "{Id_Post}", "{Date_Added}", "{Id_Comment}", "{Form_Action}"); $input = array("{User}", "{Email}", "{Web}", "{Comment}", "{Id_Post}", "{Date_Added}", "{Id_Comment}", "{Form_Action}");
$output = array($row["username"], $row["email"], $row["web"], $row["content"], $row["id_post"], $date, $row["id_comment"], $conf->urlGelato."/admin/comments.php"); $output = array($row["username"], $row["email"], $row["web"], $row["content"], $row["id_post"], $date, $row["id_comment"], $conf->urlGelato."/admin/comments.php");
$template->cargarPlantilla($input, $output, "template_comment_post"); $template->cargarPlantilla($input, $output, "template_comment_post");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
} else { } else {
@ -146,41 +146,41 @@ if ($isAdmin) {
} else { } else {
$page_num = null; $page_num = null;
} }
$limit=$conf->postLimit; $limit=$conf->postLimit;
if (isset($page_num) && is_numeric($page_num) && $page_num>0) { if (isset($page_num) && is_numeric($page_num) && $page_num>0) {
$from = (($page_num-1) * $limit); $from = (($page_num-1) * $limit);
} else { } else {
$from = 0; $from = 0;
} }
if (isset($_GET["spam"]) && $_GET["spam"]=="true") { if (isset($_GET["spam"]) && $_GET["spam"]=="true") {
$sp = "1"; $sp = "1";
} else { } else {
$sp = null; $sp = null;
} }
$rs = $comment->getComments(null, $limit, $from, $sp); $rs = $comment->getComments(null, $limit, $from, $sp);
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($rowComment = mysql_fetch_array($rs)) { while ($rowComment = $rs->fetch()) {
$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"]; $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];
$input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}"); $input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}");
$output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]); $output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]);
$template->cargarPlantilla($input, $output, "template_comment"); $template->cargarPlantilla($input, $output, "template_comment");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
} }
$p = new pagination; $p = new pagination;
$p->items($comment->countComments()); $p->items($comment->countComments());
$p->limit($limit); $p->limit($limit);
$p->currentPage(isset($page_num) ? $page_num : 1); $p->currentPage(isset($page_num) ? $page_num : 1);
$p->show(); $p->show();
} }
} ?> } ?>
</div> </div>
<div class="footer-box">&nbsp;</div> <div class="footer-box">&nbsp;</div>
@ -197,4 +197,4 @@ if ($isAdmin) {
} else { } else {
header("Location: ".$conf->urlGelato."/login.php"); header("Location: ".$conf->urlGelato."/login.php");
} }
?> ?>

View File

@ -107,7 +107,7 @@ if ($user->isAuthenticated()) {
$admin_includes = ""; $admin_includes = "";
$trigger->call('admin_includes'); $trigger->call('admin_includes');
$theme->set('admin_includes', $admin_includes); $theme->set('admin_includes', $admin_includes);
$theme->set('version', $util_class->version()); $theme->set('version', $util_class->version());
$theme->set('conf', array( $theme->set('conf', array(
'urlGelato'=>$conf->urlGelato, 'urlGelato'=>$conf->urlGelato,
@ -240,7 +240,7 @@ if ($user->isAuthenticated()) {
$rows = array(); $rows = array();
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_array($rs)) { while ($register = $rs->fetch()) {
$row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"])); $row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"]));
$formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime)); $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));

12
api.php
View File

@ -15,11 +15,11 @@ if (!defined('entry')) {
?> ?>
<?php <?php
$isFeed = true; $isFeed = true;
require('entry.php'); require('entry.php');
global $user, $conf, $tumble; global $user, $conf, $tumble;
$f = new feeds(); $f = new feeds();
$theme = new themes; $theme = new themes;
if (isset($_GET["action"]) && $_GET["action"] == "read") { if (isset($_GET["action"]) && $_GET["action"] == "read") {
@ -63,7 +63,7 @@ if (!defined('entry')) {
$feed['error_text'] = $error_text; $feed['error_text'] = $error_text;
$feeds[] = $feed; $feeds[] = $feed;
} }
$theme->set("feeds", $feeds); $theme->set("feeds", $feeds);
if ($hasType) { if ($hasType) {
@ -78,14 +78,14 @@ if (!defined('entry')) {
$theme->set("start", $start); $theme->set("start", $start);
$theme->set("total", $total); $theme->set("total", $total);
while ($post = mysql_fetch_assoc($rs)) { while ($post = $rs->fetch()) {
$post['desc'] = util::trimString($post["description"]); $post['desc'] = util::trimString($post["description"]);
$strEnd = ($conf->urlFriendly) ? "/" : ""; $strEnd = ($conf->urlFriendly) ? "/" : "";
$post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd; $post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
$post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime)); $post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
$post["type"] = util::type2Text($post["type"]); $post["type"] = util::type2Text($post["type"]);
switch ($post["type"]) { switch ($post["type"]) {
case "post": case "post":
$post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]); $post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);

View File

@ -29,16 +29,16 @@ $video = array();
$dates = array(); $dates = array();
$rs = $tumble->getPosts($tumble->getPostsNumber()); $rs = $tumble->getPosts($tumble->getPostsNumber());
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_assoc($rs)) { while ($register = $rs->fetch()) {
$date = strtotime($register['date']); $date = strtotime($register['date']);
$year = date('Y', $date); $year = date('Y', $date);
$month = date('M', $date); $month = date('M', $date);
$day = date('d', $date); $day = date('d', $date);
$dates[$year][$month][$day] = true; $dates[$year][$month][$day] = true;
$output = handleNode($register); $output = handleNode($register);
$theType = $util_class->type2Text($register["type"]); $theType = $util_class->type2Text($register["type"]);
switch ($theType) { switch ($theType) {
case 'quote': case 'quote':
$quote[] = $output; $quote[] = $output;
@ -68,7 +68,7 @@ function handleNode($node)
global $user, $tumble, $conf; global $user, $tumble, $conf;
$dateTmp = null; $dateTmp = null;
$formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime)); $formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime));
$output = array(); $output = array();
$output['url'] = $tumble->getPermalink($node["id_post"]); $output['url'] = $tumble->getPermalink($node["id_post"]);
$output['date'] = $formatedDate; $output['date'] = $formatedDate;
@ -77,10 +77,10 @@ function handleNode($node)
$year = date('Y', $date); $year = date('Y', $date);
$month = date('M', $date); $month = date('M', $date);
$day = date('d', $date); $day = date('d', $date);
$output['full_date'] = $day.' '.$month.' '.$year; $output['full_date'] = $day.' '.$month.' '.$year;
$theType = $util_class->type2Text($node["type"]); $theType = $util_class->type2Text($node["type"]);
switch ($theType) { switch ($theType) {
case 'quote': case 'quote':
$output['quote'] = $node["description"]; $output['quote'] = $node["description"];
@ -135,7 +135,7 @@ function handleNode($node)
<title><?php echo $conf->title." &raquo; ".__(" archive"); ?></title> <title><?php echo $conf->title." &raquo; ".__(" archive"); ?></title>
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script> <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.scrollTo-min.js"></script> <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.scrollTo-min.js"></script>
<link href="<?php echo $conf->urlGelato;?>/admin/css/archive.css" type="text/css" rel="stylesheet"> <link href="<?php echo $conf->urlGelato;?>/admin/css/archive.css" type="text/css" rel="stylesheet">
<script type='text/javascript'> <script type='text/javascript'>
function select(object) { function select(object) {
var sel_id = object.id; var sel_id = object.id;
@ -146,9 +146,9 @@ function handleNode($node)
$("li.selected").removeClass('selected'); $("li.selected").removeClass('selected');
$("#"+sel_id+"_content").show(); $("#"+sel_id+"_content").show();
$('#user_hover').hide(); $('#user_hover').hide();
}; };
$(function(){ $(function(){
$("#timeline li").hover(function(){ $("#timeline li").hover(function(){
$(this).css('cursor','pointer'); $(this).css('cursor','pointer');
@ -173,9 +173,9 @@ function handleNode($node)
$("#bubble").text('Not found'); $("#bubble").text('Not found');
} }
}); });
$('#user_hover').hover(function(){},function(){ $(this).hide(); }); $('#user_hover').hover(function(){},function(){ $(this).hide(); });
$('.item').hover(function(e){ $('.item').hover(function(e){
var item = $(this); var item = $(this);
$('#user_hover').css({top:$(this).offset().top,left:$(this).offset().left}).show().unbind('click').click(function(){ $('#user_hover').css({top:$(this).offset().top,left:$(this).offset().left}).show().unbind('click').click(function(){
@ -184,7 +184,7 @@ function handleNode($node)
$('#user_hover h3').text($(this).attr('rel')); $('#user_hover h3').text($(this).attr('rel'));
},function(e){}); },function(e){});
}); });
function wrap () { function wrap () {
var elems = $("li.selected"); var elems = $("li.selected");
var list = $("#content > div:visible ul.item_list > li"); var list = $("#content > div:visible ul.item_list > li");
@ -201,10 +201,10 @@ function handleNode($node)
$(elems).eq(0).append("<div class='crnr wn'>&nbsp;</div>").append("<div class='crnr ws'>&nbsp;</div>"); $(elems).eq(0).append("<div class='crnr wn'>&nbsp;</div>").append("<div class='crnr ws'>&nbsp;</div>");
$(elems).eq(l-1).append("<div class='crnr en'>&nbsp;</div>").append("<div class='crnr es'>&nbsp;</div>"); $(elems).eq(l-1).append("<div class='crnr en'>&nbsp;</div>").append("<div class='crnr es'>&nbsp;</div>");
} }
</script> </script>
</head> </head>
<body> <body>
<div id='dash'> <div id='dash'>
<div id='options'> <div id='options'>
@ -216,7 +216,7 @@ function handleNode($node)
<li><a href='#' id='quote' class='option' onclick="select(this);">Quotes</a></li> <li><a href='#' id='quote' class='option' onclick="select(this);">Quotes</a></li>
<li><a href='#' id='video' class='option' onclick="select(this);">Videos</a></li> <li><a href='#' id='video' class='option' onclick="select(this);">Videos</a></li>
</ul> </ul>
</div> </div>
<div id="timeline"> <div id="timeline">
<div id="timewrap"> <div id="timewrap">
<div id="bubble"></div> <div id="bubble"></div>
@ -239,15 +239,15 @@ function handleNode($node)
} }
?> ?>
</ul> </ul>
</div> </div>
</div> </div>
<div id='content'> <div id='content'>
<div id='msg' style="display:none;">&nbsp;</div> <div id='msg' style="display:none;">&nbsp;</div>
<div id='conversation_content'> <div id='conversation_content'>
<ul class='item_list'> <ul class='item_list'>
<?php foreach ($conversation as $item) { <?php foreach ($conversation as $item) {
@ -259,11 +259,11 @@ function handleNode($node)
</ul> </ul>
</div> </div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<div id='quote_content' style='display:none;'> <div id='quote_content' style='display:none;'>
<ul class='item_list'> <ul class='item_list'>
<?php foreach ($quote as $item) { <?php foreach ($quote as $item) {
@ -276,11 +276,11 @@ function handleNode($node)
</ul> </ul>
</div> </div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<div id='link_content' style='display:none;'> <div id='link_content' style='display:none;'>
<ul class='item_list'> <ul class='item_list'>
<?php foreach ($link as $item) { <?php foreach ($link as $item) {
@ -292,32 +292,32 @@ function handleNode($node)
</ul> </ul>
</div> </div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<div id='photo_content' style='display:none;'> <div id='photo_content' style='display:none;'>
<ul class='item_list'> <ul class='item_list'>
<?php foreach ($photo as $item) { <?php foreach ($photo as $item) {
?> ?>
<?php <?php
/* /*
echo "<pre>"; echo "<pre>";
print_r($item); print_r($item);
echo "</pre>"; echo "</pre>";
*/ */
?> ?>
<li> <li>
<div class='item' style="background-image:url('<?php echo $item['photo']; ?>')" rel='<?php echo $item['full_date'] ?>' title="<?php echo strftime("%b %d, %G", strtotime($item['date'])); ?>" onclick="location.href='<?php echo $item['url'] ?>';"></div> <div class='item' style="background-image:url('<?php echo $item['photo']; ?>')" rel='<?php echo $item['full_date'] ?>' title="<?php echo strftime("%b %d, %G", strtotime($item['date'])); ?>" onclick="location.href='<?php echo $item['url'] ?>';"></div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<div id='regular_content' style='display:none;'> <div id='regular_content' style='display:none;'>
<ul class='item_list' rel='<?php echo $item['full_date'] ?>'> <ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
<?php foreach ($regular as $item) { <?php foreach ($regular as $item) {
?> ?>
@ -327,11 +327,11 @@ function handleNode($node)
<p><?php echo $item['body']; ?></p> <p><?php echo $item['body']; ?></p>
</div> </div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<div id='video_content' style='display:none;'> <div id='video_content' style='display:none;'>
<ul class='item_list' rel='<?php echo $item['full_date'] ?>'> <ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
<?php foreach ($video as $item) { <?php foreach ($video as $item) {
@ -341,18 +341,18 @@ function handleNode($node)
<?php echo $item['embed']; //$item['caption']?> <?php echo $item['embed']; //$item['caption']?>
</div> </div>
</li> </li>
<?php <?php
} ?> } ?>
</ul> </ul>
</div> </div>
<p style="clear:both">&nbsp;</p> <p style="clear:both">&nbsp;</p>
</div> </div>
<br clear='both' /> <br clear='both' />
<div id='user_hover'><h3>&nbsp;</h3></div> <div id='user_hover'><h3>&nbsp;</h3></div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -99,7 +99,7 @@ class comments
public function getComment($id="") public function getComment($id="")
{ {
$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id); $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id);
return mysql_fetch_array($this->db->mid_consulta); return $this->db->mid_consulta->fetch();
} }
public function countComments($idPost=null) public function countComments($idPost=null)

View File

@ -169,7 +169,7 @@ class feeds extends Conexion_Mysql
$timeToUpdate = trim($this->conf->rssImportFrec). ' ago'; $timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
$delta = time() - strtotime($timeToUpdate); $delta = time() - strtotime($timeToUpdate);
$this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW()) FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id); $this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW()) FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id);
$time = mysql_fetch_array($this->mid_consulta); $time = $this->mid_consulta->fetch();
return $time[0]; return $time[0];
} }
} }

View File

@ -83,13 +83,13 @@ class gelato
public function getPost($id="") public function getPost($id="")
{ {
$this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
return mysql_fetch_array($this->db->mid_consulta); return $this->db->mid_consulta->fetch();
} }
public function getPostsNumber() public function getPostsNumber()
{ {
$this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); $this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
$row = mysql_fetch_assoc($this->db->mid_consulta); $row = $this->db->mid_consulta->fetch();
return $row['total']; return $row['total'];
} }
@ -97,7 +97,7 @@ class gelato
{ {
if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
if ($this->db->contarRegistros()>0) { if ($this->db->contarRegistros()>0) {
while ($registro = mysql_fetch_array($this->db->mid_consulta)) { while ($registro = $this->db->mid_consulta->fetch()) {
return $registro[0]; return $registro[0];
} }
} }

View File

@ -15,9 +15,9 @@
*/ */
// constantes // constantes
define('MYSQL_TYPES_NUMERIC', 'int real '); define('MYSQL_TYPES_NUMERIC', 'int real tiny long ');
define('MYSQL_TYPES_DATE', 'datetime timestamp year date time '); define('MYSQL_TYPES_DATE', 'datetime timestamp year date time ');
define('MYSQL_TYPES_STRING', 'string blob '); define('MYSQL_TYPES_STRING', 'string blob var_string ');
class Conexion_Mysql class Conexion_Mysql
{ {
@ -119,7 +119,7 @@ class Conexion_Mysql
$sqlValues .= "'$valor',"; $sqlValues .= "'$valor',";
} elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) { } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
$valor = $this->sql_escape($valor); $valor = $this->sql_escape($valor);
$sqlValues .= "'$valor',"; $sqlValues .= "$valor,";
} }
} }
$cols = rtrim($cols, ',').')'; $cols = rtrim($cols, ',').')';
@ -127,6 +127,7 @@ class Conexion_Mysql
// inserta los valores en la DB // inserta los valores en la DB
$sql = "INSERT INTO $tabla $cols VALUES $sqlValues"; $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
return $this->ejecutarConsulta($sql); return $this->ejecutarConsulta($sql);
} }
@ -168,7 +169,7 @@ class Conexion_Mysql
$sql .= "'$valor',"; $sql .= "'$valor',";
} elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) { } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
$valor = $this->sql_escape($valor); $valor = $this->sql_escape($valor);
$sql .= "'$valor',"; $sql .= "$valor,";
} }
} }
$sql = rtrim($sql, ','); // elimina la ultima coma $sql = rtrim($sql, ','); // elimina la ultima coma
@ -201,7 +202,7 @@ class Conexion_Mysql
return false; return false;
} }
$r->closeCursor(); $r->closeCursor();
return $ret; return strtolower($ret['native_type']);
} }
/** /**

View File

@ -14,3 +14,7 @@ if (!defined('entry') || !entry) {
=========================== */ =========================== */
define('Table_prefix', 'gel_'); define('Table_prefix', 'gel_');
define('DB_Server', 'localhost');
define('DB_name', 'gelatocms');
define('DB_User', 'gelatocms');
define('DB_Password', 'testpassword');

View File

@ -56,7 +56,7 @@ $util_class = new util();
$feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php"); $feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
$gelato_includes = "<meta name=\"generator\" content=\"gelato ".$util_class -> codeName()." (".$util_class -> version().")\" />\n"; $gelato_includes = "<meta name=\"generator\" content=\"gelato ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
$gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />"; $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
@ -110,7 +110,7 @@ $util_class = new util();
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
$dateTmp = null; $dateTmp = null;
while ($register = mysql_fetch_assoc($rs)) { while ($register = $rs->fetch()) {
$formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime)); $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
if ($dateTmp != null && $formatedDate == $dateTmp) { if ($dateTmp != null && $formatedDate == $dateTmp) {
$formatedDate = ""; $formatedDate = "";
@ -189,7 +189,7 @@ $util_class = new util();
$rows[] = $row; $rows[] = $row;
} }
$trigger->call('post_content'); $trigger->call('post_content');
$theme->set('rows', $rows); $theme->set('rows', $rows);
@ -296,7 +296,7 @@ $util_class = new util();
if ($conf->allowComments) { if ($conf->allowComments) {
$rsComments = $comment->getComments($register["id_post"]); $rsComments = $comment->getComments($register["id_post"]);
$comments = array(); $comments = array();
while ($rowComment = mysql_fetch_assoc($rsComments)) { while ($rowComment = $rsComments->fetch()) {
$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>"; $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
$answers['Id_Comment'] = $rowComment["id_comment"]; $answers['Id_Comment'] = $rowComment["id_comment"];
@ -319,7 +319,7 @@ $util_class = new util();
} }
$rows[] = $row; $rows[] = $row;
$trigger->call('post_content'); $trigger->call('post_content');
$theme->set('rows', $rows); $theme->set('rows', $rows);
} }

22
rss.php
View File

@ -16,22 +16,22 @@ if (!defined('entry')) {
<?php <?php
require('entry.php'); require('entry.php');
$trigger->call('feed_header'); $trigger->call('feed_header');
header("Content-type: text/xml; charset=utf-8"); header("Content-type: text/xml; charset=utf-8");
$isFeed = true; $isFeed = true;
global $conf, $tumble; global $conf, $tumble;
$util_class = new util(); $util_class = new util();
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?> ?>
<rss version="2.0"> <rss version="2.0">
<channel> <channel>
<title><?php echo htmlspecialchars($conf->title);?></title> <title><?php echo htmlspecialchars($conf->title);?></title>
<link><?php echo $conf->urlGelato;?></link> <link><?php echo $conf->urlGelato;?></link>
<description><?php echo htmlspecialchars($conf->description);?></description> <description><?php echo htmlspecialchars($conf->description);?></description>
<generator>gelato CMS <?php echo $util_class->codeName()." (".$util_class->version().")"; ?></generator> <generator>gelato CMS <?php echo $util_class->codeName()." (".$util_class->version().")"; ?></generator>
<image> <image>
<url><?php echo $conf->urlGelato;?>/images/information.png</url> <url><?php echo $conf->urlGelato;?>/images/information.png</url>
<title><?php echo htmlspecialchars($conf->description);?></title> <title><?php echo htmlspecialchars($conf->description);?></title>
@ -40,9 +40,9 @@ if (!defined('entry')) {
<?php <?php
$rs = $tumble->getPosts("20"); $rs = $tumble->getPosts("20");
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_array($rs)) { while ($register = $rs->fetch()) {
$register["description"] = $register["description"]; $register["description"] = $register["description"];
switch ($register["type"]) { switch ($register["type"]) {
case "1": case "1":
$tit = ($register["title"]=="") ? $register["description"] : $register["title"]; $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
@ -86,11 +86,11 @@ if (!defined('entry')) {
<title><?php echo $tit; ?></title> <title><?php echo $tit; ?></title>
<description><![CDATA[<?php echo $desc; ?>]]></description> <description><![CDATA[<?php echo $desc; ?>]]></description>
<link><?php echo $url; ?></link> <link><?php echo $url; ?></link>
<guid isPermaLink="true"><?php echo $url; ?></guid> <guid isPermaLink="true"><?php echo $url; ?></guid>
<pubDate><?php echo $formatedDate; ?></pubDate> <pubDate><?php echo $formatedDate; ?></pubDate>
</item> </item>
<?php <?php
} }
} }
?> ?>

View File

@ -16,23 +16,23 @@ if (!defined('entry')) {
<?php <?php
require('entry.php'); require('entry.php');
global $conf, $tumble, $db; global $conf, $tumble, $db;
// Code modified from the one at http://paste.ubuntu-nl.org/44548/ // Code modified from the one at http://paste.ubuntu-nl.org/44548/
header("Content-type: text/xml; charset=utf-8"); header("Content-type: text/xml; charset=utf-8");
$isFeed = true; $isFeed = true;
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n"; echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n";
$rs = $tumble->getPosts(1); $rs = $tumble->getPosts(1);
?> ?>
<!-- generator="gelato CMS" --> <!-- generator="gelato CMS" -->
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc><?php echo $conf->urlGelato;?></loc> <loc><?php echo $conf->urlGelato;?></loc>
<?php <?php
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
$register = mysql_fetch_array($rs); $register = $rs->fetch();
$formatedDate = gmdate("Y-m-d", strtotime($register["date"])); $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
echo "\n\t<lastmod>".$formatedDate."</lastmod>"; echo "\n\t<lastmod>".$formatedDate."</lastmod>";
} }
@ -42,14 +42,14 @@ if (!defined('entry')) {
</url> </url>
<?php <?php
$rs = $tumble->getPosts($tumble->getPostsNumber()); $rs = $tumble->getPosts($tumble->getPostsNumber());
if ($db->contarRegistros()>0) { if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_array($rs)) { while ($register = $rs->fetch()) {
$url = $tumble->getPermalink($register["id_post"]); $url = $tumble->getPermalink($register["id_post"]);
$formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?> $formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?>
<url> <url>
<loc><?php echo $url; ?></loc> <loc><?php echo $url; ?></loc>
<lastmod><?php echo $formatedDate; ?></lastmod> <lastmod><?php echo $formatedDate; ?></lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
@ -59,4 +59,4 @@ if (!defined('entry')) {
} }
} }
?> ?>
</urlset> </urlset>