1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Updated forum code to use the new shortcode stuff, moved the shortcode files into the proper *new* directories.

This commit is contained in:
mcfly
2010-04-25 22:30:26 +00:00
parent 574f6fb1ba
commit 3437f4a47f
5 changed files with 26 additions and 31 deletions

View File

@@ -69,13 +69,12 @@ if (!$forum->checkPerm($forumId, 'post'))
exit; exit;
} }
define('MODERATOR', USER && $forum->isModerator(USERID)); 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'); 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; $gen = new convert;
$fp = new floodprotect; $fp = new floodprotect;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
@@ -566,7 +565,7 @@ function process_upload()
$postId = (int)$postId; $postId = (int)$postId;
$ret = array(); $ret = array();
var_dump($_FILES); // var_dump($_FILES);
if (isset($_FILES['file_userfile']['error'])) if (isset($_FILES['file_userfile']['error']))
{ {

View File

@@ -33,6 +33,7 @@ $forum = new e107forum;
//$view = 25; //$view = 25;
$view = $forum->prefs->get('threadspage', 25); $view = $forum->prefs->get('threadspage', 25);
if(!$view) { $view = 25; }
$page = (varset($_GET['p']) ? $_GET['p'] : 0); $page = (varset($_GET['p']) ? $_GET['p'] : 0);
$threadFrom = $page * $view; $threadFrom = $page * $view;

View File

@@ -60,9 +60,11 @@ if(isset($_GET['f']))
} }
if($_GET['f'] != 'last') { $thread->init(); } if($_GET['f'] != 'last') { $thread->init(); }
} }
e107::getScParser();
require_once (e_PLUGIN . 'forum/forum_shortcodes.php'); //e107::getScParser();
setScVar('forum_shortcodes', 'thread', $thread); //require_once (e_PLUGIN . 'forum/forum_shortcodes.php');
//setScVar('forum_shortcodes', 'thread', $thread);
e107::getScBatch('forum', 'forum')->setScVar('thread', $thread);
$pm_installed = plugInstalled('pm'); $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')); 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']); $forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
define('MODERATOR', (USER && $forum->isModerator(USERID))); 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'])) if (MODERATOR && isset($_POST['mod']))
{ {
@@ -218,13 +224,14 @@ foreach ($postList as $postInfo)
{ {
$_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE); $_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"; $forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n";
} }
else else
{ {
$postInfo['thread_start'] = true; $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"; $forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes) . "\n";
} }
} }

View File

@@ -1,15 +1,11 @@
<?php <?php
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
register_shortcode('forum_post_shortcodes', true);
initShortcodeClass('forum_post_shortcodes');
class forum_post_shortcodes class forum_post_shortcodes extends e_shortcode
{ {
var $e107; protected $e107;
var $threadInfo;
var $forum;
function forum_post_shortcodes() function __construct()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
} }

View File

@@ -1,21 +1,13 @@
<?php <?php
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
register_shortcode('forum_shortcodes', true); class forum_shortcodes extends e_shortcode
initShortcodeClass('forum_shortcodes');
class forum_shortcodes
{ {
protected $e107;
var $e107; function __construct()
var $postInfo;
var $thread;
var $forum;
function forum_shortcodes()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
$this->postInfo = array();
} }
function sc_top() function sc_top()