Completed
Push — master ( 03c5d4...7f0f9f )
by
unknown
01:43 queued 11s
created

post_controller::post()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 3
nc 3
nop 0
1
<?php
2
/**
3
 *
4
 * Ideas extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ideas\controller;
12
13
use \phpbb\exception\http_exception;
14
use Symfony\Component\HttpFoundation\RedirectResponse;
15
16
class post_controller extends base
17
{
18
	/**
19
	 * Controller for /post
20
	 * Redirects to the idea forum's posting page.
21
	 *
22
	 * @throws http_exception
23
	 * @return \Symfony\Component\HttpFoundation\RedirectResponse A Symfony Response object
24
	 */
25
	public function post()
26
	{
27
		if (!$this->is_available())
28
		{
29
			throw new http_exception(404, 'IDEAS_NOT_AVAILABLE');
30
		}
31
32
		if ($this->user->data['user_id'] == ANONYMOUS)
33
		{
34
			throw new http_exception(404, 'LOGGED_OUT');
35
		}
36
37
		$params = [
38
			'mode'	=> 'post',
39
			'f'		=> $this->config['ideas_forum_id'],
40
		];
41
42
		$url = append_sid(generate_board_url() . "/posting.{$this->php_ext}", $params, false);
43
44
		return new RedirectResponse($url);
45
	}
46
}
47