diff --git a/e107_plugins/forum/e_url.php b/e107_plugins/forum/e_url.php index 1d135e9bd..22c65ffe5 100644 --- a/e107_plugins/forum/e_url.php +++ b/e107_plugins/forum/e_url.php @@ -43,6 +43,7 @@ class forum_url // plugin-folder + '_url' 'redirect' => '{e_PLUGIN}forum/forum_post.php', ); + // only create url - parsed above. $config['move'] = array( '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}/', '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( 'regex' => '^forum/(.*)$', diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php index bb42efbde..1193f16ee 100644 --- a/e107_plugins/forum/forum.php +++ b/e107_plugins/forum/forum.php @@ -379,7 +379,7 @@ function parse_forum($f, $restricted_string = '') if(is_array($forumList['subs'][$f['forum_id']])) { 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 = "
".LAN_FORUM_0069.": {$ret['text']}
"; $fVars->THREADS += $ret['threads']; $fVars->REPLIES += $ret['replies']; @@ -426,20 +426,31 @@ function parse_forum($f, $restricted_string = '') 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(); $ret = array(); + + $subList = $forumList['subs'][$id]; + $ret['text'] = ''; + foreach($subList as $sub) { $ret['text'] .= ($ret['text'] ? ', ' : ''); - $suburl = $e107->url->create('forum/forum/view', $sub); - $ret['text'] .= "".$tp->toHTML($sub['forum_name']).''; - $ret['threads'] += $sub['forum_threads']; - $ret['replies'] += $sub['forum_replies']; - $tmp = explode('.', $sub['forum_lastpost_info']); + + $urlData = $sub; + $urlData['parent_sef'] = $forumList['all'][$sub['forum_sub']]['forum_sef']; // = array('parent_sef'=> + $suburl = e107::url('forum','forum', $urlData); + + $ret['text'] .= "".$tp->toHTML($sub['forum_name']).''; + $ret['threads'] += $sub['forum_threads']; + $ret['replies'] += $sub['forum_replies']; + $tmp = explode('.', $sub['forum_lastpost_info']); + if($tmp[0] > $lastpost_datestamp) { $ret['lastpost_info'] = $sub['forum_lastpost_info']; @@ -449,9 +460,13 @@ function parse_subs($subList, $lastpost_datestamp) $lastpost_datestamp = $tmp[0]; } } + + return $ret; } + + if (e_QUERY == 'track') { if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list')) @@ -493,6 +508,8 @@ if (e_QUERY == 'track') } } + + if (e_QUERY == 'new') { $nVars = new e_vars; @@ -553,6 +570,14 @@ else { echo $forum_main_start.$forum_string.$forum_main_end; } + + + + + + + + require_once(FOOTERF); function forum_rules($action = 'check') diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index d3fb5759b..e593aca52 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -863,8 +863,9 @@ class e107forum //TODO: Fix query to get only forum and parent info needed, with correct naming $qry = ' 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, + 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_sef AS parent_sef, tr.track_userid FROM `#forum_thread` AS t LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id @@ -897,7 +898,7 @@ class e107forum } else { - e107::getMessage()->addDebug('Query failed ('.__METHOD__.' ): '.$qry); + e107::getMessage()->addDebug('Query failed ('.__METHOD__.' ): '.str_replace('#', MPREFIX,$qry)); } return false; } @@ -1379,6 +1380,9 @@ class e107forum { $ret['forums'][$row['forum_parent']][] = $row; } + + $id = $row['forum_id']; + $ret['all'][$id] = $row; } return $ret; } @@ -1544,7 +1548,10 @@ class e107forum $sql = e107::getDb(); $forum_id = (int)$forum_id; $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 sp ON f.forum_sub = sp.forum_id AND f.forum_sub > 0 WHERE f.forum_id = {$forum_id} @@ -1845,7 +1852,7 @@ class e107forum */ function set_crumb($forum_href=false, $thread_title='', &$templateVar) { - $e107 = e107::getInstance(); + $tp = e107::getParser(); $frm = e107::getForm(); @@ -1923,7 +1930,8 @@ class e107forum // New v2.x Bootstrap Standardized Breadcrumb. - // return print_a($forumInfo); + // print_a($forumInfo); + // return; $breadcrumb = array(); @@ -1938,11 +1946,16 @@ class e107forum 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); + } - - $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); + + } + if(vartrue($forumInfo['thread_name'])) { $breadcrumb[] = array('text'=> $forumInfo['thread_name'] , 'url'=>null); diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php index 269b14d1b..4b5b49635 100644 --- a/e107_plugins/forum/forum_viewforum.php +++ b/e107_plugins/forum/forum_viewforum.php @@ -389,7 +389,7 @@ else } $fVars->FORUMJUMP = forumjump(); -$fVars->TOPLINK = "".LAN_GOTO.''; // FIXME - TOPLINK not used anymore? +$fVars->TOPLINK = "".LAN_GO.''; // FIXME - TOPLINK not used anymore? 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; $tp = e107::getParser(); $tVars = new e_vars; - $e107 = e107::getInstance(); - $text = ''; $threadId = $thread_info['thread_id']; $forumId = $thread_info['thread_forum_id']; @@ -542,6 +540,7 @@ function parse_thread($thread_info) // FIXME - pages -> convert to nextprev shortcode + /* $pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage')); $urlparms = $thread_info; if ($pages > 1) @@ -583,7 +582,10 @@ function parse_thread($thread_info) { $tVars->PAGES = ''; } - + */ + + + $tVars->PAGES = fpages($thread_info, $tVars->REPLIES); $tVars->PAGESX = fpages($thread_info, $tVars->REPLIES); if (MODERATOR) @@ -606,9 +608,6 @@ function parse_thread($thread_info) $tVars->ADMINOPTIONS = fadminoptions($thread_info); } - $text .= " - ".$THREADDATE.'
'; -// $tmp = explode('.', $thread_info['thread_user'], 2); if($thread_info['user_name']) { @@ -667,12 +666,13 @@ function parse_thread($thread_info) return $tp->simpleParse($_TEMPLATE, $tVars); } + function parse_sub($subInfo) { global $FORUM_VIEW_SUB, $gen, $newflag_list; $tp = e107::getParser(); $tVars = new e_vars; - $e107 = e107::getInstance(); + $forumName = $tp->toHTML($subInfo['forum_name'], true); $tVars->SUB_FORUMTITLE = "{$forumName}"; $tVars->SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook'); diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index 4e2063a21..31f22ebfb 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -705,8 +705,9 @@ class e107ForumThread { if(E107_DEBUG_LEVEL > 0) { - echo __METHOD__ .' Line: '.__LINE__; - exit; + e107::getMessage()->addError("Thread not found or query error: ". __METHOD__ .' Line: '.__LINE__ ); + return; + // exit; } $url = e107::url('forum','index','full');