1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +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 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -156,13 +156,13 @@ if ($action == 'uninstall')
else else
{ {
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
$func = $eplug_folder.'_uninstall'; $func = $eplug_folder.'_uninstall';
if (function_exists($func)) if (function_exists($func))
{ {
$text .= call_user_func($func); $text .= call_user_func($func);
} }
if($_POST['delete_tables']) if($_POST['delete_tables'])
{ {
if (is_array($eplug_table_names)) if (is_array($eplug_table_names))
@@ -182,19 +182,19 @@ if ($action == 'uninstall')
{ {
$text .= EPL_ADLAN_49."<br />"; $text .= EPL_ADLAN_49."<br />";
} }
if (is_array($eplug_prefs)) if (is_array($eplug_prefs))
{ {
$plugin->manage_prefs('remove', $eplug_prefs); $plugin->manage_prefs('remove', $eplug_prefs);
$text .= EPL_ADLAN_29."<br />"; $text .= EPL_ADLAN_29."<br />";
} }
if (is_array($eplug_comment_ids)) if (is_array($eplug_comment_ids))
{ {
$text .= ($plugin->manage_comments('remove', $eplug_comment_ids)) ? EPL_ADLAN_50."<br />" : ""; $text .= ($plugin->manage_comments('remove', $eplug_comment_ids)) ? EPL_ADLAN_50."<br />" : "";
} }
/* Not used in 0.8 /* Not used in 0.8
if ($eplug_module) if ($eplug_module)
{ {
$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
@@ -203,7 +203,7 @@ if ($action == 'uninstall')
{ {
$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
} }
if ($eplug_latest) if ($eplug_latest)
{ {
$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
@@ -217,27 +217,27 @@ if ($action == 'uninstall')
} }
} }
/* Not used in 0.8 /* Not used in 0.8
if (is_array($eplug_sc)) if (is_array($eplug_sc))
{ {
$plugin->manage_plugin_prefs('remove', 'plug_sc', $eplug_folder, $eplug_sc); $plugin->manage_plugin_prefs('remove', 'plug_sc', $eplug_folder, $eplug_sc);
} }
if (is_array($eplug_bb)) if (is_array($eplug_bb))
{ {
$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb); $plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
} }
*/ */
if ($eplug_menu_name) if ($eplug_menu_name)
{ {
$sql->db_Delete('menus', "menu_name='$eplug_menu_name' "); $sql->db_Delete('menus', "menu_name='$eplug_menu_name' ");
} }
if ($eplug_link) if ($eplug_link)
{ {
$plugin->manage_link('remove', $eplug_link_url, $eplug_link_name); $plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
} }
if ($eplug_userclass) if ($eplug_userclass)
{ {
$plugin->manage_userclass('remove', $eplug_userclass); $plugin->manage_userclass('remove', $eplug_userclass);
@@ -245,7 +245,7 @@ if ($action == 'uninstall')
$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' "); $sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' ");
$plugin->manage_search('remove', $eplug_folder); $plugin->manage_search('remove', $eplug_folder);
$plugin->manage_notify('remove', $eplug_folder); $plugin->manage_notify('remove', $eplug_folder);
} }
@@ -268,7 +268,7 @@ if ($action == 'uninstall')
{ {
$text .= '<br />'.EPL_ADLAN_31.' <b>'.e_PLUGIN.$eplug_folder.'</b> '.EPL_ADLAN_32; $text .= '<br />'.EPL_ADLAN_31.' <b>'.e_PLUGIN.$eplug_folder.'</b> '.EPL_ADLAN_32;
} }
$plugin->save_addon_prefs(); $plugin->save_addon_prefs();
$ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($plug['plugin_name'], "", "defs,emotes_off,no_make_clickable"), $text); $ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($plug['plugin_name'], "", "defs,emotes_off,no_make_clickable"), $text);
$text = ''; $text = '';
@@ -292,7 +292,7 @@ if ($action == 'install')
if ($action == 'upgrade') if ($action == 'upgrade')
{ {
$plug = $plugin->getinfo($id); $plug = $plugin->getinfo($id);
$_path = e_PLUGIN.$plug['plugin_path'].'/'; $_path = e_PLUGIN.$plug['plugin_path'].'/';
if(file_exists($_path.'plugin.xml')) if(file_exists($_path.'plugin.xml'))
{ {
@@ -301,13 +301,13 @@ if ($action == 'upgrade')
else else
{ {
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
$func = $eplug_folder.'_upgrade'; $func = $eplug_folder.'_upgrade';
if (function_exists($func)) if (function_exists($func))
{ {
$text .= call_user_func($func); $text .= call_user_func($func);
} }
if (is_array($upgrade_alter_tables)) if (is_array($upgrade_alter_tables))
{ {
$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables); $result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
@@ -320,8 +320,8 @@ if ($action == 'upgrade')
$text .= EPL_ADLAN_7."<br />"; $text .= EPL_ADLAN_7."<br />";
} }
} }
/* Not used in 0.8 /* Not used in 0.8
if ($eplug_module) if ($eplug_module)
{ {
$plugin->manage_plugin_prefs('add', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('add', 'modules', $eplug_folder);
@@ -330,7 +330,7 @@ if ($action == 'upgrade')
{ {
$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
} }
if ($eplug_status) if ($eplug_status)
{ {
$plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder);
@@ -339,7 +339,7 @@ if ($action == 'upgrade')
{ {
$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
} }
if ($eplug_latest) if ($eplug_latest)
{ {
$plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder);
@@ -348,38 +348,38 @@ if ($action == 'upgrade')
{ {
$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
} }
if (is_array($upgrade_add_eplug_sc)) if (is_array($upgrade_add_eplug_sc))
{ {
$plugin->manage_plugin_prefs('add', 'plug_sc', $eplug_folder, $eplug_sc); $plugin->manage_plugin_prefs('add', 'plug_sc', $eplug_folder, $eplug_sc);
} }
if (is_array($upgrade_remove_eplug_sc)) if (is_array($upgrade_remove_eplug_sc))
{ {
$plugin->manage_plugin_prefs('remove', 'plug_sc', $eplug_folder, $eplug_sc); $plugin->manage_plugin_prefs('remove', 'plug_sc', $eplug_folder, $eplug_sc);
} }
if (is_array($upgrade_add_eplug_bb)) if (is_array($upgrade_add_eplug_bb))
{ {
$plugin->manage_plugin_prefs('add', 'plug_bb', $eplug_folder, $eplug_bb); $plugin->manage_plugin_prefs('add', 'plug_bb', $eplug_folder, $eplug_bb);
} }
if (is_array($upgrade_remove_eplug_bb)) if (is_array($upgrade_remove_eplug_bb))
{ {
$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb); $plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
} }
*/ */
if (is_array($upgrade_add_prefs)) if (is_array($upgrade_add_prefs))
{ {
$plugin->manage_prefs('add', $upgrade_add_prefs); $plugin->manage_prefs('add', $upgrade_add_prefs);
$text .= EPL_ADLAN_8.'<br />'; $text .= EPL_ADLAN_8.'<br />';
} }
if (is_array($upgrade_remove_prefs)) if (is_array($upgrade_remove_prefs))
{ {
$plugin->manage_prefs('remove', $upgrade_remove_prefs); $plugin->manage_prefs('remove', $upgrade_remove_prefs);
} }
if (is_array($upgrade_add_array_pref)) if (is_array($upgrade_add_array_pref))
{ {
foreach($upgrade_add_array_pref as $key => $val) foreach($upgrade_add_array_pref as $key => $val)
@@ -387,7 +387,7 @@ if ($action == 'upgrade')
$plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val); $plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val);
} }
} }
if (is_array($upgrade_remove_array_pref)) if (is_array($upgrade_remove_array_pref))
{ {
foreach($upgrade_remove_array_pref as $key => $val) foreach($upgrade_remove_array_pref as $key => $val)
@@ -395,12 +395,12 @@ if ($action == 'upgrade')
$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val); $plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
} }
} }
$plugin->manage_search('upgrade', $eplug_folder); $plugin->manage_search('upgrade', $eplug_folder);
$plugin->manage_notify('upgrade', $eplug_folder); $plugin->manage_notify('upgrade', $eplug_folder);
$eplug_addons = $plugin -> getAddons($eplug_folder); $eplug_addons = $plugin -> getAddons($eplug_folder);
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL; $text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$id' "); $sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$id' ");
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version

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;
$qry = "
SELECT t.thread_id from #forum_t AS t
WHERE t.thread_forum_id = $forum_id
AND t.thread_parent = 0
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;
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$threadList[$i++] = $row['thread_id'];
}
if (($id = array_search($thread_id, $threadList)) !== FALSE) if($which == 'next')
{ {
if ($id != 99) $dir = '<';
{ $sort = 'ASC';
return $threadList[$id+1];
}
else
{
return $this->thread_getnext($thread_id, $forum_id, $from+99, 2);
}
}
}
else
{
return FALSE;
}
$from += 100;
} }
else
{
$dir = '>';
$sort = 'DESC';
}
$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))
{
$row = $e107->sql->db_Fetch();
return $row['thread_id'];
}
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,18 +12,18 @@
| 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 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
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'])));
exit; exit;
} }
$highlight_search = isset($_POST['highlight_search']); $highlight_search = isset($_POST['highlight_search']);
@@ -30,45 +31,32 @@ $highlight_search = isset($_POST['highlight_search']);
if (!e_QUERY) if (!e_QUERY)
{ {
//No paramters given, redirect to forum home //No paramters given, redirect to forum home
header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main'))); header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
include_lan(e_PLUGIN.'forum/languages/English/lan_forum_viewtopic.php'); 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']); require_once (e_PLUGIN . 'forum/forum_shortcodes.php');
$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');
$pm_installed = plugInstalled('pm'); $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,54 +77,56 @@ 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');
} }
else else
{ {
require_once(e_PLUGIN.'forum/templates/forum_viewtopic_template.php'); require_once (e_PLUGIN . 'forum/templates/forum_viewtopic_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,43 +184,51 @@ 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++;
//TODO: Look into fixing this, to limit to a single query per pageload //TODO: Look into fixing this, to limit to a single query per pageload
$e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= ".USERID.' LIMIT 1'; $e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= " . USERID . ' LIMIT 1';
$e_hide_hidden = FORLAN_HIDDEN; $e_hide_hidden = FORLAN_HIDDEN;
$e_hide_allowed = USER; $e_hide_allowed = USER;
if($i > 1) if ($i > 1)
{ {
$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
{ {
@@ -240,13 +237,12 @@ 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'])
@@ -264,13 +260,13 @@ else
echo "<script type=\"text/javascript\"> echo "<script type=\"text/javascript\">
function confirm_(mode, forum_id, thread_id, thread) { function confirm_(mode, forum_id, thread_id, thread) {
if (mode == 'thread') { if (mode == 'thread') {
return confirm(\"".$tp->toJS(LAN_409)."\"); return confirm(\"" . $tp->toJS(LAN_409) . "\");
} else { } else {
return confirm(\"".$tp->toJS(LAN_410)." [ ".$tp->toJS(LAN_411)."\" + thread + \" ]\"); return confirm(\"" . $tp->toJS(LAN_410) . " [ " . $tp->toJS(LAN_411) . "\" + thread + \" ]\");
} }
} }
</script>"; </script>";
require_once(FOOTERF); require_once (FOOTERF);
function showmodoptions() function showmodoptions()
{ {
@@ -279,25 +275,25 @@ 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']}'>";
} }
else else
{ {
$type = 'reply'; $type = 'reply';
$ret = "<form method='post' action='".e_SELF."?".e_QUERY."' id='frmMod_{$forum_id}_{$post_info['thread_id']}'>"; $ret = "<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='frmMod_{$forum_id}_{$post_info['thread_id']}'>";
} }
$ret .= " $ret .= "
<div> <div>
<a href='".e_PLUGIN."forum/forum_post.php?edit.{$post_info['thread_id']}.{$topic_from}'>".IMAGE_admin_edit."</a> <a href='" . e_PLUGIN . "forum/forum_post.php?edit.{$post_info['thread_id']}.{$topic_from}'>" . IMAGE_admin_edit . "</a>
<input type='image' ".IMAGE_admin_delete." name='delete_{$post_info['thread_id']}' value='thread_action' onclick=\"return confirm_('{$type}', {$forum_id}, {$thread_id}, '{$post_info['user_name']}')\" /> <input type='image' " . IMAGE_admin_delete . " name='delete_{$post_info['thread_id']}' value='thread_action' onclick=\"return confirm_('{$type}', {$forum_id}, {$thread_id}, '{$post_info['user_name']}')\" />
"; ";
if ($type == 'thread') if ($type == 'thread')
{ {
$ret .= "<a href='".e_PLUGIN."forum/forum_conf.php?move.{$thread_id}'>".IMAGE_admin_move2."</a>"; $ret .= "<a href='" . e_PLUGIN . "forum/forum_conf.php?move.{$thread_id}'>" . IMAGE_admin_move2 . "</a>";
} }
$ret .= " $ret .= "
</div> </div>
@@ -310,19 +306,19 @@ function forumjump()
global $forum; global $forum;
$jumpList = $forum->forum_get_allowed(); $jumpList = $forum->forum_get_allowed();
$text = "<form method='post' action='".e_SELF."'><p>".LAN_65.": <select name='forumjump' class='tbox'>"; $text = "<form method='post' action='" . e_SELF . "'><p>" . LAN_65 . ": <select name='forumjump' class='tbox'>";
foreach($jumpList as $key => $val) foreach ($jumpList as $key => $val)
{ {
$text .= "\n<option value='".$key."'>".$val."</option>"; $text .= "\n<option value='" . $key . "'>" . $val . "</option>";
} }
$text .= "</select> <input class='button' type='submit' name='fjsubmit' value='".LAN_03."' />&nbsp;&nbsp;&nbsp;&nbsp;<a href='".e_SELF."?".e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_10."</a></p></form>"; $text .= "</select> <input class='button' type='submit' name='fjsubmit' value='" . LAN_03 . "' />&nbsp;&nbsp;&nbsp;&nbsp;<a href='" . e_SELF . "?" . e_QUERY . "#top' onclick=\"window.scrollTo(0,0);\">" . LAN_10 . "</a></p></form>";
return $text; return $text;
} }
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 '';
} }
@@ -332,209 +328,265 @@ function rpg($user_join, $user_forums)
$lvl_mp_regen_per_day = 4; $lvl_mp_regen_per_day = 4;
$lvl_avg_ppd = 5; $lvl_avg_ppd = 5;
$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 {
$lvl_level = floor(pow(log10($user_forums ), 3 ) ) + 1;
} }
if ($lvl_level < 1) { else
{
$lvl_level = floor(pow(log10($user_forums), 3)) + 1;
}
if ($lvl_level < 1)
{
$lvl_hp = "0 / 0"; $lvl_hp = "0 / 0";
$lvl_hp_percent = 0; $lvl_hp_percent = 0;
} else { }
$lvl_max_hp = floor((pow($lvl_level, (1/4) ) ) * (pow(10, pow($lvl_level+2, (1/3) ) ) ) / (1.5) ); else
{
$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); {
} else { $lvl_hp_percent = floor((.5 + (($lvl_ppd - $lvl_avg_ppd) / ($lvl_bonus_redux * 2))) * 100);
$lvl_hp_percent = floor($lvl_ppd / ($lvl_avg_ppd / 50) );
} }
if ($lvl_hp_percent > 100) { else
$lvl_max_hp += floor(($lvl_hp_percent - 100) * pi() ); {
$lvl_hp_percent = floor($lvl_ppd / ($lvl_avg_ppd / 50));
}
if ($lvl_hp_percent > 100)
{
$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));
$lvl_cur_hp = max(0, $lvl_cur_hp); $lvl_cur_hp = max(0, $lvl_cur_hp);
$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 { }
$lvl_max_mp = floor((pow($lvl_level, (1/4) ) ) * (pow(10, pow($lvl_level+2, (1/3) ) ) ) / (pi()) ); else
{
$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);
$lvl_cur_mp = floor($lvl_max_mp - $lvl_mp_cost + $lvl_mp_regen); $lvl_cur_mp = floor($lvl_max_mp - $lvl_mp_cost + $lvl_mp_regen);
$lvl_cur_mp = max(0, $lvl_cur_mp); $lvl_cur_mp = max(0, $lvl_cur_mp);
$lvl_cur_mp = min($lvl_max_mp, $lvl_cur_mp); $lvl_cur_mp = min($lvl_max_mp, $lvl_cur_mp);
$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 { }
$lvl_posts_for_next = floor(pow(10, pow($lvl_level, (1/3) ) ) ); else
if ($lvl_level == 1) { {
$lvl_posts_for_this = max(1, floor(pow (10, (($lvl_level - 1) ) ) ) ); $lvl_posts_for_next = floor(pow(10, pow($lvl_level, (1 / 3))));
} else { if ($lvl_level == 1)
$lvl_posts_for_this = max(1, floor(pow (10, pow(($lvl_level - 1), (1/3) ) ) ) ); {
$lvl_posts_for_this = max(1, floor(pow(10, (($lvl_level - 1)))));
}
else
{
$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);
$lvl_exp_percent = floor((($user_forums - $lvl_posts_for_this) / max(1, ($lvl_posts_for_next - $lvl_posts_for_this ) ) ) * 100); $lvl_exp_percent = floor((($user_forums - $lvl_posts_for_this) / max(1, ($lvl_posts_for_next - $lvl_posts_for_this))) * 100);
} }
$bar_image = THEME."images/bar.jpg"; $bar_image = THEME . "images/bar.jpg";
if(!is_readable($bar_image)) if (!is_readable($bar_image))
{ {
$bar_image = e_PLUGIN."forum/images/".IMODE."/bar.jpg"; $bar_image = e_PLUGIN . "forum/images/" . IMODE . "/bar.jpg";
} }
$rpg_info .= "<div style='padding:2px; white-space:nowrap'>"; $rpg_info .= "<div style='padding:2px; white-space:nowrap'>";
$rpg_info .= "<b>Level = ".$lvl_level."</b><br />"; $rpg_info .= "<b>Level = " . $lvl_level . "</b><br />";
$rpg_info .= "HP = ".$lvl_hp."<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:".$lvl_hp_percent."%'><br />"; $rpg_info .= "HP = " . $lvl_hp . "<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:" . $lvl_hp_percent . "%'><br />";
$rpg_info .= "EXP = ".$lvl_exp."<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:".$lvl_exp_percent."%'><br />"; $rpg_info .= "EXP = " . $lvl_exp . "<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:" . $lvl_exp_percent . "%'><br />";
$rpg_info .= "MP = ".$lvl_mp."<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:".$lvl_mp_percent."%'><br />"; $rpg_info .= "MP = " . $lvl_mp . "<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:" . $lvl_mp_percent . "%'><br />";
$rpg_info .= "</div>"; $rpg_info .= "</div>";
return $rpg_info; return $rpg_info;
} }
function processFunction() class e107ForumThread
{ {
if($topic_from === 'post')
{ var $message, $threadId, $threadInfo, $forumId, $perPage, $noInc;
if($thread_id)
function init()
{ {
$post_num = $forum->thread_postnum($thread_id); global $pref, $forum;
$pages = ceil(($post_num['post_num']+1)/$pref['forum_postspage']); $e107 = e107::getInstance();
$topic_from = ($pages-1) * $pref['forum_postspage']; $this->threadId = (int)varset($_GET['id']);
if($post_num['parent'] != $thread_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: ".e_SELF."?{$post_num['parent']}.{$topic_from}#post_{$thread_id}"); header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
}
else
{
header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit;
}
}
if ($action == 'track' && USER) //If not permitted to view forum, redirect to main forum page
{ if (!$forum->checkPerm($this->threadInfo['thread_forum_id'], 'view'))
$forum->track($thread_id);
header("location:".e_SELF."?{$thread_id}.{$topic_from}");
exit;
}
if ($action == 'untrack' && USER)
{
$forum->untrack($thread_id);
header("location:".e_SELF."?{$thread_id}.{$topic_from}");
exit;
}
if ($action == 'next')
{
$next = $forum->thread_getnext($thread_id, $topic_from);
if ($next)
{
header("location:".e_SELF."?{$next}");
exit;
}
else
{
require_once(HEADERF);
$ns->tablerender('', LAN_405, array('forum_viewtopic', '405'));
require_once(FOOTERF);
exit;
}
}
if ($action == 'prev')
{
$prev = $forum->thread_getprev($thread_id, $topic_from);
if ($prev)
{
header("location:".e_SELF."?{$prev}");
exit;
}
else
{
require_once(HEADERF);
$ns->tablerender('', LAN_404, array('forum_viewtopic', '404'));
require_once(FOOTERF);
exit;
}
}
if ($action == 'report')
{
$thread_info = $forum->thread_get_postinfo($thread_id, TRUE);
if (isset($_POST['report_thread']))
{
$report_add = $tp -> toDB($_POST['report_add']);
if ($pref['reported_post_email'])
{ {
require_once(e_HANDLER."mail.php"); header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
$report = LAN_422.SITENAME." : ".(substr(SITEURL, -1) == "/" ? SITEURL : SITEURL."/").$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$thread_id.".post\n".LAN_425.USERNAME."\n".$report_add; exit;
$subject = LAN_421." ".SITENAME;
sendemail(SITEADMINEMAIL, $subject, $report);
} }
$sql->db_Insert('generic', "0, 'reported_post', ".time().", '".USERID."', '{$thread_info['head']['thread_name']}', ".intval($thread_id).", '{$report_add}'"); $this->noInc = false;
define("e_PAGETITLE", LAN_01." / ".LAN_428);
require_once(HEADERF);
$text = LAN_424."<br /><br /><a href='forum_viewtopic.php?".$thread_id.".post'>".LAN_429."</a";
$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'));
} }
else
function processFunction()
{ {
$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off'); global $forum;
define("e_PAGETITLE", LAN_01." / ".LAN_426." ".$thread_name); $e107 = e107::getInstance();
require_once(HEADERF); if (!isset($_GET['f']))
$text = "<form action='".e_PLUGIN."forum/forum_viewtopic.php?".e_QUERY."' method='post'> <table style='width:100%'> {
<tr> return;
<td style='width:50%' > }
".LAN_415.": ".$thread_name." <a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id.".post'><span class='smalltext'>".LAN_420." </span>
</a> $function = trim($_GET['f']);
</td> switch ($function)
<td style='text-align:center;width:50%'> {
</td> case 'post':
</tr> if ($thread_id)
<tr> {
<td>".LAN_417."<br />".LAN_418." $post_num = $forum->thread_postnum($thread_id);
</td> $pages = ceil(($post_num['post_num'] + 1) / $pref['forum_postspage']);
<td style='text-align:center;'> $topic_from = ($pages - 1) * $pref['forum_postspage'];
<textarea cols='40' rows='10' class='tbox' name='report_add'></textarea> if ($post_num['parent'] != $thread_id)
</td> {
</tr> header("location: " . e_SELF . "?{$post_num['parent']}.{$topic_from}#post_{$thread_id}");
<tr> exit;
<td colspan='2' style='text-align:center;'><br /> }
<input class='button' type='submit' name='report_thread' value='".LAN_419."' /> }
</td> else
</tr> {
</table>"; header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report2')); exit;
}
break;
case 'track':
if (!USER || !isset($_GET['id']))
{
return;
}
$forum->track('add', USERID, $_GET['id']);
break;
// header("location:".e_SELF."?{$thread_id}.{$topic_from}");
// exit;
case 'untrack':
if (!USER || !isset($_GET['id']))
{
return;
}
$forum->track('del', USERID, $_GET['id']);
break;
case 'last':
// $pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
$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)
{
$url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $next));
header("location: {$url}");
exit;
}
else
{
$this->message = LAN_405;
}
break;
case 'prev':
$prev = $forum->threadGetNextPrev('prev', $this->threadId, $this->threadInfo['forum_id'], $this->threadInfo['thread_lastpost']);
if ($prev)
{
$url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $prev));
header("location: {$url}");
exit;
}
else
{
$this->message = LAN_404;
}
break;
case 'report':
$thread_info = $forum->thread_get_postinfo($thread_id, true);
if (isset($_POST['report_thread']))
{
$report_add = $tp->toDB($_POST['report_add']);
if ($pref['reported_post_email'])
{
require_once (e_HANDLER . "mail.php");
$report = LAN_422 . SITENAME . " : " . (substr(SITEURL, -1) == "/" ? SITEURL : SITEURL . "/") . $PLUGINS_DIRECTORY . "forum/forum_viewtopic.php?" . $thread_id . ".post\n" . LAN_425 . USERNAME . "\n" . $report_add;
$subject = LAN_421 . " " . SITENAME;
sendemail(SITEADMINEMAIL, $subject, $report);
}
$sql->db_Insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$thread_info['head']['thread_name']}', " . intval($thread_id) . ", '{$report_add}'");
define("e_PAGETITLE", LAN_01 . " / " . LAN_428);
require_once (HEADERF);
$text = LAN_424 . "<br /><br /><a href='forum_viewtopic.php?" . $thread_id . ".post'>" . LAN_429 . "</a";
$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'));
}
else
{
$thread_name = $tp->toHTML($thread_info['head']['thread_name'], true, 'no_hook, emotes_off');
define("e_PAGETITLE", LAN_01 . " / " . LAN_426 . " " . $thread_name);
require_once (HEADERF);
$text = "<form action='" . e_PLUGIN . "forum/forum_viewtopic.php?" . e_QUERY . "' method='post'> <table style='width:100%'>
<tr>
<td style='width:50%' >
" . LAN_415 . ": " . $thread_name . " <a href='" . e_PLUGIN . "forum/forum_viewtopic.php?" . $thread_id . ".post'><span class='smalltext'>" . LAN_420 . " </span>
</a>
</td>
<td style='text-align:center;width:50%'>
</td>
</tr>
<tr>
<td>" . LAN_417 . "<br />" . LAN_418 . "
</td>
<td style='text-align:center;'>
<textarea cols='40' rows='10' class='tbox' name='report_add'></textarea>
</td>
</tr>
<tr>
<td colspan='2' style='text-align:center;'><br />
<input class='button' type='submit' name='report_thread' value='" . LAN_419 . "' />
</td>
</tr>
</table>";
$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report2'));
}
require_once (FOOTERF);
exit;
break;
}
} }
require_once(FOOTERF);
exit;
}
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>";