|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* |
|
5
|
|
|
* @package phpBB Gallery Core |
|
6
|
|
|
* @copyright (c) 2014 nickvergessen | 2025 Leinad4Mind |
|
7
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace phpbbgallery\core\controller; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\HttpFoundation\RedirectResponse; |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
class moderate |
|
16
|
|
|
{ |
|
17
|
|
|
/* @var \phpbb\auth\auth */ |
|
|
|
|
|
|
18
|
|
|
protected $auth; |
|
19
|
|
|
|
|
20
|
|
|
/* @var \phpbb\config\config */ |
|
|
|
|
|
|
21
|
|
|
protected $config; |
|
22
|
|
|
|
|
23
|
|
|
/* @var \phpbb\db\driver\driver */ |
|
|
|
|
|
|
24
|
|
|
protected $db; |
|
25
|
|
|
|
|
26
|
|
|
/* @var \phpbb\request\request */ |
|
|
|
|
|
|
27
|
|
|
protected $request; |
|
28
|
|
|
|
|
29
|
|
|
/* @var \phpbb\template\template */ |
|
|
|
|
|
|
30
|
|
|
protected $template; |
|
31
|
|
|
|
|
32
|
|
|
/* @var \phpbb\user */ |
|
|
|
|
|
|
33
|
|
|
protected $user; |
|
34
|
|
|
|
|
35
|
|
|
/** @var \phpbb\language\language */ |
|
|
|
|
|
|
36
|
|
|
protected $language; |
|
37
|
|
|
|
|
38
|
|
|
/* @var \phpbb\controller\helper */ |
|
|
|
|
|
|
39
|
|
|
protected $helper; |
|
40
|
|
|
|
|
41
|
|
|
/* @var \phpbbgallery\core\album\display */ |
|
42
|
|
|
protected $display; |
|
43
|
|
|
|
|
44
|
|
|
/** @var \phpbbgallery\core\moderate */ |
|
45
|
|
|
protected $moderate; |
|
46
|
|
|
|
|
47
|
|
|
/** @var \phpbbgallery\core\auth\auth */ |
|
48
|
|
|
protected $gallery_auth; |
|
49
|
|
|
|
|
50
|
|
|
/** @var \phpbbgallery\core\misc */ |
|
51
|
|
|
protected $misc; |
|
52
|
|
|
|
|
53
|
|
|
/** @var \phpbbgallery\core\album\album */ |
|
54
|
|
|
protected $album; |
|
55
|
|
|
|
|
56
|
|
|
/** @var \phpbbgallery\core\image\image */ |
|
57
|
|
|
protected $image; |
|
58
|
|
|
|
|
59
|
|
|
/** @var \phpbbgallery\core\notification\helper */ |
|
60
|
|
|
protected $notification_helper; |
|
61
|
|
|
|
|
62
|
|
|
/** @var \phpbbgallery\core\url */ |
|
63
|
|
|
protected $url; |
|
64
|
|
|
|
|
65
|
|
|
/** @var \phpbbgallery\core\log */ |
|
66
|
|
|
protected $gallery_log; |
|
67
|
|
|
|
|
68
|
|
|
/** @var \phpbbgallery\core\report */ |
|
69
|
|
|
protected $report; |
|
70
|
|
|
|
|
71
|
|
|
/** @var \phpbb\user_loader */ |
|
|
|
|
|
|
72
|
|
|
protected $user_loader; |
|
73
|
|
|
|
|
74
|
|
|
/* @var string */ |
|
75
|
|
|
protected $root_path; |
|
76
|
|
|
|
|
77
|
|
|
/* @var string */ |
|
78
|
|
|
protected $php_ext; |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Constructor |
|
82
|
|
|
* |
|
83
|
|
|
* @param \phpbb\config\config $config Config object |
|
84
|
|
|
* @param \phpbb\request\request $request Request object |
|
85
|
|
|
* @param \phpbb\template\template $template Template object |
|
86
|
|
|
* @param \phpbb\user $user User object |
|
87
|
|
|
* @param \phpbb\language\language $language |
|
88
|
|
|
* @param \phpbb\controller\helper $helper Controller helper object |
|
89
|
|
|
* @param \phpbbgallery\core\album\display $display Albums display object |
|
90
|
|
|
* @param \phpbbgallery\core\moderate $moderate |
|
91
|
|
|
* @param \phpbbgallery\core\auth\auth $gallery_auth |
|
92
|
|
|
* @param \phpbbgallery\core\misc $misc |
|
93
|
|
|
* @param \phpbbgallery\core\album\album $album |
|
94
|
|
|
* @param \phpbbgallery\core\image\image $image |
|
95
|
|
|
* @param \phpbbgallery\core\notification\helper $notification_helper |
|
96
|
|
|
* @param \phpbbgallery\core\url $url |
|
97
|
|
|
* @param \phpbbgallery\core\log $gallery_log |
|
98
|
|
|
* @param \phpbbgallery\core\report $report |
|
99
|
|
|
* @param \phpbb\user_loader $user_loader |
|
100
|
|
|
* @param string $root_path Root path |
|
101
|
|
|
* @param string $php_ext php file extension |
|
102
|
|
|
* @internal param \phpbb\auth\auth $auth Auth object |
|
103
|
|
|
* @internal param \phpbb\db\driver\driver|\phpbb\db\driver\driver_interface $db Database object |
|
104
|
|
|
*/ |
|
105
|
2 |
|
public function __construct(\phpbb\config\config $config, \phpbb\request\request $request, |
|
106
|
|
|
\phpbb\template\template $template, \phpbb\user $user, \phpbb\language\language $language, |
|
107
|
|
|
\phpbb\controller\helper $helper, \phpbbgallery\core\album\display $display, \phpbbgallery\core\moderate $moderate, |
|
108
|
|
|
\phpbbgallery\core\auth\auth $gallery_auth, \phpbbgallery\core\misc $misc, \phpbbgallery\core\album\album $album, \phpbbgallery\core\image\image $image, |
|
109
|
|
|
\phpbbgallery\core\notification\helper $notification_helper, \phpbbgallery\core\url $url, \phpbbgallery\core\log $gallery_log, |
|
110
|
|
|
\phpbbgallery\core\report $report, \phpbb\user_loader $user_loader, |
|
111
|
|
|
$root_path, $php_ext) |
|
112
|
|
|
{ |
|
113
|
2 |
|
$this->config = $config; |
|
114
|
2 |
|
$this->request = $request; |
|
115
|
2 |
|
$this->template = $template; |
|
116
|
2 |
|
$this->user = $user; |
|
117
|
2 |
|
$this->language = $language; |
|
118
|
2 |
|
$this->helper = $helper; |
|
119
|
2 |
|
$this->display = $display; |
|
120
|
2 |
|
$this->moderate = $moderate; |
|
121
|
2 |
|
$this->gallery_auth = $gallery_auth; |
|
122
|
2 |
|
$this->misc = $misc; |
|
123
|
2 |
|
$this->album = $album; |
|
124
|
2 |
|
$this->image = $image; |
|
125
|
2 |
|
$this->notification_helper = $notification_helper; |
|
126
|
2 |
|
$this->url = $url; |
|
127
|
2 |
|
$this->gallery_log = $gallery_log; |
|
128
|
2 |
|
$this->report = $report; |
|
129
|
2 |
|
$this->user_loader = $user_loader; |
|
130
|
2 |
|
$this->root_path = $root_path; |
|
131
|
2 |
|
$this->php_ext = $php_ext; |
|
132
|
2 |
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Index Controller |
|
136
|
|
|
* Route: gallery/moderate |
|
137
|
|
|
* |
|
138
|
|
|
* @param int $album_id |
|
139
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
|
|
|
|
|
140
|
|
|
*/ |
|
141
|
2 |
|
public function base($album_id = 0) |
|
142
|
|
|
{ |
|
143
|
2 |
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
144
|
2 |
|
$album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
|
145
|
2 |
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
146
|
2 |
|
if ($album_id === 0) |
|
147
|
|
|
{ |
|
148
|
2 |
|
if (!$this->gallery_auth->acl_check_global('m_')) |
|
149
|
|
|
{ |
|
150
|
2 |
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
151
|
|
|
} |
|
152
|
|
|
} |
|
153
|
|
|
else |
|
154
|
|
|
{ |
|
155
|
|
|
$album = $this->album->get_info($album_id); |
|
156
|
|
|
if (!$this->gallery_auth->acl_check('m_', $album['album_id'], $album['album_user_id'])) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
159
|
|
|
} |
|
160
|
|
|
} |
|
161
|
2 |
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
162
|
2 |
|
$this->language->add_lang('mcp'); |
|
163
|
2 |
|
$this->display->display_albums(false, $this->config['load_moderators']); |
|
|
|
|
|
|
164
|
|
|
// This is the overview page, so we will need to create some queries |
|
165
|
|
|
// We will use the special moderate helper |
|
166
|
|
|
|
|
167
|
2 |
|
$this->report->build_list($album_id, 1, 5); |
|
168
|
2 |
|
$this->moderate->build_list($album_id, 1, 5); |
|
169
|
2 |
|
$this->gallery_log->build_list('moderator', 5, 1, $album_id); |
|
170
|
|
|
|
|
171
|
2 |
|
$this->template->assign_vars(array( |
|
172
|
2 |
|
'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), |
|
173
|
2 |
|
'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), |
|
174
|
2 |
|
'U_GALLERY_MODERATE_REPORT' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports'), |
|
175
|
2 |
|
'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
|
176
|
2 |
|
'U_GALLERY_MCP_LOGS' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_action_log_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_action_log'), |
|
177
|
2 |
|
'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
|
178
|
|
|
'U_OVERVIEW' => true, |
|
179
|
|
|
)); |
|
180
|
|
|
|
|
181
|
2 |
|
return $this->helper->render('gallery/moderate_overview.html', $this->language->lang('GALLERY')); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Index Controller |
|
186
|
|
|
* Route: gallery/moderate/approve |
|
187
|
|
|
* |
|
188
|
|
|
* @param $page |
|
189
|
|
|
* @param $album_id |
|
190
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
191
|
|
|
*/ |
|
192
|
|
|
public function queue_approve($page, $album_id) |
|
193
|
|
|
{ |
|
194
|
|
|
$approve_ary = $this->request->variable('approval', array('' => array(0))); |
|
195
|
|
|
$action_ary = $this->request->variable('action', array('' => 0)); |
|
196
|
|
|
$back_link = $this->request->variable('back_link', $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve')); |
|
197
|
|
|
foreach ($action_ary as $act => $garb) |
|
198
|
|
|
{ |
|
199
|
|
|
$action = $act; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
203
|
|
|
$this->language->add_lang('mcp'); |
|
204
|
|
|
|
|
205
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
206
|
|
|
$album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
|
207
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
208
|
|
|
if ($album_id === 0) |
|
209
|
|
|
{ |
|
210
|
|
|
if (!$this->gallery_auth->acl_check_global('m_status')) |
|
211
|
|
|
{ |
|
212
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
213
|
|
|
} |
|
214
|
|
|
} |
|
215
|
|
|
else |
|
216
|
|
|
{ |
|
217
|
|
|
$album = $this->album->get_info($album_id); |
|
218
|
|
|
if (!$this->gallery_auth->acl_check('m_status', $album['album_id'], $album['album_user_id'])) |
|
219
|
|
|
{ |
|
220
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
221
|
|
|
} |
|
222
|
|
|
} |
|
223
|
|
|
if (!empty($approve_ary)) |
|
224
|
|
|
{ |
|
225
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
226
|
|
|
{ |
|
227
|
|
|
if ($action == 'approve') |
|
|
|
|
|
|
228
|
|
|
{ |
|
229
|
|
|
$count = 0; |
|
230
|
|
|
foreach ($approve_ary as $album_id => $approve_array) |
|
|
|
|
|
|
231
|
|
|
{ |
|
232
|
|
|
$this->image->approve_images($approve_array, $album_id); |
|
233
|
|
|
$this->album->update_info($album_id); |
|
234
|
|
|
$count = $count + count($approve_array); |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
$message = $this->language->lang('WAITING_APPROVED_IMAGE', $count); |
|
238
|
|
|
$this->url->meta_refresh(3, $back_link); |
|
239
|
|
|
trigger_error($message); |
|
240
|
|
|
} |
|
241
|
|
|
if ($action == 'disapprove') |
|
242
|
|
|
{ |
|
243
|
|
|
$count = 0; |
|
244
|
|
|
foreach ($approve_ary as $album_id => $delete_array) |
|
|
|
|
|
|
245
|
|
|
{ |
|
246
|
|
|
// Let's load info for images, so we can |
|
247
|
|
|
$filenames = $this->image->get_filenames($delete_array); |
|
248
|
|
|
// Let's log the action |
|
249
|
|
|
foreach ($filenames as $name) |
|
250
|
|
|
{ |
|
251
|
|
|
$this->gallery_log->add_log('moderator', 'disapprove', $album_id, 0, array('LOG_GALLERY_DISAPPROVED', $name)); |
|
252
|
|
|
} |
|
253
|
|
|
$this->moderate->delete_images($delete_array); |
|
254
|
|
|
$count = $count + count($delete_array); |
|
255
|
|
|
} |
|
256
|
|
|
$message = $this->language->lang('WAITING_DISAPPROVED_IMAGE', $count); |
|
257
|
|
|
$this->url->meta_refresh(3, $back_link); |
|
258
|
|
|
trigger_error($message); |
|
259
|
|
|
} |
|
260
|
|
|
} |
|
261
|
|
|
else |
|
262
|
|
|
{ |
|
263
|
|
|
$s_hidden_fields = '<input type="hidden" name="action['.$action.']" value="' . $action . '" />'; |
|
264
|
|
|
$s_hidden_fields .= '<input type="hidden" name="back_link" value="' . $back_link . '" />'; |
|
265
|
|
|
foreach ($approve_ary as $id => $var) |
|
266
|
|
|
{ |
|
267
|
|
|
foreach ($var as $var1) |
|
268
|
|
|
{ |
|
269
|
|
|
$s_hidden_fields .= '<input type="hidden" name="approval[' . $id . '][]" value="' . $var1 . '" />'; |
|
270
|
|
|
} |
|
271
|
|
|
} |
|
272
|
|
|
confirm_box(false, $this->language->lang('QUEUES_A_' . strtoupper($action) . '2_CONFIRM'), $s_hidden_fields); |
|
273
|
|
|
} |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
$this->template->assign_vars(array( |
|
277
|
|
|
'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), |
|
278
|
|
|
'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), |
|
279
|
|
|
'U_GALLERY_MODERATE_REPORT' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports'), |
|
280
|
|
|
'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
|
281
|
|
|
'U_GALLERY_MCP_LOGS' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_action_log_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_action_log'), |
|
282
|
|
|
'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
|
283
|
|
|
)); |
|
284
|
|
|
$this->moderate->build_list($album_id, $page); |
|
285
|
|
|
return $this->helper->render('gallery/moderate_approve.html', $this->language->lang('GALLERY')); |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
/** |
|
289
|
|
|
* Index Controller |
|
290
|
|
|
* Route: gallery/moderate/actions |
|
291
|
|
|
* |
|
292
|
|
|
* @param $page |
|
293
|
|
|
* @param $album_id |
|
294
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
295
|
|
|
*/ |
|
296
|
|
|
public function action_log($page, $album_id) |
|
297
|
|
|
{ |
|
298
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
299
|
|
|
$this->language->add_lang('mcp'); |
|
300
|
|
|
|
|
301
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
302
|
|
|
$album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
|
303
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
304
|
|
|
if ($album_id === 0) |
|
305
|
|
|
{ |
|
306
|
|
|
if (!$this->gallery_auth->acl_check_global('m_')) |
|
307
|
|
|
{ |
|
308
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
309
|
|
|
} |
|
310
|
|
|
} |
|
311
|
|
|
else |
|
312
|
|
|
{ |
|
313
|
|
|
$album = $this->album->get_info($album_id); |
|
314
|
|
|
if (!$this->gallery_auth->acl_check('m_', $album['album_id'], $album['album_user_id'])) |
|
315
|
|
|
{ |
|
316
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
317
|
|
|
} |
|
318
|
|
|
} |
|
319
|
|
|
$this->template->assign_vars(array( |
|
320
|
|
|
'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), |
|
321
|
|
|
'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), |
|
322
|
|
|
'U_GALLERY_MODERATE_REPORT' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports'), |
|
323
|
|
|
'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
|
324
|
|
|
'U_GALLERY_MCP_LOGS' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_action_log_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_action_log'), |
|
325
|
|
|
'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
|
326
|
|
|
)); |
|
327
|
|
|
|
|
328
|
|
|
$this->gallery_log->build_list('moderator', 0, $page, $album_id); |
|
329
|
|
|
return $this->helper->render('gallery/moderate_actions.html', $this->language->lang('GALLERY')); |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
/** |
|
333
|
|
|
* Index Controller |
|
334
|
|
|
* Route: gallery/moderate/reports |
|
335
|
|
|
* |
|
336
|
|
|
* @param $page |
|
337
|
|
|
* @param $album_id |
|
338
|
|
|
* @param $status |
|
339
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
340
|
|
|
*/ |
|
341
|
|
|
public function reports($page, $album_id, $status) |
|
342
|
|
|
{ |
|
343
|
|
|
$report_ary = $this->request->variable('report', array(0)); |
|
344
|
|
|
$action_ary = $this->request->variable('action', array('' => 0)); |
|
345
|
|
|
$back_link = $this->request->variable('back_link', $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports')); |
|
346
|
|
|
foreach ($action_ary as $act => $garb) |
|
347
|
|
|
{ |
|
348
|
|
|
$action = $act; |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
352
|
|
|
$this->language->add_lang('mcp'); |
|
353
|
|
|
|
|
354
|
|
|
if (!empty($report_ary)) |
|
355
|
|
|
{ |
|
356
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
357
|
|
|
{ |
|
358
|
|
|
$this->report->close_reports_by_image($report_ary); |
|
359
|
|
|
$message = $this->language->lang('WAITING_REPORTED_DONE', count($report_ary)); |
|
360
|
|
|
$this->url->meta_refresh(3, $back_link); |
|
361
|
|
|
trigger_error($message); |
|
362
|
|
|
} |
|
363
|
|
|
else |
|
364
|
|
|
{ |
|
365
|
|
|
$s_hidden_fields = '<input type="hidden" name="action['.$action.']" value="' . $action . '" />'; |
|
|
|
|
|
|
366
|
|
|
$s_hidden_fields .= '<input type="hidden" name="back_link" value="' . $back_link . '" />'; |
|
367
|
|
|
foreach ($report_ary as $var) |
|
368
|
|
|
{ |
|
369
|
|
|
$s_hidden_fields .= '<input type="hidden" name="report[]" value="' . $var . '" />'; |
|
370
|
|
|
} |
|
371
|
|
|
confirm_box(false, $this->language->lang('REPORTS_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
|
372
|
|
|
} |
|
373
|
|
|
} |
|
374
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
375
|
|
|
$album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
|
376
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
377
|
|
|
if ($album_id === 0) |
|
378
|
|
|
{ |
|
379
|
|
|
if (!$this->gallery_auth->acl_check_global('m_report')) |
|
380
|
|
|
{ |
|
381
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
382
|
|
|
} |
|
383
|
|
|
} |
|
384
|
|
|
else |
|
385
|
|
|
{ |
|
386
|
|
|
$album = $this->album->get_info($album_id); |
|
387
|
|
|
if (!$this->gallery_auth->acl_check('m_report', $album['album_id'], $album['album_user_id'])) |
|
388
|
|
|
{ |
|
389
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
390
|
|
|
} |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
$this->template->assign_vars(array( |
|
394
|
|
|
'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), |
|
395
|
|
|
'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), |
|
396
|
|
|
'U_GALLERY_MODERATE_REPORT' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports'), |
|
397
|
|
|
'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
|
398
|
|
|
'U_GALLERY_MODERATE_REPORT_CLOSED' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_closed_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports_closed'), |
|
399
|
|
|
'U_GALLERY_MCP_LOGS' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_action_log_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_action_log'), |
|
400
|
|
|
'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
|
401
|
|
|
'U_STATUS' => $status == 1 ? true : false, |
|
402
|
|
|
)); |
|
403
|
|
|
|
|
404
|
|
|
$this->report->build_list($album_id, $page, $this->config['phpbb_gallery_items_per_page'], $status); |
|
405
|
|
|
return $this->helper->render('gallery/moderate_reports.html', $this->language->lang('GALLERY')); |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
/** |
|
409
|
|
|
* Moderate Controller |
|
410
|
|
|
* Route: gallery/moderate/{album_id}/list |
|
411
|
|
|
* |
|
412
|
|
|
* @param $album_id |
|
413
|
|
|
* @param $page |
|
414
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
415
|
|
|
*/ |
|
416
|
|
|
public function album_overview($album_id, $page) |
|
417
|
|
|
{ |
|
418
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
419
|
|
|
$this->language->add_lang('mcp'); |
|
420
|
|
|
|
|
421
|
|
|
$actions_array = $this->request->variable('action', array(0)); |
|
422
|
|
|
$action = $this->request->variable('select_action', ''); |
|
423
|
|
|
$back_link = $this->request->variable('back_link', $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id))); |
|
424
|
|
|
$moving_target = $this->request->variable('moving_target', ''); |
|
425
|
|
|
if (!empty($actions_array)) |
|
426
|
|
|
{ |
|
427
|
|
|
if (confirm_box(true) || $moving_target) |
|
|
|
|
|
|
428
|
|
|
{ |
|
429
|
|
|
$message = ''; |
|
430
|
|
|
switch ($action) |
|
431
|
|
|
{ |
|
432
|
|
|
case 'approve': |
|
433
|
|
|
$this->image->approve_images($actions_array, $album_id); |
|
434
|
|
|
$this->album->update_info($album_id); |
|
435
|
|
|
$message = $this->language->lang('WAITING_APPROVED_IMAGE', count($actions_array)); |
|
436
|
|
|
break; |
|
437
|
|
|
|
|
438
|
|
|
case 'unapprove': |
|
439
|
|
|
$this->image->unapprove_images($actions_array, $album_id); |
|
440
|
|
|
$this->album->update_info($album_id); |
|
441
|
|
|
$message = $this->language->lang('WAITING_UNAPPROVED_IMAGE', count($actions_array)); |
|
442
|
|
|
break; |
|
443
|
|
|
|
|
444
|
|
|
case 'lock': |
|
445
|
|
|
$this->image->lock_images($actions_array, $album_id); |
|
446
|
|
|
$this->album->update_info($album_id); |
|
447
|
|
|
$message = $this->language->lang('WAITING_LOCKED_IMAGE', count($actions_array)); |
|
448
|
|
|
break; |
|
449
|
|
|
|
|
450
|
|
|
case 'delete': |
|
451
|
|
|
$this->moderate->delete_images($actions_array); |
|
452
|
|
|
$this->album->update_info($album_id); |
|
453
|
|
|
$message = $this->language->lang('DELETED_IMAGES', count($actions_array)); |
|
454
|
|
|
break; |
|
455
|
|
|
|
|
456
|
|
|
case 'move': |
|
457
|
|
|
$this->image->move_image($actions_array, $moving_target); |
|
458
|
|
|
$this->album->update_info($album_id); |
|
459
|
|
|
$this->album->update_info($moving_target); |
|
460
|
|
|
$message = $this->language->lang('MOVED_IMAGES', count($actions_array)); |
|
461
|
|
|
break; |
|
462
|
|
|
|
|
463
|
|
|
case 'report': |
|
464
|
|
|
$this->report->close_reports_by_image($actions_array); |
|
465
|
|
|
$message = $this->language->lang('WAITING_REPORTED_DONE', count($actions_array)); |
|
466
|
|
|
break; |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
if (!empty($message)) |
|
470
|
|
|
{ |
|
471
|
|
|
$this->url->meta_refresh(3, $back_link); |
|
472
|
|
|
trigger_error($message); |
|
473
|
|
|
} |
|
474
|
|
|
} |
|
475
|
|
|
else |
|
476
|
|
|
{ |
|
477
|
|
|
$s_hidden_fields = '<input type="hidden" name="select_action" value="' . $action . '" />'; |
|
478
|
|
|
$s_hidden_fields .= '<input type="hidden" name="back_link" value="' . $back_link . '" />'; |
|
479
|
|
|
foreach ($actions_array as $var) |
|
480
|
|
|
{ |
|
481
|
|
|
$s_hidden_fields .= '<input type="hidden" name="action[]" value="' . $var . '" />'; |
|
482
|
|
|
} |
|
483
|
|
|
if ($action == 'report') |
|
484
|
|
|
{ |
|
485
|
|
|
confirm_box(false, $this->language->lang('REPORT_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
|
486
|
|
|
} |
|
487
|
|
|
if ($action == 'move') |
|
488
|
|
|
{ |
|
489
|
|
|
$category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); |
|
490
|
|
|
$this->template->assign_vars(array( |
|
491
|
|
|
'S_MOVING_IMAGES' => true, |
|
492
|
|
|
'S_ALBUM_SELECT' => $category_select, |
|
493
|
|
|
'S_HIDDEN_FIELDS' => $s_hidden_fields, |
|
494
|
|
|
)); |
|
495
|
|
|
return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); |
|
496
|
|
|
} |
|
497
|
|
|
else |
|
498
|
|
|
{ |
|
499
|
|
|
confirm_box(false, $this->language->lang('QUEUES_A_' . strtoupper($action) . '2_CONFIRM'), $s_hidden_fields); |
|
500
|
|
|
} |
|
501
|
|
|
} |
|
502
|
|
|
} |
|
503
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
504
|
|
|
$album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
|
505
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
506
|
|
|
if ($album_id === 0) |
|
507
|
|
|
{ |
|
508
|
|
|
if (!$this->gallery_auth->acl_check_global('m_')) |
|
509
|
|
|
{ |
|
510
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
511
|
|
|
} |
|
512
|
|
|
} |
|
513
|
|
|
else |
|
514
|
|
|
{ |
|
515
|
|
|
$album = $this->album->get_info($album_id); |
|
516
|
|
|
if (!$this->gallery_auth->acl_check('m_', $album['album_id'], $album['album_user_id'])) |
|
517
|
|
|
{ |
|
518
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
519
|
|
|
} |
|
520
|
|
|
} |
|
521
|
|
|
$this->template->assign_vars(array( |
|
522
|
|
|
'U_GALLERY_MODERATE_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate'), |
|
523
|
|
|
'U_GALLERY_MODERATE_APPROVE' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_queue_approve_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_queue_approve'), |
|
524
|
|
|
'U_GALLERY_MODERATE_REPORT' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_reports_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_reports'), |
|
525
|
|
|
'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
|
526
|
|
|
'U_GALLERY_MCP_LOGS' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_action_log_album', array('album_id' => $album_id)) : $this->helper->route('phpbbgallery_core_moderate_action_log'), |
|
527
|
|
|
'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
|
528
|
|
|
)); |
|
529
|
|
|
$this->moderate->album_overview($album_id, $page); |
|
530
|
|
|
return $this->helper->render('gallery/moderate_album_overview.html', $this->language->lang('GALLERY')); |
|
531
|
|
|
} |
|
532
|
|
|
|
|
533
|
|
|
/** |
|
534
|
|
|
* Index Controller |
|
535
|
|
|
* Route: gallery/moderate/image/{image_id} |
|
536
|
|
|
* |
|
537
|
|
|
* @param $image_id |
|
538
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
539
|
|
|
*/ |
|
540
|
|
|
public function image($image_id) |
|
541
|
|
|
{ |
|
542
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
543
|
|
|
$this->language->add_lang('mcp'); |
|
544
|
|
|
$quick_action = $this->request->variable('action', ''); |
|
545
|
|
|
|
|
546
|
|
|
// If we have quick mode (EDIT, DELETE) just send us to the page we need |
|
547
|
|
|
switch ($quick_action) |
|
548
|
|
|
{ |
|
549
|
|
|
case 'images_move': |
|
550
|
|
|
$route = $this->helper->route('phpbbgallery_core_moderate_image_move', array('image_id' => $image_id)); |
|
551
|
|
|
$redirect = new RedirectResponse($route); |
|
552
|
|
|
$redirect->send(); |
|
553
|
|
|
break; |
|
554
|
|
|
case 'image_edit': |
|
555
|
|
|
$route = $this->helper->route('phpbbgallery_core_image_edit', array('image_id' => $image_id)); |
|
556
|
|
|
$redirect = new RedirectResponse($route); |
|
557
|
|
|
$redirect->send(); |
|
558
|
|
|
break; |
|
559
|
|
|
case 'images_unapprove': |
|
560
|
|
|
$route = $this->helper->route('phpbbgallery_core_moderate_image_unapprove', array('image_id' => $image_id)); |
|
561
|
|
|
$redirect = new RedirectResponse($route); |
|
562
|
|
|
$redirect->send(); |
|
563
|
|
|
break; |
|
564
|
|
|
case 'images_approve': |
|
565
|
|
|
$route = $this->helper->route('phpbbgallery_core_moderate_image_approve', array('image_id' => $image_id)); |
|
566
|
|
|
$redirect = new RedirectResponse($route); |
|
567
|
|
|
$redirect->send(); |
|
568
|
|
|
break; |
|
569
|
|
|
case 'images_lock': |
|
570
|
|
|
$route = $this->helper->route('phpbbgallery_core_moderate_image_lock', array('image_id' => $image_id)); |
|
571
|
|
|
$redirect = new RedirectResponse($route); |
|
572
|
|
|
$redirect->send(); |
|
573
|
|
|
break; |
|
574
|
|
|
case 'images_delete': |
|
575
|
|
|
$route = $this->helper->route('phpbbgallery_core_image_delete', array('image_id' => $image_id)); |
|
576
|
|
|
$redirect = new RedirectResponse($route); |
|
577
|
|
|
$redirect->send(); |
|
578
|
|
|
break; |
|
579
|
|
|
case 'reports_close': |
|
580
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
581
|
|
|
{ |
|
582
|
|
|
$back_link = $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)); |
|
583
|
|
|
$this->report->close_reports_by_image($image_id); |
|
584
|
|
|
$message = $this->language->lang('WAITING_REPORTED_DONE', 1); |
|
585
|
|
|
$this->url->meta_refresh(3, $back_link); |
|
586
|
|
|
trigger_error($message); |
|
587
|
|
|
} |
|
588
|
|
|
else |
|
589
|
|
|
{ |
|
590
|
|
|
$s_hidden_fields = '<input type="hidden" name="action" value="reports_close" />'; |
|
591
|
|
|
confirm_box(false, $this->language->lang('REPORT_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
|
592
|
|
|
} |
|
593
|
|
|
break; |
|
594
|
|
|
case 'reports_open': |
|
595
|
|
|
$route = $this->helper->route('phpbbgallery_core_image_report', array('image_id' => $image_id)); |
|
596
|
|
|
$redirect = new RedirectResponse($route); |
|
597
|
|
|
$redirect->send(); |
|
598
|
|
|
break; |
|
599
|
|
|
} |
|
600
|
|
|
$image_data = $this->image->get_image_data($image_id); |
|
601
|
|
|
$album_data = $this->album->get_info($image_data['image_album_id']); |
|
602
|
|
|
$users_array = $report_data = array(); |
|
|
|
|
|
|
603
|
|
|
$open_report = false; |
|
604
|
|
|
$report_data = $this->report->get_data_by_image($image_id); |
|
605
|
|
|
foreach ($report_data as $var) |
|
606
|
|
|
{ |
|
607
|
|
|
$users_array[$var['reporter_id']] = array(''); |
|
608
|
|
|
$users_array[$var['report_manager']] = array(''); |
|
609
|
|
|
if ($var['report_status'] == 1) |
|
610
|
|
|
{ |
|
611
|
|
|
$open_report = true; |
|
612
|
|
|
} |
|
613
|
|
|
} |
|
614
|
|
|
$users_array[$image_data['image_user_id']] = array(''); |
|
615
|
|
|
$this->user_loader->load_users(array_keys($users_array)); |
|
616
|
|
|
// Now let's get some ACL |
|
617
|
|
|
$select_select = '<option value="" selected="selected">' . $this->language->lang('CHOOSE_ACTION') . '</option>'; |
|
618
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
619
|
|
|
if ($this->gallery_auth->acl_check('m_status', $album_data['album_id'], $album_data['album_user_id'])) |
|
620
|
|
|
{ |
|
621
|
|
|
if ($image_data['image_status'] == 0) |
|
622
|
|
|
{ |
|
623
|
|
|
$select_select .= '<option value="images_approve">' . $this->language->lang('QUEUE_A_APPROVE') . '</option>'; |
|
624
|
|
|
$select_select .= '<option value="images_lock">' . $this->language->lang('QUEUE_A_LOCK') . '</option>'; |
|
625
|
|
|
} |
|
626
|
|
|
else if ($image_data['image_status'] == 1) |
|
627
|
|
|
{ |
|
628
|
|
|
$select_select .= '<option value="images_unapprove">' . $this->language->lang('QUEUE_A_UNAPPROVE') . '</option>'; |
|
629
|
|
|
$select_select .= '<option value="images_lock">' . $this->language->lang('QUEUE_A_LOCK') . '</option>'; |
|
630
|
|
|
} |
|
631
|
|
|
else |
|
632
|
|
|
{ |
|
633
|
|
|
$select_select .= '<option value="images_approve">' . $this->language->lang('QUEUE_A_APPROVE') . '</option>'; |
|
634
|
|
|
$select_select .= '<option value="images_unapprove">' . $this->language->lang('QUEUE_A_UNAPPROVE') . '</option>'; |
|
635
|
|
|
} |
|
636
|
|
|
} |
|
637
|
|
|
if ($this->gallery_auth->acl_check('m_delete', $album_data['album_id'], $album_data['album_user_id'])) |
|
638
|
|
|
{ |
|
639
|
|
|
$select_select .= '<option value="images_delete">' . $this->language->lang('QUEUE_A_DELETE') . '</option>'; |
|
640
|
|
|
} |
|
641
|
|
|
if ($this->gallery_auth->acl_check('m_move', $album_data['album_id'], $album_data['album_user_id'])) |
|
642
|
|
|
{ |
|
643
|
|
|
$select_select .= '<option value="images_move">' . $this->language->lang('QUEUES_A_MOVE') . '</option>'; |
|
644
|
|
|
} |
|
645
|
|
|
if ($this->gallery_auth->acl_check('m_report', $album_data['album_id'], $album_data['album_user_id'])) |
|
646
|
|
|
{ |
|
647
|
|
|
if ($open_report) |
|
648
|
|
|
{ |
|
649
|
|
|
$select_select .= '<option value="reports_close">' . $this->language->lang('REPORT_A_CLOSE') . '</option>'; |
|
650
|
|
|
} |
|
651
|
|
|
else |
|
652
|
|
|
{ |
|
653
|
|
|
$select_select .= '<option value="reports_open">' . $this->language->lang('REPORT_A_OPEN') . '</option>'; |
|
654
|
|
|
} |
|
655
|
|
|
} |
|
656
|
|
|
$this->template->assign_vars(array( |
|
657
|
|
|
'ALBUM_NAME' => $album_data['album_name'], |
|
658
|
|
|
'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $image_data['image_album_id'])), |
|
659
|
|
|
'U_EDIT_IMAGE' => $this->helper->route('phpbbgallery_core_image_edit', array('image_id' => $image_id)), |
|
660
|
|
|
'U_DELETE_IMAGE' => $this->helper->route('phpbbgallery_core_image_delete', array('image_id' => $image_id)), |
|
661
|
|
|
'IMAGE_NAME' => $image_data['image_name'], |
|
662
|
|
|
'IMAGE_TIME' => $this->user->format_date($image_data['image_time']), |
|
663
|
|
|
'UPLOADER' => $this->user_loader->get_username($image_data['image_user_id'], 'full'), |
|
664
|
|
|
'U_MOVE_IMAGE' => $this->helper->route('phpbbgallery_core_moderate_image_move', array('image_id' => $image_id)), |
|
665
|
|
|
'STATUS' => $this->language->lang('QUEUE_STATUS_' . $image_data['image_status']), |
|
666
|
|
|
'UC_IMAGE' => $this->image->generate_link('medium', $this->config['phpbb_gallery_link_thumbnail'], $image_data['image_id'], $image_data['image_name'], $image_data['image_album_id']), |
|
667
|
|
|
'IMAGE_DESC' => generate_text_for_display($image_data['image_desc'], $image_data['image_desc_uid'], $image_data['image_desc_bitfield'], 7), |
|
|
|
|
|
|
668
|
|
|
'U_SELECT' => $select_select, |
|
669
|
|
|
'S_MCP_ACTION' => $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)), |
|
670
|
|
|
)); |
|
671
|
|
|
foreach ($report_data as $var) |
|
672
|
|
|
{ |
|
673
|
|
|
$this->template->assign_block_vars('reports', array( |
|
674
|
|
|
'REPORTER' => $this->user_loader->get_username($var['reporter_id'], 'full'), |
|
675
|
|
|
'REPORT_TIME' => $this->user->format_date($var['report_time']), |
|
676
|
|
|
'REPORT_NOTE' => $var['report_note'], |
|
677
|
|
|
'STATUS' => $var['report_status'], |
|
678
|
|
|
'MANAGER' => $var['report_manager'] != 0 ? $this->user_loader->get_username($var['report_manager'], 'full') : false, |
|
679
|
|
|
)); |
|
680
|
|
|
} |
|
681
|
|
|
return $this->helper->render('gallery/moderate_image_overview.html', $this->language->lang('GALLERY')); |
|
682
|
|
|
} |
|
683
|
|
|
|
|
684
|
|
|
/** |
|
685
|
|
|
* Index Controller |
|
686
|
|
|
* Route: gallery/moderate/image/{image_id}/approve |
|
687
|
|
|
* |
|
688
|
|
|
* @param $image_id |
|
689
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
690
|
|
|
*/ |
|
691
|
|
|
public function approve($image_id) |
|
692
|
|
|
{ |
|
693
|
|
|
$image_data = $this->image->get_image_data($image_id); |
|
694
|
|
|
$album_data = $this->album->get_info($image_data['image_album_id']); |
|
695
|
|
|
|
|
696
|
|
|
$album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $image_data['image_album_id'])); |
|
697
|
|
|
$image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
|
698
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
699
|
|
|
$meta_refresh_time = 2; |
|
700
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
701
|
|
|
if (!$this->gallery_auth->acl_check('m_status', $image_data['image_album_id'], $album_data['album_user_id'])) |
|
702
|
|
|
{ |
|
703
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
704
|
|
|
} |
|
705
|
|
|
$action_keys = array_keys($this->request->variable('action', ['approve' => 1])); |
|
706
|
|
|
$action = $action_keys[0] ?? 'approve'; |
|
707
|
|
|
|
|
708
|
|
|
if ($action === 'disapprove') |
|
709
|
|
|
{ |
|
710
|
|
|
$redirect = new RedirectResponse($this->helper->route('phpbbgallery_core_image_delete', ['image_id' => $image_id])); |
|
711
|
|
|
$redirect->send(); |
|
712
|
|
|
} |
|
713
|
|
|
$show_notify = true; |
|
714
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
715
|
|
|
$this->language->add_lang('mcp'); |
|
716
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
717
|
|
|
{ |
|
718
|
|
|
$np = $this->request->variable('notify_poster', ''); |
|
719
|
|
|
$notify_poster = ($action == 'approve' && $np); |
|
|
|
|
|
|
720
|
|
|
$image_id_ary = array($image_id); |
|
721
|
|
|
$this->image->approve_images($image_id_ary, $album_data['album_id']); |
|
722
|
|
|
$this->album->update_info($album_data['album_id']); |
|
723
|
|
|
// So we need to see if there are still unapproved images in the album |
|
724
|
|
|
$this->notification_helper->read('approval', $album_data['album_id']); |
|
725
|
|
|
$message = $this->language->lang('WAITING_APPROVED_IMAGE', 1); |
|
726
|
|
|
meta_refresh($meta_refresh_time, $image_backlink); |
|
|
|
|
|
|
727
|
|
|
trigger_error($message); |
|
728
|
|
|
} |
|
729
|
|
|
else |
|
730
|
|
|
{ |
|
731
|
|
|
$this->template->assign_vars(array( |
|
732
|
|
|
'S_NOTIFY_POSTER' => $show_notify, |
|
733
|
|
|
'S_' . strtoupper($action) => true, |
|
734
|
|
|
'S_CONFIRM_ACTION' => $this->helper->route('phpbbgallery_core_moderate_image_approve', array('image_id' => $image_id)), |
|
735
|
|
|
)); |
|
736
|
|
|
$action_msg = $this->language->lang('QUEUES_A_APPROVE2_CONFIRM'); |
|
737
|
|
|
$s_hidden_fields = build_hidden_fields(array( |
|
|
|
|
|
|
738
|
|
|
'action' => 'approve', |
|
739
|
|
|
)); |
|
740
|
|
|
confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html'); |
|
741
|
|
|
} |
|
742
|
|
|
|
|
743
|
|
|
return $this->helper->render('gallery/moderate_overview.html', $this->language->lang('GALLERY')); |
|
744
|
|
|
} |
|
745
|
|
|
|
|
746
|
|
|
/** |
|
747
|
|
|
* Index Controller |
|
748
|
|
|
* Route: gallery/moderate/image/{image_id}/unapprove |
|
749
|
|
|
* |
|
750
|
|
|
* @param $image_id |
|
751
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
752
|
|
|
*/ |
|
753
|
|
|
public function unapprove($image_id) |
|
754
|
|
|
{ |
|
755
|
|
|
$image_data = $this->image->get_image_data($image_id); |
|
756
|
|
|
$album_data = $this->album->get_info($image_data['image_album_id']); |
|
757
|
|
|
|
|
758
|
|
|
$album_backlink = $this->helper->route('phpbbgallery_core_index'); |
|
759
|
|
|
$image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
|
760
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
761
|
|
|
$meta_refresh_time = 2; |
|
762
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
763
|
|
|
if (!$this->gallery_auth->acl_check('m_status', $image_data['image_album_id'], $album_data['album_user_id'])) |
|
764
|
|
|
{ |
|
765
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
766
|
|
|
} |
|
767
|
|
|
|
|
768
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
769
|
|
|
$this->language->add_lang('mcp'); |
|
770
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
771
|
|
|
{ |
|
772
|
|
|
$image_id_ary = array($image_id); |
|
773
|
|
|
$this->image->unapprove_images($image_id_ary, $album_data['album_id']); |
|
774
|
|
|
// To DO - add notification |
|
775
|
|
|
$message = sprintf($this->language->lang('WAITING_UNAPPROVED_IMAGE', 1)); |
|
776
|
|
|
meta_refresh($meta_refresh_time, $image_backlink); |
|
|
|
|
|
|
777
|
|
|
trigger_error($message); |
|
778
|
|
|
} |
|
779
|
|
|
else |
|
780
|
|
|
{ |
|
781
|
|
|
$s_hidden_fields = ''; |
|
782
|
|
|
confirm_box(false, 'QUEUE_A_UNAPPROVE2', $s_hidden_fields); |
|
783
|
|
|
} |
|
784
|
|
|
} |
|
785
|
|
|
|
|
786
|
|
|
/** |
|
787
|
|
|
* Index Controller |
|
788
|
|
|
* Route: gallery/moderate/image/{image_id}/move |
|
789
|
|
|
* |
|
790
|
|
|
* @param $image_id |
|
791
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
792
|
|
|
*/ |
|
793
|
|
|
public function move($image_id): \Symfony\Component\HttpFoundation\Response |
|
794
|
|
|
{ |
|
795
|
|
|
$image_data = $this->image->get_image_data($image_id); |
|
796
|
|
|
$album_id = $image_data['image_album_id']; |
|
797
|
|
|
//$user_id = $image_data['image_user_id']; |
|
798
|
|
|
$album_data = $this->album->get_info($album_id); |
|
799
|
|
|
$album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)); |
|
800
|
|
|
$image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
|
801
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
802
|
|
|
$meta_refresh_time = 2; |
|
803
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
804
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
805
|
|
|
if (!$this->gallery_auth->acl_check('m_move', $image_data['image_album_id'], $album_data['album_user_id'])) |
|
806
|
|
|
{ |
|
807
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
808
|
|
|
} |
|
809
|
|
|
$moving_target = $this->request->variable('moving_target', ''); |
|
810
|
|
|
|
|
811
|
|
|
if ($moving_target) |
|
812
|
|
|
{ |
|
813
|
|
|
$target = array($image_id); |
|
814
|
|
|
$this->image->move_image($target, $moving_target); |
|
815
|
|
|
$message = sprintf($this->language->lang('IMAGES_MOVED', 1)); |
|
816
|
|
|
$this->album->update_info($album_id); |
|
817
|
|
|
$this->album->update_info($moving_target); |
|
818
|
|
|
meta_refresh($meta_refresh_time, $image_backlink); |
|
|
|
|
|
|
819
|
|
|
trigger_error($message); |
|
820
|
|
|
} |
|
821
|
|
|
else |
|
822
|
|
|
{ |
|
823
|
|
|
$category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); |
|
824
|
|
|
$this->template->assign_vars(array( |
|
825
|
|
|
'S_MOVING_IMAGES' => true, |
|
826
|
|
|
'S_ALBUM_SELECT' => $category_select, |
|
827
|
|
|
//'S_HIDDEN_FIELDS' => $s_hidden_fields, |
|
828
|
|
|
)); |
|
829
|
|
|
} |
|
830
|
|
|
|
|
831
|
|
|
return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); |
|
832
|
|
|
} |
|
833
|
|
|
|
|
834
|
|
|
/** |
|
835
|
|
|
* Index Controller |
|
836
|
|
|
* Route: gallery/moderate/image/{image_id}/lock |
|
837
|
|
|
* |
|
838
|
|
|
* @param $image_id |
|
839
|
|
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
840
|
|
|
*/ |
|
841
|
|
|
public function lock($image_id) |
|
842
|
|
|
{ |
|
843
|
|
|
$image_data = $this->image->get_image_data($image_id); |
|
844
|
|
|
$album_id = $image_data['image_album_id']; |
|
845
|
|
|
//$user_id = $image_data['image_user_id']; |
|
846
|
|
|
$album_data = $this->album->get_info($album_id); |
|
847
|
|
|
$album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)); |
|
848
|
|
|
$image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
|
849
|
|
|
$album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
|
|
|
|
|
|
850
|
|
|
$meta_refresh_time = 2; |
|
851
|
|
|
$this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
|
852
|
|
|
$this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
|
853
|
|
|
if (!$this->gallery_auth->acl_check('m_status', $image_data['image_album_id'], $album_data['album_user_id'])) |
|
854
|
|
|
{ |
|
855
|
|
|
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
|
856
|
|
|
} |
|
857
|
|
|
if (confirm_box(true)) |
|
|
|
|
|
|
858
|
|
|
{ |
|
859
|
|
|
$image_id_ary = array($image_id); |
|
860
|
|
|
$this->image->lock_images($image_id_ary, $album_data['album_id']); |
|
861
|
|
|
// To DO - add notification |
|
862
|
|
|
$message = sprintf($this->language->lang('WAITING_LOCKED_IMAGE',1)); |
|
863
|
|
|
meta_refresh($meta_refresh_time, $image_backlink); |
|
|
|
|
|
|
864
|
|
|
trigger_error($message); |
|
865
|
|
|
} |
|
866
|
|
|
else |
|
867
|
|
|
{ |
|
868
|
|
|
$s_hidden_fields = ''; |
|
869
|
|
|
confirm_box(false, 'QUEUE_A_LOCK2', $s_hidden_fields); |
|
870
|
|
|
} |
|
871
|
|
|
} |
|
872
|
|
|
} |
|
873
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths