mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Working on breadcrumb, almost there
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Id: thread.php,v 1.6 2008-12-13 21:52:19 mcfly_e107 Exp $
|
||||
// $Id: thread.php,v 1.7 2008-12-14 03:18:45 mcfly_e107 Exp $
|
||||
function url_forum_thread($parms)
|
||||
{
|
||||
switch($parms['func'])
|
||||
@@ -28,7 +28,7 @@ function url_forum_thread($parms)
|
||||
|
||||
case 'report':
|
||||
$page = (isset($parms['page']) ? (int)$parms['page'] : 0 );
|
||||
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=report&id={$parms['report']}&page={$page}";
|
||||
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=report&id={$parms['report']}&p={$page}";
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
|
||||
| $Revision: 1.25 $
|
||||
| $Date: 2008-12-13 21:52:18 $
|
||||
| $Revision: 1.26 $
|
||||
| $Date: 2008-12-14 03:18:45 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -282,9 +282,14 @@ class e107forum
|
||||
{
|
||||
//TODO: Fix query to get only forum and parent info needed, with correct naming
|
||||
$qry = '
|
||||
SELECT t.*, f.*, tr.track_userid
|
||||
SELECT t.*, f.*,
|
||||
fp.forum_id as parent_id, fp.forum_name as parent_name,
|
||||
sp.forum_id as forum_sub, sp.forum_name as sub_parent,
|
||||
tr.track_userid
|
||||
FROM `#forum_thread` AS t
|
||||
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
|
||||
LEFT JOIN `#forum` AS fp ON fp.forum_id = f.forum_parent
|
||||
LEFT JOIN `#forum` AS sp ON sp.forum_id = f.forum_sub
|
||||
LEFT JOIN `#forum_track` AS tr ON tr.track_thread = t.thread_id AND tr.track_userid = '.$uid.'
|
||||
WHERE thread_id = '.$id;
|
||||
}
|
||||
@@ -1347,63 +1352,57 @@ class e107forum
|
||||
*/
|
||||
function set_crumb($forum_href=false, $thread_title='')
|
||||
{
|
||||
global $FORUM_CRUMB, $forum_info, $threadInfo, $tp;
|
||||
$e107 = e107::getInstance();
|
||||
global $FORUM_CRUMB, $forumInfo, $thread;
|
||||
global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
|
||||
|
||||
if(!$forumInfo) { $forumInfo = $thread->threadInfo; }
|
||||
// var_dump($forumInfo);
|
||||
// var_dump($thread);
|
||||
|
||||
if(is_array($FORUM_CRUMB))
|
||||
{
|
||||
$search = array("{SITENAME}", "{SITENAME_HREF}");
|
||||
$replace = array(SITENAME, "href='".e_BASE."index.php'");
|
||||
$search = array('{SITENAME}', '{SITENAME_HREF}');
|
||||
$replace = array(SITENAME, "href='".$e107->url->getUrl('core:core', 'main', 'action=index')."'");
|
||||
$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
|
||||
|
||||
$search = array("{FORUMS_TITLE}", "{FORUMS_HREF}");
|
||||
$replace = array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
|
||||
$search = array('{FORUMS_TITLE}', '{FORUMS_HREF}');
|
||||
$replace = array(LAN_01, "href='".$e107->url->getUrl('forum', 'forum', 'func=main')."'");
|
||||
$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
|
||||
|
||||
$search = "{PARENT_TITLE}";
|
||||
$replace = $tp->toHTML($forum_info['parent_name']);
|
||||
$search = '{PARENT_TITLE}';
|
||||
$replace = $e107->tp->toHTML($forumInfo['parent_name']);
|
||||
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
|
||||
|
||||
if($forum_info['sub_parent'])
|
||||
if($forum_info['forum_sub'])
|
||||
{
|
||||
$search = array("{SUBPARENT_TITLE}", "{SUBPARENT_HREF}");
|
||||
$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
|
||||
$replace = array($forum_sub_parent, "href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'");
|
||||
$search = array('{SUBPARENT_TITLE}', '{SUBPARENT_HREF}');
|
||||
$replace = array(ltrim($forumInfo['sub_parent'], '*'), "href='".$e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_sub']}")."'");
|
||||
$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$FORUM_CRUMB['subparent']['value'] = "";
|
||||
$FORUM_CRUMB['subparent']['value'] = '';
|
||||
}
|
||||
|
||||
$search = array("{FORUM_TITLE}", "{FORUM_HREF}");
|
||||
$tmpFname = $forum_info['forum_name'];
|
||||
if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
|
||||
$replace = array($tmpFname,"href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'");
|
||||
$search = array('{FORUM_TITLE}', '{FORUM_HREF}');
|
||||
$replace = array(ltrim($forumInfo['forum_name'], '*'),"href='".$e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_id']}")."'");
|
||||
$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
|
||||
|
||||
if(strlen($thread_title))
|
||||
{
|
||||
$search = array("{THREAD_TITLE}");
|
||||
$replace = array($thread_title);
|
||||
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$FORUM_CRUMB['thread']['value'] = "";
|
||||
}
|
||||
|
||||
$FORUM_CRUMB['fieldlist'] = "sitename,forums,parent,subparent,forum,thread";
|
||||
$BREADCRUMB = $tp->parseTemplate("{BREADCRUMB=FORUM_CRUMB}", true);
|
||||
$search = array('{THREAD_TITLE}');
|
||||
$replace = array($thread->threadInfo['thread_name']);
|
||||
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
|
||||
|
||||
$FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread';
|
||||
$BREADCRUMB = $e107->tp->parseTemplate('{BREADCRUMB=FORUM_CRUMB}', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dfltsep = " :: ";
|
||||
$dfltsep = ' :: ';
|
||||
$BREADCRUMB = "<a class='forumlink' href='".e_BASE."index.php'>".SITENAME."</a>".$dfltsep."<a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_01."</a>".$dfltsep;
|
||||
if($forum_info['sub_parent'])
|
||||
{
|
||||
$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
|
||||
$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == '*' ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
|
||||
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
|
||||
}
|
||||
|
||||
@@ -1448,35 +1447,35 @@ function img_path($filename)
|
||||
{
|
||||
global $pref;
|
||||
|
||||
$multilang = array("reply.png","newthread.png","moderator.png","main_admin.png","admin.png");
|
||||
$multilang = array('reply.png','newthread.png','moderator.png','main_admin.png','admin.png');
|
||||
$ML = (in_array($filename,$multilang)) ? TRUE : FALSE;
|
||||
|
||||
if(file_exists(THEME.'forum/'.$filename) || is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename))
|
||||
if(file_exists(THEME.'forum/'.$filename) || is_readable(THEME.'forum/'.e_LANGUAGE.'_'.$filename))
|
||||
{
|
||||
$image = ($ML && is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename)) ? THEME.'forum/'.e_LANGUAGE."_".$filename : THEME.'forum/'.$filename;
|
||||
$image = ($ML && is_readable(THEME.'forum/'.e_LANGUAGE.'_'.$filename)) ? THEME.'forum/'.e_LANGUAGE."_".$filename : THEME.'forum/'.$filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(defined("IMODE"))
|
||||
if(defined('IMODE'))
|
||||
{
|
||||
if($ML)
|
||||
{
|
||||
$image = (is_readable(e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/".IMODE."/English_".$filename;
|
||||
$image = (is_readable(e_PLUGIN.'forum/images/'.IMODE.'/'.e_LANGUAGE.'_'.$filename)) ? e_PLUGIN.'forum/images/'.IMODE.'/'.e_LANGUAGE.'_'.$filename : e_PLUGIN.'forum/images/'.IMODE.'/English_'.$filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = e_PLUGIN."forum/images/".IMODE."/".$filename;
|
||||
$image = e_PLUGIN.'forum/images/'.IMODE.'/'.$filename;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($ML)
|
||||
{
|
||||
$image = (is_readable(e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/lite/English_".$filename;
|
||||
$image = (is_readable(e_PLUGIN."forum/images/lite/".e_LANGUAGE.'_'.$filename)) ? e_PLUGIN.'forum/images/lite/'.e_LANGUAGE.'_'.$filename : e_PLUGIN.'forum/images/lite/English_'.$filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = e_PLUGIN."forum/images/lite/".$filename;
|
||||
$image = e_PLUGIN.'forum/images/lite/'.$filename;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1492,7 +1491,7 @@ if (file_exists(THEME.'forum/forum_icons_template.php'))
|
||||
{
|
||||
require_once(THEME.'forum/forum_icons_template.php');
|
||||
}
|
||||
else if (file_exists(THEME.'forum_icons_template.php'))
|
||||
elseif (file_exists(THEME.'forum_icons_template.php'))
|
||||
{
|
||||
require_once(THEME.'forum_icons_template.php');
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* View specific forums
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2008-12-12 03:36:39 $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2008-12-14 03:18:45 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@@ -33,20 +33,6 @@ if (!e_QUERY)
|
||||
$view = 25;
|
||||
$threadFrom = (isset($_REQUEST['p']) ? $_REQUEST['p'] * $view : 0);
|
||||
|
||||
/*
|
||||
else
|
||||
{
|
||||
$tmp = explode('.', e_QUERY);
|
||||
$forum_id = (int)$tmp[0];
|
||||
$thread_from = (isset($tmp[1]) ? (int)$tmp[1] : 0);
|
||||
}
|
||||
|
||||
if(is_numeric(e_MENU))
|
||||
{
|
||||
$thread_from = (intval(e_MENU)-1)*$view;
|
||||
}
|
||||
*/
|
||||
|
||||
require_once(e_PLUGIN.'forum/forum_class.php');
|
||||
$forum = new e107forum;
|
||||
|
||||
@@ -68,6 +54,8 @@ if (!$forum->checkPerm($forumId, 'view'))
|
||||
|
||||
$forumInfo = $forum->forum_get($forumId);
|
||||
|
||||
//var_dump($forumInfo);
|
||||
|
||||
if (!$FORUM_VIEW_START)
|
||||
{
|
||||
if (file_exists(THEME.'forum_viewforum_template.php'))
|
||||
@@ -239,11 +227,6 @@ if(is_array($sub_list))
|
||||
|
||||
if (count($threadList) )
|
||||
{
|
||||
// foreach($threadList as $thread_info)
|
||||
// {
|
||||
// $idArray[] = $thread_info['thread_id'];
|
||||
// }
|
||||
// $inList = '('.implode(',', $idArray).')';
|
||||
foreach($threadList as $thread_info)
|
||||
{
|
||||
if($thread_info['thread_options'])
|
||||
@@ -294,7 +277,6 @@ else
|
||||
$forum_view_forum .= "<tr><td class='forumheader' colspan='6'>".LAN_58."</td></tr>";
|
||||
}
|
||||
|
||||
//$sql->db_Select('forum', '*', "forum_parent !=0 AND forum_class != '255' ");
|
||||
$FORUMJUMP = forumjump();
|
||||
$TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_02.'</a>';
|
||||
|
||||
@@ -428,13 +410,15 @@ function parse_thread($thread_info)
|
||||
for($a = 0; $a <= 2; $a++)
|
||||
{
|
||||
$PAGES .= $PAGES ? ' ' : '';
|
||||
$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
|
||||
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
|
||||
$PAGES .= "<a href='{$url}'>".($a+1).'</a>';
|
||||
}
|
||||
$PAGES .= ' ... ';
|
||||
for($a = $pages-3; $a <= $pages-1; $a++)
|
||||
{
|
||||
$PAGES .= $PAGES ? " " : "";
|
||||
$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
|
||||
$PAGES .= $PAGES ? ' ' : '';
|
||||
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
|
||||
$PAGES .= "<a href='{$url}'>".($a+1).'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -442,7 +426,8 @@ function parse_thread($thread_info)
|
||||
for($a = 0; $a <= ($pages-1); $a++)
|
||||
{
|
||||
$PAGES .= $PAGES ? ' ' : '';
|
||||
$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
|
||||
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
|
||||
$PAGES .= "<a href='{$url}'>".($a+1).'</a>';
|
||||
}
|
||||
}
|
||||
$PAGES = LAN_316.' [ '.$PAGES.' ]';
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-12-13 21:52:18 $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2008-12-14 03:18:45 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ if(isset($_POST['track_toggle']))
|
||||
if(isset($_GET['f']))
|
||||
{
|
||||
$thread->processFunction();
|
||||
$thread->init();
|
||||
if($_GET['f'] != 'last') { $thread->init(); }
|
||||
}
|
||||
|
||||
require_once (e_PLUGIN . 'forum/forum_shortcodes.php');
|
||||
@@ -84,7 +84,7 @@ if (MODERATOR && isset($_POST['mod']))
|
||||
$thread->threadInfo = $forum->threadGet($thread->threadId);
|
||||
}
|
||||
|
||||
$postList = $forum->PostGet($thread->threadId, ($thread->page-1) * $thread->perPage, $thread->perPage);
|
||||
$postList = $forum->PostGet($thread->threadId, $thread->page * $thread->perPage, $thread->perPage);
|
||||
|
||||
//var_dump($thread->threadInfo);
|
||||
require_once (e_HANDLER . 'level_handler.php');
|
||||
@@ -166,9 +166,11 @@ $THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : '');
|
||||
|
||||
//$pages = ceil(($threadInfo['thread_total_replies'] + 1) / $perPage);
|
||||
|
||||
//echo "pages = {$thread->pages}<br />";
|
||||
//var_dump($thread);
|
||||
if ($thread->pages > 1)
|
||||
{
|
||||
$parms = ($thread->threadInfo['thread_total_replies'] + 1) . ",{$perPage},{$topic_from}," . e_SELF . '?' . $this->threadId . '.[FROM],off';
|
||||
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off";
|
||||
$GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
}
|
||||
|
||||
@@ -445,7 +447,7 @@ function rpg($user_join, $user_forums)
|
||||
class e107ForumThread
|
||||
{
|
||||
|
||||
var $message, $threadId, $threadInfo, $forumId, $perPage, $noInc;
|
||||
var $message, $threadId, $threadInfo, $forumId, $perPage, $noInc, $pages;
|
||||
|
||||
function init()
|
||||
{
|
||||
@@ -453,7 +455,7 @@ class e107ForumThread
|
||||
$e107 = e107::getInstance();
|
||||
$this->threadId = (int)varset($_GET['id']);
|
||||
$this->perPage = (varset($_GET['perpage']) ? (int)$_GET['perpage'] : $pref['forum_postspage']);
|
||||
$this->page = (varset($_GET['p']) ? (int)$_GET['p'] : 1);
|
||||
$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))
|
||||
@@ -468,6 +470,7 @@ class e107ForumThread
|
||||
header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main')));
|
||||
exit;
|
||||
}
|
||||
$this->pages = ceil(($this->threadInfo['thread_total_replies'] + 1) / $this->perPage);
|
||||
$this->noInc = false;
|
||||
}
|
||||
|
||||
@@ -510,17 +513,18 @@ class e107ForumThread
|
||||
$postId = varset($_GET['id']);
|
||||
$postInfo = $forum->postGet($postId,'post');
|
||||
$postNum = $forum->postGetPostNum($postInfo['post_thread'], $postId);
|
||||
$postPage = ceil($postNum / $pref['forum_postspage']);
|
||||
$postPage = ceil($postNum / $pref['forum_postspage'])-1;
|
||||
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$postInfo['post_thread']}&page=$postPage");
|
||||
// echo "url: $url <br />";
|
||||
header('location: '.$url);
|
||||
exit;
|
||||
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;
|
||||
// var_dump($thread);
|
||||
$pages = ceil(($thread->threadInfo['thread_total_replies'] + 1) / $thread->perPage);
|
||||
echo "pages = $pages<br />";
|
||||
$thread->page = ($pages - 1);
|
||||
break;
|
||||
|
||||
case 'next':
|
||||
|
Reference in New Issue
Block a user