1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Latest coding changes

This commit is contained in:
mcfly
2008-12-04 21:36:09 +00:00
parent 62368a9551
commit b3ca240eab
10 changed files with 443 additions and 374 deletions

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
| $Revision: 1.20 $ | $Revision: 1.21 $
| $Date: 2008-12-03 22:29:46 $ | $Date: 2008-12-04 21:36:08 $
| $Author: e107steved $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */

View File

@@ -1,5 +1,5 @@
<?php <?php
// $Id: thread.php,v 1.2 2008-12-02 21:34:18 mcfly_e107 Exp $ // $Id: thread.php,v 1.3 2008-12-04 21:36:09 mcfly_e107 Exp $
function url_forum_thread($parms) function url_forum_thread($parms)
{ {
switch($parms['func']) switch($parms['func'])
@@ -17,6 +17,10 @@ function url_forum_thread($parms)
return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}"; return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}";
break; break;
case 'last':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}&last=1";
break;
case 'post': case 'post':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=post&id={$parms['id']}"; return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=post&id={$parms['id']}";
break; break;

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.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
| $Revision: 1.6 $ | $Revision: 1.7 $
| $Date: 2008-12-01 01:10:50 $ | $Date: 2008-12-04 21:36:09 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -288,6 +288,7 @@ function parse_parent($parent)
function parse_forum($f, $restricted_string = "") function parse_forum($f, $restricted_string = "")
{ {
global $FORUM_MAIN_FORUM, $gen, $forum, $tp, $newflag_list, $sub_list; global $FORUM_MAIN_FORUM, $gen, $forum, $tp, $newflag_list, $sub_list;
$e107 = e107::getInstance();
if(USER && is_array($newflag_list) && in_array($f['forum_id'], $newflag_list)) if(USER && is_array($newflag_list) && in_array($f['forum_id'], $newflag_list))
{ {
@@ -345,7 +346,9 @@ function parse_forum($f, $restricted_string = "")
} }
} }
$lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum'); $lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum');
$LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$lastpost_thread}.last'>".IMAGE_post2.'</a>'; // $e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $lastpost_thread));
$LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';
} }
else else
{ {

View File

@@ -9,8 +9,8 @@
* Forum admin functions * Forum admin functions
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin_class.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2008-11-29 01:24:27 $ * $Date: 2008-12-04 21:36:09 $
* $Author: mcfly_e107 $ * $Author: mcfly_e107 $
* *
*/ */
@@ -290,7 +290,7 @@ class forumAdmin
$text .= " $text .= "
<tr> <tr>
<td colspan='2' class='forumheader'>".$parent['forum_name']." <td colspan='2' class='forumheader'>".$parent['forum_name']."
<br /><b>".FORLAN_140.":</b> ".$e107->e_userclass->uc_get_classname($parent['forum_class'])."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".$e107->e_userclass->uc_get_classname($parent['forum_postclass'])." <br /><b>".FORLAN_140.":</b> ".$e107->user_class->uc_get_classname($parent['forum_class'])."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".$e107->user_class->uc_get_classname($parent['forum_postclass'])."
</td>"; </td>";
$text .= "<td class='forumheader' style='text-align:center'>"; $text .= "<td class='forumheader' style='text-align:center'>";
@@ -336,7 +336,7 @@ class forumAdmin
$text .= " $text .= "
<br /><span class='smallblacktext'>".$e107->tp->toHTML($forum['forum_description'])."&nbsp;</span> <br /><span class='smallblacktext'>".$e107->tp->toHTML($forum['forum_description'])."&nbsp;</span>
<br /><b>".FORLAN_140.":</b> ".$e107->e_userclass->uc_get_classname($forum['forum_class'])."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".$e107->e_userclass->uc_get_classname($forum['forum_postclass'])." <br /><b>".FORLAN_140.":</b> ".$e107->user_class->uc_get_classname($forum['forum_class'])."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".$e107->user_class->uc_get_classname($forum['forum_postclass'])."
</td> </td>
@@ -503,18 +503,18 @@ class forumAdmin
<tr> <tr>
<td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td> <td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
<td style='width:60%' class='forumheader3'>"; <td style='width:60%' class='forumheader3'>";
$text .= $e107->e_userclass->uc_dropdown('forum_moderators', $fInfo['forum_moderators'], 'admin,classes'); $text .= $e107->user_class->uc_dropdown('forum_moderators', $fInfo['forum_moderators'], 'admin,classes');
$text .= "</td> $text .= "</td>
</tr> </tr>
<tr> <tr>
<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td> <td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown('forum_moderators', $fInfo['forum_class'], 'nobody,public,member,admin,classes')."</td> <td style='width:60%' class='forumheader3'>".$e107->user_class->uc_dropdown('forum_class', $fInfo['forum_class'], 'nobody,public,member,admin,classes')."</td>
</tr> </tr>
<tr> <tr>
<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td> <td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
<td style='width:60%' class='forumheader3'>".$e107->e_userclass->uc_dropdown('forum_postclass', $fInfo['forum_postclass'], 'nobody,public,member,admin,classes')."</td> <td style='width:60%' class='forumheader3'>".$e107->user_class->uc_dropdown('forum_postclass', $fInfo['forum_postclass'], 'nobody,public,member,admin,classes')."</td>
</tr> </tr>
<tr style='vertical-align:top'> <tr style='vertical-align:top'>

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.15 $ | $Revision: 1.16 $
| $Date: 2008-12-02 21:34:18 $ | $Date: 2008-12-04 21:36:09 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -140,9 +140,9 @@ class e107forum
else else
{ {
$threadInfo['thread_lastuser'] = 0; $threadInfo['thread_lastuser'] = 0;
$threadInfo['thread_lastuser_anon'] = $postInfo['post_anon_name']; $threadInfo['thread_lastuser_anon'] = $postInfo['post_user_anon'];
$forumInfo['forum_lastpost_user'] = 0; $forumInfo['forum_lastpost_user'] = 0;
$forumInfo['forum_lastpost_user_anon'] = $postInfo['post_anon_name']; $forumInfo['forum_lastpost_user_anon'] = $postInfo['post_user_anon'];
} }
$threadInfo['thread_lastpost'] = $postInfo['post_datestamp']; $threadInfo['thread_lastpost'] = $postInfo['post_datestamp'];
$threadInfo['thread_total_replies'] = 'thread_total_replies + 1'; $threadInfo['thread_total_replies'] = 'thread_total_replies + 1';
@@ -150,6 +150,8 @@ class e107forum
$threadInfo['_FIELD_TYPES'] = $this->fieldTypes['forum_thread']; $threadInfo['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
$threadInfo['_FIELD_TYPES']['thread_total_replies'] = 'cmd'; $threadInfo['_FIELD_TYPES']['thread_total_replies'] = 'cmd';
// print_a($threadInfo);
// exit;
$result = $e107->sql->db_Update('forum_thread', $threadInfo, true); $result = $e107->sql->db_Update('forum_thread', $threadInfo, true);
} }
@@ -164,7 +166,7 @@ class e107forum
else else
{ {
$forumInfo['forum_lastpost_user'] = 0; $forumInfo['forum_lastpost_user'] = 0;
$forumInfo['forum_lastpost_user_anon'] = $postInfo['post_anon_name']; $forumInfo['forum_lastpost_user_anon'] = $postInfo['post_user_anon'];
} }
//If we update the thread, then we assume it was a reply, otherwise we've added a reply only. //If we update the thread, then we assume it was a reply, otherwise we've added a reply only.
@@ -420,19 +422,18 @@ class e107forum
function forum_getmods($uclass = e_UC_ADMIN) function forum_getmods($uclass = e_UC_ADMIN)
{ {
global $sql; $e107 = e107::getInstance();
if($uclass == e_UC_ADMIN || trim($uclass) == '') if($uclass == e_UC_ADMIN || trim($uclass) == '')
{ {
$sql->db_Select('user', 'user_id, user_name','user_admin = 1'); $e107->sql->db_Select('user', 'user_id, user_name','user_admin = 1 ORDER BY user_name ASC');
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
{
$ret[$row['user_id']] = $row['user_name'];
}
} }
else else
{ {
$regex = "(^|,)(".str_replace(",", "|", $uclass).")(,|$)"; $ret = $e107->user_class->get_users_in_class($uclass, 'user_name', true);
$sql->db_Select("user", "user_id, user_name", "user_class REGEXP '{$regex}'");
}
while($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$ret[$row['user_id']] = $row['user_name'];
} }
return $ret; return $ret;
} }
@@ -553,6 +554,10 @@ class e107forum
function track($which, $uid, $threadId) function track($which, $uid, $threadId)
{ {
$e107 = e107::getInstance(); $e107 = e107::getInstance();
global $pref;
if (!varsettrue($pref['forum_track'])) { return false; }
$threadId = (int)$threadId; $threadId = (int)$threadId;
$uid = (int)$uid; $uid = (int)$uid;
$result = false; $result = false;
@@ -695,49 +700,41 @@ class e107forum
// return $e107->sql->db_Count('forum_thread', '(*)', 'WHERE thread_forum_id='.(int)$forum_id); // return $e107->sql->db_Count('forum_thread', '(*)', 'WHERE thread_forum_id='.(int)$forum_id);
// } // }
function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100) function threadGetNextPrev($which, $threadId, $forumId, $lastpost)
{ {
global $sql; // echo "threadid = $threadId <br />forum id = $forumId <br />";
$forum_id = intval($forum_id); // return;
global $sql; $e107 = e107::getInstance();
$ftab = MPREFIX.'forum_t'; $threadId = (int)$threadId;
while (!$found) $forumId = (int)$forumId;
$lastpost = (int)$lastpost;
if($which == 'next')
{ {
$qry = " $dir = '<';
SELECT t.thread_id from #forum_t AS t $sort = 'ASC';
WHERE t.thread_forum_id = $forum_id }
AND t.thread_parent = 0 else
ORDER BY
t.thread_s DESC,
t.thread_lastpost DESC,
t.thread_datestamp DESC
LIMIT ".intval($from).",".intval($limit);
if ($sql->db_Select_gen($qry))
{ {
$i = 0; $dir = '>';
while ($row = $sql->db_Fetch(MYSQL_ASSOC)) $sort = 'DESC';
{
$threadList[$i++] = $row['thread_id'];
} }
if (($id = array_search($thread_id, $threadList)) !== FALSE) $qry = "
SELECT thread_id from `#forum_thread`
WHERE thread_forum_id = $forumId
AND thread_lastpost {$dir} $lastpost
ORDER BY
thread_s DESC,
thread_lastpost {$sort}
LIMIT 1";
if ($e107->sql->db_Select_gen($qry))
{ {
if ($id != 99) $row = $e107->sql->db_Fetch();
{ return $row['thread_id'];
return $threadList[$id+1];
}
else
{
return $this->thread_getnext($thread_id, $forum_id, $from+99, 2);
}
}
}
else
{
return FALSE;
}
$from += 100;
} }
return false;
} }
function thread_getprev($thread_id, $forum_id, $from = 0, $limit = 100) function thread_getprev($thread_id, $forum_id, $from = 0, $limit = 100)

View File

@@ -60,7 +60,7 @@ SC_END
SC_BEGIN ANON_IP SC_BEGIN ANON_IP
global $postInfo; global $postInfo;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
if(ADMIN || MODERATOR) if($postInfo['post_user_anon'] && (ADMIN || MODERATOR))
{ {
return $e107->ipDecode($postInfo['post_ip']); return $e107->ipDecode($postInfo['post_ip']);
} }
@@ -84,7 +84,7 @@ if($postInfo['user_name'])
} }
else else
{ {
return '<b>'.$e107->tp->toHTML($postInfo['post_anon_name']).'</b>'; return '<b>'.$e107->tp->toHTML($postInfo['post_user_anon']).'</b>';
} }
SC_END SC_END

