1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Issue #1015 - Possible forum edit/view access cache issue corrected. New-Topic and Post-Reply buttons now use the new SEF urls.

This commit is contained in:
Cameron 2015-05-22 15:37:46 -07:00
parent 392acf19bf
commit 03ab8b867e
5 changed files with 96 additions and 26 deletions

View File

@ -362,6 +362,7 @@ if(!deftrue('OLD_FORUMADMIN'))
public function afterCreate($new_data, $old_data, $id)
{
// do something
e107::getCache()->clear_sys('forum_perms');
}
public function onCreateError($new_data, $old_data)
@ -385,6 +386,14 @@ if(!deftrue('OLD_FORUMADMIN'))
public function afterUpdate($new_data, $old_data, $id)
{
// do something
e107::getCache()->clear_sys('forum_perms');
}
public function afterDelete($del_data,$id)
{
e107::getCache()->clear_sys('forum_perms');
}
public function onUpdateError($new_data, $old_data, $id)

View File

@ -231,7 +231,10 @@ class e107forum
print_a($this->permList);
return;
}
header('Location:'.e107::getUrl()->create('forum/forum/main')); // FIXME needs proper redirect and 403 header
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
// header('Location:'.e107::getUrl()->create('forum/forum/main')); // FIXME needs proper redirect and 403 header
exit;
}
@ -252,7 +255,9 @@ class e107forum
return;
}
header('Location:'.e107::getUrl()->create('forum/forum/main', TRUE, 404)); // FIXME needs proper redirect and 404 header
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
// header('Location:'.e107::getUrl()->create('forum/forum/main', TRUE, 404)); // FIXME needs proper redirect and 404 header
exit;
}
}
@ -753,7 +758,7 @@ class e107forum
$postInfo['post_thread'] = $newThreadId;
$newPostId = $this->postAdd($postInfo, false);
$this->threadMarkAsRead($newThreadId);
return array('postid' => $newPostId, 'threadid' => $newThreadId);
return array('postid' => $newPostId, 'threadid' => $newThreadId, 'threadsef'=>$threadInfo['thread_sef']);
}
return false;
}
@ -1333,13 +1338,15 @@ class e107forum
function forumGetForumList($all=false)
{
$sql = e107::getDb();
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
$qry = '
SELECT f.*, u.user_name FROM `#forum` AS f
if(!empty($this->permList['view_list']))
{
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
}
$qry = 'SELECT f.*, u.user_name FROM `#forum` AS f
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
'.$where.
'ORDER BY f.forum_order ASC';
'.$where.'ORDER BY f.forum_order ASC';
if ($sql->gen($qry))
{
$ret = array();

View File

@ -569,7 +569,6 @@ class forum_post_handler
$fp = new floodprotect;
if ((isset($_POST['newthread']) && trim($_POST['subject']) == '') || trim($_POST['post']) == '')
{
message_handler('ALERT', 5);
@ -672,6 +671,10 @@ class forum_post_handler
$newPostId = $postResult['postid'];
$newThreadId = $postResult['threadid'];
$this->data['thread_id'] = $newThreadId;
$this->data['thread_sef'] = $postResult['threadsef'];
if($_POST['email_notify'])
{
$this->forumObj->track('add', USERID, $newThreadId);
@ -709,10 +712,8 @@ class forum_post_handler
e107::getCache()->clear('newforumposts');
$postInfo = $this->forumObj->postGet($newPostId, 'post');
$forumInfo = $this->forumObj->forumGet($postInfo['post_forum']);
// $postInfo = $this->forumObj->postGet($newPostId, 'post');
// $forumInfo = $this->forumObj->forumGet($postInfo['post_forum']);
// $threadLink = e107::getUrl()->create('forum/thread/last', $postInfo);
// $forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo);

View File

@ -33,7 +33,14 @@ if (isset($_POST['fjsubmit']))
if (!e_QUERY && empty($_GET))
{
header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
if(E107_DEBUG_LEVEL > 0)
{
echo __FILE__ .' Line: '.__LINE__;
exit;
}
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
//header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -73,7 +80,20 @@ if(!$forumId && e_QUERY) // BC Fix for old links.
if (!$forum->checkPerm($forumId, 'view'))
{
header('Location:'.e107::getUrl()->create('forum/forum/main'));
// header('Location:'.e107::getUrl()->create('forum/forum/main'));
$url = e107::url('forum','index','full');
if(E107_DEBUG_LEVEL > 0)
{
echo __FILE__ .' Line: '.__LINE__;
echo " forumId: ".$forumId;
exit;
}
e107::getRedirect()->go($url);
exit;
}
@ -197,8 +217,11 @@ if ($pages)
if($forum->checkPerm($forumId, 'post'))
{
$fVars->NEWTHREADBUTTON = "<a href='".e107::getUrl()->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump(e107::getUrl()->create('forum/thread/new', array('id' => $forumId))); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $forumId;
// $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $forumId));
$fVars->NEWTHREADBUTTON = "<a href='".$ntUrl."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump($ntUrl); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
}
if(!BOOTSTRAP)

View File

@ -37,8 +37,12 @@ $highlight_search = isset($_POST['highlight_search']);
if (!e_QUERY)
{
// var_dump(e_QUERY);
// exit;
//No parameters given, redirect to forum home
header('Location:' . e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
// header('Location:' . e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -263,11 +267,16 @@ if ($thread->pages > 1)
$tVars->BUTTONS = '';
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{
$tVars->BUTTONS .= "<a href='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "'>" . IMAGE_reply . "</a>";
// print_a($thread->threadInfo);
$url = e107::url('forum','post')."?f=rp&amp;id=".$thread->threadInfo['thread_id']."&amp;post=".$thread->threadId;
// $url = $e107->url->create('forum/thread/reply', array('id' => $thread->threadId));
$tVars->BUTTONS .= "<a href='" . $url . "'>" . IMAGE_reply . "</a>";
}
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
{
$tVars->BUTTONS .= "<a href='" . $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . "</a>";
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $thread->threadInfo['thread_forum_id'];
// $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
$tVars->BUTTONS .= "<a href='" . $ntUrl . "'>" . IMAGE_newthread . "</a>";
}
@ -276,16 +285,19 @@ $tVars->BUTTONSX = forumbuttons($thread);
function forumbuttons($thread)
{
global $forum;
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{
$replyUrl = "<a class='btn btn-primary' href='".e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId))."'>".LAN_FORUM_2006."</a>";
$url = e107::url('forum','post')."?f=rp&amp;id=".$thread->threadInfo['thread_id']."&amp;post=".$thread->threadId;
// $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId));
$replyUrl = "<a class='btn btn-primary' href='".$url."'>".LAN_FORUM_2006."</a>";
}
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
{
$options[] = " <a href='".e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']))."'>".LAN_FORUM_2005."</a>";
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $thread->threadInfo['thread_forum_id'];
// $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
$options[] = " <a href='".$ntUrl."'>".LAN_FORUM_2005."</a>";
}
$options[] = "<a href='" . e107::getUrl()->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2001."</a>";
@ -659,14 +671,32 @@ class e107ForumThread
//If threadId doesn't exist, or not given, redirect to main forum page
if (!$this->threadId || !$this->threadInfo = $forum->threadGet($this->threadId))
{
header('Location:' . $e107->url->create('forum/forum/main', array(), 'encode=0&full=1'));
if(E107_DEBUG_LEVEL > 0)
{
echo __METHOD__ .' Line: '.__LINE__;
exit;
}
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
// header('Location:' . $e107->url->create('forum/forum/main', array(), 'encode=0&full=1'));
exit;
}
//If not permitted to view forum, redirect to main forum page
if (!$forum->checkPerm($this->threadInfo['thread_forum_id'], 'view'))
{
header('Location:' . $e107->url->create('forum/forum/main', array(), 'encode=0&full=1'));
if(E107_DEBUG_LEVEL > 0)
{
echo __METHOD__ .' Line: '.__LINE__;
exit;
}
$url = e107::url('forum','index','full');
e107::getRedirect()->go($url);
// header('Location:' . $e107->url->create('forum/forum/main', array(), 'encode=0&full=1'));
exit;
}