mirror of
https://github.com/e107inc/e107.git
synced 2025-07-17 13:01:14 +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:
@@ -362,6 +362,7 @@ if(!deftrue('OLD_FORUMADMIN'))
|
|||||||
public function afterCreate($new_data, $old_data, $id)
|
public function afterCreate($new_data, $old_data, $id)
|
||||||
{
|
{
|
||||||
// do something
|
// do something
|
||||||
|
e107::getCache()->clear_sys('forum_perms');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCreateError($new_data, $old_data)
|
public function onCreateError($new_data, $old_data)
|
||||||
@@ -385,6 +386,14 @@ if(!deftrue('OLD_FORUMADMIN'))
|
|||||||
public function afterUpdate($new_data, $old_data, $id)
|
public function afterUpdate($new_data, $old_data, $id)
|
||||||
{
|
{
|
||||||
// do something
|
// 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)
|
public function onUpdateError($new_data, $old_data, $id)
|
||||||
|
@@ -231,7 +231,10 @@ class e107forum
|
|||||||
print_a($this->permList);
|
print_a($this->permList);
|
||||||
return;
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +255,9 @@ class e107forum
|
|||||||
return;
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,7 +758,7 @@ class e107forum
|
|||||||
$postInfo['post_thread'] = $newThreadId;
|
$postInfo['post_thread'] = $newThreadId;
|
||||||
$newPostId = $this->postAdd($postInfo, false);
|
$newPostId = $this->postAdd($postInfo, false);
|
||||||
$this->threadMarkAsRead($newThreadId);
|
$this->threadMarkAsRead($newThreadId);
|
||||||
return array('postid' => $newPostId, 'threadid' => $newThreadId);
|
return array('postid' => $newPostId, 'threadid' => $newThreadId, 'threadsef'=>$threadInfo['thread_sef']);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1333,13 +1338,15 @@ class e107forum
|
|||||||
function forumGetForumList($all=false)
|
function forumGetForumList($all=false)
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
|
|
||||||
|
|
||||||
$qry = '
|
if(!empty($this->permList['view_list']))
|
||||||
SELECT f.*, u.user_name FROM `#forum` AS f
|
{
|
||||||
|
$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
|
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
|
||||||
'.$where.
|
'.$where.'ORDER BY f.forum_order ASC';
|
||||||
'ORDER BY f.forum_order ASC';
|
|
||||||
if ($sql->gen($qry))
|
if ($sql->gen($qry))
|
||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
|
@@ -569,7 +569,6 @@ class forum_post_handler
|
|||||||
|
|
||||||
$fp = new floodprotect;
|
$fp = new floodprotect;
|
||||||
|
|
||||||
|
|
||||||
if ((isset($_POST['newthread']) && trim($_POST['subject']) == '') || trim($_POST['post']) == '')
|
if ((isset($_POST['newthread']) && trim($_POST['subject']) == '') || trim($_POST['post']) == '')
|
||||||
{
|
{
|
||||||
message_handler('ALERT', 5);
|
message_handler('ALERT', 5);
|
||||||
@@ -672,6 +671,10 @@ class forum_post_handler
|
|||||||
$newPostId = $postResult['postid'];
|
$newPostId = $postResult['postid'];
|
||||||
$newThreadId = $postResult['threadid'];
|
$newThreadId = $postResult['threadid'];
|
||||||
|
|
||||||
|
$this->data['thread_id'] = $newThreadId;
|
||||||
|
$this->data['thread_sef'] = $postResult['threadsef'];
|
||||||
|
|
||||||
|
|
||||||
if($_POST['email_notify'])
|
if($_POST['email_notify'])
|
||||||
{
|
{
|
||||||
$this->forumObj->track('add', USERID, $newThreadId);
|
$this->forumObj->track('add', USERID, $newThreadId);
|
||||||
@@ -709,10 +712,8 @@ class forum_post_handler
|
|||||||
e107::getCache()->clear('newforumposts');
|
e107::getCache()->clear('newforumposts');
|
||||||
|
|
||||||
|
|
||||||
$postInfo = $this->forumObj->postGet($newPostId, 'post');
|
// $postInfo = $this->forumObj->postGet($newPostId, 'post');
|
||||||
$forumInfo = $this->forumObj->forumGet($postInfo['post_forum']);
|
// $forumInfo = $this->forumObj->forumGet($postInfo['post_forum']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $threadLink = e107::getUrl()->create('forum/thread/last', $postInfo);
|
// $threadLink = e107::getUrl()->create('forum/thread/last', $postInfo);
|
||||||
// $forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo);
|
// $forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo);
|
||||||
|
@@ -33,7 +33,14 @@ if (isset($_POST['fjsubmit']))
|
|||||||
|
|
||||||
if (!e_QUERY && empty($_GET))
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +80,20 @@ if(!$forumId && e_QUERY) // BC Fix for old links.
|
|||||||
|
|
||||||
if (!$forum->checkPerm($forumId, 'view'))
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +217,11 @@ if ($pages)
|
|||||||
|
|
||||||
if($forum->checkPerm($forumId, 'post'))
|
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&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)
|
if(!BOOTSTRAP)
|
||||||
|
@@ -37,8 +37,12 @@ $highlight_search = isset($_POST['highlight_search']);
|
|||||||
|
|
||||||
if (!e_QUERY)
|
if (!e_QUERY)
|
||||||
{
|
{
|
||||||
|
// var_dump(e_QUERY);
|
||||||
|
// exit;
|
||||||
//No parameters given, redirect to forum home
|
//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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,11 +267,16 @@ if ($thread->pages > 1)
|
|||||||
$tVars->BUTTONS = '';
|
$tVars->BUTTONS = '';
|
||||||
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
|
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&id=".$thread->threadInfo['thread_id']."&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'))
|
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&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)
|
function forumbuttons($thread)
|
||||||
{
|
{
|
||||||
global $forum;
|
global $forum;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
|
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&id=".$thread->threadInfo['thread_id']."&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'))
|
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&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>";
|
$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 threadId doesn't exist, or not given, redirect to main forum page
|
||||||
if (!$this->threadId || !$this->threadInfo = $forum->threadGet($this->threadId))
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If not permitted to view forum, redirect to main forum page
|
//If not permitted to view forum, redirect to main forum page
|
||||||
if (!$forum->checkPerm($this->threadInfo['thread_forum_id'], 'view'))
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user