123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?php
- if (!defined('entry')) {
- define('entry', true);
- }
- /* ===========================
-
- Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
-
- Sorbet CMS is a free software licensed under the GPL 3.0
-
- =========================== */
- ?>
- <?php
- require_once '../entry.php';
- global $user, $conf, $tumble;
-
- $comment = new comments();
- $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"])) {
- header("Location: comments.php?modified=true");
- die();
- } else {
- header("Location: comments.php?modified=false");
- die();
- }
- }
- } else {
- $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->urlSorbet.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
- die();
- } else {
- header("Location: ".$conf->urlSorbet.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
- die();
- }
- }
- }
-
- if ($isAdmin) {
- if (isset($_GET["delete"])) {
- if ($comment->deleteComment($_GET['delete'])) {
- header("Location: comments.php?deleted=true");
- die();
- } else {
- header("Location: comments.php?deleted=false");
- die();
- }
- } ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>sorbet :: <?php echo __("comments")?></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="sorbet cms <?php echo util::version(); ?>" />
- <link rel="shortcut icon" href="<?php echo $conf->urlSorbet; ?>/images/favicon.ico" />
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/jquery.js"></script>
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/tools.js"></script>
- <script language="javascript" type="text/javascript">
- $(document).ready(function(){
- $("#divMessages").fadeOut(5000,function(){
- $("#divMessages").css({display:"none"});
- });
- });
- </script>
- <style type="text/css" media="screen">
- @import "<?php echo $conf->urlSorbet; ?>/admin/css/style.css";
- </style>
- </head>
-
- <body>
- <div id="div-process" style="display:none;"><?=__("Processing request…"); ?></div>
- <div id="cont">
- <div id="head">
- <h1><a href="<?php echo $conf->urlSorbet; ?>/admin/index.php" title="sorbet :: <?=__("home")?>">sorbet cms</a></h1>
- <ul id="nav">
- <li><a href="<?php echo $conf->urlSorbet; ?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li>
- </ul>
- </div>
- <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
- } ?>><a href="comments.php?spam=true"><?=__("Spam")?></a></li>
- <li <?php if (!isset($_GET["spam"])) {
- ?> class="selected" <?php
- } ?> ><a href="comments.php"><?php echo ($isEdition) ? __("Edit") : __("List"); ?></a></li>
- </ul>
- <p> </p>
- <?php
- if (isset($_GET["deleted"])) {
- if ($_GET["deleted"]=="true") {
- echo "<div class=\"exito\" id=\"divMessages\">".__("The comment has been eliminated successfully.")."</div>";
- }
- if ($_GET["deleted"]=="false") {
- 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>";
- }
- if ($_GET["modified"]=="false") {
- echo "<div class=\"error\" id=\"divMessages\">".__("The post has NOT been modified.")."</div>";
- }
- } ?>
- <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->urlSorbet."/admin/comments.php");
-
- $template->cargarPlantilla($input, $output, "template_comment_post");
- $template->mostrarPlantilla();
- } else {
- if (isset($_GET["page"]) && is_numeric($_GET["page"])) {
- $page_num = $_GET["page"];
- } 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 = $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->urlSorbet."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlSorbet, $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>
- </div>
- </div>
- <div id="foot">
- Sorbet CMS :: PHP Tumblelog Content Management System.
- </div>
- </div>
- </body>
- </html>
- <?php
-
- } else {
- header("Location: ".$conf->urlSorbet."/login.php");
- }
- ?>
|