Total Complexity | 121 |
Total Lines | 864 |
Duplicated Lines | 0 % |
Changes | 9 | ||
Bugs | 0 | Features | 0 |
Complex classes like moderate often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use moderate, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
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 | public function __construct(\phpbb\config\config $config, \phpbb\request\request $request, |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Index Controller |
||
136 | * Route: gallery/modarate |
||
137 | * |
||
138 | * @param int $album_id |
||
139 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
140 | */ |
||
141 | public function base($album_id = 0) |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * Index Controller |
||
186 | * Route: gallery/modarate/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) |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * Index Controller |
||
290 | * Route: gallery/modarate/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_premissions($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 | $this->gallery_log->build_list('moderator', 0, $page, $album_id); |
||
328 | return $this->helper->render('gallery/moderate_actions.html', $this->language->lang('GALLERY')); |
||
329 | } |
||
330 | |||
331 | /** |
||
332 | * Index Controller |
||
333 | * Route: gallery/modarate/reports |
||
334 | * |
||
335 | * @param $page |
||
336 | * @param $album_id |
||
337 | * @param $status |
||
338 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
339 | */ |
||
340 | public function reports($page, $album_id, $status) |
||
341 | { |
||
342 | $report_ary = $this->request->variable('report', array(0)); |
||
343 | $action_ary = $this->request->variable('action', array('' => 0)); |
||
344 | $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')); |
||
345 | foreach ($action_ary as $act => $garb) |
||
346 | { |
||
347 | $action = $act; |
||
348 | } |
||
349 | |||
350 | $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
||
351 | $this->language->add_lang('mcp'); |
||
352 | |||
353 | if (!empty($report_ary)) |
||
354 | { |
||
355 | if (confirm_box(true)) |
||
356 | { |
||
357 | $this->report->close_reports_by_image($report_ary); |
||
358 | $message = $this->language->lang('WAITING_REPORTED_DONE', count($report_ary)); |
||
359 | $this->url->meta_refresh(3, $back_link); |
||
360 | trigger_error($message); |
||
361 | } |
||
362 | else |
||
363 | { |
||
364 | $s_hidden_fields = '<input type="hidden" name="action['.$action.']" value="' . $action . '" />'; |
||
365 | $s_hidden_fields .= '<input type="hidden" name="back_link" value="' . $back_link . '" />'; |
||
366 | foreach ($report_ary as $var) |
||
367 | { |
||
368 | $s_hidden_fields .= '<input type="hidden" name="report[]" value="' . $var . '" />'; |
||
369 | } |
||
370 | confirm_box(false, $this->language->lang('REPORTS_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
||
371 | } |
||
372 | } |
||
373 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
||
374 | $album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
||
375 | $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
||
376 | if ($album_id === 0) |
||
377 | { |
||
378 | if (!$this->gallery_auth->acl_check_global('m_report')) |
||
379 | { |
||
380 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
381 | } |
||
382 | } |
||
383 | else |
||
384 | { |
||
385 | $album = $this->album->get_info($album_id); |
||
386 | if (!$this->gallery_auth->acl_check('m_report', $album['album_id'], $album['album_user_id'])) |
||
387 | { |
||
388 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
389 | } |
||
390 | } |
||
391 | |||
392 | $this->template->assign_vars(array( |
||
393 | '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'), |
||
394 | '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'), |
||
395 | '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'), |
||
396 | 'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
||
397 | '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'), |
||
398 | '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'), |
||
399 | 'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
||
400 | 'U_STATUS' => $status == 1 ? true : false, |
||
401 | )); |
||
402 | |||
403 | $this->report->build_list($album_id, $page, $this->config['phpbb_gallery_items_per_page'], $status); |
||
404 | return $this->helper->render('gallery/moderate_reports.html', $this->language->lang('GALLERY')); |
||
405 | } |
||
406 | |||
407 | /** |
||
408 | * Moderate Controller |
||
409 | * Route: gallery/moderate/{album_id}/list |
||
410 | * |
||
411 | * @param $album_id |
||
412 | * @param $page |
||
413 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
414 | */ |
||
415 | public function album_overview($album_id, $page) |
||
416 | { |
||
417 | $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
||
418 | $this->language->add_lang('mcp'); |
||
419 | |||
420 | $actions_array = $this->request->variable('action', array(0)); |
||
421 | $action = $this->request->variable('select_action', ''); |
||
422 | $back_link = $this->request->variable('back_link', $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id))); |
||
423 | $moving_target = $this->request->variable('moving_target', ''); |
||
424 | if (!empty($actions_array)) |
||
425 | { |
||
426 | if (confirm_box(true) || $moving_target) |
||
427 | { |
||
428 | switch ($action) |
||
429 | { |
||
430 | case 'approve': |
||
431 | $this->image->approve_images($actions_array, $album_id); |
||
432 | $this->album->update_info($album_id); |
||
433 | |||
434 | $message = $this->language->lang('WAITING_APPROVED_IMAGE', count($actions_array)); |
||
435 | $this->url->meta_refresh(3, $back_link); |
||
436 | trigger_error($message); |
||
437 | break; |
||
438 | case 'unapprove': |
||
439 | $this->image->unapprove_images($actions_array, $album_id); |
||
440 | $this->album->update_info($album_id); |
||
441 | |||
442 | $message = $this->language->lang('WAITING_UNAPPROVED_IMAGE', count($actions_array)); |
||
443 | $this->url->meta_refresh(3, $back_link); |
||
444 | trigger_error($message); |
||
445 | break; |
||
446 | case 'lock': |
||
447 | $this->image->lock_images($actions_array, $album_id); |
||
448 | $this->album->update_info($album_id); |
||
449 | |||
450 | $message = $this->language->lang('WAITING_LOCKED_IMAGE', count($actions_array)); |
||
451 | $this->url->meta_refresh(3, $back_link); |
||
452 | trigger_error($message); |
||
453 | break; |
||
454 | case 'delete': |
||
455 | $this->moderate->delete_images($actions_array); |
||
456 | $this->album->update_info($album_id); |
||
457 | |||
458 | $message = $this->language->lang('DELETED_IMAGES', count($actions_array)); |
||
459 | $this->url->meta_refresh(3, $back_link); |
||
460 | trigger_error($message); |
||
461 | break; |
||
462 | case 'move': |
||
463 | $this->image->move_image($actions_array, $moving_target); |
||
464 | $this->album->update_info($album_id); |
||
465 | $this->album->update_info($moving_target); |
||
466 | |||
467 | $message = $this->language->lang('MOVED_IMAGES', count($actions_array)); |
||
468 | $this->url->meta_refresh(3, $back_link); |
||
469 | trigger_error($message); |
||
470 | break; |
||
471 | case 'report': |
||
472 | $this->report->close_reports_by_image($actions_array); |
||
473 | $message = $this->language->lang('WAITING_REPORTED_DONE', count($actions_array)); |
||
474 | $this->url->meta_refresh(3, $back_link); |
||
475 | trigger_error($message); |
||
476 | break; |
||
477 | } |
||
478 | } |
||
479 | else |
||
480 | { |
||
481 | $s_hidden_fields = '<input type="hidden" name="select_action" value="' . $action . '" />'; |
||
482 | $s_hidden_fields .= '<input type="hidden" name="back_link" value="' . $back_link . '" />'; |
||
483 | foreach ($actions_array as $var) |
||
484 | { |
||
485 | $s_hidden_fields .= '<input type="hidden" name="action[]" value="' . $var . '" />'; |
||
486 | } |
||
487 | if ($action == 'report') |
||
488 | { |
||
489 | confirm_box(false, $this->language->lang('REPORT_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
||
490 | } |
||
491 | if ($action == 'move') |
||
492 | { |
||
493 | $category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); |
||
494 | $this->template->assign_vars(array( |
||
495 | 'S_MOVING_IMAGES' => true, |
||
496 | 'S_ALBUM_SELECT' => $category_select, |
||
497 | 'S_HIDDEN_FIELDS' => $s_hidden_fields, |
||
498 | )); |
||
499 | return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); |
||
500 | } |
||
501 | else |
||
502 | { |
||
503 | confirm_box(false, $this->language->lang('QUEUES_A_' . strtoupper($action) . '2_CONFIRM'), $s_hidden_fields); |
||
504 | } |
||
505 | } |
||
506 | } |
||
507 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
||
508 | $album_backlink = $album_id === 0 ? $this->helper->route('phpbbgallery_core_moderate') : $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $album_id)); |
||
509 | $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
||
510 | if ($album_id === 0) |
||
511 | { |
||
512 | if (!$this->gallery_auth->acl_check_global('m_')) |
||
513 | { |
||
514 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
515 | } |
||
516 | } |
||
517 | else |
||
518 | { |
||
519 | $album = $this->album->get_info($album_id); |
||
520 | if (!$this->gallery_auth->acl_check('m_', $album['album_id'], $album['album_user_id'])) |
||
521 | { |
||
522 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
523 | } |
||
524 | } |
||
525 | $this->template->assign_vars(array( |
||
526 | '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'), |
||
527 | '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'), |
||
528 | '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'), |
||
529 | 'U_ALBUM_OVERVIEW' => $album_id > 0 ? $this->helper->route('phpbbgallery_core_moderate_view', array('album_id' => $album_id)) : false, |
||
530 | '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'), |
||
531 | 'U_ALBUM_NAME' => $album_id > 0 ? $album['album_name'] : false, |
||
532 | )); |
||
533 | $this->moderate->album_overview($album_id, $page); |
||
534 | return $this->helper->render('gallery/moderate_album_overview.html', $this->language->lang('GALLERY')); |
||
535 | } |
||
536 | |||
537 | /** |
||
538 | * Index Controller |
||
539 | * Route: gallery/modarate/image/{image_id} |
||
540 | * |
||
541 | * @param $image_id |
||
542 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
543 | */ |
||
544 | public function image($image_id) |
||
545 | { |
||
546 | $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
||
547 | $this->language->add_lang('mcp'); |
||
548 | $quick_action = $this->request->variable('action', ''); |
||
549 | |||
550 | // If we have quick mode (EDIT, DELETE) just send us to the page we need |
||
551 | switch ($quick_action) |
||
552 | { |
||
553 | case 'images_move': |
||
554 | $route = $this->helper->route('phpbbgallery_core_moderate_image_move', array('image_id' => $image_id)); |
||
555 | $redirect = new RedirectResponse($route); |
||
556 | $redirect->send(); |
||
557 | break; |
||
558 | case 'image_edit': |
||
559 | $route = $this->helper->route('phpbbgallery_core_image_edit', array('image_id' => $image_id)); |
||
560 | $redirect = new RedirectResponse($route); |
||
561 | $redirect->send(); |
||
562 | break; |
||
563 | case 'images_unapprove': |
||
564 | $route = $this->helper->route('phpbbgallery_core_moderate_image_unapprove', array('image_id' => $image_id)); |
||
565 | $redirect = new RedirectResponse($route); |
||
566 | $redirect->send(); |
||
567 | break; |
||
568 | case 'images_approve': |
||
569 | $route = $this->helper->route('phpbbgallery_core_moderate_image_approve', array('image_id' => $image_id)); |
||
570 | $redirect = new RedirectResponse($route); |
||
571 | $redirect->send(); |
||
572 | break; |
||
573 | case 'images_lock': |
||
574 | $route = $this->helper->route('phpbbgallery_core_moderate_image_lock', array('image_id' => $image_id)); |
||
575 | $redirect = new RedirectResponse($route); |
||
576 | $redirect->send(); |
||
577 | break; |
||
578 | case 'images_delete': |
||
579 | $route = $this->helper->route('phpbbgallery_core_image_delete', array('image_id' => $image_id)); |
||
580 | $redirect = new RedirectResponse($route); |
||
581 | $redirect->send(); |
||
582 | break; |
||
583 | case 'reports_close': |
||
584 | if (confirm_box(true)) |
||
585 | { |
||
586 | $back_link = $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)); |
||
587 | $this->report->close_reports_by_image($image_id); |
||
588 | $message = $this->language->lang('WAITING_REPORTED_DONE', 1); |
||
589 | $this->url->meta_refresh(3, $back_link); |
||
590 | trigger_error($message); |
||
591 | } |
||
592 | else |
||
593 | { |
||
594 | $s_hidden_fields = '<input type="hidden" name="action" value="reports_close" />'; |
||
595 | confirm_box(false, $this->language->lang('REPORT_A_CLOSE2_CONFIRM'), $s_hidden_fields); |
||
596 | } |
||
597 | break; |
||
598 | case 'reports_open': |
||
599 | $route = $this->helper->route('phpbbgallery_core_image_report', array('image_id' => $image_id)); |
||
600 | $redirect = new RedirectResponse($route); |
||
601 | $redirect->send(); |
||
602 | break; |
||
603 | } |
||
604 | $image_data = $this->image->get_image_data($image_id); |
||
605 | $album_data = $this->album->get_info($image_data['image_album_id']); |
||
606 | $users_array = $report_data = array(); |
||
607 | $open_report = false; |
||
608 | $report_data = $this->report->get_data_by_image($image_id); |
||
609 | foreach ($report_data as $var) |
||
610 | { |
||
611 | $users_array[$var['reporter_id']] = array(''); |
||
612 | $users_array[$var['report_manager']] = array(''); |
||
613 | if ($var['report_status'] == 1) |
||
614 | { |
||
615 | $open_report = true; |
||
616 | } |
||
617 | } |
||
618 | $users_array[$image_data['image_user_id']] = array(''); |
||
619 | $this->user_loader->load_users(array_keys($users_array)); |
||
620 | // Now let's get some ACL |
||
621 | $select_select = '<option value="" selected="selected">' . $this->language->lang('CHOOSE_ACTION') . '</option>'; |
||
622 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
||
623 | if ($this->gallery_auth->acl_check('m_status', $album_data['album_id'], $album_data['album_user_id'])) |
||
624 | { |
||
625 | if ($image_data['image_status'] == 0) |
||
626 | { |
||
627 | $select_select .= '<option value="images_approve">' . $this->language->lang('QUEUE_A_APPROVE') . '</option>'; |
||
628 | $select_select .= '<option value="images_lock">' . $this->language->lang('QUEUE_A_LOCK') . '</option>'; |
||
629 | } |
||
630 | if ($image_data['image_status'] == 1) |
||
631 | { |
||
632 | $select_select .= '<option value="images_unapprove">' . $this->language->lang('QUEUE_A_UNAPPROVE') . '</option>'; |
||
633 | $select_select .= '<option value="images_lock">' . $this->language->lang('QUEUE_A_LOCK') . '</option>'; |
||
634 | } |
||
635 | else |
||
636 | { |
||
637 | $select_select .= '<option value="images_approve">' . $this->language->lang('QUEUE_A_APPROVE') . '</option>'; |
||
638 | $select_select .= '<option value="images_unapprove">' . $this->language->lang('QUEUE_A_UNAPPROVE') . '</option>'; |
||
639 | } |
||
640 | } |
||
641 | if ($this->gallery_auth->acl_check('m_delete', $album_data['album_id'], $album_data['album_user_id'])) |
||
642 | { |
||
643 | $select_select .= '<option value="images_delete">' . $this->language->lang('QUEUE_A_DELETE') . '</option>'; |
||
644 | } |
||
645 | if ($this->gallery_auth->acl_check('m_move', $album_data['album_id'], $album_data['album_user_id'])) |
||
646 | { |
||
647 | $select_select .= '<option value="images_move">' . $this->language->lang('QUEUES_A_MOVE') . '</option>'; |
||
648 | } |
||
649 | if ($this->gallery_auth->acl_check('m_report', $album_data['album_id'], $album_data['album_user_id'])) |
||
650 | { |
||
651 | if ($open_report) |
||
652 | { |
||
653 | $select_select .= '<option value="reports_close">' . $this->language->lang('REPORT_A_CLOSE') . '</option>'; |
||
654 | } |
||
655 | else |
||
656 | { |
||
657 | $select_select .= '<option value="reports_open">' . $this->language->lang('REPORT_A_OPEN') . '</option>'; |
||
658 | } |
||
659 | } |
||
660 | $this->template->assign_vars(array( |
||
661 | 'ALBUM_NAME' => $album_data['album_name'], |
||
662 | 'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_core_moderate_album', array('album_id' => $image_data['image_album_id'])), |
||
663 | 'U_EDIT_IMAGE' => $this->helper->route('phpbbgallery_core_image_edit', array('image_id' => $image_id)), |
||
664 | 'U_DELETE_IMAGE' => $this->helper->route('phpbbgallery_core_image_delete', array('image_id' => $image_id)), |
||
665 | 'IMAGE_NAME' => $image_data['image_name'], |
||
666 | 'IMAGE_TIME' => $this->user->format_date($image_data['image_time']), |
||
667 | 'UPLOADER' => $this->user_loader->get_username($image_data['image_user_id'], 'full'), |
||
668 | 'U_MOVE_IMAGE' => $this->helper->route('phpbbgallery_core_moderate_image_move', array('image_id' => $image_id)), |
||
669 | 'STATUS' => $this->language->lang('QUEUE_STATUS_' . $image_data['image_status']), |
||
670 | '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']), |
||
671 | 'IMAGE_DESC' => generate_text_for_display($image_data['image_desc'], $image_data['image_desc_uid'], $image_data['image_desc_bitfield'], 7), |
||
672 | 'U_SELECT' => $select_select, |
||
673 | 'S_MCP_ACTION' => $this->helper->route('phpbbgallery_core_moderate_image', array('image_id' => $image_id)), |
||
674 | )); |
||
675 | foreach ($report_data as $var) |
||
676 | { |
||
677 | $this->template->assign_block_vars('reports', array( |
||
678 | 'REPORTER' => $this->user_loader->get_username($var['reporter_id'], 'full'), |
||
679 | 'REPORT_TIME' => $this->user->format_date($var['report_time']), |
||
680 | 'REPORT_NOTE' => $var['report_note'], |
||
681 | 'STATUS' => $var['report_status'], |
||
682 | 'MANAGER' => $var['report_manager'] != 0 ? $this->user_loader->get_username($var['report_manager'], 'full') : false, |
||
683 | )); |
||
684 | } |
||
685 | return $this->helper->render('gallery/moderate_image_overview.html', $this->language->lang('GALLERY')); |
||
686 | } |
||
687 | |||
688 | /** |
||
689 | * Index Controller |
||
690 | * Route: gallery/modarate/image/{image_id}/approve |
||
691 | * |
||
692 | * @param $image_id |
||
693 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
694 | */ |
||
695 | public function approve($image_id) |
||
753 | } |
||
754 | |||
755 | /** |
||
756 | * Index Controller |
||
757 | * Route: gallery/modarate/image/{image_id}/unapprove |
||
758 | * |
||
759 | * @param $image_id |
||
760 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
761 | */ |
||
762 | public function unapprove($image_id) |
||
763 | { |
||
764 | $image_data = $this->image->get_image_data($image_id); |
||
765 | $album_data = $this->album->get_info($image_data['image_album_id']); |
||
766 | |||
767 | $album_backlink = $this->helper->route('phpbbgallery_core_index'); |
||
768 | $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
||
769 | $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
||
770 | $meta_refresh_time = 2; |
||
771 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
||
772 | if (!$this->gallery_auth->acl_check('m_status', $image_data['image_album_id'], $album_data['album_user_id'])) |
||
773 | { |
||
774 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
775 | } |
||
776 | |||
777 | $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
||
778 | $this->language->add_lang('mcp'); |
||
779 | if (confirm_box(true)) |
||
780 | { |
||
781 | $image_id_ary = array($image_id); |
||
782 | $this->image->unapprove_images($image_id_ary, $album_data['album_id']); |
||
783 | // To DO - add notification |
||
784 | $message = sprintf($this->language->lang('WAITING_UNAPPROVED_IMAGE', 1)); |
||
785 | meta_refresh($meta_refresh_time, $image_backlink); |
||
786 | trigger_error($message); |
||
787 | } |
||
788 | else |
||
789 | { |
||
790 | $s_hidden_fields = ''; |
||
791 | confirm_box(false, 'QUEUE_A_UNAPPROVE2', $s_hidden_fields); |
||
792 | } |
||
793 | } |
||
794 | |||
795 | /** |
||
796 | * Index Controller |
||
797 | * Route: gallery/modarate/image/{image_id}/move |
||
798 | * |
||
799 | * @param $image_id |
||
800 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
801 | */ |
||
802 | public function move($image_id): \Symfony\Component\HttpFoundation\Response |
||
803 | { |
||
804 | $image_data = $this->image->get_image_data($image_id); |
||
805 | $album_id = $image_data['image_album_id']; |
||
806 | //$user_id = $image_data['image_user_id']; |
||
807 | $album_data = $this->album->get_info($album_id); |
||
808 | $album_backlink = $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_id)); |
||
809 | $image_backlink = $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)); |
||
810 | $album_loginlink = append_sid($this->root_path . 'ucp.' . $this->php_ext . '?mode=login'); |
||
811 | $meta_refresh_time = 2; |
||
812 | $this->language->add_lang(array('gallery_mcp', 'gallery'), 'phpbbgallery/core'); |
||
813 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
||
814 | if (!$this->gallery_auth->acl_check('m_move', $image_data['image_album_id'], $album_data['album_user_id'])) |
||
815 | { |
||
816 | $this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD'); |
||
817 | } |
||
818 | $moving_target = $this->request->variable('moving_target', ''); |
||
819 | |||
820 | if ($moving_target) |
||
821 | { |
||
822 | $target = array($image_id); |
||
823 | $this->image->move_image($target, $moving_target); |
||
824 | $message = sprintf($this->language->lang('IMAGES_MOVED', 1)); |
||
825 | $this->album->update_info($album_id); |
||
826 | $this->album->update_info($moving_target); |
||
827 | meta_refresh($meta_refresh_time, $image_backlink); |
||
828 | trigger_error($message); |
||
829 | } |
||
830 | else |
||
831 | { |
||
832 | $category_select = $this->album->get_albumbox(false, 'moving_target', $album_id, 'm_move', $album_id); |
||
833 | $this->template->assign_vars(array( |
||
834 | 'S_MOVING_IMAGES' => true, |
||
835 | 'S_ALBUM_SELECT' => $category_select, |
||
836 | //'S_HIDDEN_FIELDS' => $s_hidden_fields, |
||
837 | )); |
||
838 | } |
||
839 | |||
840 | return $this->helper->render('gallery/mcp_body.html', $this->language->lang('GALLERY')); |
||
841 | } |
||
842 | |||
843 | /** |
||
844 | * Index Controller |
||
845 | * Route: gallery/modarate/image/{image_id}/lock |
||
846 | * |
||
847 | * @param $image_id |
||
848 | * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
||
849 | */ |
||
850 | public function lock($image_id) |
||
879 | } |
||
880 | } |
||
881 | } |
||
882 |
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