You can now create, modify, delete, list and view posts
parent
517481277d
commit
ed2c60a8d1
|
|
@ -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 type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#admin-table").tablesorter({
|
||||
headers: {
|
||||
2: {sorter: false},
|
||||
3: {sorter: false}
|
||||
}
|
||||
});
|
||||
$("#admin-table").tablesorter({
|
||||
headers: {
|
||||
2: {sorter: false},
|
||||
3: {sorter: false}
|
||||
}
|
||||
});
|
||||
$("#divMessages").fadeOut(5000,function(){
|
||||
$("#divMessages").css({display:"none"});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css" media="screen">
|
||||
<style type="text/css" media="screen">
|
||||
@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div id="div-process" style="display:none;"><?php echo __("Processing request…")?></div>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main">
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div class="box">
|
||||
<ul class="menu manage">
|
||||
<h3>Manage</h3>
|
||||
|
|
@ -69,32 +69,32 @@ if ($user->isAdmin()) {
|
|||
<li class="selected"><a><?php echo __("Users")?></a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<?php
|
||||
<?php
|
||||
if (isset($_GET["added"])) {
|
||||
if ($_GET["added"]=="true") {
|
||||
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["delete"])) {
|
||||
if ($_GET["delete"]=="true") {
|
||||
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["modified"])) {
|
||||
if ($_GET["modified"]=="true") {
|
||||
echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["error"])) {
|
||||
if ($_GET["error"]==1) {
|
||||
echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
|
||||
} elseif ($_GET["error"]==2) {
|
||||
echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
|
||||
}
|
||||
} ?>
|
||||
} ?>
|
||||
<div class="tabla">
|
||||
<table border="0" cellpadding="0" cellspacing="0" id="admin-table">
|
||||
<thead>
|
||||
|
|
@ -110,7 +110,7 @@ if ($user->isAdmin()) {
|
|||
$odd=false;
|
||||
$rs = $user->getUsers();
|
||||
if ($db->contarRegistros()>0) {
|
||||
while ($register = mysql_fetch_array($rs)) {
|
||||
while ($register = $rs->fetch()) {
|
||||
?>
|
||||
<tr <?php if ($odd) {
|
||||
echo 'class="odd"';
|
||||
|
|
@ -118,18 +118,18 @@ if ($user->isAdmin()) {
|
|||
$odd=!$odd; ?>>
|
||||
<td><?php echo $register["login"]."\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"]) {
|
||||
?><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
|
||||
} ?> </td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<tr>
|
||||
<td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -22,15 +22,15 @@ $template = new plantillas("admin");
|
|||
$isAdmin = $user->isAdmin();
|
||||
$isEdition = isset($_GET["edit"]);
|
||||
$commentId = ($isEdition) ? $_GET["edit"] : null;
|
||||
|
||||
|
||||
if (isset($_POST["btnAdd"])) {
|
||||
unset($_POST["btnAdd"]);
|
||||
|
||||
|
||||
$_POST["username"] = strip_tags($_POST["username"]);
|
||||
$_POST["email"] = strip_tags($_POST["email"]);
|
||||
$_POST["web"] = strip_tags($_POST["web"]);
|
||||
$_POST["content"] = util::removeBadTags($_POST["content"], true);
|
||||
|
||||
|
||||
if (isset($_POST["id_comment"])) {
|
||||
if ($isAdmin) {
|
||||
if ($comment->modifyComment($_POST, $_POST["id_comment"])) {
|
||||
|
|
@ -45,7 +45,7 @@ if (isset($_POST["btnAdd"])) {
|
|||
$comment->generateCookie($_POST);
|
||||
$_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0";
|
||||
$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
|
||||
|
||||
|
||||
$strEnd=($conf->urlFriendly) ? "/" : "";
|
||||
if ($comment->addComment($_POST)) {
|
||||
header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
|
||||
|
|
@ -83,11 +83,11 @@ if ($isAdmin) {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css" media="screen">
|
||||
<style type="text/css" media="screen">
|
||||
@import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div id="div-process" style="display:none;"><?=__("Processing request…"); ?></div>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main">
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div class="box">
|
||||
<ul class="menu manage">
|
||||
<h3><?=__("Manage comments")?></h3>
|
||||
<li><a href="index.php"><?=__("Posts")?></a></li>
|
||||
<li <?php if (isset($_GET["spam"])) {
|
||||
?> class="selected" <?php
|
||||
?> class="selected" <?php
|
||||
} ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li>
|
||||
<li <?php if (!isset($_GET["spam"])) {
|
||||
?> class="selected" <?php
|
||||
?> class="selected" <?php
|
||||
} ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<?php
|
||||
<p> </p>
|
||||
<?php
|
||||
if (isset($_GET["deleted"])) {
|
||||
if ($_GET["deleted"]=="true") {
|
||||
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>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["modified"])) {
|
||||
if ($_GET["modified"]=="true") {
|
||||
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>";
|
||||
}
|
||||
} ?>
|
||||
<div class="tabla">
|
||||
<div class="tabla">
|
||||
<?php
|
||||
if ($isEdition) {
|
||||
$row = $comment->getComment($_GET["edit"]);
|
||||
$date = strtotime($row["comment_date"]);
|
||||
|
||||
|
||||
$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");
|
||||
|
||||
|
||||
$template->cargarPlantilla($input, $output, "template_comment_post");
|
||||
$template->mostrarPlantilla();
|
||||
} else {
|
||||
|
|
@ -146,41 +146,41 @@ if ($isAdmin) {
|
|||
} else {
|
||||
$page_num = null;
|
||||
}
|
||||
|
||||
|
||||
$limit=$conf->postLimit;
|
||||
|
||||
|
||||
if (isset($page_num) && is_numeric($page_num) && $page_num>0) {
|
||||
$from = (($page_num-1) * $limit);
|
||||
} else {
|
||||
$from = 0;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["spam"]) && $_GET["spam"]=="true") {
|
||||
$sp = "1";
|
||||
} else {
|
||||
$sp = null;
|
||||
}
|
||||
|
||||
|
||||
$rs = $comment->getComments(null, $limit, $from, $sp);
|
||||
|
||||
|
||||
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"];
|
||||
|
||||
|
||||
$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"]);
|
||||
|
||||
|
||||
$template->cargarPlantilla($input, $output, "template_comment");
|
||||
$template->mostrarPlantilla();
|
||||
}
|
||||
|
||||
|
||||
$p = new pagination;
|
||||
$p->items($comment->countComments());
|
||||
$p->limit($limit);
|
||||
$p->currentPage(isset($page_num) ? $page_num : 1);
|
||||
$p->show();
|
||||
}
|
||||
} ?>
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div class="footer-box"> </div>
|
||||
|
|
@ -197,4 +197,4 @@ if ($isAdmin) {
|
|||
} else {
|
||||
header("Location: ".$conf->urlGelato."/login.php");
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ if ($user->isAuthenticated()) {
|
|||
$admin_includes = "";
|
||||
$trigger->call('admin_includes');
|
||||
$theme->set('admin_includes', $admin_includes);
|
||||
|
||||
|
||||
$theme->set('version', $util_class->version());
|
||||
$theme->set('conf', array(
|
||||
'urlGelato'=>$conf->urlGelato,
|
||||
|
|
@ -240,7 +240,7 @@ if ($user->isAuthenticated()) {
|
|||
|
||||
$rows = array();
|
||||
if ($db->contarRegistros()>0) {
|
||||
while ($register = mysql_fetch_array($rs)) {
|
||||
while ($register = $rs->fetch()) {
|
||||
$row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"]));
|
||||
|
||||
$formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
|
||||
|
|
|
|||
12
api.php
12
api.php
|
|
@ -15,11 +15,11 @@ if (!defined('entry')) {
|
|||
?>
|
||||
<?php
|
||||
$isFeed = true;
|
||||
|
||||
|
||||
require('entry.php');
|
||||
global $user, $conf, $tumble;
|
||||
$f = new feeds();
|
||||
|
||||
|
||||
$theme = new themes;
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == "read") {
|
||||
|
|
@ -63,7 +63,7 @@ if (!defined('entry')) {
|
|||
$feed['error_text'] = $error_text;
|
||||
$feeds[] = $feed;
|
||||
}
|
||||
|
||||
|
||||
$theme->set("feeds", $feeds);
|
||||
|
||||
if ($hasType) {
|
||||
|
|
@ -78,14 +78,14 @@ if (!defined('entry')) {
|
|||
$theme->set("start", $start);
|
||||
$theme->set("total", $total);
|
||||
|
||||
while ($post = mysql_fetch_assoc($rs)) {
|
||||
while ($post = $rs->fetch()) {
|
||||
$post['desc'] = util::trimString($post["description"]);
|
||||
$strEnd = ($conf->urlFriendly) ? "/" : "";
|
||||
$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["type"] = util::type2Text($post["type"]);
|
||||
|
||||
|
||||
switch ($post["type"]) {
|
||||
case "post":
|
||||
$post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);
|
||||
|
|
|
|||
76
archive.php
76
archive.php
|
|
@ -29,16 +29,16 @@ $video = array();
|
|||
$dates = array();
|
||||
$rs = $tumble->getPosts($tumble->getPostsNumber());
|
||||
if ($db->contarRegistros()>0) {
|
||||
while ($register = mysql_fetch_assoc($rs)) {
|
||||
while ($register = $rs->fetch()) {
|
||||
$date = strtotime($register['date']);
|
||||
$year = date('Y', $date);
|
||||
$month = date('M', $date);
|
||||
$day = date('d', $date);
|
||||
$dates[$year][$month][$day] = true;
|
||||
$output = handleNode($register);
|
||||
|
||||
|
||||
$theType = $util_class->type2Text($register["type"]);
|
||||
|
||||
|
||||
switch ($theType) {
|
||||
case 'quote':
|
||||
$quote[] = $output;
|
||||
|
|
@ -68,7 +68,7 @@ function handleNode($node)
|
|||
global $user, $tumble, $conf;
|
||||
$dateTmp = null;
|
||||
$formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime));
|
||||
|
||||
|
||||
$output = array();
|
||||
$output['url'] = $tumble->getPermalink($node["id_post"]);
|
||||
$output['date'] = $formatedDate;
|
||||
|
|
@ -77,10 +77,10 @@ function handleNode($node)
|
|||
$year = date('Y', $date);
|
||||
$month = date('M', $date);
|
||||
$day = date('d', $date);
|
||||
|
||||
|
||||
$output['full_date'] = $day.' '.$month.' '.$year;
|
||||
$theType = $util_class->type2Text($node["type"]);
|
||||
|
||||
|
||||
switch ($theType) {
|
||||
case 'quote':
|
||||
$output['quote'] = $node["description"];
|
||||
|
|
@ -135,7 +135,7 @@ function handleNode($node)
|
|||
<title><?php echo $conf->title." » ".__(" 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.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'>
|
||||
function select(object) {
|
||||
var sel_id = object.id;
|
||||
|
|
@ -146,9 +146,9 @@ function handleNode($node)
|
|||
$("li.selected").removeClass('selected');
|
||||
$("#"+sel_id+"_content").show();
|
||||
$('#user_hover').hide();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$(function(){
|
||||
$("#timeline li").hover(function(){
|
||||
$(this).css('cursor','pointer');
|
||||
|
|
@ -173,9 +173,9 @@ function handleNode($node)
|
|||
$("#bubble").text('Not found');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#user_hover').hover(function(){},function(){ $(this).hide(); });
|
||||
|
||||
|
||||
$('.item').hover(function(e){
|
||||
var item = $(this);
|
||||
$('#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'));
|
||||
},function(e){});
|
||||
});
|
||||
|
||||
|
||||
function wrap () {
|
||||
var elems = $("li.selected");
|
||||
var list = $("#content > div:visible ul.item_list > li");
|
||||
|
|
@ -201,10 +201,10 @@ function handleNode($node)
|
|||
$(elems).eq(0).append("<div class='crnr wn'> </div>").append("<div class='crnr ws'> </div>");
|
||||
$(elems).eq(l-1).append("<div class='crnr en'> </div>").append("<div class='crnr es'> </div>");
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div id='dash'>
|
||||
<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='video' class='option' onclick="select(this);">Videos</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="timeline">
|
||||
<div id="timewrap">
|
||||
<div id="bubble"></div>
|
||||
|
|
@ -239,15 +239,15 @@ function handleNode($node)
|
|||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id='content'>
|
||||
<div id='msg' style="display:none;"> </div>
|
||||
|
||||
|
||||
<div id='conversation_content'>
|
||||
<ul class='item_list'>
|
||||
<?php foreach ($conversation as $item) {
|
||||
|
|
@ -259,11 +259,11 @@ function handleNode($node)
|
|||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id='quote_content' style='display:none;'>
|
||||
<ul class='item_list'>
|
||||
<?php foreach ($quote as $item) {
|
||||
|
|
@ -276,11 +276,11 @@ function handleNode($node)
|
|||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id='link_content' style='display:none;'>
|
||||
<ul class='item_list'>
|
||||
<?php foreach ($link as $item) {
|
||||
|
|
@ -292,32 +292,32 @@ function handleNode($node)
|
|||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id='photo_content' style='display:none;'>
|
||||
<ul class='item_list'>
|
||||
<?php foreach ($photo as $item) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
/*
|
||||
echo "<pre>";
|
||||
print_r($item);
|
||||
echo "</pre>";
|
||||
echo "</pre>";
|
||||
*/
|
||||
?>
|
||||
?>
|
||||
<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>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</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'] ?>'>
|
||||
<?php foreach ($regular as $item) {
|
||||
?>
|
||||
|
|
@ -327,11 +327,11 @@ function handleNode($node)
|
|||
<p><?php echo $item['body']; ?></p>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id='video_content' style='display:none;'>
|
||||
<ul class='item_list' rel='<?php echo $item['full_date'] ?>'>
|
||||
<?php foreach ($video as $item) {
|
||||
|
|
@ -341,18 +341,18 @@ function handleNode($node)
|
|||
<?php echo $item['embed']; //$item['caption']?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
<p style="clear:both"> </p>
|
||||
</div>
|
||||
|
||||
|
||||
<br clear='both' />
|
||||
<div id='user_hover'><h3> </h3></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class comments
|
|||
public function getComment($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)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class feeds extends Conexion_Mysql
|
|||
$timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
|
||||
$delta = time() - strtotime($timeToUpdate);
|
||||
$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];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ class gelato
|
|||
public function getPost($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()
|
||||
{
|
||||
$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'];
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ class gelato
|
|||
{
|
||||
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)) {
|
||||
while ($registro = $this->db->mid_consulta->fetch()) {
|
||||
return $registro[0];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
|
||||
// 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_STRING', 'string blob ');
|
||||
define('MYSQL_TYPES_STRING', 'string blob var_string ');
|
||||
|
||||
class Conexion_Mysql
|
||||
{
|
||||
|
|
@ -119,7 +119,7 @@ class Conexion_Mysql
|
|||
$sqlValues .= "'$valor',";
|
||||
} elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
|
||||
$valor = $this->sql_escape($valor);
|
||||
$sqlValues .= "'$valor',";
|
||||
$sqlValues .= "$valor,";
|
||||
}
|
||||
}
|
||||
$cols = rtrim($cols, ',').')';
|
||||
|
|
@ -127,6 +127,7 @@ class Conexion_Mysql
|
|||
|
||||
// inserta los valores en la DB
|
||||
$sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
|
||||
|
||||
return $this->ejecutarConsulta($sql);
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +169,7 @@ class Conexion_Mysql
|
|||
$sql .= "'$valor',";
|
||||
} elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
|
||||
$valor = $this->sql_escape($valor);
|
||||
$sql .= "'$valor',";
|
||||
$sql .= "$valor,";
|
||||
}
|
||||
}
|
||||
$sql = rtrim($sql, ','); // elimina la ultima coma
|
||||
|
|
@ -201,7 +202,7 @@ class Conexion_Mysql
|
|||
return false;
|
||||
}
|
||||
$r->closeCursor();
|
||||
return $ret;
|
||||
return strtolower($ret['native_type']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,3 +14,7 @@ if (!defined('entry') || !entry) {
|
|||
=========================== */
|
||||
|
||||
define('Table_prefix', 'gel_');
|
||||
define('DB_Server', 'localhost');
|
||||
define('DB_name', 'gelatocms');
|
||||
define('DB_User', 'gelatocms');
|
||||
define('DB_Password', 'testpassword');
|
||||
|
|
|
|||
10
index.php
10
index.php
|
|
@ -56,7 +56,7 @@ $util_class = new util();
|
|||
|
||||
$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 .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
|
||||
|
|
@ -110,7 +110,7 @@ $util_class = new util();
|
|||
|
||||
if ($db->contarRegistros()>0) {
|
||||
$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));
|
||||
if ($dateTmp != null && $formatedDate == $dateTmp) {
|
||||
$formatedDate = "";
|
||||
|
|
@ -189,7 +189,7 @@ $util_class = new util();
|
|||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
|
||||
$trigger->call('post_content');
|
||||
$theme->set('rows', $rows);
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ $util_class = new util();
|
|||
if ($conf->allowComments) {
|
||||
$rsComments = $comment->getComments($register["id_post"]);
|
||||
$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>";
|
||||
|
||||
$answers['Id_Comment'] = $rowComment["id_comment"];
|
||||
|
|
@ -319,7 +319,7 @@ $util_class = new util();
|
|||
}
|
||||
|
||||
$rows[] = $row;
|
||||
|
||||
|
||||
$trigger->call('post_content');
|
||||
$theme->set('rows', $rows);
|
||||
}
|
||||
|
|
|
|||
22
rss.php
22
rss.php
|
|
@ -16,22 +16,22 @@ if (!defined('entry')) {
|
|||
<?php
|
||||
require('entry.php');
|
||||
$trigger->call('feed_header');
|
||||
|
||||
|
||||
header("Content-type: text/xml; charset=utf-8");
|
||||
$isFeed = true;
|
||||
|
||||
|
||||
global $conf, $tumble;
|
||||
|
||||
|
||||
$util_class = new util();
|
||||
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
?>
|
||||
?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title><?php echo htmlspecialchars($conf->title);?></title>
|
||||
<link><?php echo $conf->urlGelato;?></link>
|
||||
<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>
|
||||
<url><?php echo $conf->urlGelato;?>/images/information.png</url>
|
||||
<title><?php echo htmlspecialchars($conf->description);?></title>
|
||||
|
|
@ -40,9 +40,9 @@ if (!defined('entry')) {
|
|||
<?php
|
||||
$rs = $tumble->getPosts("20");
|
||||
if ($db->contarRegistros()>0) {
|
||||
while ($register = mysql_fetch_array($rs)) {
|
||||
while ($register = $rs->fetch()) {
|
||||
$register["description"] = $register["description"];
|
||||
|
||||
|
||||
switch ($register["type"]) {
|
||||
case "1":
|
||||
$tit = ($register["title"]=="") ? $register["description"] : $register["title"];
|
||||
|
|
@ -86,11 +86,11 @@ if (!defined('entry')) {
|
|||
<title><?php echo $tit; ?></title>
|
||||
<description><![CDATA[<?php echo $desc; ?>]]></description>
|
||||
<link><?php echo $url; ?></link>
|
||||
<guid isPermaLink="true"><?php echo $url; ?></guid>
|
||||
<pubDate><?php echo $formatedDate; ?></pubDate>
|
||||
<guid isPermaLink="true"><?php echo $url; ?></guid>
|
||||
<pubDate><?php echo $formatedDate; ?></pubDate>
|
||||
</item>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
20
sitemap.php
20
sitemap.php
|
|
@ -16,23 +16,23 @@ if (!defined('entry')) {
|
|||
<?php
|
||||
require('entry.php');
|
||||
global $conf, $tumble, $db;
|
||||
|
||||
|
||||
// Code modified from the one at http://paste.ubuntu-nl.org/44548/
|
||||
header("Content-type: text/xml; charset=utf-8");
|
||||
$isFeed = true;
|
||||
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n";
|
||||
|
||||
|
||||
$rs = $tumble->getPosts(1);
|
||||
?>
|
||||
<!-- 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>
|
||||
<loc><?php echo $conf->urlGelato;?></loc>
|
||||
<loc><?php echo $conf->urlGelato;?></loc>
|
||||
<?php
|
||||
if ($db->contarRegistros()>0) {
|
||||
$register = mysql_fetch_array($rs);
|
||||
$register = $rs->fetch();
|
||||
$formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
|
||||
echo "\n\t<lastmod>".$formatedDate."</lastmod>";
|
||||
}
|
||||
|
|
@ -42,14 +42,14 @@ if (!defined('entry')) {
|
|||
</url>
|
||||
|
||||
|
||||
<?php
|
||||
<?php
|
||||
$rs = $tumble->getPosts($tumble->getPostsNumber());
|
||||
if ($db->contarRegistros()>0) {
|
||||
while ($register = mysql_fetch_array($rs)) {
|
||||
while ($register = $rs->fetch()) {
|
||||
$url = $tumble->getPermalink($register["id_post"]);
|
||||
$formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?>
|
||||
<url>
|
||||
<loc><?php echo $url; ?></loc>
|
||||
<loc><?php echo $url; ?></loc>
|
||||
<lastmod><?php echo $formatedDate; ?></lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.7</priority>
|
||||
|
|
@ -59,4 +59,4 @@ if (!defined('entry')) {
|
|||
}
|
||||
}
|
||||
?>
|
||||
</urlset>
|
||||
</urlset>
|
||||
|
|
|
|||
Loading…
Reference in New Issue