mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Forum code changes
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
* Forum admin functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin_class.php,v $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2008-11-26 03:24:51 $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2008-11-26 19:59:06 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ class forumAdmin
|
||||
$var['main']['link'] = e_SELF;
|
||||
$var['cat']['text'] = FORLAN_83;
|
||||
$var['cat']['link'] = e_SELF."?cat";
|
||||
if ($sql->db_Select("forum", "*", "forum_parent='0' "))
|
||||
if ($sql->db_Select('forum', 'forum_id', "forum_parent='0' LIMIT 1"))
|
||||
{
|
||||
$var['create']['text'] = FORLAN_77;
|
||||
$var['create']['link'] = e_SELF."?create";
|
||||
@@ -57,8 +57,8 @@ class forumAdmin
|
||||
function delete_item($id)
|
||||
{
|
||||
global $sql;
|
||||
$id = intval($id);
|
||||
$confirm = isset($_POST['confirm']) ? TRUE : FALSE;
|
||||
$id = (int)$id;
|
||||
$confirm = isset($_POST['confirm']) ? true : false;
|
||||
|
||||
if($sql->db_Select('forum', '*', "forum_id = {$id}"))
|
||||
{
|
||||
@@ -87,11 +87,11 @@ class forumAdmin
|
||||
}
|
||||
}
|
||||
|
||||
function delete_parent($id, $confirm = FALSE)
|
||||
function delete_parent($id, $confirm = false)
|
||||
{
|
||||
global $sql;
|
||||
$ret = "";
|
||||
if($sql->db_Select("forum", "forum_id", "forum_parent = {$id} AND forum_sub = 0"))
|
||||
if($sql->db_Select('forum', 'forum_id', "forum_parent = {$id} AND forum_sub = 0"))
|
||||
{
|
||||
$fList = $sql->db_getList();
|
||||
foreach($fList as $f)
|
||||
@@ -101,25 +101,25 @@ class forumAdmin
|
||||
}
|
||||
if($confirm)
|
||||
{
|
||||
if($sql->db_Delete("forum", "forum_id = {$id}"))
|
||||
if($sql->db_Delete('forum', "forum_id = {$id}"))
|
||||
{
|
||||
$ret .= "Forum parent successfully deleted";
|
||||
$ret .= 'Forum parent successfully deleted';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret .= "Forum parent could not be deleted";
|
||||
$ret .= 'Forum parent could not be deleted';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
return "The forum parent has the following info: <br />".$ret;
|
||||
return 'The forum parent has the following info: <br />'.$ret;
|
||||
|
||||
}
|
||||
|
||||
function delete_forum($id, $confirm = FALSE)
|
||||
function delete_forum($id, $confirm = false)
|
||||
{
|
||||
global $sql, $tp;
|
||||
$ret = "";
|
||||
if($sql->db_Select("forum", "forum_id", "forum_sub = {$id}"))
|
||||
$ret = '';
|
||||
if($sql->db_Select('forum', 'forum_id', "forum_sub = {$id}"))
|
||||
{
|
||||
$fList = $sql->db_getList();
|
||||
foreach($fList as $f)
|
||||
@@ -129,7 +129,7 @@ class forumAdmin
|
||||
}
|
||||
if($confirm)
|
||||
{
|
||||
$cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}");
|
||||
$cnt = $sql->db_Delete('forum_t',"thread_forum_id = {$id}");
|
||||
$ret .= $cnt." forum {$id} thread(s) deleted <br />";
|
||||
if($sql->db_Delete("forum", "forum_id = {$id}"))
|
||||
{
|
||||
@@ -142,7 +142,7 @@ class forumAdmin
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$sql->db_Select("forum", "*", "forum_id = {$id}");
|
||||
$sql->db_Select('forum', 'forum_name, forum_threads, forum_replies', "forum_id = {$id}");
|
||||
$row = $sql->db_Fetch();
|
||||
return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ class forumAdmin
|
||||
$text .= "
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader'>".$parent['forum_name']."
|
||||
<br /><b>".FORLAN_140.":</b> ".r_userclass_name($parent['forum_class'])." <b>".FORLAN_141.":</b> ".r_userclass_name($parent['forum_postclass'])."
|
||||
<br /><b>".FORLAN_140.":</b> ".$e107->e_userclass->uc_get_classname($parent['forum_class'])." <b>".FORLAN_141.":</b> ".$e107->e_userclass->uc_get_classname($parent['forum_postclass'])."
|
||||
</td>";
|
||||
|
||||
$text .= "<td class='forumheader' style='text-align:center'>";
|
||||
@@ -336,7 +336,7 @@ class forumAdmin
|
||||
|
||||
$text .= "
|
||||
<br /><span class='smallblacktext'>".$e107->tp->toHTML($forum['forum_description'])." </span>
|
||||
<br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum['forum_class'])." <b>".FORLAN_141.":</b> ".r_userclass_name($forum['forum_postclass'])."
|
||||
<br /><b>".FORLAN_140.":</b> ".$e107->e_userclass->uc_get_classname($forum['forum_class'])." <b>".FORLAN_141.":</b> ".$e107->e_userclass->uc_get_classname($forum['forum_postclass'])."
|
||||
|
||||
</td>
|
||||
|
||||
@@ -394,6 +394,7 @@ class forumAdmin
|
||||
$row = $e107->sql->db_Fetch(MYSQL_ASSOC);
|
||||
}
|
||||
}
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF.'?'.e_QUERY."'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
@@ -407,12 +408,12 @@ class forumAdmin
|
||||
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
|
||||
<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $row['forum_class'], 'off', 'nobody,public,member,admin,classes')."</td>
|
||||
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown('forum_class', $row['forum_class'], 'nobody,public,member,admin,classes')."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
|
||||
<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $row['forum_postclass'], 'off', 'nobody,public,member,admin,classes')."</td>
|
||||
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown("forum_postclass", $row['forum_postclass'], 'nobody,public,member,admin,classes')."</td>
|
||||
</tr>
|
||||
|
||||
<tr style='vertical-align:top'>
|
||||
@@ -486,18 +487,18 @@ class forumAdmin
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
|
||||
<td style='width:60%' class='forumheader3'>";
|
||||
$text .= r_userclass('forum_moderators', $fInfo['forum_moderators'], 'off', 'admin,classes');
|
||||
$text .= $e107->e_userclass->uc_dropdown('forum_moderators', $fInfo['forum_moderators'], 'admin,classes');
|
||||
|
||||
$text .= "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
|
||||
<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $fInfo['forum_class'], 'off', 'nobody,public,member,admin,classes')."</td>
|
||||
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown('forum_moderators', $fInfo['forum_class'], 'nobody,public,member,admin,classes')."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
|
||||
<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $fInfo['forum_postclass'], 'off', 'nobody,public,member,admin,classes')."</td>
|
||||
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown('forum_postclass', $fInfo['forum_postclass'], 'nobody,public,member,admin,classes')."</td>
|
||||
</tr>
|
||||
|
||||
<tr style='vertical-align:top'>
|
||||
@@ -952,7 +953,7 @@ class forumAdmin
|
||||
$txt .= "
|
||||
<tr>
|
||||
<td class='forumheader'>{$f['forum_name']}</td>
|
||||
<td class='forumheader'>".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."</td>
|
||||
<td class='forumheader'>".$e107->e_userclass->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."</td>
|
||||
</tr>
|
||||
";
|
||||
foreach($subList[$f['forum_id']] as $s)
|
||||
@@ -960,7 +961,7 @@ class forumAdmin
|
||||
$txt .= "
|
||||
<tr>
|
||||
<td class='forumheader3'> {$s['forum_name']}</td>
|
||||
<td class='forumheader3'>".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."</td>
|
||||
<td class='forumheader3'>".$e107->e_userclass->uc_dropdown("mods[{$s['forum_id']}]", $s['forum_moderators'], 'admin,classes')."</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-11-26 04:00:36 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-11-26 19:59:06 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -20,6 +20,83 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -36,7 +113,7 @@ class e107forum
|
||||
";
|
||||
if($ret['post_num'] = $sql->db_Select_gen($query))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->db_Fetch(MYSQL_ASSOC);
|
||||
$ret['parent'] = $row['parent'];
|
||||
}
|
||||
return $ret;
|
||||
@@ -71,7 +148,7 @@ class e107forum
|
||||
{
|
||||
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'];
|
||||
}
|
||||
@@ -91,7 +168,7 @@ class e107forum
|
||||
{
|
||||
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']);
|
||||
}
|
||||
@@ -99,7 +176,7 @@ class e107forum
|
||||
}
|
||||
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']);
|
||||
$forum_lp_user = $tmp[0];
|
||||
$last_id = $row['thread_parent'] ? $row['thread_parent'] : $row['thread_id'];
|
||||
@@ -121,7 +198,7 @@ class e107forum
|
||||
$qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} ";
|
||||
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'].".";
|
||||
}
|
||||
@@ -147,7 +224,7 @@ class e107forum
|
||||
global $sql;
|
||||
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;
|
||||
}
|
||||
return $ret;
|
||||
@@ -167,7 +244,7 @@ class e107forum
|
||||
$regex = "(^|,)(".str_replace(",", "|", $uclass).")(,|$)";
|
||||
$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'];
|
||||
}
|
||||
@@ -185,7 +262,7 @@ class e107forum
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
if($type == 'all')
|
||||
{
|
||||
@@ -258,7 +335,7 @@ class e107forum
|
||||
";
|
||||
if($sql->db_Select_gen($_newqry))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
while($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row['thread_forum_id'];
|
||||
if($row['forum_sub'])
|
||||
@@ -333,7 +410,7 @@ class e107forum
|
||||
global $sql;
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
return $sql->db_Fetch();
|
||||
return $sql->db_Fetch(MYSQL_ASSOC);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -350,7 +427,7 @@ class e107forum
|
||||
";
|
||||
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'];
|
||||
}
|
||||
@@ -390,7 +467,7 @@ class e107forum
|
||||
$ret = array();
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row;
|
||||
}
|
||||
@@ -418,7 +495,7 @@ class e107forum
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
return $sql->db_Fetch();
|
||||
return $sql->db_Fetch(MYSQL_ASSOC);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -449,7 +526,7 @@ class e107forum
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$i = 0;
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$threadList[$i++] = $row['thread_id'];
|
||||
}
|
||||
@@ -494,7 +571,7 @@ class e107forum
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$i = 0;
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$threadList[$i++] = $row['thread_id'];
|
||||
}
|
||||
@@ -560,7 +637,7 @@ class e107forum
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$i = $array_start;
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[$i] = $row;
|
||||
$i++;
|
||||
@@ -577,7 +654,7 @@ class e107forum
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->db_Fetch(MYSQL_ASSOC);
|
||||
$ret['head'] = $row;
|
||||
if (!array_key_exists(0, $ret))
|
||||
{
|
||||
@@ -606,7 +683,7 @@ class e107forum
|
||||
";
|
||||
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'];
|
||||
}
|
||||
@@ -636,7 +713,7 @@ class e107forum
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$ret[0] = $sql->db_Fetch();
|
||||
$ret[0] = $sql->db_Fetch(MYSQL_ASSOC);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -662,7 +739,7 @@ class e107forum
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->db_Fetch(MYSQL_ASSOC);
|
||||
$ret['head'] = $row;
|
||||
}
|
||||
}
|
||||
@@ -755,7 +832,7 @@ class e107forum
|
||||
{
|
||||
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;
|
||||
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
|
||||
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))
|
||||
{
|
||||
$ret = array();
|
||||
while($row = $sql->db_Fetch())
|
||||
while($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[$row['uid']] = $row['cnt'];
|
||||
}
|
||||
|
@@ -11,69 +11,81 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
|
||||
| $Revision: 1.16 $
|
||||
| $Date: 2008-01-18 21:07:47 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.17 $
|
||||
| $Date: 2008-11-26 19:59:06 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
require_once("../../class2.php");
|
||||
$e_wysiwyg = "post";
|
||||
require_once('../../class2.php');
|
||||
$e_wysiwyg = 'post';
|
||||
$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');
|
||||
|
||||
if (IsSet($_POST['fjsubmit'])) {
|
||||
header("location:".e_BASE.$PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$_POST['forumjump']);
|
||||
if (isset($_POST['fjsubmit']))
|
||||
{
|
||||
header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id'=>$_POST['forumjump'])));
|
||||
exit;
|
||||
}
|
||||
|
||||
//$_POST['forumjump']
|
||||
require_once(e_PLUGIN.'forum/forum_class.php');
|
||||
$forum = new e107forum;
|
||||
|
||||
if (!e_QUERY) {
|
||||
header("Location:".e_PLUGIN."forum/forum.php");
|
||||
if (!e_QUERY || !isset($_REQUEST['id']))
|
||||
{
|
||||
header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
|
||||
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 ...
|
||||
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);
|
||||
$ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
|
||||
require_once(FOOTERF);
|
||||
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']));
|
||||
//require_once(e_HANDLER.'forum_include.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' ");
|
||||
}
|
||||
|
||||
//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 ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR)
|
||||
{
|
||||
@@ -112,16 +114,17 @@ if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR)
|
||||
exit;
|
||||
}
|
||||
|
||||
$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));
|
||||
$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));
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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 = explode(',', $a_filetypes);
|
||||
foreach ($a_filetypes as $ftype) {
|
||||
foreach ($a_filetypes as $ftype)
|
||||
{
|
||||
$sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
|
||||
}
|
||||
$allowed_filetypes = implode(' | ', $sa_filetypes);
|
||||
|
@@ -48,6 +48,7 @@ CREATE TABLE forum_post (
|
||||
`post_edit_datestamp` int(10) unsigned NOT NULL default '0',
|
||||
`post_edit_user` int(10) unsigned NOT NULL,
|
||||
`post_ip` varchar(45) NOT NULL,
|
||||
`post_anon_name` varchar(30) NULL,
|
||||
`post_attachments` text default NULL,
|
||||
`post_options` text,
|
||||
PRIMARY KEY (`post_id`),
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?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)
|
||||
{
|
||||
switch($parms['func'])
|
||||
@@ -12,5 +12,9 @@ function url_forum_forum($parms)
|
||||
return e_PLUGIN_ABS.'forum/forum.php?track';
|
||||
break;
|
||||
|
||||
case 'main':
|
||||
return e_PLUGIN_ABS.'forum/forum.php';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,17 @@
|
||||
<?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)
|
||||
{
|
||||
switch($parms['func'])
|
||||
{
|
||||
|
||||
case 'track':
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -6,11 +6,11 @@
|
||||
* Released under the terms and conditions of the
|
||||
* 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 $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2008-11-26 03:24:51 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2008-11-26 19:59:06 $
|
||||
* $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');
|
||||
|
||||
if (isset($_POST['fjsubmit'])) {
|
||||
header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']);
|
||||
header("location:".e_SELF.'?'.$_POST['forumjump']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ if (!e_QUERY)
|
||||
else
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$forum_id = intval($tmp[0]);
|
||||
$thread_from = (isset($tmp[1]) ? intval($tmp[1]) : 0);
|
||||
$forum_id = (int)$tmp[0];
|
||||
$thread_from = (isset($tmp[1]) ? (int)$tmp[1] : 0);
|
||||
}
|
||||
$view = 25;
|
||||
|
||||
@@ -124,7 +124,8 @@ if ($pages)
|
||||
|
||||
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) == "*")
|
||||
|
Reference in New Issue
Block a user