2008-12-12 03:36:39 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* e107 website system
|
|
|
|
*
|
2011-01-14 18:29:06 +00:00
|
|
|
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
2008-12-12 03:36:39 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* View specific forums
|
|
|
|
*
|
2010-03-14 00:50:27 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2008-12-12 03:36:39 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once('../../class2.php');
|
2011-01-14 18:29:06 +00:00
|
|
|
$e107 = e107::getInstance();
|
2011-04-21 13:20:22 +00:00
|
|
|
if (!$e107->isInstalled('forum'))
|
2011-01-14 18:29:06 +00:00
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
header('Location: '.SITEURL);
|
2011-01-14 18:29:06 +00:00
|
|
|
exit;
|
|
|
|
}
|
2009-11-19 15:31:59 +00:00
|
|
|
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
|
2008-12-12 03:36:39 +00:00
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-12 03:36:39 +00:00
|
|
|
if (isset($_POST['fjsubmit']))
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
// TODO - load from DB and find forum_name
|
|
|
|
header('location:'.$e107->url->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), '', 'full=1&encode=0'));
|
2008-12-12 03:36:39 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!e_QUERY)
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
header('Location:'.$e107->url->create('forum/forum/main', array(), 'full=1&encode=0'));
|
2008-12-12 03:36:39 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2010-03-10 01:23:57 +00:00
|
|
|
require_once(e_PLUGIN.'forum/forum_class.php');
|
|
|
|
$forum = new e107forum;
|
|
|
|
|
2008-12-15 00:29:20 +00:00
|
|
|
//$view = 25;
|
2010-03-10 01:23:57 +00:00
|
|
|
$view = $forum->prefs->get('threadspage', 25);
|
2010-04-25 22:30:26 +00:00
|
|
|
if(!$view) { $view = 25; }
|
2011-04-25 11:29:21 +00:00
|
|
|
$page = (varset($_GET['p']) ? $_GET['p'] : 1);
|
|
|
|
$threadFrom = ($page - 1) * $view;
|
2008-12-12 03:36:39 +00:00
|
|
|
|
|
|
|
global $forum_info, $FORUM_CRUMB;
|
2010-02-01 03:41:59 +00:00
|
|
|
$fVars = new e_vars;
|
2010-01-23 03:25:31 +00:00
|
|
|
|
|
|
|
$fVars->STARTERTITLE = LAN_54;
|
|
|
|
$fVars->THREADTITLE = LAN_53;
|
|
|
|
$fVars->REPLYTITLE = LAN_55;
|
|
|
|
$fVars->LASTPOSTITLE = LAN_57;
|
|
|
|
$fVars->VIEWTITLE = LAN_56;
|
2008-12-12 03:36:39 +00:00
|
|
|
|
|
|
|
$forumId = (int)$_REQUEST['id'];
|
|
|
|
|
|
|
|
if (!$forum->checkPerm($forumId, 'view'))
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
header('Location:'.$e107->url->create('forum/forum/main'));
|
2008-12-12 03:36:39 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2010-03-14 00:50:27 +00:00
|
|
|
$forumInfo = $forum->forumGet($forumId);
|
2008-12-17 04:22:37 +00:00
|
|
|
$threadsViewed = $forum->threadGetUserViewed();
|
|
|
|
|
2012-12-08 20:22:05 +01:00
|
|
|
if (!vartrue($FORUM_VIEW_START))
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
if (file_exists(THEME.'forum_viewforum_template.php'))
|
|
|
|
{
|
|
|
|
require_once(THEME.'forum_viewforum_template.php');
|
|
|
|
}
|
|
|
|
elseif (file_exists(THEME.'forum_template.php'))
|
|
|
|
{
|
|
|
|
require_once(THEME.'forum_template.php');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
require_once(e_PLUGIN.'forum/templates/forum_viewforum_template.php');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-12 04:22:09 -07:00
|
|
|
|
2013-03-13 02:39:00 -07:00
|
|
|
if(is_array($FORUM_VIEWFORUM_TEMPLATE)) // New Template.
|
2013-03-12 04:22:09 -07:00
|
|
|
{
|
|
|
|
|
2013-03-13 02:39:00 -07:00
|
|
|
$FORUM_VIEW_START_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['start'];
|
|
|
|
$FORUM_VIEW_START = $FORUM_VIEWFORUM_TEMPLATE['header'];
|
|
|
|
$FORUM_VIEW_FORUM = $FORUM_VIEWFORUM_TEMPLATE['item'];
|
|
|
|
$FORUM_VIEW_FORUM_STICKY = $FORUM_VIEWFORUM_TEMPLATE['item-sticky'];
|
|
|
|
$FORUM_VIEW_FORUM_ANNOUNCE = $FORUM_VIEWFORUM_TEMPLATE['item-announce'];
|
|
|
|
$FORUM_VIEW_END = $FORUM_VIEWFORUM_TEMPLATE['footer'];
|
|
|
|
$FORUM_VIEW_END_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['end'];
|
|
|
|
$FORUM_VIEW_SUB_START = $FORUM_VIEWFORUM_TEMPLATE['sub-header'];
|
|
|
|
$FORUM_VIEW_SUB = $FORUM_VIEWFORUM_TEMPLATE['sub-item'];
|
|
|
|
$FORUM_VIEW_SUB_END = $FORUM_VIEWFORUM_TEMPLATE['sub-footer'];
|
|
|
|
$FORUM_IMPORTANT_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-important'];
|
|
|
|
$FORUM_NORMAL_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-normal'];
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-12 03:36:39 +00:00
|
|
|
$forumInfo['forum_name'] = $e107->tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
|
|
|
|
$forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
|
|
|
|
|
|
|
|
$_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']);
|
2011-04-25 11:29:21 +00:00
|
|
|
define('e_PAGETITLE', $_forum_name.' / '.LAN_01);
|
2011-06-28 12:58:26 +00:00
|
|
|
|
|
|
|
// SEO - meta description (auto)
|
|
|
|
if(!empty($forumInfo['forum_description']))
|
|
|
|
{
|
|
|
|
define("META_DESCRIPTION", $tp->text_truncate(
|
|
|
|
str_replace(
|
|
|
|
array('"', "'"), '', strip_tags($tp->toHTML($forumInfo['forum_description']))
|
|
|
|
), 250, '...'));
|
|
|
|
}
|
|
|
|
|
2008-12-12 03:36:39 +00:00
|
|
|
//define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
|
|
|
|
//$modArray = $forum->forum_getmods($forum_info['forum_moderators']);
|
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
$modArray = $forum->forumGetMods($thread->forum_info['forum_moderators']);
|
2008-12-12 03:36:39 +00:00
|
|
|
define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray))));
|
|
|
|
|
|
|
|
$message = '';
|
|
|
|
if (MODERATOR)
|
|
|
|
{
|
|
|
|
if ($_POST)
|
|
|
|
{
|
|
|
|
require_once(e_PLUGIN.'forum/forum_mod.php');
|
|
|
|
$message = forum_thread_moderate($_POST);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(varset($pref['track_online']))
|
|
|
|
{
|
|
|
|
$member_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id != 0");
|
|
|
|
$guest_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id = 0");
|
|
|
|
$users = $member_users+$guest_users;
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once(HEADERF);
|
|
|
|
$text='';
|
2011-06-28 12:14:45 +00:00
|
|
|
// TODO - message batch shortcode
|
2008-12-12 03:36:39 +00:00
|
|
|
if ($message)
|
|
|
|
{
|
2011-06-28 12:14:45 +00:00
|
|
|
//$ns->tablerender('', $message, array('forum_viewforum', 'msg'));
|
|
|
|
//e107::getMessage()->add($thread->message);
|
|
|
|
$fVars->MESSAGE = $message;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$threadCount = $forumInfo['forum_threads'];
|
|
|
|
|
|
|
|
if ($threadCount > $view)
|
|
|
|
{
|
|
|
|
$pages = ceil($threadCount/$view);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$pages = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($pages)
|
|
|
|
{
|
|
|
|
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
|
|
|
|
{
|
2011-04-25 16:52:20 +00:00
|
|
|
//if(!$page) $page = 1;
|
2011-11-28 14:19:19 +00:00
|
|
|
$urlparms = $forumInfo;
|
|
|
|
$urlparms['page'] = '[FROM]';
|
|
|
|
$url = rawurlencode(e107::getUrl()->create('forum/forum/view', $urlparms));
|
2011-04-21 13:20:22 +00:00
|
|
|
$parms = "total={$pages}&type=page¤t={$page}&url=".$url."&caption=off";
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->THREADPAGES = $e107->tp->parseTemplate("{NEXTPREV={$parms}}");
|
2011-11-28 14:19:19 +00:00
|
|
|
unset($urlparms);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($forum->checkPerm($forumId, 'post'))
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
$fVars->NEWTHREADBUTTON = "<a href='".$e107->url->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>';
|
2013-03-12 04:22:09 -07:00
|
|
|
$fVars->NEWTHREADBUTTONX = newthreadjump($e107->url->create('forum/thread/new', array('id' => $forumId))); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(substr($forumInfo['forum_name'], 0, 1) == '*')
|
|
|
|
{
|
|
|
|
$forum_info['forum_name'] = substr($forum_info['forum_name'], 1);
|
|
|
|
$container_only = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$container_only = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(substr($forum_info['sub_parent'], 0, 1) == '*')
|
|
|
|
{
|
|
|
|
$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
|
|
|
|
}
|
|
|
|
|
2010-02-01 03:41:59 +00:00
|
|
|
$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
|
2008-12-12 03:36:39 +00:00
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->FORUMTITLE = $forumInfo['forum_name'];
|
|
|
|
$fVars->MODERATORS = LAN_404.': '.implode(', ', $modArray);
|
|
|
|
$fVars->BROWSERS = '';
|
2008-12-12 03:36:39 +00:00
|
|
|
if(varset($pref['track_online']))
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->BROWSERS = $users.' '.($users == 1 ? LAN_405 : LAN_406).' ('.$member_users.' '.($member_users == 1 ? LAN_407 : LAN_409).", ".$guest_users." ".($guest_users == 1 ? LAN_408 : LAN_410).')';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->ICONKEY = "
|
2008-12-12 03:36:39 +00:00
|
|
|
<table style='width:100%'>
|
|
|
|
<tr>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_79."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_80."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_sticky_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_202."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_announce_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_396."</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_popular_small."</td>
|
|
|
|
<td style='width:2%' class='smallblacktext'>".LAN_79." ".LAN_395."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_popular_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_80." ".LAN_395."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_stickyclosed_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_203."</td>
|
|
|
|
<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_closed_small."</td>
|
|
|
|
<td style='width:10%' class='smallblacktext'>".LAN_81."</td>
|
|
|
|
</tr>
|
|
|
|
</table>";
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->SEARCH = "
|
2013-03-12 04:22:09 -07:00
|
|
|
<form method='get' class='form-inline input-append' action='".e_BASE."search.php'>
|
2008-12-12 03:36:39 +00:00
|
|
|
<p>
|
|
|
|
<input class='tbox' type='text' name='q' size='20' value='' maxlength='50' />
|
2013-03-12 04:22:09 -07:00
|
|
|
<button class='btn button' type='submit' name='s' >".LAN_180."</button>
|
2008-12-12 03:36:39 +00:00
|
|
|
<input type='hidden' name='r' value='0' />
|
2013-03-12 04:22:09 -07:00
|
|
|
<input type='hidden' name='ref' value='forum' />
|
2008-12-12 03:36:39 +00:00
|
|
|
</p>
|
|
|
|
</form>";
|
|
|
|
|
|
|
|
if($forum->checkPerm($forumId, 'post'))
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->PERMS = LAN_204.' - '.LAN_206.' - '.LAN_208;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->PERMS = LAN_205.' - '.LAN_207.' - '.LAN_209;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$sticky_threads = 0;
|
|
|
|
$stuck = false;
|
|
|
|
$reg_threads = 0;
|
|
|
|
$unstuck = false;
|
|
|
|
|
|
|
|
$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view);
|
2012-12-08 20:22:05 +01:00
|
|
|
$subList = $forum->forumGetSubs(vartrue($forum_id));
|
2008-12-12 03:36:39 +00:00
|
|
|
$gen = new convert;
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->SUBFORUMS = '';
|
2008-12-15 00:29:20 +00:00
|
|
|
if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
2008-12-17 04:22:37 +00:00
|
|
|
$newflag_list = $forum->forumGetUnreadForums();
|
2008-12-12 03:36:39 +00:00
|
|
|
$sub_info = '';
|
2008-12-15 00:29:20 +00:00
|
|
|
foreach($subList[$forumInfo['forum_parent']][$forumId] as $sub)
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
$sub_info .= parse_sub($sub);
|
|
|
|
}
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count($threadList) )
|
|
|
|
{
|
|
|
|
foreach($threadList as $thread_info)
|
|
|
|
{
|
|
|
|
if($thread_info['thread_options'])
|
|
|
|
{
|
|
|
|
$thread_info['thread_options'] = unserialize($thread_info['thread_options']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$thread_info['thread_options'] = array();
|
|
|
|
}
|
2008-12-15 00:29:20 +00:00
|
|
|
if ($thread_info['thread_sticky'])
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
$sticky_threads ++;
|
|
|
|
}
|
2010-03-10 01:23:57 +00:00
|
|
|
if ($sticky_threads > 0 && !$stuck && $forum->prefs->get('hilightsticky'))
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
if($FORUM_IMPORTANT_ROW)
|
|
|
|
{
|
|
|
|
$forum_view_forum .= $FORUM_IMPORTANT_ROW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$forum_view_forum .= "<tr><td class='forumheader'> </td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_411."</b></span></td></tr>";
|
|
|
|
}
|
|
|
|
$stuck = true;
|
|
|
|
}
|
2008-12-15 00:29:20 +00:00
|
|
|
if (!$thread_info['thread_sticky'])
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
$reg_threads ++;
|
|
|
|
}
|
2013-03-12 05:43:02 -07:00
|
|
|
if ($reg_threads == '1') // Removed as not needed in new template. && !$unstuck && $stuck
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
if($FORUM_NORMAL_ROW)
|
|
|
|
{
|
|
|
|
$forum_view_forum .= $FORUM_NORMAL_ROW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$forum_view_forum .= "<tr><td class='forumheader'> </td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_412."</b></span></td></tr>";
|
|
|
|
}
|
|
|
|
$unstuck = true;
|
|
|
|
}
|
|
|
|
$forum_view_forum .= parse_thread($thread_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$forum_view_forum .= "<tr><td class='forumheader' colspan='6'>".LAN_58."</td></tr>";
|
|
|
|
}
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$fVars->FORUMJUMP = forumjump();
|
|
|
|
$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_02.'</a>';
|
2008-12-12 03:36:39 +00:00
|
|
|
|
|
|
|
if($container_only)
|
|
|
|
{
|
|
|
|
$FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START);
|
|
|
|
$FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END);
|
|
|
|
$forum_view_forum = '';
|
|
|
|
}
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars);
|
|
|
|
$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
|
2008-12-12 03:36:39 +00:00
|
|
|
|
2013-03-12 04:22:09 -07:00
|
|
|
if ($forum->prefs->get('enclose'))
|
|
|
|
{
|
|
|
|
$ns->tablerender($forum->prefs->get('title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1'));
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo $forum_view_start.$forum_view_forum.$forum_view_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<script type=\"text/javascript\">
|
|
|
|
function confirm_(thread_id)
|
|
|
|
{
|
|
|
|
return confirm(\"".$tp->toJS(LAN_434)."\");
|
|
|
|
}
|
|
|
|
</script>";
|
|
|
|
|
|
|
|
require_once(FOOTERF);
|
|
|
|
|
|
|
|
|
|
|
|
function parse_thread($thread_info)
|
|
|
|
{
|
2010-03-10 01:23:57 +00:00
|
|
|
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
|
2010-01-23 03:25:31 +00:00
|
|
|
global $tp;
|
2010-02-01 03:41:59 +00:00
|
|
|
$tVars = new e_vars;
|
2008-12-12 03:36:39 +00:00
|
|
|
$e107 = e107::getInstance();
|
|
|
|
$text = '';
|
|
|
|
|
|
|
|
$threadId = $thread_info['thread_id'];
|
|
|
|
$forumId = $thread_info['thread_forum_id'];
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->VIEWS = $thread_info['thread_views'];
|
|
|
|
$tVars->REPLIES = $thread_info['thread_total_replies'];
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
$badge = ($thread_info['thread_views'] > 0) ? "badge-info" : "";
|
|
|
|
|
|
|
|
$tVars->REPLIESX = "<span class='badge badge-info'>".$thread_info['thread_total_replies']."</span>";
|
|
|
|
$tVars->VIEWSX = "<span class='badge {$badge}'>".$thread_info['thread_views']."</span>";
|
2008-12-12 03:36:39 +00:00
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
if ($tVars->REPLIES)
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
$lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
|
|
|
|
if($thread_info['lastpost_username'])
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
// XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
|
|
|
|
$url = $e107->url->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->LASTPOST = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->LASTPOSTUSER = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!$thread_info['thread_lastuser'])
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->LASTPOST = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->LASTPOSTUSER = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->LASTPOST = FORLAN_19;
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->LASTPOSTUSER = FORLAN_19;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->LASTPOST .= '<br />'.$lastpost_datestamp;
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->LASTPOSTDATE .= $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short');
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
$newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed));
|
2008-12-12 03:36:39 +00:00
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
$tVars->THREADTIMELAPSE = $gen->computeLapse($thread_info['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
|
2010-03-10 01:23:57 +00:00
|
|
|
if ($tVars->REPLIES >= $forum->prefs->get('popular', 10))
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->THREADTYPE = '';
|
2008-12-15 00:29:20 +00:00
|
|
|
if ($thread_info['thread_sticky'] == 1)
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ICON = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
|
|
|
|
$tVars->THREADTYPE = '['.LAN_202.']<br />';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2008-12-15 00:29:20 +00:00
|
|
|
elseif($thread_info['thread_sticky'] == 2)
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ICON = IMAGE_announce;
|
|
|
|
$tVars->THREADTYPE = '['.LAN_396.']<br />';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
elseif(!$thread_info['thread_active'])
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ICON = IMAGE_closed;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
2008-12-15 00:29:20 +00:00
|
|
|
$thread_name = strip_tags($e107->tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
|
2008-12-12 03:36:39 +00:00
|
|
|
if(isset($thread_info['thread_options']['poll']))
|
|
|
|
{
|
|
|
|
$thread_name = '['.FORLAN_23.'] ' . $thread_name;
|
|
|
|
}
|
|
|
|
// if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE))))
|
|
|
|
// {
|
|
|
|
// $thread_name = substr($thread_name, strlen($THREADTYPE));
|
|
|
|
// }
|
2010-03-10 01:23:57 +00:00
|
|
|
if ($forum->prefs->get('tooltip'))
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
|
|
|
$thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook'));
|
2010-03-10 01:23:57 +00:00
|
|
|
$tip_length = $forum->prefs->get('tiplength', 400);
|
2008-12-12 03:36:39 +00:00
|
|
|
if (strlen($thread_thread) > $tip_length)
|
|
|
|
{
|
2010-01-23 09:53:08 +00:00
|
|
|
//$thread_thread = substr($thread_thread, 0, $tip_length).' '.$menu_pref['newforumposts_postfix'];
|
|
|
|
$thread_thread = $tp->text_truncate($thread_thread, $tip_length, $menu_pref['newforumposts_postfix']); // Doesn't split entities
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
$thread_thread = str_replace("'", ''', $thread_thread);
|
|
|
|
$title = "title='".$thread_thread."'";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$title = '';
|
|
|
|
}
|
2011-11-28 14:19:19 +00:00
|
|
|
$tVars->THREADNAME = "<a {$title} href='".$e107->url->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name))."'>{$thread_name}</a>";
|
|
|
|
// FIXME - pages -> convert to nextprev shortcode
|
2011-04-25 16:52:20 +00:00
|
|
|
$pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage'));
|
2011-11-28 14:19:19 +00:00
|
|
|
$urlparms = $thread_info;
|
2008-12-12 03:36:39 +00:00
|
|
|
if ($pages > 1)
|
|
|
|
{
|
|
|
|
if($pages > 6)
|
|
|
|
{
|
|
|
|
for($a = 0; $a <= 2; $a++)
|
|
|
|
{
|
2011-04-25 11:29:21 +00:00
|
|
|
$aa = $a + 1;
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
|
2011-11-28 14:19:19 +00:00
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = $e107->url->create('forum/thread/view', $urlparms);
|
2011-04-25 11:29:21 +00:00
|
|
|
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES .= ' ... ';
|
2008-12-12 03:36:39 +00:00
|
|
|
for($a = $pages-3; $a <= $pages-1; $a++)
|
|
|
|
{
|
2011-04-25 11:29:21 +00:00
|
|
|
$aa = $a + 1;
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
|
2011-11-28 14:19:19 +00:00
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = $e107->url->create('forum/thread/view', $urlparms);
|
2011-04-25 11:29:21 +00:00
|
|
|
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for($a = 0; $a <= ($pages-1); $a++)
|
|
|
|
{
|
2011-04-25 11:29:21 +00:00
|
|
|
$aa = $a + 1;
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
|
2011-11-28 14:19:19 +00:00
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = $e107->url->create('forum/thread/view', $urlparms);
|
2011-04-25 11:29:21 +00:00
|
|
|
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES = LAN_316.' [ '.$tVars->PAGES.' ]';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->PAGES = '';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
$tVars->PAGESX = fpages($thread_info, $tVars->REPLIES);
|
2008-12-12 03:36:39 +00:00
|
|
|
|
|
|
|
if (MODERATOR)
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
// FIXME _URL_ thread name
|
|
|
|
// $e107->url->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
|
|
|
|
// USED self instead
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->ADMIN_ICONS = "
|
2011-11-28 14:19:19 +00:00
|
|
|
<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'><div>
|
2008-12-12 03:36:39 +00:00
|
|
|
<input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" />
|
2008-12-15 00:29:20 +00:00
|
|
|
".($thread_info['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> ")."
|
2008-12-12 03:36:39 +00:00
|
|
|
".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> "). "
|
2011-11-28 14:19:19 +00:00
|
|
|
<a href='".$e107->url->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a>
|
2008-12-12 03:36:39 +00:00
|
|
|
</div></form>
|
2008-12-15 00:29:20 +00:00
|
|
|
';
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
$tVars->ADMINOPTIONS = fadminoptions($thread_info);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "</td>
|
|
|
|
<td style='vertical-align:top; text-align:center; width:20%' class='forumheader3'>".$THREADDATE.'<br />';
|
2008-12-15 00:29:20 +00:00
|
|
|
// $tmp = explode('.', $thread_info['thread_user'], 2);
|
2008-12-12 03:36:39 +00:00
|
|
|
|
|
|
|
if($thread_info['user_name'])
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
$tVars->POSTER = "<a href='".$e107->url->create('user/profile/view', array('id' => $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name']."</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if($thread_info['thread_user_anon'])
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->POSTER = $e107->tp->toHTML($thread_info['thread_user_anon']);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->POSTER = FORLAN_19;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-23 03:25:31 +00:00
|
|
|
if (!$tVars->REPLIES)
|
2008-12-12 03:36:39 +00:00
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->REPLIES = LAN_317; // 'None'
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->REPLIESX = "<span class='badge'>0</span>";
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->LASTPOST = ' - ';
|
2013-03-12 04:22:09 -07:00
|
|
|
$tVars->LASTPOSTDATE = ' - ';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2010-03-14 00:50:27 +00:00
|
|
|
|
2010-02-01 03:41:59 +00:00
|
|
|
switch($thread_info['thread_sticky'])
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
$_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
|
|
|
|
break;
|
2010-03-14 00:50:27 +00:00
|
|
|
|
2010-02-01 03:41:59 +00:00
|
|
|
case 2:
|
|
|
|
$_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
|
|
|
|
break;
|
2010-03-14 00:50:27 +00:00
|
|
|
|
2010-02-01 03:41:59 +00:00
|
|
|
default:
|
|
|
|
$_TEMPLATE = $FORUM_VIEW_FORUM;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
if(substr($_TEMPLATE,0,4) == '<tr>') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
|
|
|
|
{
|
|
|
|
$_TEMPLATE = "<tr id='thread-{$threadId}'>".substr($_TEMPLATE,4);
|
|
|
|
}
|
|
|
|
|
2010-03-14 00:50:27 +00:00
|
|
|
|
2010-02-01 03:41:59 +00:00
|
|
|
return $tp->simpleParse($_TEMPLATE, $tVars);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function parse_sub($subInfo)
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
global $FORUM_VIEW_SUB, $gen, $newflag_list, $tp;
|
2010-02-01 03:41:59 +00:00
|
|
|
$tVars = new e_vars;
|
2008-12-12 03:36:39 +00:00
|
|
|
$e107 = e107::getInstance();
|
2008-12-15 00:29:20 +00:00
|
|
|
$forumName = $e107->tp->toHTML($subInfo['forum_name'], true);
|
2011-11-28 14:19:19 +00:00
|
|
|
$tVars->SUB_FORUMTITLE = "<a href='".$e107->url->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->SUB_DESCRIPTION = $e107->tp->toHTML($subInfo['forum_description'], false, 'no_hook');
|
|
|
|
$tVars->SUB_THREADS = $subInfo['forum_threads'];
|
|
|
|
$tVars->SUB_REPLIES = $subInfo['forum_replies'];
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
$badgeReplies = ($subInfo['forum_replies']) ? "badge-info" : "";
|
|
|
|
$badgeThreads = ($subInfo['forum_replies']) ? "badge-info" : "";
|
|
|
|
|
|
|
|
$tVars->SUB_THREADSX = "<span class='badge {$badgeThreads}'>".$subInfo['forum_threads']."</span>";
|
|
|
|
$tVars->SUB_REPLIESX = "<span class='badge {$badgeReplies}'>".$subInfo['forum_replies']."</span>";
|
|
|
|
|
|
|
|
// $tVars->REPLIESX = "<span class='badge badge-info'>".$thread_info['thread_total_replies']."</span>";
|
|
|
|
// $tVars->VIEWSX = "<span class='badge {$badge}'>".$thread_info['thread_views']."</span>";
|
|
|
|
|
2008-12-12 03:36:39 +00:00
|
|
|
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
|
|
|
|
{
|
2010-03-14 00:50:27 +00:00
|
|
|
|
2011-11-28 14:19:19 +00:00
|
|
|
$tVars->NEWFLAG = "<a href='".$e107->url->create('forum/forum/mfar', 'id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->NEWFLAG = IMAGE_nonew;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if($subInfo['forum_lastpost_info'])
|
|
|
|
{
|
|
|
|
$tmp = explode('.', $subInfo['forum_lastpost_info']);
|
2011-11-28 14:19:19 +00:00
|
|
|
$lp_thread = "<a href='".$e107->url->create('forum/thread/last', array('id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
|
2008-12-12 03:36:39 +00:00
|
|
|
$lp_date = $gen->convert_date($tmp[0], 'forum');
|
|
|
|
|
|
|
|
if($subInfo['user_name'])
|
|
|
|
{
|
2011-11-28 14:19:19 +00:00
|
|
|
$lp_name = "<a href='".$e107->url->create('user/profile/view', array('id' => $subInfo['forum_lastpost_user'], 'name' => $subInfo['user_name']))."'>{$subInfo['user_name']}</a>";
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-15 00:29:20 +00:00
|
|
|
$lp_name = $subInfo['forum_lastpost_user_anon'];
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->SUB_LASTPOST = $lp_date.'<br />'.$lp_name.' '.$lp_thread;
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
$tVars->SUB_LASTPOSTDATE = $gen->computeLapse($tmp[0], time(), false, false, 'short');
|
|
|
|
$tVars->SUB_LASTPOSTUSER = $lp_name;
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-23 03:25:31 +00:00
|
|
|
$tVars->SUB_LASTPOST = '-';
|
2013-03-12 20:35:04 -07:00
|
|
|
$tVars->SUB_LASTPOSTUSER = '';
|
|
|
|
$tVars->SUB_LASTPOSTDATE = '';
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
2010-03-31 14:23:25 +00:00
|
|
|
return $tp->simpleParse($FORUM_VIEW_SUB, $tVars);
|
2008-12-12 03:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function forumjump()
|
|
|
|
{
|
|
|
|
global $forum;
|
2008-12-18 14:08:33 +00:00
|
|
|
$jumpList = $forum->forumGetAllowed('view');
|
2008-12-12 03:36:39 +00:00
|
|
|
$text = "<form method='post' action='".e_SELF."'><p>".LAN_403.": <select name='forumjump' class='tbox'>";
|
|
|
|
foreach($jumpList as $key => $val)
|
|
|
|
{
|
|
|
|
$text .= "\n<option value='".$key."'>".$val."</option>";
|
|
|
|
}
|
2013-03-10 19:44:54 -07:00
|
|
|
$text .= "</select> <input class='btn button' type='submit' name='fjsubmit' value='".LAN_03."' /></form>";
|
2008-12-12 03:36:39 +00:00
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
2013-03-12 04:22:09 -07:00
|
|
|
|
|
|
|
function fadminoptions($thread_info)
|
|
|
|
{
|
|
|
|
$tVars = new e_vars;
|
|
|
|
$e107 = e107::getInstance();
|
|
|
|
|
|
|
|
// $text = "<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'>";
|
|
|
|
$text .= '<div class="btn-group"><button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
|
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu left">
|
|
|
|
';
|
|
|
|
|
|
|
|
//FIXME - not fully working.
|
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
$moveUrl = $e107->url->create('forum/thread/move', "id=".$thread_info['thread_id']);
|
|
|
|
$lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock';
|
|
|
|
$stickUnstick = ($thread_info['thread_sticky'] == 1) ? 'unstick' : 'stick';
|
|
|
|
$id = intval($thread_info['thread_id']);
|
|
|
|
|
|
|
|
$lan = array('stick'=>'Stick','unstick'=>'Unstick','lock'=>"Lock", 'unlock'=>"Unlock");
|
|
|
|
|
2013-03-12 04:22:09 -07:00
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
$text .= "<li><a href='".e_REQUEST_URI."' data-forum-action='delete' data-forum-thread='".$id."'>Delete</a></li>";
|
|
|
|
$text .= "<li><a href='".e_REQUEST_URI."' data-forum-action='".$stickUnstick."' data-forum-thread='".$id."'>".$lan[$stickUnstick]."</a></li>";
|
|
|
|
$text .= "<li><a href='".e_REQUEST_URI."' data-forum-action='".$lockUnlock."' data-forum-thread='".$id."'><i class='icon_lock'></i> ".$lan[$lockUnlock]."</a></li>";
|
|
|
|
|
2013-03-12 04:22:09 -07:00
|
|
|
$text .= "<li><a href='{$moveUrl}'>Move</a></li>";
|
|
|
|
|
|
|
|
/*
|
|
|
|
$text .= "<li><input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" /> Delete</li>";
|
|
|
|
|
|
|
|
$text .= "<li>".($thread_info['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> Unstick" : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> Stick")."
|
|
|
|
</li>";
|
|
|
|
|
|
|
|
$text .= "<li>".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> Lock" : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> Unlock"). "
|
|
|
|
</li>";
|
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
$text .= "<li><a href='".$e107->url->create('forum/thread/move', "id={$thread_info['thread_id']}")."'>Move</a></li>";
|
2013-03-12 04:22:09 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
$text .= "</ul></div>";
|
|
|
|
// $text .= "</form>";
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fpages($thread_info, $replies)
|
|
|
|
{
|
|
|
|
global $forum;
|
|
|
|
|
|
|
|
$pages = ceil(($replies)/$forum->prefs->get('postspage'));
|
|
|
|
$urlparms = $thread_info;
|
|
|
|
|
|
|
|
if ($pages > 1)
|
|
|
|
{
|
|
|
|
if($pages > 6)
|
|
|
|
{
|
|
|
|
for($a = 0; $a <= 2; $a++)
|
|
|
|
{
|
|
|
|
$aa = $a + 1;
|
|
|
|
$text .= $text ? ' ' : '';
|
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
|
|
|
|
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
|
|
|
|
}
|
|
|
|
$text .= ' ... ';
|
|
|
|
for($a = $pages-3; $a <= $pages-1; $a++)
|
|
|
|
{
|
|
|
|
$aa = $a + 1;
|
|
|
|
$text .= $text ? ' ' : '';
|
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
|
|
|
|
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for($a = 0; $a <= ($pages-1); $a++)
|
|
|
|
{
|
|
|
|
$aa = $a + 1;
|
|
|
|
$text .= $text ? ' ' : '';
|
|
|
|
$urlparms['page'] = $aa;
|
|
|
|
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
|
|
|
|
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$text = implode("",$opts); // ."</div>";
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$text = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function newthreadjump($url)
|
|
|
|
{
|
|
|
|
global $forum;
|
|
|
|
$jumpList = $forum->forumGetAllowed('view');
|
|
|
|
$text = '<div class="btn-group">
|
|
|
|
<a href="'.$url.'" class="btn btn-primary">New Thread</a>
|
|
|
|
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
';
|
|
|
|
|
|
|
|
foreach($jumpList as $key => $val)
|
|
|
|
{
|
|
|
|
$text .= '<li><a href="'.$key.'">Go to: '.$val.'</a></li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$text .= '
|
|
|
|
</ul>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-12 03:36:39 +00:00
|
|
|
?>
|