diff --git a/e107_handlers/level_handler.php b/e107_handlers/level_handler.php index 1d11bfb38..1c66b2a22 100644 --- a/e107_handlers/level_handler.php +++ b/e107_handlers/level_handler.php @@ -9,9 +9,9 @@ * * * $Source: /cvs_backup/e107_0.8/e107_handlers/level_handler.php,v $ - * $Revision: 1.12 $ - * $Date: 2009-11-18 01:04:43 $ - * $Author: e107coders $ + * $Revision: 1.13 $ + * $Date: 2010-02-01 03:41:59 $ + * $Author: mcfly_e107 $ */ if (!defined('e107_INIT')) { exit; } @@ -246,9 +246,11 @@ class e107UserRank $search[] = '{'.$f.'}'; $replace[] = $userData['user_'.$f]; } - $calc = '$userLevelValue = '.str_replace($search, $replace, $calc).';'; + $_calc = trim(str_replace($search, $replace, $calc)); + if($_calc == '') { return 0; } + $calc = '$userLevelValue = '.$_calc.';'; $value = eval($calc); - return $userLevelValue; + return $value; } } diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php index 47c0ed571..6a6ca59a6 100644 --- a/e107_plugins/forum/forum.php +++ b/e107_plugins/forum/forum.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $ -| $Revision: 1.17 $ -| $Date: 2010-01-23 03:25:31 $ +| $Revision: 1.18 $ +| $Date: 2010-02-01 03:41:57 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -56,7 +56,7 @@ if(isset($_GET['f'])) break; } } -$fVars = new templateVars; +$fVars = new e_vars; $gen = new convert; $fVars->FORUMTITLE = LAN_46; @@ -221,7 +221,7 @@ if (!$forumList) } $forum_string = ''; -$pVars = new templateVars; +$pVars = new e_vars; foreach ($forumList['parents'] as $parent) { $status = parse_parent($parent); @@ -229,7 +229,6 @@ foreach ($forumList['parents'] as $parent) if ($status[1]) { $pVars->PARENTNAME = $parent['forum_name']; - //$forum_string .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_MAIN_PARENT); $forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars); if (!count($forumList['forums'][$parent['forum_id']])) { @@ -262,7 +261,6 @@ foreach ($forumList['parents'] as $parent) } if (isset($FORUM_MAIN_PARENT_END)) { -// $forum_string .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_MAIN_PARENT_END); $forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT_END, $pVars); } } @@ -290,7 +288,7 @@ function parse_parent($parent) function parse_forum($f, $restricted_string = '') { global $FORUM_MAIN_FORUM, $gen, $forum, $newflag_list, $forumList; - $fVars = new templateVars; + $fVars = new e_vars; $e107 = e107::getInstance(); if(USER && is_array($newflag_list) && in_array($f['forum_id'], $newflag_list)) @@ -352,7 +350,6 @@ function parse_forum($f, $restricted_string = '') $fVars->LASTPOST = '-'; } return $e107->tp->simpleParse($FORUM_MAIN_FORUM, $fVars); -// return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_MAIN_FORUM)); } function parse_subs($subList, $lastpost_datestamp) @@ -384,7 +381,7 @@ if (e_QUERY == 'track') { if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list')) { - $trackVars = new templateVars; + $trackVars = new e_vars; $viewed = $forum->threadGetUserViewed(); $qry = " SELECT t.*, p.* from `#forum_thread` AS t @@ -406,12 +403,9 @@ if (e_QUERY == 'track') $trackVars->TRACKPOSTNAME = "".$e107->tp->toHTML($row['thread_name']).''; $trackVars->UNTRACK = "".LAN_392.""; $forum_trackstring .= $e107->tp->simpleParse($FORUM_TRACK_MAIN, $trackVars); -// $forum_trackstring .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_TRACK_MAIN); } } -// $forum_track_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_TRACK_START); $forum_track_start = $e107->tp->simpleParse($FORUM_TRACK_START, $trackVars); -// $forum_track_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_TRACK_END); $forum_track_end = $e107->tp->simpleParse($FORUM_TRACK_END, $trackVars); if ($pref['forum_enclose']) { @@ -426,7 +420,7 @@ if (e_QUERY == 'track') if (e_QUERY == 'new') { - $nVars = new templateVars; + $nVars = new e_vars; $newThreadList = $forum->threadGetNew(10); foreach($newThreadList as $thread) { @@ -443,20 +437,16 @@ if (e_QUERY == 'new') } $nVars->NEWSPOSTNAME = "".$e107->tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').''; -// $forum_newstring .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN); $forum_newstring .= $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars); } if (!$newThreadList) { $nVars->NEWSPOSTNAME = LAN_198; -// $forum_newstring = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN); $forum_newstring = $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars); } -// $forum_new_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_START); $forum_new_start = $e107->tp->simpleParse($FORUM_NEWPOSTS_START, $nVars); -// $forum_new_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_END); $forum_new_end = $e107->tp->simpleParse($FORUM_NEWPOSTS_END, $nVars); if ($pref['forum_enclose']) @@ -469,9 +459,7 @@ if (e_QUERY == 'new') } } -//$forum_main_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_MAIN_START); $forum_main_start = $e107->tp->simpleParse($FORUM_MAIN_START, $fVars); -//$forum_main_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_MAIN_END); $forum_main_end = $e107->tp->simpleParse($FORUM_MAIN_END, $fVars); if ($pref['forum_enclose']) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 58757fb7b..cb501d64d 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -9,9 +9,9 @@ * Message Handler * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ - * $Revision: 1.41 $ - * $Date: 2009-11-18 01:05:36 $ - * $Author: e107coders $ + * $Revision: 1.42 $ + * $Date: 2010-02-01 03:41:58 $ + * $Author: mcfly_e107 $ * */ @@ -1090,7 +1090,7 @@ class e107forum * $forum_href override ONLY applies when template is missing FORUM_CRUMB * $thread_title is needed for post-related breadcrumbs */ - function set_crumb($forum_href=false, $thread_title='') + function set_crumb($forum_href=false, $thread_title='', &$templateVar) { $e107 = e107::getInstance(); global $FORUM_CRUMB, $forumInfo, $thread; @@ -1162,6 +1162,9 @@ class e107forum } } $BACKLINK = $BREADCRUMB; + $templateVar->BREADCRUMB = $BREADCRUMB; + $templateVar->BACKLINK = $BACKLINK; + $templateVar->FORUM_CRUMB = $FORUM_CRUMB; } diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index dd9f7309f..47c606cb4 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -9,9 +9,9 @@ * Forum Posting * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ - * $Revision: 1.41 $ - * $Date: 2009-11-19 09:52:35 $ - * $Author: marj_nl_fr $ + * $Revision: 1.42 $ + * $Date: 2010-02-01 03:41:58 $ + * $Author: mcfly_e107 $ */ require_once('../../class2.php'); @@ -44,7 +44,7 @@ switch($action) break; case 'nt': - $forum_info = $forum->forum_get($id); + $forumInfo = $forum->forum_get($id); $forumId = $id; break; @@ -53,10 +53,7 @@ switch($action) $postInfo = $forum->postGet($id, 'post'); $threadInfo = $postInfo; $forumId = $postInfo['post_forum']; -// print_a($postInfo); -// exit; -// $forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']); -// $forumId = $forum_info['forum_id']; + $forumInfo = $forum->forum_get($forumId); break; default: @@ -65,7 +62,6 @@ switch($action) } -//echo "forumId = $forumId
"; // check if user can post to this forum ... if (!$forum->checkPerm($forumId, 'post')) { @@ -95,7 +91,7 @@ if ($action != 'nt' && !$threadInfo['thread_active'] && !MODERATOR) exit; } -$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], true); +$forumInfo['forum_name'] = $tp->toHTML($forumInfo['forum_name'], true); define('e_PAGETITLE', LAN_01.' / '.$forumInfo['forum_name'].' / '.($action == 'rp' ? LAN_02.$threadInfo['thread_name'] : LAN_03)); // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -479,7 +475,7 @@ if (!$FORUMPOST) } else { - include_once(e_PLUGIN.'forum/templates/forum_post_template.php'); + include_once(e_PLUGIN.'forum/templates/forum_post_template.php'); } } @@ -554,7 +550,7 @@ function forumjump() function process_upload() { - global $pref, $forum_info, $thread_info, $admin_log; + global $pref, $forumInfo, $thread_info, $admin_log; $postId = (int)$postId; $ret = array(); diff --git a/e107_plugins/forum/forum_post_shortcodes.php b/e107_plugins/forum/forum_post_shortcodes.php index ac7cdbae4..32aefb751 100644 --- a/e107_plugins/forum/forum_post_shortcodes.php +++ b/e107_plugins/forum/forum_post_shortcodes.php @@ -139,9 +139,10 @@ class forum_post_shortcodes function sc_backlink() { - global $forum, $thread_info,$eaction, $action,$BREADCRUMB; - $forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406." ".$thread_info['head']['thread_name']))); - return $BREADCRUMB; + global $forum, $thread_info, $eaction, $action; + $_tmp = ''; + $forum->set_crumb(true, ($action == 'nt' ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406.' '.$thread_info['head']['thread_name'])), $_tmp); + return $_tmp->BREADCRUMB; } function sc_noemotes() @@ -186,5 +187,5 @@ class forum_post_shortcodes return ''; } -} +} ?> \ No newline at end of file diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php index ad585c892..66070cd9c 100644 --- a/e107_plugins/forum/forum_viewforum.php +++ b/e107_plugins/forum/forum_viewforum.php @@ -9,9 +9,9 @@ * View specific forums * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $ -* $Revision: 1.18 $ -* $Date: 2010-01-23 09:53:08 $ -* $Author: e107steved $ +* $Revision: 1.19 $ +* $Date: 2010-02-01 03:41:58 $ +* $Author: mcfly_e107 $ * */ @@ -31,9 +31,7 @@ if (!e_QUERY) } //$view = 25; -//echo "pref = {$pref['forum_threadspage']}
"; $view = (varset($pref['forum_threadspage']) ? $pref['forum_threadspage'] : 25); -//echo "view = $view
"; $page = (varset($_GET['p']) ? $_GET['p'] : 0); $threadFrom = $page * $view; @@ -41,7 +39,7 @@ require_once(e_PLUGIN.'forum/forum_class.php'); $forum = new e107forum; global $forum_info, $FORUM_CRUMB; -$fVars = new templateVars; +$fVars = new e_vars; $fVars->STARTERTITLE = LAN_54; $fVars->THREADTITLE = LAN_53; @@ -153,7 +151,7 @@ if(substr($forum_info['sub_parent'], 0, 1) == '*') $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1); } -$forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK) +$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK) $fVars->FORUMTITLE = $forumInfo['forum_name']; $fVars->MODERATORS = LAN_404.': '.implode(', ', $modArray); @@ -290,9 +288,7 @@ if($container_only) $forum_view_forum = ''; } -//$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START); $forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars); -//$forum_view_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_END); $forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars); @@ -319,7 +315,7 @@ function parse_thread($thread_info) { global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $pref, $menu_pref, $threadsViewed; global $tp; - $tVars = new templateVars; + $tVars = new e_vars; $e107 = e107::getInstance(); $text = ''; @@ -470,30 +466,34 @@ function parse_thread($thread_info) } } - if ($thread_info['thread_sticky'] == 1 && $FORUM_VIEW_FORUM_STICKY) - { - return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM_STICKY)); - } - - if ($thread_info['thread_sticky'] == 2 && $FORUM_VIEW_FORUM_ANNOUNCE) - { - return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM_ANNOUNCE)); - } - if (!$tVars->REPLIES) { $tVars->REPLIES = LAN_317; // 'None' $tVars->LASTPOST = ' - '; } - - return $tp->simpleParse($FORUM_VIEW_FORUM, $tVars); - //return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM)); + + switch($thread_info['thread_sticky']) + { + case 1: + $_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM); + break; + + case 2: + $_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM); + break; + + default: + $_TEMPLATE = $FORUM_VIEW_FORUM; + break; + } + + return $tp->simpleParse($_TEMPLATE, $tVars); } function parse_sub($subInfo) { global $FORUM_VIEW_SUB, $gen, $newflag_list, $tp; - $tVars = new templateVars; + $tVars = new e_vars; $e107 = e107::getInstance(); $forumName = $e107->tp->toHTML($subInfo['forum_name'], true); $tVars->SUB_FORUMTITLE = "{$forumName}"; @@ -530,7 +530,6 @@ function parse_sub($subInfo) { $tVars->SUB_LASTPOST = '-'; } -// return (preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_SUB)); return $tp->simpleParse($FORUM_VIEW_SUB, $fVars); } diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index a49b253ae..876f2d24d 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -9,9 +9,9 @@ * Forum View Topic * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $ - * $Revision: 1.25 $ - * $Date: 2009-11-19 15:31:59 $ - * $Author: marj_nl_fr $ + * $Revision: 1.26 $ + * $Date: 2010-02-01 03:41:58 $ + * $Author: mcfly_e107 $ * */ @@ -27,7 +27,7 @@ $highlight_search = isset($_POST['highlight_search']); if (!e_QUERY) { - //No paramters given, redirect to forum home + //No parameters given, redirect to forum home header('Location:' . $e107->url->getUrl('forum', 'forum', array('func' => 'main'))); exit; } @@ -125,18 +125,21 @@ if (!$FORUMSTART) } // get info for main thread ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -$forum->set_crumb(true); // Set $BREADCRUMB (and BACKLINK) -$THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'); -$NEXTPREV = "<< 'prev', 'id' => $thread->threadId)) . "'>" . LAN_389 . ""; -$NEXTPREV .= ' | '; -$NEXTPREV .= " 'next', 'id' => $thread->threadId)) . "'>" . LAN_390 . " >>"; +$tVars = new e_vars; +$forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK) +//$tVars->BREADCRUMB = $crumbs['breadcrumb']; +//$tVars->BACKLINK = $tVars->BREADCRUMB; +//$tVars->FORUM_CRUMB = $crumbs['forum_crumb']; +$tVars->THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'); +$tVars->NEXTPREV = "<< 'prev', 'id' => $thread->threadId)) . "'>" . LAN_389 . ""; +$tVars->NEXTPREV .= ' | '; +$tVars->NEXTPREV .= " 'next', 'id' => $thread->threadId)) . "'>" . LAN_390 . " >>"; if ($pref['forum_track'] && USER) { $img = ($thread->threadInfo['track_userid'] ? IMAGE_track : IMAGE_untrack); $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => $thread->threadId)); - $TRACK .= " + $tVars->TRACK .= " {$img} @@ -157,31 +160,31 @@ if ($pref['forum_track'] && USER) "; } -$MODERATORS = LAN_321 . implode(', ', $forum->modArray); +$tVars->MODERATORS = LAN_321 . implode(', ', $forum->modArray); -$THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : ''); +$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : ''); if ($thread->pages > 1) { $parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; - $GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); + $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); } -$BUTTONS = ''; +$tVars->BUTTONS = ''; if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active']) { - $BUTTONS .= " 'rp', 'id' => $thread->threadId)) . "'>" . IMAGE_reply . ""; + $tVars->BUTTONS .= " 'rp', 'id' => $thread->threadId)) . "'>" . IMAGE_reply . ""; } if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread')) { - $BUTTONS .= " 'nt', 'id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . ""; + $tVars->BUTTONS .= " 'nt', 'id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . ""; } -$POLL = $pollstr; +$tVars->POLL = $pollstr; -$FORUMJUMP = forumjump(); +$tVars->FORUMJUMP = forumjump(); -$forstr = preg_replace("/\{(.*?)\}/e", '$\1', $FORUMSTART); +$forstr = $tp->simpleParse($FORUMSTART, $tVars); unset($forrep); if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE; @@ -231,7 +234,7 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread { if (!$forum_quickreply) { - $QUICKREPLY = " + $tVars->QUICKREPLY = "
'rp', 'id' => $thread->threadId)) . "' method='post'>

" . LAN_393 . ":
@@ -244,11 +247,12 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread } else { - $QUICKREPLY = $forum_quickreply; + $tVars->QUICKREPLY = $forum_quickreply; } } -$forend = preg_replace("/\{(.*?)\}/e", '$\1', $FORUMEND); +$forend = $tp->simpleParse($FORUMEND, $tVars); + $forumstring = $forstr . $forthr . $forrep . $forend; //If last post came after USERLV and not yet marked as read, mark the thread id as read