Plik post.php ma wyglądać tak:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
include LOCALE.LOCALESET."forum/post.php";
require_once INCLUDES."forum_functions_include.php";
if (!FUSION_QUERY || !isset($forum_id) || !isNum($forum_id)) fallback("index.php");
$result = dbquery(
"SELECT f.*, f2.forum_name AS forum_cat_name
FROM ".$db_prefix."forums f
LEFT JOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id
WHERE f.forum_id='".$forum_id."'"
);
if (dbrows($result)) {
$fdata = dbarray($result);
if (!checkgroup($fdata['forum_access']) || !$fdata['forum_cat']) fallback("index.php");
} else {
fallback("index.php");
}
if (!checkgroup($fdata['forum_posting'])) fallback("index.php");
$forum_mods = explode(".", $fdata['forum_moderators']);
if (iMEMBER && in_array($userdata['user_id'], $forum_mods)) { define("iMOD", true); } else { define("iMOD", false); }
$caption = $fdata['forum_cat_name']." | ".$fdata['forum_name'];
if ($action == "newthread") {
include "postnewthread.php";
} elseif ($action == "reply") {
if (!isset($thread_id) || !isNum($thread_id)) fallback("index.php");
$result = dbquery("SELECT * FROM ".$db_prefix."threads WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'");
if (dbrows($result)) { $tdata = dbarray($result); } else { fallback("index.php"); }
if (!$tdata['thread_locked']) { include "postreply.php"; } else { fallback("index.php"); }
} elseif ($action == "edit") {
if (!isset($thread_id) || !isNum($thread_id) || !isset($post_id) || !isNum($post_id)) { fallback("index.php"); exit; }
$result = dbquery("SELECT * FROM ".$db_prefix."threads WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'");
if (dbrows($result)) { $tdata = dbarray($result); } else { fallback("index.php"); }
$result = dbquery("SELECT * FROM ".$db_prefix."posts WHERE post_id='".$post_id."' AND thread_id='".$tdata['thread_id']."' AND forum_id='".$fdata['forum_id']."'");
if (dbrows($result)) { $pdata = dbarray($result); } else { fallback("index.php"); }
if ($userdata['user_id'] != $pdata['post_author'] && !iMOD && !iSUPERADMIN) fallback("index.php");
if (!$tdata['thread_locked']) {
include "postedit.php";
} else {
if (iMOD || iSUPERADMIN) { include "postedit.php"; } else { fallback("index.php"); }
}
} elseif ($action == "delete") { $result = dbquery("UPDATE ".$db_prefix."users SET user_posts=user_posts-1 WHERE user_id='$post_author'"); $result = dbquery("DELETE FROM ".$db_prefix."posts WHERE post_id='$post_id' AND thread_id='$thread_id'"); $result = dbquery("SELECT * FROM ".$db_prefix."forum_attachments WHERE post_id='$post_id'"); if (dbrows($result) != 0) { $attach = dbarray($result); unlink(FORUM."attachments/".$attach['attach_name']."[".$attach ['attach_id']."]".$attach['attach_ext']); $result2 = dbquery("DELETE FROM ".$db_prefix."forum_attachments WHERE post_id='$post_id'"); } $posts = dbcount("(post_id)", "posts", "thread_id='$thread_id'"); if ($posts == 0) $result = dbquery("DELETE FROM ".$db_prefix."threads WHERE thread_id='$thread_id' AND forum_id='$forum_id'"); opentable($locale['407']); echo "
\n".$locale['445']."
\n"; if ($posts > 0) echo "". $locale['447']." |\n"; echo "".$locale['448']." | ".$locale['449']."
\n
\n"; closetable();
}else {
header("Location: index.php");
}
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>
A w pliku viewthread.php, linia ~151, po:
if ($userdata['user_id'] == $data['post_author'] || iMOD || iSUPERADMIN) {
echo "<a href='post.php?action=edit&forum_id=$forum_id&thread_id=".$data['thread_id']."&post_id=".$data['post_id']."'><img src='".THEME."forum/edit.gif' alt='".$locale['568']."' style='border:0px;'></a>\n";
dodaj:
echo "<a href='post.php?action=delete&forum_id=$forum_id&thread_id=".$data['thread_id']."&post_id=".$data['post_id']."'><img src='".THEME."forum/delete.gif' alt='Usuń' style='border:0px;'></a>\n";
Umieść sobie jeszcze jakąś graficzkę o nazwie delete.gif w folderze forum Twojego thema.
Nie pomagam na komunikatorach oraz PW!
|