|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Integration system for attachments into Diplay controller |
|
5
|
|
|
* |
|
6
|
|
|
* @package ElkArte Forum |
|
7
|
|
|
* @copyright ElkArte Forum contributors |
|
8
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file) |
|
9
|
|
|
* |
|
10
|
|
|
* This file contains code covered by: |
|
11
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
|
12
|
|
|
* |
|
13
|
|
|
* @version 2.0 dev |
|
14
|
|
|
* |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
namespace ElkArte\Modules\Attachments; |
|
18
|
|
|
|
|
19
|
|
|
use ElkArte\AttachmentsDisplay; |
|
20
|
|
|
use ElkArte\EventManager; |
|
21
|
|
|
use ElkArte\Modules\AbstractModule; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class \ElkArte\Modules\Attachments\Display |
|
25
|
|
|
*/ |
|
26
|
|
|
class Display extends AbstractModule |
|
27
|
|
|
{ |
|
28
|
|
|
/** @var int The mode of attachments (disabled/enabled/show only). */ |
|
29
|
|
|
protected static $attach_level = 0; |
|
30
|
|
|
|
|
31
|
|
|
/** @var The good old attachments array */ |
|
|
|
|
|
|
32
|
|
|
protected static $attachments = null; |
|
33
|
|
|
|
|
34
|
|
|
/** @var bool If unapproved posts/attachments should be shown */ |
|
35
|
|
|
protected static $includeUnapproved = false; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* {@inheritdoc } |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function hooks(EventManager $eventsManager) |
|
41
|
|
|
{ |
|
42
|
|
|
global $modSettings; |
|
43
|
|
|
|
|
44
|
|
|
if (!empty($modSettings['attachmentEnable'])) |
|
45
|
|
|
{ |
|
46
|
|
|
require_once(SUBSDIR . '/Attachments.subs.php'); |
|
47
|
|
|
|
|
48
|
|
|
self::$attach_level = (int) $modSettings['attachmentEnable']; |
|
49
|
|
|
self::$includeUnapproved = !$modSettings['postmod_active'] || allowedTo('approve_posts'); |
|
50
|
|
|
|
|
51
|
|
|
add_integration_function('integrate_display_message_list', '\\ElkArte\\Modules\\Attachments\\Display::integrate_display_message_list', '', false); |
|
52
|
|
|
add_integration_function('integrate_prepare_display_context', '\\ElkArte\\Modules\\Attachments\\Display::integrate_prepare_display_context', '', false); |
|
53
|
|
|
// return array( |
|
54
|
|
|
// array('prepare_context', array('\\ElkArte\\Modules\\Attachments\\Display', 'prepare_context'), array('post_errors')), |
|
55
|
|
|
// ); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return array(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Loads up all the attachments |
|
63
|
|
|
*/ |
|
64
|
|
|
public static function integrate_display_message_list(&$messages, &$posters) |
|
65
|
|
|
{ |
|
66
|
|
|
self::$attachments = new AttachmentsDisplay($messages, $posters, self::$includeUnapproved); |
|
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Shows the attachments for the current message |
|
71
|
|
|
*/ |
|
72
|
|
|
public static function integrate_prepare_display_context(&$output, &$this_message, $counter) |
|
|
|
|
|
|
73
|
|
|
{ |
|
74
|
|
|
$output['attachment'] = self::$attachments->loadAttachmentContext($this_message['id_msg']); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
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