Sveiki. Taigi turiu saite įsidiegęs įspėjimu sistemą jau gan ilgai ir ka?kaip tik dabar sumasčiau ir pagalvojau, kad davus nariui įspėjimą jis negauną jokio prane?imo, o kas pagal viską turėtų būti.
Taigi gal ?inot kaip padaryti, kad kaip duotu nariui įspėjimą jam ateitu asmeninė ?inutė su tekstų, Jus gavote įspėjimą u? taisyklių pa?eidinėjimą.?
O ?mogau didelis dėkui tau;]
Dar klausimėlis vienas. Buvau pasidaręs, kad forume rodytų nario turimus įspėjimus, bet kaip diegiau ka?kokia modifikaciją netyčia teko keisti tą failą ir neliko man to kodo. Band?iau dėti kodus ten bandė ka?kas irgi padėti, bet nesigavo nes i?sikraipydavo forumas. Beja dar įdiegta Reputacijos modas tai kaip įdedu tą kodą, kad atvaizduotu forume įspėjimus man ka?kaip susibugina.
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: viewthread.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once \"../maincore.php\";
require_once INCLUDES.\"forum_include.php\";
require_once THEMES.\"templates/header.php\";
include LOCALE.LOCALESET.\"forum/main.php\";
if (!isset($_GET['thread_id']) || !isnum($_GET['thread_id'])) { redirect(\"index.php\"); }
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
$result = dbquery(
\"SELECT t.*, f.*, f2.forum_name AS forum_cat_name
FROM \".DB_THREADS.\" t
LEFT JOIN \".DB_FORUMS.\" f ON t.forum_id=f.forum_id
LEFT JOIN \".DB_FORUMS.\" f2 ON f.forum_cat=f2.forum_id
WHERE t.thread_id='\".$_GET['thread_id'].\"'\"
);
if (dbrows($result)) {
$fdata = dbarray($result);
if (!checkgroup($fdata['forum_access']) || !$fdata['forum_cat']) { redirect(\"index.php\"); }
} else {
redirect(\"index.php\");
}
if (!defined(\"iMOD\") && iMEMBER && $fdata['forum_moderators']) {
foreach ($mod_groups as $mod_group) {
if (!defined(\"iMOD\") && checkgroup($mod_group)) { define(\"iMOD\", true); }
}
}
if (!defined(\"iMOD\")) { define(\"iMOD\", false); }
if (iMEMBER) {
$thread_match = $fdata['thread_id'].\"\|\".$fdata['thread_lastpost'].\"\|\".$fdata['forum_id'];
if (($fdata['thread_lastpost'] > $lastvisited) && !preg_match(\"(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)\", $userdata['user_threads'])) {
$result = dbquery(\"UPDATE \".DB_USERS.\" SET user_threads='\".$userdata['user_threads'].\".\".stripslashes($thread_match).\"' WHERE user_id='\".$userdata['user_id'].\"'\");
}
}
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_views=thread_views+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
if ((iMOD || iSUPERADMIN) && isset($_POST['delete_posts']) && (isset($_POST['delete_post'])) && is_array($_POST['delete_post']) && count($_POST['delete_post'])) {
$del_posts = \"\"; $i = 0; $post_count = 0;
foreach ($_POST['delete_post'] as $del_post_id) {
if (isnum($del_post_id)) { $del_posts .= ($del_posts ? \",\" : \"\").$del_post_id; $i++; }
}
if ($del_posts) {
$result = dbquery(\"SELECT post_author, COUNT(post_id) as num_posts FROM \".DB_POSTS.\" WHERE post_id IN (\".$del_posts.\") GROUP BY post_author\");
if (dbrows($result)) {
while ($pdata = dbarray($result)) {
$result2 = dbquery(\"UPDATE \".DB_USERS.\" SET user_posts=user_posts-\".$pdata['num_posts'].\" WHERE user_id='\".$pdata['post_author'].\"'\");
$post_count = $post_count + $pdata['num_posts'];
}
}
$result = dbquery(\"SELECT attach_name FROM \".DB_FORUM_ATTACHMENTS.\" WHERE post_id IN (\".$del_posts.\")\");
if (dbrows($result)) {
while ($data = dbarray($result)) {
unlink(FORUM.\"attachments/\".$data['attach_name']);
}
}
$result = dbquery(\"DELETE FROM \".DB_FORUM_ATTACHMENTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
$result = dbquery(\"DELETE FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
}
if (!dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$_GET['thread_id'].\"'\")) {
$result = dbquery(\"DELETE FROM \".DB_THREADS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_THREAD_NOTIFY.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_VOTERS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_OPTIONS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLLS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = false;
} else {
$result = dbquery(\"SELECT post_datestamp, post_author, post_id FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
$ldata = dbarray($result);
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_lastpost='\".$ldata['post_datestamp'].\"', thread_lastpostid='\".$ldata['post_id'].\"', thread_postcount=thread_postcount-1, thread_lastuser='\".$ldata['post_author'].\"' WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = true; unset($ldata);
}
$result = dbquery(\"SELECT post_datestamp, post_author FROM \".DB_POSTS.\" WHERE forum_id='\".$fdata['forum_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
if (dbrows($result)) {
$ldata = dbarray($result);
$forum_lastpost = \"forum_lastpost='\".$ldata['post_datestamp'].\"', forum_lastuser='\".$ldata['post_author'].\"'\";
} else {
$forum_lastpost = \"forum_lastpost='0', forum_lastuser='0'\";
}
$result = dbquery(\"UPDATE \".DB_FORUMS.\" SET \".$forum_lastpost.(!$thread_count ? \"forum_threadcount=forum_threadcount-1,\" : \",\").\" forum_postcount=forum_postcount-\".$post_count.\" WHERE forum_id = '\".$fdata['forum_id'].\"'\");
if (!$thread_count) { redirect(\"viewforum.php?forum_id=\".$fdata['forum_id']); }
}
if (isset($_GET['pid']) && isnum($_GET['pid'])) {
$reply_count = dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$fdata['thread_id'].\"' AND post_id<='\".$_GET['pid'].\"'\");
if ($reply_count > $posts_per_page) { $_GET['rowstart'] = ((ceil($reply_count / $posts_per_page)-1) * $posts_per_page); }
}
if ($fdata['forum_parent'] != 0 ) {
$sub_data = dbarray(dbquery(\"SELECT forum_id, forum_name FROM \".DB_FORUMS.\" WHERE forum_id='\".$fdata['forum_parent'].\"'\"));
$caption = $fdata['forum_cat_name'].\" :: \".$sub_data['forum_name'].\" :: \".$fdata['forum_name'].\"\";
}else{
$caption = $fdata['forum_cat_name'].\" :: \".$fdata['forum_name'].\"\";
}
if (iMEMBER && isset($_POST['cast_vote']) && (isset($_POST['poll_option']) && isnum($_POST['poll_option']))) {
$result = dbquery(\"SELECT * FROM \".DB_FORUM_POLL_VOTERS.\" WHERE forum_vote_user_id='\".$userdata['user_id'].\"' AND thread_id='\".$_GET['thread_id'].\"'\");
if (!dbrows($result)) {
$result = dbquery(\"UPDATE \".DB_FORUM_POLL_OPTIONS.\" SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"' AND forum_poll_option_id='\".$_POST['poll_option'].\"'\");
$result = dbquery(\"UPDATE \".DB_FORUM_POLLS.\" SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"INSERT INTO \".DB_FORUM_POLL_VOTERS.\" (thread_id, forum_vote_user_id, forum_vote_user_ip) VALUES ('\".$_GET['thread_id'].\"', '\".$userdata['user_id'].\"', '\".USER_IP.\"')\");
}
redirect(FUSION_SELF.\"?thread_id=\".$_GET['thread_id']);
}
\n\";
if (!$fdata['thread_locked'] && $can_reply) {
echo \"\n\";
}
if ($can_post) {
echo \"\n
\n\";
}
}
echo \"
\n
\n\";
}
if ($rows != 0) {
if ($_GET['rowstart'] == 0 && $fdata['thread_poll'] == \"1\") {
if (iMEMBER) {
$presult = dbquery(
\"SELECT tfp.*, tfv.forum_vote_user_id FROM \".DB_FORUM_POLLS.\" tfp
LEFT JOIN \".DB_FORUM_POLL_VOTERS.\" tfv
ON tfp.thread_id=tfv.thread_id AND forum_vote_user_id='\".$userdata['user_id'].\"'
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
} else {
$presult = dbquery(
\"SELECT tfp.* FROM \".DB_FORUM_POLLS.\" tfp
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
}
if (dbrows($presult)) {
$pdata = dbarray($presult); $i = 1;
if (iMEMBER) { echo \"\n\"; }
}
}
$result = dbquery(
\"SELECT p.*, fa.attach_id, fa.attach_name, fa.attach_ext, fa.attach_size, u.*, u2.user_name AS edit_name
FROM \".DB_POSTS.\" p
LEFT JOIN \".DB_FORUM_ATTACHMENTS.\" fa USING(post_id)
LEFT JOIN \".DB_USERS.\" u ON p.post_author = u.user_id
LEFT JOIN \".DB_USERS.\" u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'
WHERE p.thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp LIMIT \".$_GET['rowstart'].\",$posts_per_page\"
);
if (iMOD) { echo \"\n\";
}
list($postcount, $lastpid) = dbarraynum(dbquery(\"SELECT COUNT(post_id), MAX(post_id) FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' GROUP BY thread_id\"));
if(isnum($postcount)){
dbquery(\"UPDATE \".DB_THREADS.\" SET thread_postcount='$postcount', thread_lastpostid=$lastpid WHERE thread_id='\".$_GET['thread_id'].\"'\");
}
Padariau, kad įspėjimus rodytų kaip ?auktukus prie nario vardo:
Code
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: viewthread.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once \"../maincore.php\";
require_once INCLUDES.\"forum_include.php\";
require_once THEMES.\"templates/header.php\";
include LOCALE.LOCALESET.\"forum/main.php\";
if (!isset($_GET['thread_id']) || !isnum($_GET['thread_id'])) { redirect(\"index.php\"); }
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
$result = dbquery(
\"SELECT t.*, f.*, f2.forum_name AS forum_cat_name
FROM \".DB_THREADS.\" t
LEFT JOIN \".DB_FORUMS.\" f ON t.forum_id=f.forum_id
LEFT JOIN \".DB_FORUMS.\" f2 ON f.forum_cat=f2.forum_id
WHERE t.thread_id='\".$_GET['thread_id'].\"'\"
);
if (dbrows($result)) {
$fdata = dbarray($result);
if (!checkgroup($fdata['forum_access']) || !$fdata['forum_cat']) { redirect(\"index.php\"); }
} else {
redirect(\"index.php\");
}
if (!defined(\"iMOD\") && iMEMBER && $fdata['forum_moderators']) {
foreach ($mod_groups as $mod_group) {
if (!defined(\"iMOD\") && checkgroup($mod_group)) { define(\"iMOD\", true); }
}
}
if (!defined(\"iMOD\")) { define(\"iMOD\", false); }
if (iMEMBER) {
$thread_match = $fdata['thread_id'].\"\|\".$fdata['thread_lastpost'].\"\|\".$fdata['forum_id'];
if (($fdata['thread_lastpost'] > $lastvisited) && !preg_match(\"(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)\", $userdata['user_threads'])) {
$result = dbquery(\"UPDATE \".DB_USERS.\" SET user_threads='\".$userdata['user_threads'].\".\".stripslashes($thread_match).\"' WHERE user_id='\".$userdata['user_id'].\"'\");
}
}
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_views=thread_views+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
if ((iMOD || iSUPERADMIN) && isset($_POST['delete_posts']) && (isset($_POST['delete_post'])) && is_array($_POST['delete_post']) && count($_POST['delete_post'])) {
$del_posts = \"\"; $i = 0; $post_count = 0;
foreach ($_POST['delete_post'] as $del_post_id) {
if (isnum($del_post_id)) { $del_posts .= ($del_posts ? \",\" : \"\").$del_post_id; $i++; }
}
if ($del_posts) {
$result = dbquery(\"SELECT post_author, COUNT(post_id) as num_posts FROM \".DB_POSTS.\" WHERE post_id IN (\".$del_posts.\") GROUP BY post_author\");
if (dbrows($result)) {
while ($pdata = dbarray($result)) {
$result2 = dbquery(\"UPDATE \".DB_USERS.\" SET user_posts=user_posts-\".$pdata['num_posts'].\" WHERE user_id='\".$pdata['post_author'].\"'\");
$post_count = $post_count + $pdata['num_posts'];
}
}
$result = dbquery(\"SELECT attach_name FROM \".DB_FORUM_ATTACHMENTS.\" WHERE post_id IN (\".$del_posts.\")\");
if (dbrows($result)) {
while ($data = dbarray($result)) {
unlink(FORUM.\"attachments/\".$data['attach_name']);
}
}
$result = dbquery(\"DELETE FROM \".DB_FORUM_ATTACHMENTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
$result = dbquery(\"DELETE FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
}
if (!dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$_GET['thread_id'].\"'\")) {
$result = dbquery(\"DELETE FROM \".DB_THREADS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_THREAD_NOTIFY.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_VOTERS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_OPTIONS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLLS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = false;
} else {
$result = dbquery(\"SELECT post_datestamp, post_author, post_id FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
$ldata = dbarray($result);
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_lastpost='\".$ldata['post_datestamp'].\"', thread_lastpostid='\".$ldata['post_id'].\"', thread_postcount=thread_postcount-1, thread_lastuser='\".$ldata['post_author'].\"' WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = true; unset($ldata);
}
$result = dbquery(\"SELECT post_datestamp, post_author FROM \".DB_POSTS.\" WHERE forum_id='\".$fdata['forum_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
if (dbrows($result)) {
$ldata = dbarray($result);
$forum_lastpost = \"forum_lastpost='\".$ldata['post_datestamp'].\"', forum_lastuser='\".$ldata['post_author'].\"'\";
} else {
$forum_lastpost = \"forum_lastpost='0', forum_lastuser='0'\";
}
$result = dbquery(\"UPDATE \".DB_FORUMS.\" SET \".$forum_lastpost.(!$thread_count ? \"forum_threadcount=forum_threadcount-1,\" : \",\").\" forum_postcount=forum_postcount-\".$post_count.\" WHERE forum_id = '\".$fdata['forum_id'].\"'\");
if (!$thread_count) { redirect(\"viewforum.php?forum_id=\".$fdata['forum_id']); }
}
if (isset($_GET['pid']) && isnum($_GET['pid'])) {
$reply_count = dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$fdata['thread_id'].\"' AND post_id<='\".$_GET['pid'].\"'\");
if ($reply_count > $posts_per_page) { $_GET['rowstart'] = ((ceil($reply_count / $posts_per_page)-1) * $posts_per_page); }
}
if ($fdata['forum_parent'] != 0 ) {
$sub_data = dbarray(dbquery(\"SELECT forum_id, forum_name FROM \".DB_FORUMS.\" WHERE forum_id='\".$fdata['forum_parent'].\"'\"));
$caption = $fdata['forum_cat_name'].\" :: \".$sub_data['forum_name'].\" :: \".$fdata['forum_name'].\"\";
}else{
$caption = $fdata['forum_cat_name'].\" :: \".$fdata['forum_name'].\"\";
}
if (iMEMBER && isset($_POST['cast_vote']) && (isset($_POST['poll_option']) && isnum($_POST['poll_option']))) {
$result = dbquery(\"SELECT * FROM \".DB_FORUM_POLL_VOTERS.\" WHERE forum_vote_user_id='\".$userdata['user_id'].\"' AND thread_id='\".$_GET['thread_id'].\"'\");
if (!dbrows($result)) {
$result = dbquery(\"UPDATE \".DB_FORUM_POLL_OPTIONS.\" SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"' AND forum_poll_option_id='\".$_POST['poll_option'].\"'\");
$result = dbquery(\"UPDATE \".DB_FORUM_POLLS.\" SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"INSERT INTO \".DB_FORUM_POLL_VOTERS.\" (thread_id, forum_vote_user_id, forum_vote_user_ip) VALUES ('\".$_GET['thread_id'].\"', '\".$userdata['user_id'].\"', '\".USER_IP.\"')\");
}
redirect(FUSION_SELF.\"?thread_id=\".$_GET['thread_id']);
}
\n\";
if (!$fdata['thread_locked'] && $can_reply) {
echo \"\n\";
}
if ($can_post) {
echo \"\n
\n\";
}
}
echo \"
\n
\n\";
}
if ($rows != 0) {
if ($_GET['rowstart'] == 0 && $fdata['thread_poll'] == \"1\") {
if (iMEMBER) {
$presult = dbquery(
\"SELECT tfp.*, tfv.forum_vote_user_id FROM \".DB_FORUM_POLLS.\" tfp
LEFT JOIN \".DB_FORUM_POLL_VOTERS.\" tfv
ON tfp.thread_id=tfv.thread_id AND forum_vote_user_id='\".$userdata['user_id'].\"'
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
} else {
$presult = dbquery(
\"SELECT tfp.* FROM \".DB_FORUM_POLLS.\" tfp
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
}
if (dbrows($presult)) {
$pdata = dbarray($presult); $i = 1;
if (iMEMBER) { echo \"\n\"; }
}
}
$result = dbquery(
\"SELECT p.*, fa.attach_id, fa.attach_name, fa.attach_ext, fa.attach_size, u.*, u2.user_name AS edit_name
FROM \".DB_POSTS.\" p
LEFT JOIN \".DB_FORUM_ATTACHMENTS.\" fa USING(post_id)
LEFT JOIN \".DB_USERS.\" u ON p.post_author = u.user_id
LEFT JOIN \".DB_USERS.\" u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'
WHERE p.thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp LIMIT \".$_GET['rowstart'].\",$posts_per_page\"
);
if (iMOD) { echo \"\n\";
}
list($postcount, $lastpid) = dbarraynum(dbquery(\"SELECT COUNT(post_id), MAX(post_id) FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' GROUP BY thread_id\"));
if(isnum($postcount)){
dbquery(\"UPDATE \".DB_THREADS.\" SET thread_postcount='$postcount', thread_lastpostid=$lastpid WHERE thread_id='\".$_GET['thread_id'].\"'\");
}
Nu va visai puiku, bet galėjai daryt, kad po reputacijos rodytų.
Įspėjimai: Ir čia tuos ?auktukus, bet jei nesigauna tai gerai ir taip didelis dėkui dar kartą dedu + ;]
Gaunasi čia kaip tik nori, tik galvojau, kad prie nario vardo ma?iau vietos u?ims.
Įspėjimai po reputacija:
Code
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: viewthread.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once \"../maincore.php\";
require_once INCLUDES.\"forum_include.php\";
require_once THEMES.\"templates/header.php\";
include LOCALE.LOCALESET.\"forum/main.php\";
if (!isset($_GET['thread_id']) || !isnum($_GET['thread_id'])) { redirect(\"index.php\"); }
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
$result = dbquery(
\"SELECT t.*, f.*, f2.forum_name AS forum_cat_name
FROM \".DB_THREADS.\" t
LEFT JOIN \".DB_FORUMS.\" f ON t.forum_id=f.forum_id
LEFT JOIN \".DB_FORUMS.\" f2 ON f.forum_cat=f2.forum_id
WHERE t.thread_id='\".$_GET['thread_id'].\"'\"
);
if (dbrows($result)) {
$fdata = dbarray($result);
if (!checkgroup($fdata['forum_access']) || !$fdata['forum_cat']) { redirect(\"index.php\"); }
} else {
redirect(\"index.php\");
}
if (!defined(\"iMOD\") && iMEMBER && $fdata['forum_moderators']) {
foreach ($mod_groups as $mod_group) {
if (!defined(\"iMOD\") && checkgroup($mod_group)) { define(\"iMOD\", true); }
}
}
if (!defined(\"iMOD\")) { define(\"iMOD\", false); }
if (iMEMBER) {
$thread_match = $fdata['thread_id'].\"\|\".$fdata['thread_lastpost'].\"\|\".$fdata['forum_id'];
if (($fdata['thread_lastpost'] > $lastvisited) && !preg_match(\"(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)\", $userdata['user_threads'])) {
$result = dbquery(\"UPDATE \".DB_USERS.\" SET user_threads='\".$userdata['user_threads'].\".\".stripslashes($thread_match).\"' WHERE user_id='\".$userdata['user_id'].\"'\");
}
}
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_views=thread_views+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
if ((iMOD || iSUPERADMIN) && isset($_POST['delete_posts']) && (isset($_POST['delete_post'])) && is_array($_POST['delete_post']) && count($_POST['delete_post'])) {
$del_posts = \"\"; $i = 0; $post_count = 0;
foreach ($_POST['delete_post'] as $del_post_id) {
if (isnum($del_post_id)) { $del_posts .= ($del_posts ? \",\" : \"\").$del_post_id; $i++; }
}
if ($del_posts) {
$result = dbquery(\"SELECT post_author, COUNT(post_id) as num_posts FROM \".DB_POSTS.\" WHERE post_id IN (\".$del_posts.\") GROUP BY post_author\");
if (dbrows($result)) {
while ($pdata = dbarray($result)) {
$result2 = dbquery(\"UPDATE \".DB_USERS.\" SET user_posts=user_posts-\".$pdata['num_posts'].\" WHERE user_id='\".$pdata['post_author'].\"'\");
$post_count = $post_count + $pdata['num_posts'];
}
}
$result = dbquery(\"SELECT attach_name FROM \".DB_FORUM_ATTACHMENTS.\" WHERE post_id IN (\".$del_posts.\")\");
if (dbrows($result)) {
while ($data = dbarray($result)) {
unlink(FORUM.\"attachments/\".$data['attach_name']);
}
}
$result = dbquery(\"DELETE FROM \".DB_FORUM_ATTACHMENTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
$result = dbquery(\"DELETE FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' AND post_id IN(\".$del_posts.\")\");
}
if (!dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$_GET['thread_id'].\"'\")) {
$result = dbquery(\"DELETE FROM \".DB_THREADS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_THREAD_NOTIFY.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_VOTERS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLL_OPTIONS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"DELETE FROM \".DB_FORUM_POLLS.\" WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = false;
} else {
$result = dbquery(\"SELECT post_datestamp, post_author, post_id FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
$ldata = dbarray($result);
$result = dbquery(\"UPDATE \".DB_THREADS.\" SET thread_lastpost='\".$ldata['post_datestamp'].\"', thread_lastpostid='\".$ldata['post_id'].\"', thread_postcount=thread_postcount-1, thread_lastuser='\".$ldata['post_author'].\"' WHERE thread_id='\".$_GET['thread_id'].\"'\");
$thread_count = true; unset($ldata);
}
$result = dbquery(\"SELECT post_datestamp, post_author FROM \".DB_POSTS.\" WHERE forum_id='\".$fdata['forum_id'].\"' ORDER BY post_datestamp DESC LIMIT 1\");
if (dbrows($result)) {
$ldata = dbarray($result);
$forum_lastpost = \"forum_lastpost='\".$ldata['post_datestamp'].\"', forum_lastuser='\".$ldata['post_author'].\"'\";
} else {
$forum_lastpost = \"forum_lastpost='0', forum_lastuser='0'\";
}
$result = dbquery(\"UPDATE \".DB_FORUMS.\" SET \".$forum_lastpost.(!$thread_count ? \"forum_threadcount=forum_threadcount-1,\" : \",\").\" forum_postcount=forum_postcount-\".$post_count.\" WHERE forum_id = '\".$fdata['forum_id'].\"'\");
if (!$thread_count) { redirect(\"viewforum.php?forum_id=\".$fdata['forum_id']); }
}
if (isset($_GET['pid']) && isnum($_GET['pid'])) {
$reply_count = dbcount(\"(post_id)\", DB_POSTS, \"thread_id='\".$fdata['thread_id'].\"' AND post_id<='\".$_GET['pid'].\"'\");
if ($reply_count > $posts_per_page) { $_GET['rowstart'] = ((ceil($reply_count / $posts_per_page)-1) * $posts_per_page); }
}
if ($fdata['forum_parent'] != 0 ) {
$sub_data = dbarray(dbquery(\"SELECT forum_id, forum_name FROM \".DB_FORUMS.\" WHERE forum_id='\".$fdata['forum_parent'].\"'\"));
$caption = $fdata['forum_cat_name'].\" :: \".$sub_data['forum_name'].\" :: \".$fdata['forum_name'].\"\";
}else{
$caption = $fdata['forum_cat_name'].\" :: \".$fdata['forum_name'].\"\";
}
if (iMEMBER && isset($_POST['cast_vote']) && (isset($_POST['poll_option']) && isnum($_POST['poll_option']))) {
$result = dbquery(\"SELECT * FROM \".DB_FORUM_POLL_VOTERS.\" WHERE forum_vote_user_id='\".$userdata['user_id'].\"' AND thread_id='\".$_GET['thread_id'].\"'\");
if (!dbrows($result)) {
$result = dbquery(\"UPDATE \".DB_FORUM_POLL_OPTIONS.\" SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"' AND forum_poll_option_id='\".$_POST['poll_option'].\"'\");
$result = dbquery(\"UPDATE \".DB_FORUM_POLLS.\" SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='\".$_GET['thread_id'].\"'\");
$result = dbquery(\"INSERT INTO \".DB_FORUM_POLL_VOTERS.\" (thread_id, forum_vote_user_id, forum_vote_user_ip) VALUES ('\".$_GET['thread_id'].\"', '\".$userdata['user_id'].\"', '\".USER_IP.\"')\");
}
redirect(FUSION_SELF.\"?thread_id=\".$_GET['thread_id']);
}
\n\";
if (!$fdata['thread_locked'] && $can_reply) {
echo \"\n\";
}
if ($can_post) {
echo \"\n
\n\";
}
}
echo \"
\n
\n\";
}
if ($rows != 0) {
if ($_GET['rowstart'] == 0 && $fdata['thread_poll'] == \"1\") {
if (iMEMBER) {
$presult = dbquery(
\"SELECT tfp.*, tfv.forum_vote_user_id FROM \".DB_FORUM_POLLS.\" tfp
LEFT JOIN \".DB_FORUM_POLL_VOTERS.\" tfv
ON tfp.thread_id=tfv.thread_id AND forum_vote_user_id='\".$userdata['user_id'].\"'
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
} else {
$presult = dbquery(
\"SELECT tfp.* FROM \".DB_FORUM_POLLS.\" tfp
WHERE tfp.thread_id='\".$_GET['thread_id'].\"'\"
);
}
if (dbrows($presult)) {
$pdata = dbarray($presult); $i = 1;
if (iMEMBER) { echo \"\n\"; }
}
}
$result = dbquery(
\"SELECT p.*, fa.attach_id, fa.attach_name, fa.attach_ext, fa.attach_size, u.*, u2.user_name AS edit_name
FROM \".DB_POSTS.\" p
LEFT JOIN \".DB_FORUM_ATTACHMENTS.\" fa USING(post_id)
LEFT JOIN \".DB_USERS.\" u ON p.post_author = u.user_id
LEFT JOIN \".DB_USERS.\" u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'
WHERE p.thread_id='\".$_GET['thread_id'].\"' ORDER BY post_datestamp LIMIT \".$_GET['rowstart'].\",$posts_per_page\"
);
if (iMOD) { echo \"\n\";
}
list($postcount, $lastpid) = dbarraynum(dbquery(\"SELECT COUNT(post_id), MAX(post_id) FROM \".DB_POSTS.\" WHERE thread_id='\".$_GET['thread_id'].\"' GROUP BY thread_id\"));
if(isnum($postcount)){
dbquery(\"UPDATE \".DB_THREADS.\" SET thread_postcount='$postcount', thread_lastpostid=$lastpid WHERE thread_id='\".$_GET['thread_id'].\"'\");
}