/*
---------------------------------------------------
PHP-Fusion - Content Management System
-------------------------------------------
© Nick Jones (Digitanium) 2002-2004
http://www.php-fusion.co.uk
nick@php-fusion.co.uk
-------------------------------------------
Released under the terms and conditions of
the GNU General Public License (Version 2)
-------------------------------------------
Poprawione przez JacekR SP6VGJ/3
Leszno 2004
---------------------------------------------------
*/
@require "../fusion_config.php";
require "../header.php";
require fusion_basedir."subheader.php";
require fusion_langdir."admin/admin_main.php";
require fusion_langdir."admin/admin_comments.php"; //tylko teksty
require "navigation.php";
if (!Admin()) header("Location: ../index.php");
if (Admin()) {
if ($article_id) {
$query = "comment_item_id='$article_id' AND comment_type='A'";
$del_query = "article_id='$article_id'";
$url = "article_id=$article_id";
$type = "articles SET article_comments='";
} else if ($news_id)
{
$query = "comment_item_id='$news_id' AND comment_type='N'";
$del_query = "news_id='$news_id'";
$url = "news_id=$news_id";
$type = "news SET news_comments='";
} else if ($photo_id)
{
$query = "comment_item_id='$photo_id' ";//AND comment_type='P'";
$del_query = "photo_id='$photo_id'";
$url = "photo_id=$photo_id";
$type = "photo SET photo_comments='";
}
if (isset($_POST['save_comment'])) {
$comment_message = stripinput($comment_message);
$result = dbquery("UPDATE ".$fusion_prefix."comments SET comment_message='$comment_message' WHERE comment_id='$comment_id'");
header("Location: comments.php?$url");
}
if ($step == "delete") {
$result = dbquery("DELETE FROM ".$fusion_prefix."comments WHERE comment_id='$comment_id'");
$count = dbrows(dbquery("SELECT * FROM ".$fusion_prefix."comments WHERE $query"));
$result = dbquery("UPDATE ".$fusion_prefix.$type."$count' WHERE $del_query");
if ($count == 0) $url = "";
header("Location: comments.php?$url");
}
$result = dbquery("SELECT * FROM ".$fusion_prefix."articles WHERE article_comments!='0' ORDER BY article_datestamp DESC");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
if (isset($article_id)) { if ($article_id == $data['article_id']) { $sel = " selected"; } else { $sel = ""; }}
$article_list .= "\n";
}
}
//===============
$result = dbquery("SELECT * FROM ".$fusion_prefix."photos WHERE photo_views!='0' ORDER BY photo_date DESC");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
$result1 = dbquery("SELECT * FROM ".$fusion_prefix."comments WHERE comment_item_id=".$data['photo_id']."");
$coments=dbrows($result1);
if ($coments != 0) {
if (isset($photo_id)) { if ($photo_id == $data['photo_id']) { $sel = " selected"; } else { $sel = ""; }}
$photo_list .= "\n";
}
}
}
//=================
$result = dbquery("SELECT * FROM ".$fusion_prefix."news WHERE news_comments!='0' ORDER BY news_datestamp DESC");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
if (isset($news_id)) { if ($news_id == $data['news_id']) { $sel = " selected"; } else { $sel = ""; }}
$news_list .= "\n";
}
}
opentable(LAN_400);
echo "
\n";
closetable();
if ($step == "edit")
{
$data = dbarray(dbquery("SELECT * FROM ".$fusion_prefix."comments WHERE comment_id=$comment_id"));
tablebreak();
opentable(LAN_420);
echo "\n";
closetable();
echo "\n";
}
if ($article_id || $news_id || $photo_id) {
tablebreak();
opentable(LAN_430);
echo "
\n";
$result = dbquery("SELECT * FROM ".$fusion_prefix."comments LEFT JOIN ".$fusion_prefix."users ON ".$fusion_prefix."comments.comment_name=".$fusion_prefix."users.user_id WHERE $query ORDER BY comment_datestamp ASC");
$numrows = dbrows($result);
$i = 1;
while ($data = dbarray($result)) {
echo "
";
if ($data[user_name]) {
echo "".$data['user_name']."";
} else {
echo "";
}
echo " | \n";
if (SuperAdmin()) echo "IP: ".$data['comment_ip']." | \n";
echo "
|
".parseubb(parsesmileys($data['comment_message']))." |
".LAN_431." |
".LAN_432." |
".strftime($settings['longdate'], $data['comment_datestamp']+($settings['timeoffset']*3600))." |
|
\n";
if ($i != $numrows) { echo "
\n"; }
$i++;
}
echo "
\n";
closetable();
echo "\n";
}
}
echo "\n";
require "../footer.php";
?>