mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +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'))
|
||||||
{
|
{
|
||||||
@@ -225,9 +221,8 @@ $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'];
|
$pVars->PARENTNAME = $parent['forum_name'];
|
||||||
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
|
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
|
||||||
if (!count($forumList['forums'][$parent['forum_id']]))
|
if (!count($forumList['forums'][$parent['forum_id']]))
|
||||||
@@ -236,6 +231,7 @@ foreach ($forumList['parents'] as $parent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//TODO: Rework the restricted string
|
||||||
foreach($forumList['forums'][$parent['forum_id']] as $f)
|
foreach($forumList['forums'][$parent['forum_id']] as $f)
|
||||||
{
|
{
|
||||||
if ($f['forum_class'] == e_UC_ADMIN && ADMIN)
|
if ($f['forum_class'] == e_UC_ADMIN && ADMIN)
|
||||||
@@ -264,23 +260,13 @@ foreach ($forumList['parents'] as $parent)
|
|||||||
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars);
|
$forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_parent($parent)
|
function parse_parent($parent)
|
||||||
{
|
{
|
||||||
if(check_class($parent['forum_class']))
|
|
||||||
{
|
|
||||||
$status[0] = '';
|
|
||||||
$status[1] = true;
|
|
||||||
if(!check_class($parent['forum_postclass']))
|
if(!check_class($parent['forum_postclass']))
|
||||||
{
|
{
|
||||||
$status[0] = '( '.LAN_405.' )';
|
$status = '( '.LAN_405.' )';
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$status[1] = false;
|
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
@@ -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'))
|
||||||
|
@@ -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