1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 05:07:27 +02:00

Forum code changes

This commit is contained in:
mcfly
2008-11-26 19:59:06 +00:00
parent 41310ac870
commit ecd197430d
7 changed files with 1338 additions and 1246 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2008-11-26 04:00:36 $ | $Date: 2008-11-26 19:59:06 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -20,6 +20,83 @@ if (!defined('e107_INIT')) { exit; }
class e107forum class e107forum
{ {
var $permList = array();
function e107forum()
{
$this->loadPermList();
// print_a($this->permList);
}
function loadPermList()
{
global $e107;
if($tmp = $e107->ecache->retrieve_sys('forum_perms'))
{
$this->permList = $e107->arrayStorage->ReadArray($tmp);
}
else
{
$this->getForumPermList();
$tmp = $e107->arrayStorage->WriteArray($this->permList);
$e107->ecache->set_sys('forum_perms', $tmp);
}
unset($tmp);
}
function getForumPermList()
{
global $e107;
$this->permList = array();
$qryList = array();
$qryList[view] = "
SELECT f.forum_id
FROM `#forum` AS f
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_class IN (".USERCLASS_LIST.")
WHERE f.forum_class IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
";
$qryList[post] = "
SELECT f.forum_id
FROM `#forum` AS f
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_postclass IN (".USERCLASS_LIST.")
WHERE f.forum_postclass IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
";
$qryList[thread] = "
SELECT f.forum_id
FROM `#forum` AS f
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_threadclass IN (".USERCLASS_LIST.")
WHERE f.forum_threadclass IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
";
foreach($qryList as $key => $qry)
{
if($e107->sql->db_Select_gen($qry))
{
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
{
$this->permList[$key][] = $row['forum_id'];
}
}
}
// print_a($this->permList);
// LEFT JOIN #forum_t AS ft ON ft.thread_parent = t.thread_parent AND ft.thread_id <= ".intval($thread_id)."
// LEFT JOIN #forum_t as fp ON fp.thread_id = t.thread_parent
// WHERE t.thread_id = ".intval($thread_id)." AND t.thread_parent != 0
// ORDER BY ft.thread_datestamp ASC
// ";
}
function thread_postnum($thread_id) function thread_postnum($thread_id)
{ {
@@ -36,7 +113,7 @@ class e107forum
"; ";
if($ret['post_num'] = $sql->db_Select_gen($query)) if($ret['post_num'] = $sql->db_Select_gen($query))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch(MYSQL_ASSOC);
$ret['parent'] = $row['parent']; $ret['parent'] = $row['parent'];
} }
return $ret; return $ret;
@@ -71,7 +148,7 @@ class e107forum
{ {
if ($sql->db_Select('forum', 'forum_id', 'forum_parent != 0')) if ($sql->db_Select('forum', 'forum_id', 'forum_parent != 0'))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$parentList[] = $row['forum_id']; $parentList[] = $row['forum_id'];
} }
@@ -91,7 +168,7 @@ class e107forum
{ {
if ($sql2->db_Select('forum_t', 'thread_id', "thread_forum_id = $id AND thread_parent = 0")) if ($sql2->db_Select('forum_t', 'thread_id', "thread_forum_id = $id AND thread_parent = 0"))
{ {
while ($row = $sql2->db_Fetch()) while ($row = $sql2->db_Fetch(MYSQL_ASSOC))
{ {
$this->update_lastpost('thread', $row['thread_id']); $this->update_lastpost('thread', $row['thread_id']);
} }
@@ -99,7 +176,7 @@ class e107forum
} }
if ($sql->db_Select("forum_t", "*", "thread_forum_id={$id} ORDER BY thread_datestamp DESC LIMIT 0,1")) if ($sql->db_Select("forum_t", "*", "thread_forum_id={$id} ORDER BY thread_datestamp DESC LIMIT 0,1"))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch(MYSQL_ASSOC);
$tmp = explode(chr(1), $row['thread_user']); $tmp = explode(chr(1), $row['thread_user']);
$forum_lp_user = $tmp[0]; $forum_lp_user = $tmp[0];
$last_id = $row['thread_parent'] ? $row['thread_parent'] : $row['thread_id']; $last_id = $row['thread_parent'] ? $row['thread_parent'] : $row['thread_id'];
@@ -110,18 +187,18 @@ class e107forum
} }
} }
function forum_markasread($forum_id) function forum_markasread($forum_id)
{ {
global $sql; global $sql;
if ($forum_id != 'all') if ($forum_id != 'all')
{ {
$forum_id = intval($forum_id); $forum_id = intval($forum_id);
$extra = " AND thread_forum_id={$forum_id}"; $extra = " AND thread_forum_id={$forum_id}";
} }
$qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} "; $qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} ";
if ($sql->db_Select('forum_t', 'thread_id', $qry)) if ($sql->db_Select('forum_t', 'thread_id', $qry))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$u_new .= $row['thread_id']."."; $u_new .= $row['thread_id'].".";
} }
@@ -147,7 +224,7 @@ class e107forum
global $sql; global $sql;
if ($sql->db_Select('forum', '*', "forum_parent=0 ORDER BY forum_order ASC")) if ($sql->db_Select('forum', '*', "forum_parent=0 ORDER BY forum_order ASC"))
{ {
while ($row = $sql->db_Fetch()) { while ($row = $sql->db_Fetch(MYSQL_ASSOC)) {
$ret[] = $row; $ret[] = $row;
} }
return $ret; return $ret;
@@ -167,7 +244,7 @@ class e107forum
$regex = "(^|,)(".str_replace(",", "|", $uclass).")(,|$)"; $regex = "(^|,)(".str_replace(",", "|", $uclass).")(,|$)";
$sql->db_Select("user", "user_id, user_name", "user_class REGEXP '{$regex}'"); $sql->db_Select("user", "user_id, user_name", "user_class REGEXP '{$regex}'");
} }
while($row = $sql->db_Fetch()) while($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[$row['user_id']] = $row['user_name']; $ret[$row['user_id']] = $row['user_name'];
} }
@@ -185,7 +262,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
if($type == 'all') if($type == 'all')
{ {
@@ -258,7 +335,7 @@ class e107forum
"; ";
if($sql->db_Select_gen($_newqry)) if($sql->db_Select_gen($_newqry))
{ {
while($row = $sql->db_Fetch()) while($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[] = $row['thread_forum_id']; $ret[] = $row['thread_forum_id'];
if($row['forum_sub']) if($row['forum_sub'])
@@ -302,7 +379,7 @@ class e107forum
$result = $e107->sql->db_Insert('forum_track', $tmp); $result = $e107->sql->db_Insert('forum_track', $tmp);
unset($tmp); unset($tmp);
break; break;
case 'delete': case 'delete':
case 'del': case 'del':
$result = $e107->sql->db_Delete('forum_track', 'WHERE `track_userid` = {$uid} AND `track_thread'); $result = $e107->sql->db_Delete('forum_track', 'WHERE `track_userid` = {$uid} AND `track_thread');
@@ -333,7 +410,7 @@ class e107forum
global $sql; global $sql;
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
return $sql->db_Fetch(); return $sql->db_Fetch(MYSQL_ASSOC);
} }
return FALSE; return FALSE;
} }
@@ -350,7 +427,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
while($row = $sql->db_Fetch()) while($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[$row['forum_id']] = $row['forum_name']; $ret[$row['forum_id']] = $row['forum_name'];
} }
@@ -390,7 +467,7 @@ class e107forum
$ret = array(); $ret = array();
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[] = $row; $ret[] = $row;
} }
@@ -418,7 +495,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
return $sql->db_Fetch(); return $sql->db_Fetch(MYSQL_ASSOC);
} }
return FALSE; return FALSE;
} }
@@ -449,7 +526,7 @@ class e107forum
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$i = 0; $i = 0;
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$threadList[$i++] = $row['thread_id']; $threadList[$i++] = $row['thread_id'];
} }
@@ -494,7 +571,7 @@ class e107forum
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$i = 0; $i = 0;
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$threadList[$i++] = $row['thread_id']; $threadList[$i++] = $row['thread_id'];
} }
@@ -560,7 +637,7 @@ class e107forum
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$i = $array_start; $i = $array_start;
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[$i] = $row; $ret[$i] = $row;
$i++; $i++;
@@ -577,7 +654,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch(MYSQL_ASSOC);
$ret['head'] = $row; $ret['head'] = $row;
if (!array_key_exists(0, $ret)) if (!array_key_exists(0, $ret))
{ {
@@ -606,7 +683,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[$row['thread_parent']] = $row['thread_replies']; $ret[$row['thread_parent']] = $row['thread_replies'];
} }
@@ -636,7 +713,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$ret[0] = $sql->db_Fetch(); $ret[0] = $sql->db_Fetch(MYSQL_ASSOC);
} }
else else
{ {
@@ -662,7 +739,7 @@ class e107forum
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch(MYSQL_ASSOC);
$ret['head'] = $row; $ret['head'] = $row;
} }
} }
@@ -755,7 +832,7 @@ class e107forum
{ {
include_once(e_HANDLER.'mail.php'); include_once(e_HANDLER.'mail.php');
$message = LAN_385.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link; $message = LAN_385.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link;
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{ // Don't sent to self, nor to originator of thread if they've got 'notify' set { // Don't sent to self, nor to originator of thread if they've got 'notify' set
if ($row['user_email'] && ($row['user_email'] != $email_addy) && ($row['user_id'] != USERID)) // (May be wrong, but this could be faster than filtering current user in the query) if ($row['user_email'] && ($row['user_email'] != $email_addy) && ($row['user_id'] != USERID)) // (May be wrong, but this could be faster than filtering current user in the query)
{ {
@@ -889,7 +966,7 @@ class e107forum
if($sql->db_Select_gen($qry)) if($sql->db_Select_gen($qry))
{ {
$ret = array(); $ret = array();
while($row = $sql->db_Fetch()) while($row = $sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[$row['uid']] = $row['cnt']; $ret[$row['uid']] = $row['cnt'];
} }
@@ -897,7 +974,7 @@ class e107forum
} }
return FALSE; return FALSE;
} }
/* /*
* set bread crumb * set bread crumb
* $forum_href override ONLY applies when template is missing FORUM_CRUMB * $forum_href override ONLY applies when template is missing FORUM_CRUMB
@@ -907,17 +984,17 @@ class e107forum
{ {
global $FORUM_CRUMB,$forum_info,$thread_info,$tp; global $FORUM_CRUMB,$forum_info,$thread_info,$tp;
global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
if(is_array($FORUM_CRUMB)) if(is_array($FORUM_CRUMB))
{ {
$search = array("{SITENAME}", "{SITENAME_HREF}"); $search = array("{SITENAME}", "{SITENAME_HREF}");
$replace = array(SITENAME, "href='".e_BASE."index.php'"); $replace = array(SITENAME, "href='".e_BASE."index.php'");
$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']); $FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
$search = array("{FORUMS_TITLE}", "{FORUMS_HREF}"); $search = array("{FORUMS_TITLE}", "{FORUMS_HREF}");
$replace = array(LAN_01, "href='".e_PLUGIN."forum/forum.php'"); $replace = array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']); $FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
$search = "{PARENT_TITLE}"; $search = "{PARENT_TITLE}";
$replace = $tp->toHTML($forum_info['parent_name']); $replace = $tp->toHTML($forum_info['parent_name']);
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']); $FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
@@ -964,7 +1041,7 @@ class e107forum
$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']); $forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep; $BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
} }
$tmpFname = $forum_info['forum_name']; $tmpFname = $forum_info['forum_name'];
if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); } if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
if ($forum_href) if ($forum_href)

View File

@@ -11,69 +11,81 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
| $Revision: 1.16 $ | $Revision: 1.17 $
| $Date: 2008-01-18 21:07:47 $ | $Date: 2008-11-26 19:59:06 $
| $Author: e107steved $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("../../class2.php"); require_once('../../class2.php');
$e_wysiwyg = "post"; $e_wysiwyg = 'post';
$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php'; $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php';
include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php'); include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php');
if (IsSet($_POST['fjsubmit'])) { if (isset($_POST['fjsubmit']))
header("location:".e_BASE.$PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$_POST['forumjump']); {
header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id'=>$_POST['forumjump'])));
exit; exit;
} }
//$_POST['forumjump']
require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum; $forum = new e107forum;
if (!e_QUERY) { if (!e_QUERY || !isset($_REQUEST['id']))
header("Location:".e_PLUGIN."forum/forum.php"); {
header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} else {
$tmp = explode(".", e_QUERY);
$action = preg_replace('#\W#', '', $tmp[0]);
$id = intval($tmp[1]);
$from = intval($tmp[2]);
} }
//else
//{
// $tmp = explode(".", e_QUERY);
// $action = preg_replace('#\W#', '', $tmp[0]);
// $id = intval($tmp[1]);
// $from = intval($tmp[2]);
//}
$action = $_REQUEST['f'];
$id = (int)$_REQUEST['id'];
// check if user can post to this forum ... // check if user can post to this forum ...
if ($action == 'rp') if (!in_array($id, $forum->permList['post']))
{ {
// reply to thread
$thread_info = $forum->thread_get($id, 'last', 11);
if (!is_array($thread_info) || !count($thread_info))
{
$forum_info = FALSE; // Someone fed us a dud forum id - should exist if replying
}
else
{
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
}
}
elseif ($action == 'nt')
{
// New post
$forum_info = $forum->forum_get($id);
}
elseif ($action == 'quote' || $action == 'edit')
{
$thread_info = $forum->thread_get_postinfo($id, TRUE);
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
if($action == 'quote')
{
$id = $thread_info['head']['thread_id'];
}
}
if (($forum_info === FALSE) || !check_class($forum_info['forum_postclass']) || !check_class($forum_info['parent_postclass'])) {
require_once(HEADERF); require_once(HEADERF);
$ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>"); $ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
switch($action)
{
case 'rp':
$thread_info = $forum->thread_get($id, 'last', 11);
if (!is_array($thread_info) || !count($thread_info))
{
$forum_info = false; // Someone fed us a dud forum id - should exist if replying
}
else
{
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
}
break;
case 'nt':
$forum_info = $forum->forum_get($id);
break;
case 'quote':
case 'edit':
$thread_info = $forum->thread_get_postinfo($id, true);
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
if($_REQUST['f'] == 'quote')
{
$id = $thread_info['head']['thread_id'];
}
break;
}
define("MODERATOR", check_class($forum_info['forum_moderators'])); define("MODERATOR", check_class($forum_info['forum_moderators']));
//require_once(e_HANDLER.'forum_include.php'); //require_once(e_HANDLER.'forum_include.php');
require_once(e_PLUGIN."forum/forum_post_shortcodes.php"); require_once(e_PLUGIN."forum/forum_post_shortcodes.php");
@@ -93,16 +105,6 @@ if ($sql->db_Select("tmp", "*", "tmp_ip='$ip' ")) {
$sql->db_Delete("tmp", "tmp_ip='$ip' "); $sql->db_Delete("tmp", "tmp_ip='$ip' ");
} }
//Check to see if user had post rights
if (!check_class($forum_info['forum_postclass']))
{
require_once(HEADERF);
$text .= "<div style='text-align:center'>".LAN_399."</div>";
$ns->tablerender(LAN_20, $text);
require_once(FOOTERF);
exit;
}
//if thread is not active and not new thread, show warning //if thread is not active and not new thread, show warning
if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR) if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR)
{ {
@@ -112,16 +114,17 @@ if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR)
exit; exit;
} }
$forum_info['forum_name'] = $tp -> toHTML($forum_info['forum_name'], TRUE); $forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], true);
define("e_PAGETITLE", LAN_01." / ".$forum_info['forum_name']." / ".($action == 'rp' ? LAN_02.$forum_info['thread_name'] : LAN_03));
define("e_PAGETITLE", LAN_01." / ".$forum_info['forum_name']." / ".($action == "rp" ? LAN_02.$forum_info['thread_name'] : LAN_03));
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (is_readable(e_ADMIN.'filetypes.php')) { if (is_readable(e_ADMIN.'filetypes.php'))
{
$a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php')); $a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
$a_filetypes = explode(',', $a_filetypes); $a_filetypes = explode(',', $a_filetypes);
foreach ($a_filetypes as $ftype) { foreach ($a_filetypes as $ftype)
{
$sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype)); $sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
} }
$allowed_filetypes = implode(' | ', $sa_filetypes); $allowed_filetypes = implode(' | ', $sa_filetypes);
@@ -193,7 +196,7 @@ if (isset($_POST['fpreview']))
$ns->tablerender(LAN_323, $text); $ns->tablerender(LAN_323, $text);
$anonname = $tp->post_toHTML($_POST['anonname'], FALSE); $anonname = $tp->post_toHTML($_POST['anonname'], FALSE);
$post = $tp->post_toForm($_POST['post']); $post = $tp->post_toForm($_POST['post']);
$subject = $tp->post_toHTML($_POST['subject'], false); $subject = $tp->post_toHTML($_POST['subject'], false);
if ($action == "edit") if ($action == "edit")
@@ -463,7 +466,7 @@ elseif($action == "nt")
else else
{ {
// DB access should pass - after all, the thread should exist // DB access should pass - after all, the thread should exist
$sql->db_Select_gen("SELECT t.*, p.forum_postclass FROM #forum_t AS t $sql->db_Select_gen("SELECT t.*, p.forum_postclass FROM #forum_t AS t
LEFT JOIN #forum AS p ON t.thread_forum_id=p.forum_id WHERE thread_id='{$id}'"); LEFT JOIN #forum AS p ON t.thread_forum_id=p.forum_id WHERE thread_id='{$id}'");
$fpr = $sql -> db_Fetch(); $fpr = $sql -> db_Fetch();
if(!check_class($fpr['forum_postclass'])) if(!check_class($fpr['forum_postclass']))

View File

@@ -48,6 +48,7 @@ CREATE TABLE forum_post (
`post_edit_datestamp` int(10) unsigned NOT NULL default '0', `post_edit_datestamp` int(10) unsigned NOT NULL default '0',
`post_edit_user` int(10) unsigned NOT NULL, `post_edit_user` int(10) unsigned NOT NULL,
`post_ip` varchar(45) NOT NULL, `post_ip` varchar(45) NOT NULL,
`post_anon_name` varchar(30) NULL,
`post_attachments` text default NULL, `post_attachments` text default NULL,
`post_options` text, `post_options` text,
PRIMARY KEY (`post_id`), PRIMARY KEY (`post_id`),

View File

@@ -1,16 +1,20 @@
<?php <?php
// $Id: forum.php,v 1.2 2008-11-26 04:00:36 mcfly_e107 Exp $ // $Id: forum.php,v 1.3 2008-11-26 19:59:06 mcfly_e107 Exp $
function url_forum_forum($parms) function url_forum_forum($parms)
{ {
switch($parms['func']) switch($parms['func'])
{ {
case 'view': case 'view':
return e_PLUGIN_ABS."forum/viewforum.php?{$parms['id']}"; return e_PLUGIN_ABS."forum/viewforum.php?{$parms['id']}";
break; break;
case 'track': case 'track':
return e_PLUGIN_ABS.'forum/forum.php?track'; return e_PLUGIN_ABS.'forum/forum.php?track';
break; break;
} case 'main':
} return e_PLUGIN_ABS.'forum/forum.php';
break;
}
}

View File

@@ -1,12 +1,17 @@
<?php <?php
// $Id: thread.php,v 1.1 2008-11-26 04:00:36 mcfly_e107 Exp $ // $Id: thread.php,v 1.2 2008-11-26 19:59:06 mcfly_e107 Exp $
function url_forum_thread($parms) function url_forum_thread($parms)
{ {
switch($parms['func']) switch($parms['func'])
{ {
case 'track':
return e_PLUGIN_ABS.'forum/forum.php?track'; case 'track':
break; return e_PLUGIN_ABS.'forum/forum.php?track';
break;
}
} case 'nt':
return e_PLUGIN_ABS."forum/forum_post.php?f=nt&id={$parms['id']}";
break;
}
}

View File

@@ -6,11 +6,11 @@
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* View all forums * View specific forums
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/viewforum.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/viewforum.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2008-11-26 03:24:51 $ * $Date: 2008-11-26 19:59:06 $
* $Author: mcfly_e107 $ * $Author: mcfly_e107 $
* *
*/ */
@@ -20,7 +20,7 @@ $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php';
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php'); include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
if (isset($_POST['fjsubmit'])) { if (isset($_POST['fjsubmit'])) {
header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']); header("location:".e_SELF.'?'.$_POST['forumjump']);
exit; exit;
} }
@@ -31,8 +31,8 @@ if (!e_QUERY)
else else
{ {
$tmp = explode(".", e_QUERY); $tmp = explode(".", e_QUERY);
$forum_id = intval($tmp[0]); $forum_id = (int)$tmp[0];
$thread_from = (isset($tmp[1]) ? intval($tmp[1]) : 0); $thread_from = (isset($tmp[1]) ? (int)$tmp[1] : 0);
} }
$view = 25; $view = 25;
@@ -124,7 +124,8 @@ if ($pages)
if (check_class($forum_info['forum_postclass']) && check_class($forum_info['parent_postclass'])) if (check_class($forum_info['forum_postclass']) && check_class($forum_info['parent_postclass']))
{ {
$NEWTHREADBUTTON = "<a href='".e_PLUGIN."forum/forum_post.php?nt.".$forum_id."'>".IMAGE_newthread."</a>"; // $NEWTHREADBUTTON = "<a href='".e_PLUGIN."forum/forum_post.php?nt.".$forum_id."'>".IMAGE_newthread."</a>";
$NEWTHREADBUTTON = "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'nt', 'id' => $forum_id))."'>".IMAGE_newthread.'</a>';
} }
if(substr($forum_info['forum_name'], 0, 1) == "*") if(substr($forum_info['forum_name'], 0, 1) == "*")
@@ -336,7 +337,7 @@ function parse_thread($thread_info)
$THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum'); $THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
$ICON = ($newflag ? IMAGE_new : IMAGE_nonew); $ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
if ($REPLIES >= $pref['forum_popular']) if ($REPLIES >= $pref['forum_popular'])
{ {
$ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular); $ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
} }
@@ -458,7 +459,7 @@ function parse_thread($thread_info)
if (!$REPLIES) if (!$REPLIES)
{ {
$REPLIES = LAN_317; // 'None' $REPLIES = LAN_317; // 'None'
$LASTPOST = " - "; $LASTPOST = " - ";
} }