From 3437f4a47ffe50c21f46c45d2c32277c9a9435b1 Mon Sep 17 00:00:00 2001 From: mcfly Date: Sun, 25 Apr 2010 22:30:26 +0000 Subject: [PATCH] Updated forum code to use the new shortcode stuff, moved the shortcode files into the proper *new* directories. --- e107_plugins/forum/forum_post.php | 13 ++++++------- e107_plugins/forum/forum_viewforum.php | 1 + e107_plugins/forum/forum_viewtopic.php | 19 +++++++++++++------ .../batch}/forum_post_shortcodes.php | 10 +++------- .../batch}/forum_shortcodes.php | 14 +++----------- 5 files changed, 26 insertions(+), 31 deletions(-) rename e107_plugins/forum/{ => shortcodes/batch}/forum_post_shortcodes.php (96%) rename e107_plugins/forum/{ => shortcodes/batch}/forum_shortcodes.php (97%) diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 60c2d409c..15830df9c 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -69,13 +69,12 @@ if (!$forum->checkPerm($forumId, 'post')) exit; } define('MODERATOR', USER && $forum->isModerator(USERID)); -//require_once(e_HANDLER.'forum_include.php'); -e107::getScParser(); -require_once(e_PLUGIN.'forum/forum_post_shortcodes.php'); -require_once(e_PLUGIN.'forum/forum_shortcodes.php'); require_once(e_HANDLER.'ren_help.php'); -setScVar('forum_post_shortcodes', 'forum', $forum); -setScVar('forum_post_shortcodes', 'threadInfo', $threadInfo); + +//require_once(e_HANDLER.'forum_include.php'); +e107::getScBatch('forum', 'forum'); +e107::getScBatch('forum_post', 'forum')->setScVar('forum', $forum)->setScVar('threadInfo', $threadInfo); + $gen = new convert; $fp = new floodprotect; $e107 = e107::getInstance(); @@ -566,7 +565,7 @@ function process_upload() $postId = (int)$postId; $ret = array(); - var_dump($_FILES); +// var_dump($_FILES); if (isset($_FILES['file_userfile']['error'])) { diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php index acb66d0d5..a06c919f4 100644 --- a/e107_plugins/forum/forum_viewforum.php +++ b/e107_plugins/forum/forum_viewforum.php @@ -33,6 +33,7 @@ $forum = new e107forum; //$view = 25; $view = $forum->prefs->get('threadspage', 25); +if(!$view) { $view = 25; } $page = (varset($_GET['p']) ? $_GET['p'] : 0); $threadFrom = $page * $view; diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index cd29501ad..c4df027a8 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -60,9 +60,11 @@ if(isset($_GET['f'])) } if($_GET['f'] != 'last') { $thread->init(); } } -e107::getScParser(); -require_once (e_PLUGIN . 'forum/forum_shortcodes.php'); -setScVar('forum_shortcodes', 'thread', $thread); + +//e107::getScParser(); +//require_once (e_PLUGIN . 'forum/forum_shortcodes.php'); +//setScVar('forum_shortcodes', 'thread', $thread); +e107::getScBatch('forum', 'forum')->setScVar('thread', $thread); $pm_installed = plugInstalled('pm'); @@ -75,7 +77,11 @@ if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo define('e_PAGETITLE', LAN_01 . ' / ' . $e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off') . " / " . $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off')); $forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']); define('MODERATOR', (USER && $forum->isModerator(USERID))); -setScVar('forum_shortcodes', 'forum', $forum); + +e107::getScBatch('forum', 'forum')->setScVar('forum', $forum); +//var_dump(e107::getScBatch('forum', 'forum')); + +//setScVar('forum_shortcodes', 'forum', $forum); if (MODERATOR && isset($_POST['mod'])) { @@ -218,13 +224,14 @@ foreach ($postList as $postInfo) { $_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE); } - setScVar('forum_shortcodes', 'postInfo', $postInfo); +// setScVar('forum_shortcodes', 'postInfo', $postInfo); + e107::getScBatch('forum', 'forum')->setScVar('postInfo', $postInfo); $forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n"; } else { $postInfo['thread_start'] = true; - setScVar('forum_shortcodes', 'postInfo', $postInfo); + e107::getScBatch('forum', 'forum')->setScVar('postInfo', $postInfo); $forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes) . "\n"; } } diff --git a/e107_plugins/forum/forum_post_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_post_shortcodes.php similarity index 96% rename from e107_plugins/forum/forum_post_shortcodes.php rename to e107_plugins/forum/shortcodes/batch/forum_post_shortcodes.php index ebf1684f3..559e7b85f 100644 --- a/e107_plugins/forum/forum_post_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/forum_post_shortcodes.php @@ -1,15 +1,11 @@ e107 = e107::getInstance(); } diff --git a/e107_plugins/forum/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php similarity index 97% rename from e107_plugins/forum/forum_shortcodes.php rename to e107_plugins/forum/shortcodes/batch/forum_shortcodes.php index a120e7744..4941cff8c 100644 --- a/e107_plugins/forum/forum_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php @@ -1,21 +1,13 @@ e107 = e107::getInstance(); - $this->postInfo = array(); } function sc_top()