1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

EONE-34 (Improvement): Making progress on forum

This commit is contained in:
mcfly
2010-03-14 00:50:27 +00:00
parent 5a7cfe76c9
commit 637cf91009
5 changed files with 79 additions and 96 deletions

View File

@@ -1,20 +1,16 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ?Copyright (C) 2008-2009 e107 Inc (e107.org)
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Forum main page
*
* $URL$
* $Id$
*
*/
if(!defined('e107_INIT'))
{
@@ -225,62 +221,52 @@ $pVars = new e_vars;
foreach ($forumList['parents'] as $parent)
{
$status = parse_parent($parent);
$pVars->PARENTSTATUS = $status[0];
if ($status[1])
$pVars->PARENTSTATUS = $status;
$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'];
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
if (!count($forumList['forums'][$parent['forum_id']]))
$text .= "<td colspan='5' style='text-align:center' class='forumheader3'>".LAN_52."</td>";
}
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)
{
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);
}
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars);
}
}
}
function parse_parent($parent)
{
if(check_class($parent['forum_class']))
if(!check_class($parent['forum_postclass']))
{
$status[0] = '';
$status[1] = true;
if(!check_class($parent['forum_postclass']))
{
$status[0] = '( '.LAN_405.' )';
}
}
else
{
$status[1] = false;
$status = '( '.LAN_405.' )';
}
return $status;
}

View File

@@ -70,7 +70,6 @@ class e107forum
$this->getForumPermList();
$tmp = $e107->arrayStorage->WriteArray($this->permList, false);
$e107->ecache->set_sys('forum_perms', $tmp);
}
unset($tmp);
}
@@ -98,21 +97,21 @@ class e107forum
$qryList = array();
$qryList['view'] = "
SELECT f.forum_id
SELECT f.forum_id, f.forum_parent
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
SELECT f.forum_id, f.forum_parent
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
SELECT f.forum_id, f.forum_parent
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
@@ -122,10 +121,15 @@ class e107forum
{
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)));
}
function forumGetForumList()
function forumGetForumList($all=false)
{
$e107 = e107::getInstance();
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
$qry = '
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
ORDER BY f.forum_order ASC
';
'.$where.
'ORDER BY f.forum_order ASC';
if ($e107->sql->db_Select_gen($qry))
{
$ret = array();
while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
while ($row = $e107->sql->db_Fetch())
{
if(!$row['forum_parent'])
{
@@ -717,7 +723,6 @@ class e107forum
}
elseif($row['forum_sub'])
{
// $ret['subs'][$row['forum_parent']][$row['forum_sub']][] = $row;
$ret['subs'][$row['forum_sub']][] = $row;
}
else
@@ -875,8 +880,9 @@ class e107forum
return $result;
}
function forum_get($forum_id)
function forumGet($forum_id)
{
$sql = e107::getDb();
$forum_id = (int)$forum_id;
$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
@@ -884,7 +890,6 @@ class e107forum
LEFT JOIN #forum AS sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0
WHERE f.forum_id = {$forum_id}
";
global $sql;
if ($sql->db_Select_gen($qry))
{
return $sql->db_Fetch(MYSQL_ASSOC);

View File

@@ -42,7 +42,7 @@ switch($action)
break;
case 'nt':
$forumInfo = $forum->forum_get($id);
$forumInfo = $forum->forumGet($id);
$forumId = $id;
break;

View File

@@ -8,10 +8,8 @@
*
* View specific forums
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*
*/
@@ -55,11 +53,9 @@ if (!$forum->checkPerm($forumId, 'view'))
exit;
}
$forumInfo = $forum->forum_get($forumId);
$forumInfo = $forum->forumGet($forumId);
$threadsViewed = $forum->threadGetUserViewed();
//var_dump($forumInfo);
if (!$FORUM_VIEW_START)
{
if (file_exists(THEME.'forum_viewforum_template.php'))

View File

@@ -8,16 +8,13 @@
*
* Forum View Topic
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*
*/
require_once ('../../class2.php');
if (isset($_POST['fjsubmit']))
{
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();
exit;
}
//print_a($_POST);
if(isset($_GET['f']))
{