1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Forum: Fixes #1079 - broken 'move' url.

This commit is contained in:
Cameron
2015-06-26 10:26:47 -07:00
parent 1073171387
commit 84485c50da
6 changed files with 31 additions and 9 deletions

View File

@@ -43,6 +43,10 @@ class forum_url // plugin-folder + '_url'
'redirect' => '{e_PLUGIN}forum/forum_post.php',
);
$config['move'] = array(
'sef' => 'forum/post/?f=move&id={thread_id}',
);
$config['topic'] = array(
'regex' => '^forum/(.*)/(\d*)-([\w-]*)/?\??(.*)',
'sef' => 'forum/{forum_sef}/{thread_id}-{thread_sef}/',

View File

@@ -132,10 +132,8 @@ class forum_post_handler
break;
case 'edit':
case 'move':
case "quote":
case "report":
$postInfo = $this->forumObj->postGet($this->post, 'post');
$forumInfo = $this->forumObj->forumGet($postInfo['post_forum']);
$data = array_merge($postInfo ,$forumInfo);
@@ -144,6 +142,15 @@ class forum_post_handler
return $data;
break;
case 'move':
$thread = $this->forumObj->threadGet($this->id, true);
$extra = $this->forumObj->postGet($this->id,0,1); // get first post.
$data = array_merge($thread,$extra[0]);
$data['action'] = $this->action;
$this->setPageTitle($data);
return $data;
break;
default:
$url = e107::url('forum','index',null,'full');
$this->redirect($url);

View File

@@ -591,12 +591,15 @@ function parse_thread($thread_info)
// FIXME _URL_ thread name
// e107::getUrl()->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
// USED self instead
$moveUrl = e107::url('forum','move', $thread_info);
$tVars->ADMIN_ICONS = "
<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'><div>
<input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" />
".($thread_info['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> ")."
".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> "). "
<a href='".e107::getUrl()->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a>
<a href='".$moveUrl."'>".IMAGE_admin_move.'</a>
</div></form>
';
@@ -744,7 +747,7 @@ function fadminoptions($thread_info)
$tp = e107::getParser();
// $text = "<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'>";
$text .= '<div class="btn-group"><button class="btn btn-default btn-sm btn-mini dropdown-toggle" data-toggle="dropdown">
$text = '<div class="btn-group"><button class="btn btn-default btn-sm btn-mini dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
@@ -752,7 +755,8 @@ function fadminoptions($thread_info)
//FIXME - not fully working.
$moveUrl = e107::getUrl()->create('forum/thread/move', "id=".$thread_info['thread_id']);
$moveUrl = e107::url('forum','move', $thread_info);
$lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock';
$stickUnstick = ($thread_info['thread_sticky'] == 1) ? 'unstick' : 'stick';
$id = intval($thread_info['thread_id']);

View File

@@ -539,7 +539,8 @@ function showmodoptions()
";
if ($type == 'Thread')
{
$ret .= "<a href='" . $e107->url->create('forum/thread/move', array('id' => $postInfo['post_id']))."'>" . IMAGE_admin_move2 . "</a>";
$moveUrl = e107::url('forum','move', array('thread_id'=>$postInfo['post_thread']));
$ret .= "<a href='" . $moveUrl."'>" . IMAGE_admin_move2 . "</a>";
}
else
{

View File

@@ -564,8 +564,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
if ($type == 'thread')
{
$url = e107::url('forum','post')."?f=move&amp;id=".$this->postInfo['post_thread']."&amp;post=".$this->postInfo['post_id'];
// $url = e107::getUrl()->create('forum/thread/move', array('id' => $this->postInfo['post_id'], 'post'=>$this->postInfo['post_id']));
$url = e107::url('forum','move', array('thread_id'=>$this->postInfo['post_thread']));
$text .= "<li class='text-right'><a href='" . $url."'>".LAN_FORUM_2042." ".$tp->toGlyph('move')."</a></a></li>";
}
else //TODO

View File

@@ -100,6 +100,13 @@
foreach($cfg as $k=>$v)
{
if(empty($v['regex']))
{
// e107::getMessage()->addDebug("Skipping empty regex: <b>".$k."</b>");
continue;
}
if(!empty($v['alias']))
{
$alias = (!empty($pref['e_url_alias'][e_LAN][$plug][$k])) ? $pref['e_url_alias'][e_LAN][$plug][$k] : $v['alias'];