mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Forum: Added SEF URLs on subForums.
This commit is contained in:
@@ -43,6 +43,7 @@ class forum_url // plugin-folder + '_url'
|
|||||||
'redirect' => '{e_PLUGIN}forum/forum_post.php',
|
'redirect' => '{e_PLUGIN}forum/forum_post.php',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// only create url - parsed above.
|
||||||
$config['move'] = array(
|
$config['move'] = array(
|
||||||
'sef' => 'forum/post/?f=move&id={thread_id}',
|
'sef' => 'forum/post/?f=move&id={thread_id}',
|
||||||
);
|
);
|
||||||
@@ -52,7 +53,14 @@ class forum_url // plugin-folder + '_url'
|
|||||||
'sef' => 'forum/{forum_sef}/{thread_id}-{thread_sef}/',
|
'sef' => 'forum/{forum_sef}/{thread_id}-{thread_sef}/',
|
||||||
'redirect' => '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4'
|
'redirect' => '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4'
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
|
$config['subforum'] = array(
|
||||||
|
'regex' => '^forum/(.*)/(.*)$',
|
||||||
|
'sef' => 'forum/{parent_sef}/{forum_sef}',
|
||||||
|
'redirect' => '{e_PLUGIN}forum/forum_viewforum.php?sef=$2',
|
||||||
|
'legacy' => '{e_PLUGIN}forum/forum_viewforum.php?id={forum_id}'
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
$config['forum'] = array(
|
$config['forum'] = array(
|
||||||
'regex' => '^forum/(.*)$',
|
'regex' => '^forum/(.*)$',
|
||||||
|
@@ -379,7 +379,7 @@ function parse_forum($f, $restricted_string = '')
|
|||||||
if(is_array($forumList['subs'][$f['forum_id']]))
|
if(is_array($forumList['subs'][$f['forum_id']]))
|
||||||
{
|
{
|
||||||
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
|
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
|
||||||
$ret = parse_subs($forumList['subs'][$f['forum_id']], $lastpost_datestamp);
|
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
|
||||||
$fVars->FORUMSUBFORUMS = "<br /><div class='smalltext'>".LAN_FORUM_0069.": {$ret['text']}</div>";
|
$fVars->FORUMSUBFORUMS = "<br /><div class='smalltext'>".LAN_FORUM_0069.": {$ret['text']}</div>";
|
||||||
$fVars->THREADS += $ret['threads'];
|
$fVars->THREADS += $ret['threads'];
|
||||||
$fVars->REPLIES += $ret['replies'];
|
$fVars->REPLIES += $ret['replies'];
|
||||||
@@ -426,20 +426,31 @@ function parse_forum($f, $restricted_string = '')
|
|||||||
return $tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
|
return $tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_subs($subList, $lastpost_datestamp)
|
|
||||||
|
|
||||||
|
function parse_subs($forumList, $id ='', $lastpost_datestamp)
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
|
$subList = $forumList['subs'][$id];
|
||||||
|
|
||||||
$ret['text'] = '';
|
$ret['text'] = '';
|
||||||
|
|
||||||
foreach($subList as $sub)
|
foreach($subList as $sub)
|
||||||
{
|
{
|
||||||
$ret['text'] .= ($ret['text'] ? ', ' : '');
|
$ret['text'] .= ($ret['text'] ? ', ' : '');
|
||||||
$suburl = $e107->url->create('forum/forum/view', $sub);
|
|
||||||
$ret['text'] .= "<a href='{$suburl}'>".$tp->toHTML($sub['forum_name']).'</a>';
|
$urlData = $sub;
|
||||||
$ret['threads'] += $sub['forum_threads'];
|
$urlData['parent_sef'] = $forumList['all'][$sub['forum_sub']]['forum_sef']; // = array('parent_sef'=>
|
||||||
$ret['replies'] += $sub['forum_replies'];
|
$suburl = e107::url('forum','forum', $urlData);
|
||||||
$tmp = explode('.', $sub['forum_lastpost_info']);
|
|
||||||
|
$ret['text'] .= "<a href='{$suburl}'>".$tp->toHTML($sub['forum_name']).'</a>';
|
||||||
|
$ret['threads'] += $sub['forum_threads'];
|
||||||
|
$ret['replies'] += $sub['forum_replies'];
|
||||||
|
$tmp = explode('.', $sub['forum_lastpost_info']);
|
||||||
|
|
||||||
if($tmp[0] > $lastpost_datestamp)
|
if($tmp[0] > $lastpost_datestamp)
|
||||||
{
|
{
|
||||||
$ret['lastpost_info'] = $sub['forum_lastpost_info'];
|
$ret['lastpost_info'] = $sub['forum_lastpost_info'];
|
||||||
@@ -449,9 +460,13 @@ function parse_subs($subList, $lastpost_datestamp)
|
|||||||
$lastpost_datestamp = $tmp[0];
|
$lastpost_datestamp = $tmp[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (e_QUERY == 'track')
|
if (e_QUERY == 'track')
|
||||||
{
|
{
|
||||||
if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list'))
|
if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list'))
|
||||||
@@ -493,6 +508,8 @@ if (e_QUERY == 'track')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (e_QUERY == 'new')
|
if (e_QUERY == 'new')
|
||||||
{
|
{
|
||||||
$nVars = new e_vars;
|
$nVars = new e_vars;
|
||||||
@@ -553,6 +570,14 @@ else
|
|||||||
{
|
{
|
||||||
echo $forum_main_start.$forum_string.$forum_main_end;
|
echo $forum_main_start.$forum_string.$forum_main_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
|
|
||||||
function forum_rules($action = 'check')
|
function forum_rules($action = 'check')
|
||||||
|
@@ -863,8 +863,9 @@ class e107forum
|
|||||||
//TODO: Fix query to get only forum and parent info needed, with correct naming
|
//TODO: Fix query to get only forum and parent info needed, with correct naming
|
||||||
$qry = '
|
$qry = '
|
||||||
SELECT t.*, f.*,
|
SELECT t.*, f.*,
|
||||||
fp.forum_id as parent_id, fp.forum_name as parent_name,
|
fp.forum_id AS parent_id, fp.forum_name AS parent_name,
|
||||||
sp.forum_id as forum_sub, sp.forum_name as sub_parent,
|
sp.forum_id AS forum_sub, sp.forum_name AS sub_parent,
|
||||||
|
sp.forum_sef AS parent_sef,
|
||||||
tr.track_userid
|
tr.track_userid
|
||||||
FROM `#forum_thread` AS t
|
FROM `#forum_thread` AS t
|
||||||
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
|
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
|
||||||
@@ -897,7 +898,7 @@ class e107forum
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e107::getMessage()->addDebug('Query failed ('.__METHOD__.' ): '.$qry);
|
e107::getMessage()->addDebug('Query failed ('.__METHOD__.' ): '.str_replace('#', MPREFIX,$qry));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1379,6 +1380,9 @@ class e107forum
|
|||||||
{
|
{
|
||||||
$ret['forums'][$row['forum_parent']][] = $row;
|
$ret['forums'][$row['forum_parent']][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = $row['forum_id'];
|
||||||
|
$ret['all'][$id] = $row;
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@@ -1544,7 +1548,10 @@ class e107forum
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$forum_id = (int)$forum_id;
|
$forum_id = (int)$forum_id;
|
||||||
$qry = "
|
$qry = "
|
||||||
SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name, fp.forum_id as parent_id, fp.forum_postclass as parent_postclass, sp.forum_name AS sub_parent FROM #forum AS f
|
SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name,
|
||||||
|
fp.forum_id as parent_id, fp.forum_postclass as parent_postclass,
|
||||||
|
sp.forum_name AS sub_parent, sp.forum_sef AS parent_sef
|
||||||
|
FROM #forum AS f
|
||||||
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
|
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
|
||||||
LEFT JOIN #forum AS sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0
|
LEFT JOIN #forum AS sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0
|
||||||
WHERE f.forum_id = {$forum_id}
|
WHERE f.forum_id = {$forum_id}
|
||||||
@@ -1845,7 +1852,7 @@ class e107forum
|
|||||||
*/
|
*/
|
||||||
function set_crumb($forum_href=false, $thread_title='', &$templateVar)
|
function set_crumb($forum_href=false, $thread_title='', &$templateVar)
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
|
|
||||||
@@ -1923,7 +1930,8 @@ class e107forum
|
|||||||
|
|
||||||
// New v2.x Bootstrap Standardized Breadcrumb.
|
// New v2.x Bootstrap Standardized Breadcrumb.
|
||||||
|
|
||||||
// return print_a($forumInfo);
|
// print_a($forumInfo);
|
||||||
|
// return;
|
||||||
|
|
||||||
$breadcrumb = array();
|
$breadcrumb = array();
|
||||||
|
|
||||||
@@ -1938,11 +1946,16 @@ class e107forum
|
|||||||
|
|
||||||
if($forumInfo['forum_sub'])
|
if($forumInfo['forum_sub'])
|
||||||
{
|
{
|
||||||
$breadcrumb[] = array('text'=> ltrim($forumInfo['sub_parent'], '*') , 'url'=> e107::getUrl()->create('forum/forum/view', "id={$forumInfo['forum_sub']}"));
|
$breadcrumb[] = array('text'=> ltrim($forumInfo['sub_parent'], '*') , 'url'=> e107::url('forum','forum', array('forum_sef'=> $forumInfo['parent_sef'])));
|
||||||
|
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
|
{
|
||||||
|
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(vartrue($forumInfo['thread_name']))
|
if(vartrue($forumInfo['thread_name']))
|
||||||
{
|
{
|
||||||
$breadcrumb[] = array('text'=> $forumInfo['thread_name'] , 'url'=>null);
|
$breadcrumb[] = array('text'=> $forumInfo['thread_name'] , 'url'=>null);
|
||||||
|
@@ -389,7 +389,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fVars->FORUMJUMP = forumjump();
|
$fVars->FORUMJUMP = forumjump();
|
||||||
$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GOTO.'</a>'; // FIXME - TOPLINK not used anymore?
|
$fVars->TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_GO.'</a>'; // FIXME - TOPLINK not used anymore?
|
||||||
|
|
||||||
if($container_only)
|
if($container_only)
|
||||||
{
|
{
|
||||||
@@ -428,8 +428,6 @@ function parse_thread($thread_info)
|
|||||||
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
|
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$tVars = new e_vars;
|
$tVars = new e_vars;
|
||||||
$e107 = e107::getInstance();
|
|
||||||
$text = '';
|
|
||||||
|
|
||||||
$threadId = $thread_info['thread_id'];
|
$threadId = $thread_info['thread_id'];
|
||||||
$forumId = $thread_info['thread_forum_id'];
|
$forumId = $thread_info['thread_forum_id'];
|
||||||
@@ -542,6 +540,7 @@ function parse_thread($thread_info)
|
|||||||
|
|
||||||
|
|
||||||
// FIXME - pages -> convert to nextprev shortcode
|
// FIXME - pages -> convert to nextprev shortcode
|
||||||
|
/*
|
||||||
$pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage'));
|
$pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage'));
|
||||||
$urlparms = $thread_info;
|
$urlparms = $thread_info;
|
||||||
if ($pages > 1)
|
if ($pages > 1)
|
||||||
@@ -583,7 +582,10 @@ function parse_thread($thread_info)
|
|||||||
{
|
{
|
||||||
$tVars->PAGES = '';
|
$tVars->PAGES = '';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
$tVars->PAGES = fpages($thread_info, $tVars->REPLIES);
|
||||||
$tVars->PAGESX = fpages($thread_info, $tVars->REPLIES);
|
$tVars->PAGESX = fpages($thread_info, $tVars->REPLIES);
|
||||||
|
|
||||||
if (MODERATOR)
|
if (MODERATOR)
|
||||||
@@ -606,9 +608,6 @@ function parse_thread($thread_info)
|
|||||||
$tVars->ADMINOPTIONS = fadminoptions($thread_info);
|
$tVars->ADMINOPTIONS = fadminoptions($thread_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</td>
|
|
||||||
<td style='vertical-align:top; text-align:center; width:20%' class='forumheader3'>".$THREADDATE.'<br />';
|
|
||||||
// $tmp = explode('.', $thread_info['thread_user'], 2);
|
|
||||||
|
|
||||||
if($thread_info['user_name'])
|
if($thread_info['user_name'])
|
||||||
{
|
{
|
||||||
@@ -667,12 +666,13 @@ function parse_thread($thread_info)
|
|||||||
return $tp->simpleParse($_TEMPLATE, $tVars);
|
return $tp->simpleParse($_TEMPLATE, $tVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function parse_sub($subInfo)
|
function parse_sub($subInfo)
|
||||||
{
|
{
|
||||||
global $FORUM_VIEW_SUB, $gen, $newflag_list;
|
global $FORUM_VIEW_SUB, $gen, $newflag_list;
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$tVars = new e_vars;
|
$tVars = new e_vars;
|
||||||
$e107 = e107::getInstance();
|
|
||||||
$forumName = $tp->toHTML($subInfo['forum_name'], true);
|
$forumName = $tp->toHTML($subInfo['forum_name'], true);
|
||||||
$tVars->SUB_FORUMTITLE = "<a href='".e107::getUrl()->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
|
$tVars->SUB_FORUMTITLE = "<a href='".e107::getUrl()->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
|
||||||
$tVars->SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
|
$tVars->SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
|
||||||
|
@@ -705,8 +705,9 @@ class e107ForumThread
|
|||||||
{
|
{
|
||||||
if(E107_DEBUG_LEVEL > 0)
|
if(E107_DEBUG_LEVEL > 0)
|
||||||
{
|
{
|
||||||
echo __METHOD__ .' Line: '.__LINE__;
|
e107::getMessage()->addError("Thread not found or query error: ". __METHOD__ .' Line: '.__LINE__ );
|
||||||
exit;
|
return;
|
||||||
|
// exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = e107::url('forum','index','full');
|
$url = e107::url('forum','index','full');
|
||||||
|
Reference in New Issue
Block a user