1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* @package phpBB Extension - Wiki |
5
|
|
|
* @copyright (c) 2015 tas2580 (https://tas2580.net) |
6
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
namespace tas2580\wiki\wiki; |
10
|
|
|
|
11
|
|
|
class delete extends \tas2580\wiki\wiki\functions |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** @var \phpbb\auth\auth */ |
15
|
|
|
protected $auth; |
16
|
|
|
|
17
|
|
|
/** @var \phpbb\db\driver\driver_interface */ |
18
|
|
|
protected $db; |
19
|
|
|
|
20
|
|
|
/** @var \phpbb\controller\helper */ |
21
|
|
|
protected $helper; |
22
|
|
|
|
23
|
|
|
/** @var \parse_message */ |
24
|
|
|
protected $message_parser; |
25
|
|
|
|
26
|
|
|
/** @var \phpbb\user */ |
27
|
|
|
protected $user; |
28
|
|
|
|
29
|
|
|
/** @var string article_table */ |
30
|
|
|
protected $article_table; |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constructor |
35
|
|
|
* |
36
|
|
|
* @param \phpbb\auth\auth $auth Auth object |
37
|
|
|
* @param \phpbb\config\config $config |
|
|
|
|
38
|
|
|
* @param \phpbb\db\driver\driver_interface $db Database object |
39
|
|
|
* @param \phpbb\controller\helper $helper Controller helper object |
40
|
|
|
* @param \phpbb\notification\manager $notification_manager |
|
|
|
|
41
|
|
|
* @param \phpbb\request\request $request Request object |
|
|
|
|
42
|
|
|
* @param \phpbb\template\template $template Template object |
|
|
|
|
43
|
|
|
* @param \phpbb\user $user |
44
|
|
|
* @param string $article_table |
45
|
|
|
* @param string $phpbb_root_path |
|
|
|
|
46
|
|
|
* @param string $php_ext |
|
|
|
|
47
|
|
|
|
48
|
|
|
*/ |
49
|
|
|
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\user $user, $article_table) |
50
|
|
|
{ |
51
|
|
|
$this->auth = $auth; |
52
|
|
|
$this->db = $db; |
53
|
|
|
$this->helper = $helper; |
54
|
|
|
$this->user = $user; |
55
|
|
|
$this->article_table = $article_table; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Delete a version of an article |
60
|
|
|
* |
61
|
|
|
* @param int $id Id of the version to delete |
62
|
|
|
* @return object |
63
|
|
|
*/ |
64
|
|
View Code Duplication |
public function version($id) |
|
|
|
|
65
|
|
|
{ |
66
|
|
|
if (!$this->auth->acl_get('u_wiki_delete')) |
67
|
|
|
{ |
68
|
|
|
trigger_error('NOT_AUTHORISED'); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
if (confirm_box(true)) |
72
|
|
|
{ |
73
|
|
|
$sql = 'DELETE FROM ' . $this->article_table . ' |
74
|
|
|
WHERE article_id = ' . (int) $id; |
75
|
|
|
$this->db->sql_query($sql); |
76
|
|
|
//return $helper->message('DELETE_VERSION_SUCCESS', array()); |
|
|
|
|
77
|
|
|
trigger_error($this->user->lang['DELETE_VERSION_SUCCESS'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_index', array()) . '">' . $this->user->lang['BACK_TO_WIKI'] . '</a>'); |
78
|
|
|
} |
79
|
|
|
else |
80
|
|
|
{ |
81
|
|
|
$s_hidden_fields = build_hidden_fields(array( |
82
|
|
|
'id' => $id, |
83
|
|
|
)); |
84
|
|
|
confirm_box(false, $this->user->lang['CONFIRM_DELETE_VERSION'], $s_hidden_fields); |
85
|
|
|
} |
86
|
|
|
redirect($this->helper->route('tas2580_wiki_index', array('id' => $id))); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Delete an complete article |
91
|
|
|
* |
92
|
|
|
* @param string $article URL of the article to delete |
93
|
|
|
* @return object |
94
|
|
|
*/ |
95
|
|
View Code Duplication |
public function article($article) |
|
|
|
|
96
|
|
|
{ |
97
|
|
|
if (!$this->auth->acl_get('u_wiki_delete_article')) |
98
|
|
|
{ |
99
|
|
|
trigger_error('NOT_AUTHORISED'); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
if (confirm_box(true)) |
103
|
|
|
{ |
104
|
|
|
$sql = 'DELETE FROM ' . $this->article_table . " |
105
|
|
|
WHERE article_url = '" . $this->db->sql_escape($article) . "'"; |
106
|
|
|
$this->db->sql_query($sql); |
107
|
|
|
trigger_error($this->user->lang['DELETE_ARTICLE_SUCCESS'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_index', array()) . '">' . $this->user->lang['BACK_TO_WIKI'] . '</a>'); |
108
|
|
|
} |
109
|
|
|
else |
110
|
|
|
{ |
111
|
|
|
$s_hidden_fields = build_hidden_fields(array( |
112
|
|
|
'article' => $article, |
113
|
|
|
)); |
114
|
|
|
confirm_box(false, $this->user->lang['CONFIRM_DELETE_ARTICLE'], $s_hidden_fields); |
115
|
|
|
} |
116
|
|
|
redirect($this->helper->route('tas2580_wiki_index', array('article' => $article))); |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.