View File

@@ -9,6 +9,7 @@ CREATE TABLE forum (
`forum_threads` int(10) unsigned NOT NULL default '0', `forum_threads` int(10) unsigned NOT NULL default '0',
`forum_replies` int(10) unsigned NOT NULL default '0', `forum_replies` int(10) unsigned NOT NULL default '0',
`forum_lastpost_user` int(10) unsigned default NULL, `forum_lastpost_user` int(10) unsigned default NULL,
`forum_lastpost_user_anon` varchar(30) default NULL,
`forum_lastpost_info` varchar(40) default NULL, `forum_lastpost_info` varchar(40) default NULL,
`forum_class` tinyint(3) unsigned NOT NULL default '0', `forum_class` tinyint(3) unsigned NOT NULL default '0',
`forum_order` int(10) unsigned NOT NULL default '0', `forum_order` int(10) unsigned NOT NULL default '0',
@@ -51,7 +52,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_user_anon` 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,4 +1,5 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system | e107 website system
@@ -11,8 +12,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_viewtopic.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2008-12-02 21:34:18 $ | $Date: 2008-12-04 21:36:09 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -38,28 +39,15 @@ include_lan(e_PLUGIN.'forum/languages/English/lan_forum_viewtopic.php');
include_once (e_PLUGIN . 'forum/forum_class.php'); include_once (e_PLUGIN . 'forum/forum_class.php');
$forum = new e107forum; $forum = new e107forum;
$thread = new e107ForumThread;
if(isset($_REQUEST['f']))
$thread->init();
if(isset($_GET['f']))
{ {
processFunction(); $thread->processFunction();
} $thread->init();
$threadId = (int)varset($_GET['id']);
$perPage = (varset($_REQUEST['perpage']) ? (int)$_REQUEST['perpage'] : $pref['forum_postspage']);
$page = (varset($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0);
//If threadId doesn't exist, or not given, redirect to main forum page
if (!$threadId || !$threadInfo = $forum->threadGet($threadId))
{
header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit;
}
//If not permitted to view forum, redirect to main forum page
if(!$forum->checkPerm($threadInfo['thread_forum_id'], 'view'))
{
header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit;
} }
require_once (e_PLUGIN . 'forum/forum_shortcodes.php'); require_once (e_PLUGIN . 'forum/forum_shortcodes.php');
@@ -68,7 +56,7 @@ $pm_installed = plugInstalled('pm');
//Only increment thread views if not being viewed by thread starter //Only increment thread views if not being viewed by thread starter
if(!USER || USER != $threadInfo['thread_user']) if (USER || USER != $threadInfo['thread_user'] || !$thread->noInc)
{ {
$forum->threadIncview($threadId); $forum->threadIncview($threadId);
} }
@@ -89,48 +77,50 @@ if(!USER || USER != $threadInfo['thread_user'])
// exit; // exit;
//} //}
define('e_PAGETITLE', LAN_01.' / '.$e107->tp->toHTML($threadInfo['forum_name'], true, 'no_hook, emotes_off')." / ".$tp->toHTML($threadInfo['thread_name'], true, 'no_hook, emotes_off')); define('e_PAGETITLE', LAN_01 . ' / ' . $e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off') . " / " . $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'));
//define("MODERATOR", (preg_match("/".preg_quote(ADMINNAME)."/", $forum_info['forum_moderators']) && getperms('A') ? TRUE : FALSE)); $modArray = $forum->forum_getmods($thread->threadInfo['forum_moderators']);
define('MODERATOR', ($forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']))); define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray))));
$modArray = $forum->forum_getmods($threadInfo['forum_moderators']);
//var_dump($modArray);
$message = '';
if (MODERATOR && isset($_POST['mod'])) if (MODERATOR && isset($_POST['mod']))
{ {
require_once (e_PLUGIN . 'forum/forum_mod.php'); require_once (e_PLUGIN . 'forum/forum_mod.php');
$message = forum_thread_moderate($_POST); $thread->message = forum_thread_moderate($_POST);
$threadInfo = $forum->threadGet($threadId); $thread->threadInfo = $forum->threadGet($thread->threadId);
} }
$postList = $forum->PostGet($threadId, $page * $perPage, $perPage); $postList = $forum->PostGet($thread->threadId, $thread->threadpage * $thread->perPage, $thread->perPage);
var_dump($threadInfo); //var_dump($thread->threadInfo);
require_once (HEADERF); require_once (HEADERF);
require_once (e_HANDLER . 'level_handler.php'); require_once (e_HANDLER . 'level_handler.php');
$gen = new convert; $gen = new convert;
if ($message) if ($thread->message)
{ {
$ns->tablerender('', $message, array('forum_viewtopic', 'msg')); $ns->tablerender('', $thread->message, array('forum_viewtopic', 'msg'));
} }
if(isset($threadInfo['thread_options']['poll'])) if (isset($thread->threadInfo['thread_options']['poll']))
{ {
if(!defined('POLLCLASS')) { include(e_PLUGIN.'poll/poll_class.php'); } if (!defined('POLLCLASS'))
$_qry = 'SELECT * FROM `#polls` WHERE `poll_datestamp` = '.$threadId; {
include (e_PLUGIN . 'poll/poll_class.php');
}
$_qry = 'SELECT * FROM `#polls` WHERE `poll_datestamp` = ' . $thread->threadId;
$poll = new poll; $poll = new poll;
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>'; $pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
} }
//Load forum templates //Load forum templates
if (file_exists(THEME.'forum_design.php')) { include_once(THEME.'forum_design.php'); } if (file_exists(THEME . 'forum_design.php'))
{
include_once (THEME . 'forum_design.php');
}
if (!$FORUMSTART) if (!$FORUMSTART)
{ {
if (file_exists(THEME . 'forum_viewtopic_template.php')) if (file_exists(THEME . 'forum_viewtopic_template.php'))
{ {
require_once (THEME . 'forum_viewtopic_template.php'); require_once (THEME . 'forum_viewtopic_template.php');
} } elseif (file_exists(THEME . 'forum_template.php'))
elseif (file_exists(THEME.'forum_template.php'))
{ {
require_once (THEME . 'forum_template.php'); require_once (THEME . 'forum_template.php');
} }
@@ -144,45 +134,44 @@ if (!$FORUMSTART)
// get info for main thread ------------------------------------------------------------------------------------------------------------------------------------------------------------------- // get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
//$e107->url->getUrl('forum', 'thread', array('func' => 'next', 'id' => $threadId))
$forum->set_crumb(true); // Set $BREADCRUMB (and BACKLINK) $forum->set_crumb(true); // Set $BREADCRUMB (and BACKLINK)
$THREADNAME = $e107->tp->toHTML($threadInfo['thread_name'], true, 'no_hook, emotes_off'); $THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
$NEXTPREV = "&lt;&lt; <a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'prev', 'id' => $threadId))."'>".LAN_389."</a>"; $NEXTPREV = "&lt;&lt; <a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'prev', 'id' => $thread->threadId)) . "'>" . LAN_389 . "</a>";
$NEXTPREV .= ' | '; $NEXTPREV .= ' | ';
$NEXTPREV .= "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'next', 'id' => $threadId))."'>".LAN_390."</a> &gt;&gt;"; $NEXTPREV .= "<a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'next', 'id' => $thread->threadId)) . "'>" . LAN_390 . "</a> &gt;&gt;";
if ($pref['forum_track'] && USER) if ($pref['forum_track'] && USER)
{ {
if($threadInfo['track_userid']) if ($thread->threadInfo['track_userid'])
{ {
$TRACK = "<span class='smalltext'><a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'untrack', 'id' => $threadId))."'>".LAN_392."</a></span>"; $TRACK = "<span class='smalltext'><a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'untrack', 'id' => $thread->threadId)) . "'>" . LAN_392 . "</a></span>";
} }
else else
{ {
$TRACK = "<span class='smalltext'><a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'track', 'id' => $threadId))."'>".LAN_391."</a></span>"; $TRACK = "<span class='smalltext'><a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'track', 'id' => $thread->threadId)) . "'>" . LAN_391 . "</a></span>";
} }
} }
$MODERATORS = LAN_321 . implode(', ', $modArray); $MODERATORS = LAN_321 . implode(', ', $modArray);
$THREADSTATUS = (!$threadInfo['thread_active'] ? LAN_66 : ''); $THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : '');
$pages = ceil(($threadInfo['thread_total_replies']+1) / $perPage); //$pages = ceil(($threadInfo['thread_total_replies'] + 1) / $perPage);
if ($pages > 1) if ($thread->pages > 1)
{ {
$parms = ($threadInfo['thread_total_replies']+1).",{$perPage},{$topic_from},".e_SELF.'?'.$thread_id.'.[FROM],off'; $parms = ($thread->threadInfo['thread_total_replies'] + 1) . ",{$perPage},{$topic_from}," . e_SELF . '?' . $this->threadId . '.[FROM],off';
$GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); $GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
} }
$BUTTONS = ''; $BUTTONS = '';
if($forum->checkPerm($threadInfo['thread_forum_id'], 'post') && $threadInfo['thread_active']) if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{ {
$BUTTONS .= "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'rp', 'id' => $threadId))."'>".IMAGE_reply."</a>"; $BUTTONS .= "<a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'rp', 'id' => $thread->threadId)) . "'>" . IMAGE_reply . "</a>";
} }
if($forum->checkPerm($threadInfo['thread_forum_id'], 'thread')) if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
{ {
$BUTTONS .= "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'nt', 'id' => $threadInfo['thread_forum_id']))."'>".IMAGE_newthread."</a>"; $BUTTONS .= "<a href='" . $e107->url->getUrl('forum', 'thread', array('func' => 'nt', 'id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . "</a>";
} }
$POLL = $pollstr; $POLL = $pollstr;
@@ -195,11 +184,10 @@ unset($forrep);
if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE; if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE;
$alt = false; $alt = false;
$i=$page; $i = $thread->page;
global $postInfo; global $postInfo;
foreach ($postList as $postInfo) foreach ($postList as $postInfo)
{ {
// print_a($postInfo);
$loop_uid = (int)$postInfo['post_user']; $loop_uid = (int)$postInfo['post_user'];
$i++; $i++;
@@ -213,25 +201,34 @@ foreach($postList as $postInfo)
$alt = !$alt; $alt = !$alt;
if (isset($FORUMREPLYSTYLE_ALT) && $alt) if (isset($FORUMREPLYSTYLE_ALT) && $alt)
{ {
$forrep .= $tp->parseTemplate($FORUMREPLYSTYLE_ALT, true, $forum_shortcodes)."\n"; $forrep .= $e107->tp->parseTemplate($FORUMREPLYSTYLE_ALT, true, $forum_shortcodes) . "\n";
} }
else else
{ {
$forrep .= $tp->parseTemplate($FORUMREPLYSTYLE, true, $forum_shortcodes)."\n"; $forrep .= $e107->tp->parseTemplate($FORUMREPLYSTYLE, true, $forum_shortcodes) . "\n";
} }
} }
else else
{ {
$forthr = $tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes)."\n"; $forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes) . "\n";
} }
} }
unset($loop_uid); unset($loop_uid);
if($forum->checkPerm($threadInfo['thread_forum_id'], 'post') && $threadInfo['thread_active']) if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{ {
if (!$forum_quickreply) if (!$forum_quickreply)
{ {
$QUICKREPLY = "<form action='".$e107->url->getUrl('forum', 'thread', array('func' => 'rp', 'id' => $threadId))."' method='post'>\n<p>\n".LAN_393.":<br /><textarea cols='60' rows='4' class='tbox' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea><br /><input type='submit' name='fpreview' value='".LAN_394."' class='button' /> &nbsp;\n<input type='submit' name='reply' value='".LAN_395."' class='button' />\n<input type='hidden' name='thread_id' value='$thread_parent' />\n</p>\n</form>"; $QUICKREPLY = "
<form action='" . $e107->url->getUrl('forum', 'thread', array('func' => 'rp', 'id' => $thread->threadId)) . "' method='post'>
<p>" . LAN_393 . ":<br />
<textarea cols='60' rows='4' class='tbox' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
<br />
<input type='submit' name='fpreview' value='" . LAN_394 . "' class='button' /> &nbsp;
<input type='submit' name='reply' value='" . LAN_395 . "' class='button' />
<input type='hidden' name='thread_id' value='$thread_parent' />
</p>
</form>";
} }
else else
{ {
@@ -242,11 +239,10 @@ if($forum->checkPerm($threadInfo['thread_forum_id'], 'post') && $threadInfo['thr
$forend = preg_replace("/\{(.*?)\}/e", '$\1', $FORUMEND); $forend = preg_replace("/\{(.*?)\}/e", '$\1', $FORUMEND);
$forumstring = $forstr . $forthr . $forrep . $forend; $forumstring = $forstr . $forthr . $forrep . $forend;
//If last post came after USERLV and not yet marked as read, mark the thread id as read //If last post came after USERLV and not yet marked as read, mark the thread id as read
if ($threadInfo['thread_lastpost'] > USERLV && (strpos($currentUser['user_plugin_forum_viewed'], '.'.$threadId.'.') === false)) if ($thread->threadInfo['thread_lastpost'] > USERLV && (strpos($currentUser['user_plugin_forum_viewed'], '.' . $thread->threadId . '.') === false))
{ {
$tst = $forum->threadMarkAsRead($threadId); $tst = $forum->threadMarkAsRead($thread->threadId);
} }
if ($pref['forum_enclose']) if ($pref['forum_enclose'])
@@ -279,7 +275,7 @@ function showmodoptions()
global $forum_info; global $forum_info;
global $post_info; global $post_info;
$forum_id = $forum_info['forum_id']; $forum_id = $forum_info['forum_id'];
if ($post_info['thread_parent'] == FALSE) if ($post_info['thread_parent'] == false)
{ {
$type = 'thread'; $type = 'thread';
$ret = "<form method='post' action='" . e_PLUGIN . "forum/forum_viewforum.php?{$forum_id}' id='frmMod_{$forum_id}_{$post_info['thread_id']}'>"; $ret = "<form method='post' action='" . e_PLUGIN . "forum/forum_viewforum.php?{$forum_id}' id='frmMod_{$forum_id}_{$post_info['thread_id']}'>";
@@ -322,7 +318,7 @@ function forumjump()
function rpg($user_join, $user_forums) function rpg($user_join, $user_forums)
{ {
global $FORUMTHREADSTYLE; global $FORUMTHREADSTYLE;
if (strpos($FORUMTHREADSTYLE, '{RPG}') == FALSE) if (strpos($FORUMTHREADSTYLE, '{RPG}') == false)
{ {
return ''; return '';
} }
@@ -334,26 +330,38 @@ function rpg($user_join, $user_forums)
$lvl_bonus_redux = 5; $lvl_bonus_redux = 5;
$lvl_user_days = max(1, round((time() - $user_join) / 86400)); $lvl_user_days = max(1, round((time() - $user_join) / 86400));
$lvl_ppd = $user_forums / $lvl_user_days; $lvl_ppd = $user_forums / $lvl_user_days;
if ($user_forums < 1) { if ($user_forums < 1)
{
$lvl_level = 0; $lvl_level = 0;
} else { }
else
{
$lvl_level = floor(pow(log10($user_forums), 3)) + 1; $lvl_level = floor(pow(log10($user_forums), 3)) + 1;
} }
if ($lvl_level < 1) { if ($lvl_level < 1)
{
$lvl_hp = "0 / 0"; $lvl_hp = "0 / 0";
$lvl_hp_percent = 0; $lvl_hp_percent = 0;
} else { }
else
{
$lvl_max_hp = floor((pow($lvl_level, (1 / 4))) * (pow(10, pow($lvl_level + 2, (1 / 3)))) / (1.5)); $lvl_max_hp = floor((pow($lvl_level, (1 / 4))) * (pow(10, pow($lvl_level + 2, (1 / 3)))) / (1.5));
if ($lvl_ppd >= $lvl_avg_ppd) { if ($lvl_ppd >= $lvl_avg_ppd)
{
$lvl_hp_percent = floor((.5 + (($lvl_ppd - $lvl_avg_ppd) / ($lvl_bonus_redux * 2))) * 100); $lvl_hp_percent = floor((.5 + (($lvl_ppd - $lvl_avg_ppd) / ($lvl_bonus_redux * 2))) * 100);
} else { }
else
{
$lvl_hp_percent = floor($lvl_ppd / ($lvl_avg_ppd / 50)); $lvl_hp_percent = floor($lvl_ppd / ($lvl_avg_ppd / 50));
} }
if ($lvl_hp_percent > 100) { if ($lvl_hp_percent > 100)
{
$lvl_max_hp += floor(($lvl_hp_percent - 100) * pi()); $lvl_max_hp += floor(($lvl_hp_percent - 100) * pi());
$lvl_hp_percent = 100; $lvl_hp_percent = 100;
} else { }
else
{
$lvl_hp_percent = max(0, $lvl_hp_percent); $lvl_hp_percent = max(0, $lvl_hp_percent);
} }
$lvl_cur_hp = floor($lvl_max_hp * ($lvl_hp_percent / 100)); $lvl_cur_hp = floor($lvl_max_hp * ($lvl_hp_percent / 100));
@@ -361,10 +369,13 @@ function rpg($user_join, $user_forums)
$lvl_cur_hp = min($lvl_max_hp, $lvl_cur_hp); $lvl_cur_hp = min($lvl_max_hp, $lvl_cur_hp);
$lvl_hp = $lvl_cur_hp . '/' . $lvl_max_hp; $lvl_hp = $lvl_cur_hp . '/' . $lvl_max_hp;
} }
if ($lvl_level < 1) { if ($lvl_level < 1)
{
$lvl_mp = '0 / 0'; $lvl_mp = '0 / 0';
$lvl_mp_percent = 0; $lvl_mp_percent = 0;
} else { }
else
{
$lvl_max_mp = floor((pow($lvl_level, (1 / 4))) * (pow(10, pow($lvl_level + 2, (1 / 3)))) / (pi())); $lvl_max_mp = floor((pow($lvl_level, (1 / 4))) * (pow(10, pow($lvl_level + 2, (1 / 3)))) / (pi()));
$lvl_mp_cost = $user_forums * $lvl_post_mp_cost; $lvl_mp_cost = $user_forums * $lvl_post_mp_cost;
$lvl_mp_regen = max(1, $lvl_user_days * $lvl_mp_regen_per_day); $lvl_mp_regen = max(1, $lvl_user_days * $lvl_mp_regen_per_day);
@@ -374,14 +385,20 @@ function rpg($user_join, $user_forums)
$lvl_mp = $lvl_cur_mp . '/' . $lvl_max_mp; $lvl_mp = $lvl_cur_mp . '/' . $lvl_max_mp;
$lvl_mp_percent = floor($lvl_cur_mp / $lvl_max_mp * 100); $lvl_mp_percent = floor($lvl_cur_mp / $lvl_max_mp * 100);
} }
if ($lvl_level < 1) { if ($lvl_level < 1)
{
$lvl_exp = "0 / 0"; $lvl_exp = "0 / 0";
$lvl_exp_percent = 100; $lvl_exp_percent = 100;
} else { }
else
{
$lvl_posts_for_next = floor(pow(10, pow($lvl_level, (1 / 3)))); $lvl_posts_for_next = floor(pow(10, pow($lvl_level, (1 / 3))));
if ($lvl_level == 1) { if ($lvl_level == 1)
{
$lvl_posts_for_this = max(1, floor(pow(10, (($lvl_level - 1))))); $lvl_posts_for_this = max(1, floor(pow(10, (($lvl_level - 1)))));
} else { }
else
{
$lvl_posts_for_this = max(1, floor(pow(10, pow(($lvl_level - 1), (1 / 3))))); $lvl_posts_for_this = max(1, floor(pow(10, pow(($lvl_level - 1), (1 / 3)))));
} }
$lvl_exp = ($user_forums - $lvl_posts_for_this) . "/" . ($lvl_posts_for_next - $lvl_posts_for_this); $lvl_exp = ($user_forums - $lvl_posts_for_this) . "/" . ($lvl_posts_for_next - $lvl_posts_for_this);
@@ -403,10 +420,48 @@ function rpg($user_join, $user_forums)
return $rpg_info; return $rpg_info;
} }
class e107ForumThread
{
var $message, $threadId, $threadInfo, $forumId, $perPage, $noInc;
function init()
{
global $pref, $forum;
$e107 = e107::getInstance();
$this->threadId = (int)varset($_GET['id']);
$this->perPage = (varset($_GET['perpage']) ? (int)$_GET['perpage'] : $pref['forum_postspage']);
$this->page = (varset($_GET['p']) ? (int)$_GET['p'] : 0);
//If threadId doesn't exist, or not given, redirect to main forum page
if (!$this->threadId || !$this->threadInfo = $forum->threadGet($this->threadId))
{
header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit;
}
//If not permitted to view forum, redirect to main forum page
if (!$forum->checkPerm($this->threadInfo['thread_forum_id'], 'view'))
{
header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit;
}
$this->noInc = false;
}
function processFunction() function processFunction()
{ {
if($topic_from === 'post') global $forum;
$e107 = e107::getInstance();
if (!isset($_GET['f']))
{ {
return;
}
$function = trim($_GET['f']);
switch ($function)
{
case 'post':
if ($thread_id) if ($thread_id)
{ {
$post_num = $forum->thread_postnum($thread_id); $post_num = $forum->thread_postnum($thread_id);
@@ -423,59 +478,63 @@ if($topic_from === 'post')
header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main'))); header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
} break;
if ($action == 'track' && USER) case 'track':
if (!USER || !isset($_GET['id']))
{ {
$forum->track($thread_id); return;
header("location:".e_SELF."?{$thread_id}.{$topic_from}");
exit;
} }
$forum->track('add', USERID, $_GET['id']);
break;
if ($action == 'untrack' && USER) // header("location:".e_SELF."?{$thread_id}.{$topic_from}");
// exit;
case 'untrack':
if (!USER || !isset($_GET['id']))
{ {
$forum->untrack($thread_id); return;
header("location:".e_SELF."?{$thread_id}.{$topic_from}");
exit;
} }
$forum->track('del', USERID, $_GET['id']);
break;
if ($action == 'next') case 'last':
{ // $pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
$next = $forum->thread_getnext($thread_id, $topic_from); $pages = ceil(($this->threadInfo['thread_total_replies'] + 1) / $this->perPage);
$this->page = ($pages - 1) * $this->perPage;
break;
case 'next':
$next = $forum->threadGetNextPrev('next', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']);
if ($next) if ($next)
{ {
header("location:".e_SELF."?{$next}"); $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $next));
header("location: {$url}");
exit; exit;
} }
else else
{ {
require_once(HEADERF); $this->message = LAN_405;
$ns->tablerender('', LAN_405, array('forum_viewtopic', '405'));
require_once(FOOTERF);
exit;
}
} }
break;
if ($action == 'prev') case 'prev':
{ $prev = $forum->threadGetNextPrev('prev', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']);
$prev = $forum->thread_getprev($thread_id, $topic_from);
if ($prev) if ($prev)
{ {
header("location:".e_SELF."?{$prev}"); $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $prev));
header("location: {$url}");
exit; exit;
} }
else else
{ {
require_once(HEADERF); $this->message = LAN_404;
$ns->tablerender('', LAN_404, array('forum_viewtopic', '404'));
require_once(FOOTERF);
exit;
}
} }
break;
if ($action == 'report') case 'report':
{ $thread_info = $forum->thread_get_postinfo($thread_id, true);
$thread_info = $forum->thread_get_postinfo($thread_id, TRUE);
if (isset($_POST['report_thread'])) if (isset($_POST['report_thread']))
{ {
@@ -495,7 +554,7 @@ if ($action == 'report')
} }
else else
{ {
$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off'); $thread_name = $tp->toHTML($thread_info['head']['thread_name'], true, 'no_hook, emotes_off');
define("e_PAGETITLE", LAN_01 . " / " . LAN_426 . " " . $thread_name); define("e_PAGETITLE", LAN_01 . " / " . LAN_426 . " " . $thread_name);
require_once (HEADERF); require_once (HEADERF);
$text = "<form action='" . e_PLUGIN . "forum/forum_viewtopic.php?" . e_QUERY . "' method='post'> <table style='width:100%'> $text = "<form action='" . e_PLUGIN . "forum/forum_viewtopic.php?" . e_QUERY . "' method='post'> <table style='width:100%'>
@@ -524,17 +583,10 @@ if ($action == 'report')
} }
require_once (FOOTERF); require_once (FOOTERF);
exit; exit;
break;
} }
if ($topic_from === 'last')
{
$pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
$pages = ceil(($threadInfo['thread_total_replies']+1)/$pref['forum_postspage']);
$topic_from = ($pages-1) * $pref['forum_postspage'];
} }
} }
?> ?>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.13 2008-12-04 12:49:30 mcfly_e107 Exp $ --> <!-- $Id: plugin.xml,v 1.14 2008-12-04 21:36:09 mcfly_e107 Exp $ -->
<e107Plugin name="Forum" version="2.0" compatibility="0.8" installRequired="true"> <e107Plugin name="Forum" version="2.0" compatibility="0.8" installRequired="true">
<author name="e107dev" url="http://e107.org"/> <author name="e107dev" url="http://e107.org"/>
<description>This plugin is a fully featured Forum system</description> <description>This plugin is a fully featured Forum system</description>
@@ -17,7 +17,7 @@
<pref name="forum_postfix" value="[more...]" /> <pref name="forum_postfix" value="[more...]" />
<pref name="forum_poll" value="0" /> <pref name="forum_poll" value="0" />
<pref name="forum_popular" value="10" /> <pref name="forum_popular" value="10" />
<pref name="forum_track" value="0" /> <pref name="forum_track" value="1" />
<pref name="forum_eprefix" value="[forum]" /> <pref name="forum_eprefix" value="[forum]" />
<pref name="forum_enclose" value="1" /> <pref name="forum_enclose" value="1" />
<pref name="forum_title" value="Forums" /> <pref name="forum_title" value="Forums" />

View File

@@ -9,8 +9,8 @@
* View specific 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.5 $ * $Revision: 1.6 $
* $Date: 2008-12-02 21:34:18 $ * $Date: 2008-12-04 21:36:09 $
* $Author: mcfly_e107 $ * $Author: mcfly_e107 $
* *
*/ */
@@ -68,7 +68,8 @@ if (!$forum->checkPerm($forumId, 'view'))
$forumInfo = $forum->forum_get($forumId); $forumInfo = $forum->forum_get($forumId);
if (!$FORUM_VIEW_START) { if (!$FORUM_VIEW_START)
{
if (file_exists(THEME.'forum_viewforum_template.php')) if (file_exists(THEME.'forum_viewforum_template.php'))
{ {
require_once(THEME.'forum_viewforum_template.php'); require_once(THEME.'forum_viewforum_template.php');
@@ -158,7 +159,7 @@ if(substr($forum_info['sub_parent'], 0, 1) == '*')
$forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK) $forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK)
$FORUMTITLE = $forum_info['forum_name']; $FORUMTITLE = $forumInfo['forum_name'];
//$MODERATORS = LAN_404.": ".$forum_info['forum_moderators']; //$MODERATORS = LAN_404.": ".$forum_info['forum_moderators'];
$MODERATORS = LAN_404.': '.implode(', ', $modArray); $MODERATORS = LAN_404.': '.implode(', ', $modArray);
$BROWSERS = ''; $BROWSERS = '';
@@ -324,26 +325,27 @@ function parse_thread($thread_info)
$REPLIES = $thread_info['thread_total_replies']; $REPLIES = $thread_info['thread_total_replies'];
print_a($thread_info);
if ($REPLIES) if ($REPLIES)
{ {
$lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum'); $lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
$tmp = explode(".", $thread_info['thread_lastuser'], 2); // $tmp = explode(".", $thread_info['thread_lastuser'], 2);
if($thread_info['lastpost_username']) if($thread_info['lastpost_username'])
{ {
$LASTPOST = "<a href='".e_BASE."user.php?id.".$tmp[0]."'>".$thread_info['lastpost_username']."</a>"; $LASTPOST = "<a href='".e_BASE."user.php?id.".$tmp[0]."'>".$thread_info['lastpost_username']."</a>";
} }
else else
{ {
if($tmp[1]) if(!$thread_info['thread_lastuser'])
{ {
$LASTPOST = $tp->toHTML($tmp[1]); $LASTPOST = $tp->toHTML($thread_info['thread_lastuser_anon']);
} }
else else
{ {
$LASTPOST = FORLAN_19; $LASTPOST = FORLAN_19;
} }
} }
$LASTPOST .= "<br />".$lastpost_datestamp; $LASTPOST .= '<br />'.$lastpost_datestamp;
} }
$newflag = FALSE; $newflag = FALSE;
@@ -379,19 +381,24 @@ function parse_thread($thread_info)
} }
$thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off')); $thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE)))) { if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE))))
{
$thread_name = substr($thread_name, strlen($THREADTYPE)); $thread_name = substr($thread_name, strlen($THREADTYPE));
} }
if ($pref['forum_tooltip']) { if ($pref['forum_tooltip'])
{
$thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook')); $thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook'));
$tip_length = ($pref['forum_tiplength'] ? $pref['forum_tiplength'] : 400); $tip_length = ($pref['forum_tiplength'] ? $pref['forum_tiplength'] : 400);
if (strlen($thread_thread) > $tip_length) { if (strlen($thread_thread) > $tip_length)
{
$thread_thread = substr($thread_thread, 0, $tip_length)." ".$menu_pref['newforumposts_postfix']; $thread_thread = substr($thread_thread, 0, $tip_length)." ".$menu_pref['newforumposts_postfix'];
} }
$thread_thread = str_replace("'", "&#39;", $thread_thread); $thread_thread = str_replace("'", "&#39;", $thread_thread);
$title = "title='".$thread_thread."'"; $title = "title='".$thread_thread."'";
} else { }
$title = ""; else
{
$title = '';
} }
$THREADNAME = "<a {$title} href='".e_PLUGIN."forum/forum_viewtopic.php?id={$thread_info['thread_id']}'>{$thread_name}</a>"; $THREADNAME = "<a {$title} href='".e_PLUGIN."forum/forum_viewtopic.php?id={$thread_info['thread_id']}'>{$thread_name}</a>";
@@ -489,6 +496,7 @@ function parse_thread($thread_info)
function parse_sub($subInfo) function parse_sub($subInfo)
{ {
global $FORUM_VIEW_SUB, $gen, $tp, $newflag_list; global $FORUM_VIEW_SUB, $gen, $tp, $newflag_list;
$e107 = e107::getInstance();
$SUB_FORUMTITLE = "<a href='".e_PLUGIN."forum/forum_viewforum.php?{$subInfo['forum_id']}'>{$subInfo['forum_name']}</a>"; $SUB_FORUMTITLE = "<a href='".e_PLUGIN."forum/forum_viewforum.php?{$subInfo['forum_id']}'>{$subInfo['forum_name']}</a>";
$SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook'); $SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
$SUB_THREADS = $subInfo['forum_threads']; $SUB_THREADS = $subInfo['forum_threads'];
@@ -504,10 +512,14 @@ function parse_sub($subInfo)
if($subInfo['forum_lastpost_info']) if($subInfo['forum_lastpost_info'])
{ {
$tmp = explode(".", $subInfo['forum_lastpost_info']); $tmp = explode('.', $subInfo['forum_lastpost_info']);
$lp_thread = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?{$tmp[1]}.last'>".IMAGE_post2."</a>";
// $e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $tmp[1]));
$lp_thread = "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
$lp_date = $gen->convert_date($tmp[0], 'forum'); $lp_date = $gen->convert_date($tmp[0], 'forum');
$tmp = explode(".", $subInfo['forum_lastpost_user'],2); $tmp = explode(".", $subInfo['forum_lastpost_user'],2);
if($subInfo['user_name']) if($subInfo['user_name'])
{ {
$lp_name = "<a href='".e_BASE."user.php?id.{$tmp[0]}'>{$subInfo['user_name']}</a>"; $lp_name = "<a href='".e_BASE."user.php?id.{$tmp[0]}'>{$subInfo['user_name']}</a>";