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