1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-26 01:11:28 +02:00

Various forum problems:

- nextprev new parameters usage
- outdate forum code cleanup (preventing sc parsing)
- forum preferences fixes (maybe more to do)
This commit is contained in:
secretr
2011-04-21 13:20:22 +00:00
parent 58a8ac844e
commit ec1eeac94d
7 changed files with 34 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2010 e107 Inc (e107.org) * Copyright (C) 2008-2011 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
@@ -47,6 +47,8 @@
* WARNING: You have to do rawuldecode() on url, caption and title parameter values (before passing them to the shortcode) * WARNING: You have to do rawuldecode() on url, caption and title parameter values (before passing them to the shortcode)
* or you'll break the whole script * or you'll break the whole script
* *
* TODO - add create URL support when new URL handler is ready
*
* @param string $parm * @param string $parm
* @return string page navigation bar HTML * @return string page navigation bar HTML
*/ */
@@ -274,7 +276,7 @@ function nextprev_shortcode($parm = '')
if($show_last && !empty($tmpl[$tprefix.'nav_last'])) if($show_last && !empty($tmpl[$tprefix.'nav_last']))
{ {
$e_vars->url = str_replace('[FROM]', $last_page, $url); $e_vars->url = str_replace('[FROM]', $total_pages, $url);//$last_page
$e_vars->label = LAN_NP_LAST; $e_vars->label = LAN_NP_LAST;
$e_vars->url_label = LAN_NP_URLLAST; $e_vars->url_label = LAN_NP_URLLAST;
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_last'], $e_vars); $ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_last'], $e_vars);

View File

@@ -100,7 +100,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_fileattach() function sc_fileattach()
{ {
global $forum, $pref, $fileattach, $fileattach_alert; global $forum, $fileattach, $fileattach_alert;
if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0'))) if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
{ {
@@ -115,7 +115,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
{ {
if(!$fileattach_alert) if(!$fileattach_alert)
{ {
$fileattach_alert = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr><tr><td colspan='2' class='forumheader3'>".LAN_FORUM_1."</td></tr>\n"; $fileattach_alert = "<tr><td colspan='2' class='nforumcaption2'>".(e107::getPref('image_post') ? LAN_390 : LAN_416)."</td></tr><tr><td colspan='2' class='forumheader3'>".LAN_FORUM_1."</td></tr>\n";
} }
return $fileattach_alert; return $fileattach_alert;
} }
@@ -126,6 +126,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_postthreadas() function sc_postthreadas()
{ {
global $action, $thread_info; global $action, $thread_info;
e_dump(MODERATOR);
if (MODERATOR && $action == "nt") if (MODERATOR && $action == "nt")
{ {
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_sticky']); $thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_sticky']);
@@ -150,13 +151,16 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_emailnotify() function sc_emailnotify()
{ {
global $pref, $thread_info, $action, $eaction; global $thread_info, $action, $eaction;
$pref = e107::getPlugPref('forum');
if($eaction == true) { return ; } if($eaction == true) { return ; }
if ($pref['email_notify'] && $action == 'nt' && USER) if ($pref['notify'] && $action == 'nt' && USER)
{ {
if(isset($_POST['fpreview'])) if(isset($_POST['fpreview']))
{ {
$chk = ($_POST['email_notify'] ? "checked = 'checked'" : ''); $chk = ($_POST['notify'] ? "checked = 'checked'" : '');
} }
else else
{ {
@@ -166,10 +170,10 @@ class plugin_forum_post_shortcodes extends e_shortcode
} }
else else
{ {
$chk = ($pref['email_notify_on'] ? "checked='checked'" : ''); $chk = ($pref['notify_on'] ? "checked='checked'" : '');
} }
} }
return "<br /><input type='checkbox' name='email_notify' value='1' {$chk} />&nbsp;<span class='defaulttext'>".LAN_380."</span>"; return "<br /><input type='checkbox' name='notify' value='1' {$chk} />&nbsp;<span class='defaulttext'>".LAN_380."</span>";
} }
return ''; return '';
} }

View File

@@ -664,12 +664,12 @@ class forumAdmin
<tr> <tr>
<td style='width:75%' class='forumheader3'>".FORLAN_47."<br /><span class='smalltext'>".FORLAN_48."</span></td> <td style='width:75%' class='forumheader3'>".FORLAN_47."<br /><span class='smalltext'>".FORLAN_48."</span></td>
<td style='width:25%;text-align:center' class='forumheader3' >".($fPref->get('email_notify') ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />")."</td> <td style='width:25%;text-align:center' class='forumheader3' >".($fPref->get('notify') ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />")."</td>
</tr> </tr>
<tr> <tr>
<td style='width:75%' class='forumheader3'>".FORLAN_177."<br /><span class='smalltext'>".FORLAN_178."</span></td> <td style='width:75%' class='forumheader3'>".FORLAN_177."<br /><span class='smalltext'>".FORLAN_178."</span></td>
<td style='width:25%;text-align:center' class='forumheader3' >".($fPref->get('email_notify_on') ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' value='1' />")."</td> <td style='width:25%;text-align:center' class='forumheader3' >".($fPref->get('notify_on') ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' value='1' />")."</td>
</tr> </tr>
<tr> <tr>

View File

@@ -699,7 +699,7 @@ class e107forum
function isModerator($uid) function isModerator($uid)
{ {
return ($uid && in_array($uid, array_keys($this->modArray))); return ($uid && in_array($uid, array_keys($this->forumGetMods())));
} }
function forumGetForumList($all=false) function forumGetForumList($all=false)

View File

@@ -14,7 +14,7 @@
require_once('../../class2.php'); require_once('../../class2.php');
$e107 = e107::getInstance(); $e107 = e107::getInstance();
if (!$e107->isInstalled('forum')) if (!$e107->isInstalled('forum'))
{ {
header('Location: '.e_BASE.'index.php'); header('Location: '.e_BASE.'index.php');
exit; exit;
@@ -29,7 +29,7 @@ if (isset($_POST['fjsubmit']))
} }
require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum; $forum = new e107forum();
if (!e_QUERY || !isset($_GET['id'])) if (!e_QUERY || !isset($_GET['id']))
{ {
@@ -325,7 +325,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply']))
$e107cache->clear('newforumposts'); $e107cache->clear('newforumposts');
$threadLink = $e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $threadId)); $threadLink = $e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $threadId));
$forumLink = $e107->url->getUrl('forum', 'forum', array('func' => 'view', 'id' => $forumId)); $forumLink = $e107->url->getUrl('forum', 'forum', array('func' => 'view', 'id' => $forumId));
if ($forum->prefs->get('forum_redirect')) if ($forum->prefs->get('redirect'))
{ {
header('location:'.$threadLink); header('location:'.$threadLink);
exit; exit;

View File

@@ -15,7 +15,7 @@
require_once('../../class2.php'); require_once('../../class2.php');
$e107 = e107::getInstance(); $e107 = e107::getInstance();
if (!$e107->isInstalled('forum')) if (!$e107->isInstalled('forum'))
{ {
header('Location: '.e_BASE.'index.php'); header('Location: '.e_BASE.'index.php');
exit; exit;
@@ -129,7 +129,9 @@ if ($pages)
{ {
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false) if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
{ {
$parms = "{$pages},1,{$page},url::forum::forum::func=view&id={$forumId}&page=[FROM], off"; if(!$page) $page = 1;
$url = rawurlencode(e107::getUrl()->getUrl('forum', 'forum', array('func' => 'view', 'id' => $forumId, 'page' => '[FROM]')));
$parms = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
$fVars->THREADPAGES = $e107->tp->parseTemplate("{NEXTPREV={$parms}}"); $fVars->THREADPAGES = $e107->tp->parseTemplate("{NEXTPREV={$parms}}");
} }
} }

View File

@@ -15,7 +15,9 @@
require_once ('../../class2.php'); require_once ('../../class2.php');
$e107 = e107::getInstance(); $e107 = e107::getInstance();
if (!$e107->isInstalled('forum')) $tp = e107::getParser();
if (!$e107->isInstalled('forum'))
{ {
header('Location: '.e_BASE.'index.php'); header('Location: '.e_BASE.'index.php');
exit; exit;
@@ -178,8 +180,13 @@ $tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : '');
if ($thread->pages > 1) if ($thread->pages > 1)
{ {
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; if(!$thread->page) $thread->page = 1;
$url = rawurlencode(e107::getUrl()->getUrl('forum', 'thread', array('func' => 'view', 'id' => $thread->threadId, 'page' => '[FROM]')));
$parms = "total={$thread->pages}&type=page&current={$thread->page}&url=".$url."&caption=off";
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
/*
$parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off";
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/
} }
$tVars->BUTTONS = ''; $tVars->BUTTONS = '';