mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
EONE-34 (Improvement): Making progress on forum
This commit is contained in:
@@ -1,20 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
* e107 website system
|
||||||
| e107 website system
|
*
|
||||||
|
|
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||||
| ?Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Released under the terms and conditions of the
|
||||||
| http://e107.org
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
|
*
|
||||||
|
|
* Forum main page
|
||||||
| Released under the terms and conditions of the
|
*
|
||||||
| GNU General Public License (http://gnu.org).
|
* $URL$
|
||||||
|
|
* $Id$
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
|
*
|
||||||
| $Revision$
|
|
||||||
| $Date$
|
|
||||||
| $Author$
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
*/
|
||||||
if(!defined('e107_INIT'))
|
if(!defined('e107_INIT'))
|
||||||
{
|
{
|
||||||
@@ -47,7 +43,7 @@ if(isset($_GET['f']))
|
|||||||
header('location:'.e_SELF);
|
header('location:'.e_SELF);
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rules':
|
case 'rules':
|
||||||
include_once(HEADERF);
|
include_once(HEADERF);
|
||||||
forum_rules('show');
|
forum_rules('show');
|
||||||
@@ -225,62 +221,52 @@ $pVars = new e_vars;
|
|||||||
foreach ($forumList['parents'] as $parent)
|
foreach ($forumList['parents'] as $parent)
|
||||||
{
|
{
|
||||||
$status = parse_parent($parent);
|
$status = parse_parent($parent);
|
||||||
$pVars->PARENTSTATUS = $status[0];
|
$pVars->PARENTSTATUS = $status;
|
||||||
if ($status[1])
|
|
||||||
|
$pVars->PARENTNAME = $parent['forum_name'];
|
||||||
|
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
|
||||||
|
if (!count($forumList['forums'][$parent['forum_id']]))
|
||||||
{
|
{
|
||||||
$pVars->PARENTNAME = $parent['forum_name'];
|
$text .= "<td colspan='5' style='text-align:center' class='forumheader3'>".LAN_52."</td>";
|
||||||
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
|
}
|
||||||
if (!count($forumList['forums'][$parent['forum_id']]))
|
else
|
||||||
|
{
|
||||||
|
//TODO: Rework the restricted string
|
||||||
|
foreach($forumList['forums'][$parent['forum_id']] as $f)
|
||||||
{
|
{
|
||||||
$text .= "<td colspan='5' style='text-align:center' class='forumheader3'>".LAN_52."</td>";
|
if ($f['forum_class'] == e_UC_ADMIN && ADMIN)
|
||||||
|
{
|
||||||
|
$forum_string .= parse_forum($f, LAN_406);
|
||||||
|
}
|
||||||
|
elseif($f['forum_class'] == e_UC_MEMBER && USER)
|
||||||
|
{
|
||||||
|
$forum_string .= parse_forum($f, LAN_407);
|
||||||
|
}
|
||||||
|
elseif($f['forum_class'] == e_UC_READONLY)
|
||||||
|
{
|
||||||
|
$forum_string .= parse_forum($f, LAN_408);
|
||||||
|
}
|
||||||
|
elseif($f['forum_class'] && check_class($f['forum_class']))
|
||||||
|
{
|
||||||
|
$forum_string .= parse_forum($f, LAN_409);
|
||||||
|
}
|
||||||
|
elseif(!$f['forum_class'])
|
||||||
|
{
|
||||||
|
$forum_string .= parse_forum($f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
if (isset($FORUM_MAIN_PARENT_END))
|
||||||
{
|
{
|
||||||
foreach($forumList['forums'][$parent['forum_id']] as $f)
|
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars);
|
||||||
{
|
|
||||||
if ($f['forum_class'] == e_UC_ADMIN && ADMIN)
|
|
||||||
{
|
|
||||||
$forum_string .= parse_forum($f, LAN_406);
|
|
||||||
}
|
|
||||||
elseif($f['forum_class'] == e_UC_MEMBER && USER)
|
|
||||||
{
|
|
||||||
$forum_string .= parse_forum($f, LAN_407);
|
|
||||||
}
|
|
||||||
elseif($f['forum_class'] == e_UC_READONLY)
|
|
||||||
{
|
|
||||||
$forum_string .= parse_forum($f, LAN_408);
|
|
||||||
}
|
|
||||||
elseif($f['forum_class'] && check_class($f['forum_class']))
|
|
||||||
{
|
|
||||||
$forum_string .= parse_forum($f, LAN_409);
|
|
||||||
}
|
|
||||||
elseif(!$f['forum_class'])
|
|
||||||
{
|
|
||||||
$forum_string .= parse_forum($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($FORUM_MAIN_PARENT_END))
|
|
||||||
{
|
|
||||||
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_parent($parent)
|
function parse_parent($parent)
|
||||||
{
|
{
|
||||||
if(check_class($parent['forum_class']))
|
if(!check_class($parent['forum_postclass']))
|
||||||
{
|
{
|
||||||
$status[0] = '';
|
$status = '( '.LAN_405.' )';
|
||||||
$status[1] = true;
|
|
||||||
if(!check_class($parent['forum_postclass']))
|
|
||||||
{
|
|
||||||
$status[0] = '( '.LAN_405.' )';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$status[1] = false;
|
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
@@ -335,7 +321,7 @@ function parse_forum($f, $restricted_string = '')
|
|||||||
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
|
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
|
||||||
if ($f['user_name'])
|
if ($f['user_name'])
|
||||||
{
|
{
|
||||||
|
|
||||||
$lastpost_name = "<a href='".$e107->url->getUrl('core:user','main','func=profile&id='.$f['forum_lastpost_user'])."'>{$f['user_name']}</a>";
|
$lastpost_name = "<a href='".$e107->url->getUrl('core:user','main','func=profile&id='.$f['forum_lastpost_user'])."'>{$f['user_name']}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -444,11 +430,11 @@ if (e_QUERY == 'new')
|
|||||||
{
|
{
|
||||||
$nVars->NEWSPOSTNAME = LAN_198;
|
$nVars->NEWSPOSTNAME = LAN_198;
|
||||||
$forum_newstring = $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
$forum_newstring = $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
||||||
|
|
||||||
}
|
}
|
||||||
$forum_new_start = $e107->tp->simpleParse($FORUM_NEWPOSTS_START, $nVars);
|
$forum_new_start = $e107->tp->simpleParse($FORUM_NEWPOSTS_START, $nVars);
|
||||||
$forum_new_end = $e107->tp->simpleParse($FORUM_NEWPOSTS_END, $nVars);
|
$forum_new_end = $e107->tp->simpleParse($FORUM_NEWPOSTS_END, $nVars);
|
||||||
|
|
||||||
if ($forum->prefs->get('enclose'))
|
if ($forum->prefs->get('enclose'))
|
||||||
{
|
{
|
||||||
$ns->tablerender($forum->prefs->get('title'), $forum_new_start.$forum_newstring.$forum_new_end, array('forum', 'main2'));
|
$ns->tablerender($forum->prefs->get('title'), $forum_new_start.$forum_newstring.$forum_new_end, array('forum', 'main2'));
|
||||||
|
@@ -70,7 +70,6 @@ class e107forum
|
|||||||
$this->getForumPermList();
|
$this->getForumPermList();
|
||||||
$tmp = $e107->arrayStorage->WriteArray($this->permList, false);
|
$tmp = $e107->arrayStorage->WriteArray($this->permList, false);
|
||||||
$e107->ecache->set_sys('forum_perms', $tmp);
|
$e107->ecache->set_sys('forum_perms', $tmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
unset($tmp);
|
unset($tmp);
|
||||||
}
|
}
|
||||||
@@ -98,21 +97,21 @@ class e107forum
|
|||||||
$qryList = array();
|
$qryList = array();
|
||||||
|
|
||||||
$qryList['view'] = "
|
$qryList['view'] = "
|
||||||
SELECT f.forum_id
|
SELECT f.forum_id, f.forum_parent
|
||||||
FROM `#forum` AS f
|
FROM `#forum` AS f
|
||||||
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_class IN (".USERCLASS_LIST.")
|
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
|
WHERE f.forum_class IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
|
||||||
";
|
";
|
||||||
|
|
||||||
$qryList['post'] = "
|
$qryList['post'] = "
|
||||||
SELECT f.forum_id
|
SELECT f.forum_id, f.forum_parent
|
||||||
FROM `#forum` AS f
|
FROM `#forum` AS f
|
||||||
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_postclass IN (".USERCLASS_LIST.")
|
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
|
WHERE f.forum_postclass IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
|
||||||
";
|
";
|
||||||
|
|
||||||
$qryList['thread'] = "
|
$qryList['thread'] = "
|
||||||
SELECT f.forum_id
|
SELECT f.forum_id, f.forum_parent
|
||||||
FROM `#forum` AS f
|
FROM `#forum` AS f
|
||||||
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id AND fp.forum_threadclass IN (".USERCLASS_LIST.")
|
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
|
WHERE f.forum_threadclass IN (".USERCLASS_LIST.") AND f.forum_parent != 0 AND fp.forum_id IS NOT NULL
|
||||||
@@ -122,10 +121,15 @@ class e107forum
|
|||||||
{
|
{
|
||||||
if($e107->sql->db_Select_gen($qry))
|
if($e107->sql->db_Select_gen($qry))
|
||||||
{
|
{
|
||||||
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
$tmp = array();
|
||||||
|
while($row = $e107->sql->db_Fetch())
|
||||||
{
|
{
|
||||||
$this->permList[$key][] = $row['forum_id'];
|
$tmp[$row['forum_id']] = 1;
|
||||||
|
$tmp[$row['forum_parent']] = 1;
|
||||||
}
|
}
|
||||||
|
ksort($tmp);
|
||||||
|
$this->permList[$key] = array_keys($tmp);
|
||||||
|
$this->permList[$key.'_list'] = implode(',', array_keys($tmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -698,18 +702,20 @@ class e107forum
|
|||||||
return ($uid && in_array($uid, array_keys($this->modArray)));
|
return ($uid && in_array($uid, array_keys($this->modArray)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function forumGetForumList()
|
function forumGetForumList($all=false)
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
|
||||||
|
|
||||||
$qry = '
|
$qry = '
|
||||||
SELECT f.*, u.user_name FROM `#forum` AS f
|
SELECT f.*, u.user_name FROM `#forum` AS f
|
||||||
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
|
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
|
||||||
ORDER BY f.forum_order ASC
|
'.$where.
|
||||||
';
|
'ORDER BY f.forum_order ASC';
|
||||||
if ($e107->sql->db_Select_gen($qry))
|
if ($e107->sql->db_Select_gen($qry))
|
||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
while ($row = $e107->sql->db_Fetch())
|
||||||
{
|
{
|
||||||
if(!$row['forum_parent'])
|
if(!$row['forum_parent'])
|
||||||
{
|
{
|
||||||
@@ -717,7 +723,6 @@ class e107forum
|
|||||||
}
|
}
|
||||||
elseif($row['forum_sub'])
|
elseif($row['forum_sub'])
|
||||||
{
|
{
|
||||||
// $ret['subs'][$row['forum_parent']][$row['forum_sub']][] = $row;
|
|
||||||
$ret['subs'][$row['forum_sub']][] = $row;
|
$ret['subs'][$row['forum_sub']][] = $row;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -875,8 +880,9 @@ class e107forum
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function forum_get($forum_id)
|
function forumGet($forum_id)
|
||||||
{
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
$forum_id = (int)$forum_id;
|
$forum_id = (int)$forum_id;
|
||||||
$qry = "
|
$qry = "
|
||||||
SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name, fp.forum_id as parent_id, fp.forum_postclass as parent_postclass, sp.forum_name AS sub_parent FROM #forum AS f
|
SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name, fp.forum_id as parent_id, fp.forum_postclass as parent_postclass, sp.forum_name AS sub_parent FROM #forum AS f
|
||||||
@@ -884,7 +890,6 @@ class e107forum
|
|||||||
LEFT JOIN #forum AS sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0
|
LEFT JOIN #forum AS sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0
|
||||||
WHERE f.forum_id = {$forum_id}
|
WHERE f.forum_id = {$forum_id}
|
||||||
";
|
";
|
||||||
global $sql;
|
|
||||||
if ($sql->db_Select_gen($qry))
|
if ($sql->db_Select_gen($qry))
|
||||||
{
|
{
|
||||||
return $sql->db_Fetch(MYSQL_ASSOC);
|
return $sql->db_Fetch(MYSQL_ASSOC);
|
||||||
|
@@ -42,7 +42,7 @@ switch($action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'nt':
|
case 'nt':
|
||||||
$forumInfo = $forum->forum_get($id);
|
$forumInfo = $forum->forumGet($id);
|
||||||
$forumId = $id;
|
$forumId = $id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -8,10 +8,8 @@
|
|||||||
*
|
*
|
||||||
* View specific forums
|
* View specific forums
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -55,11 +53,9 @@ if (!$forum->checkPerm($forumId, 'view'))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forumInfo = $forum->forum_get($forumId);
|
$forumInfo = $forum->forumGet($forumId);
|
||||||
$threadsViewed = $forum->threadGetUserViewed();
|
$threadsViewed = $forum->threadGetUserViewed();
|
||||||
|
|
||||||
//var_dump($forumInfo);
|
|
||||||
|
|
||||||
if (!$FORUM_VIEW_START)
|
if (!$FORUM_VIEW_START)
|
||||||
{
|
{
|
||||||
if (file_exists(THEME.'forum_viewforum_template.php'))
|
if (file_exists(THEME.'forum_viewforum_template.php'))
|
||||||
@@ -471,22 +467,22 @@ function parse_thread($thread_info)
|
|||||||
$tVars->REPLIES = LAN_317; // 'None'
|
$tVars->REPLIES = LAN_317; // 'None'
|
||||||
$tVars->LASTPOST = ' - ';
|
$tVars->LASTPOST = ' - ';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($thread_info['thread_sticky'])
|
switch($thread_info['thread_sticky'])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
$_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
|
$_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
$_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
|
$_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$_TEMPLATE = $FORUM_VIEW_FORUM;
|
$_TEMPLATE = $FORUM_VIEW_FORUM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tp->simpleParse($_TEMPLATE, $tVars);
|
return $tp->simpleParse($_TEMPLATE, $tVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,7 +498,7 @@ function parse_sub($subInfo)
|
|||||||
$tVars->SUB_REPLIES = $subInfo['forum_replies'];
|
$tVars->SUB_REPLIES = $subInfo['forum_replies'];
|
||||||
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
|
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
|
||||||
{
|
{
|
||||||
|
|
||||||
$tVars->NEWFLAG = "<a href='".$e107->url->getUrl('forum','forum', 'func=mfar&id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
|
$tVars->NEWFLAG = "<a href='".$e107->url->getUrl('forum','forum', 'func=mfar&id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -8,16 +8,13 @@
|
|||||||
*
|
*
|
||||||
* Forum View Topic
|
* Forum View Topic
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ('../../class2.php');
|
require_once ('../../class2.php');
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['fjsubmit']))
|
if (isset($_POST['fjsubmit']))
|
||||||
{
|
{
|
||||||
header('location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'view', 'id' => $_POST['forumjump'])));
|
header('location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'view', 'id' => $_POST['forumjump'])));
|
||||||
@@ -51,7 +48,6 @@ if(isset($_POST['track_toggle']))
|
|||||||
$thread->toggle_track();
|
$thread->toggle_track();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
//print_a($_POST);
|
|
||||||
|
|
||||||
if(isset($_GET['f']))
|
if(isset($_GET['f']))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user