|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* @package Breizh Shoutbox Extension |
|
5
|
|
|
* @copyright (c) 2018-2020 Sylver35 https://breizhcode.com |
|
6
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
7
|
|
|
* |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace sylver35\breizhshoutbox\controller; |
|
11
|
|
|
use sylver35\breizhshoutbox\core\shoutbox; |
|
|
|
|
|
|
12
|
|
|
use phpbb\db\driver\driver_interface as db; |
|
13
|
|
|
use phpbb\request\request; |
|
14
|
|
|
use phpbb\auth\auth; |
|
15
|
|
|
|
|
16
|
|
|
class ajax |
|
17
|
|
|
{ |
|
18
|
|
|
/* @var \sylver35\breizhshoutbox\core\shoutbox */ |
|
19
|
|
|
protected $shoutbox; |
|
20
|
|
|
|
|
21
|
|
|
/** @var \phpbb\db\driver\driver_interface as db */ |
|
22
|
|
|
protected $db; |
|
23
|
|
|
|
|
24
|
|
|
/** @var \phpbb\request\request */ |
|
25
|
|
|
protected $request; |
|
26
|
|
|
|
|
27
|
|
|
/** @var \phpbb\auth\auth */ |
|
28
|
|
|
protected $auth; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Constructor |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct(shoutbox $shoutbox, db $db, request $request, auth $auth) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->shoutbox = $shoutbox; |
|
36
|
|
|
$this->db = $db; |
|
37
|
|
|
$this->request = $request; |
|
38
|
|
|
$this->auth = $auth; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Function construct_ajax |
|
43
|
|
|
* |
|
44
|
|
|
* @param string $mode Mode to switch |
|
45
|
|
|
* @return void |
|
46
|
|
|
*/ |
|
47
|
|
|
public function construct_ajax($mode) |
|
48
|
|
|
{ |
|
49
|
|
|
$val = $this->shoutbox->shout_manage_ajax($mode, (int) $this->request->variable('sort', 2), (int) $this->request->variable('user', 0)); |
|
50
|
|
|
$data = array(); |
|
51
|
|
|
|
|
52
|
|
|
// We have our own error handling |
|
53
|
|
|
$this->db->sql_return_on_error(true); |
|
54
|
|
|
|
|
55
|
|
|
// Permissions verification |
|
56
|
|
|
if (!$this->auth->acl_get("u_shout{$val['perm']}")) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->shoutbox->shout_error("NO_VIEW{$val['privat']}_PERM"); |
|
59
|
|
|
return; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
switch ($mode) |
|
63
|
|
|
{ |
|
64
|
|
|
case 'smilies': |
|
65
|
|
|
$data = $this->shoutbox->shout_ajax_smilies(); |
|
66
|
|
|
break; |
|
67
|
|
|
|
|
68
|
|
|
case 'smilies_popup': |
|
69
|
|
|
$data = $this->shoutbox->shout_ajax_smilies_popup((int) $this->request->variable('cat', -1)); |
|
70
|
|
|
break; |
|
71
|
|
|
|
|
72
|
|
|
case 'display_smilies': |
|
73
|
|
|
$data = $this->shoutbox->shout_ajax_display_smilies((int) $this->request->variable('smiley', 0), (int) $this->request->variable('display', 3)); |
|
74
|
|
|
break; |
|
75
|
|
|
|
|
76
|
|
|
case 'user_bbcode': |
|
77
|
|
|
$data = $this->shoutbox->shout_ajax_user_bbcode((string) $this->request->variable('open', ''), (string) $this->request->variable('close', ''), (int) $this->request->variable('other', 0)); |
|
78
|
|
|
break; |
|
79
|
|
|
|
|
80
|
|
|
case 'charge_bbcode': |
|
81
|
|
|
$data = $this->shoutbox->shout_ajax_charge_bbcode($val['id']); |
|
82
|
|
|
break; |
|
83
|
|
|
|
|
84
|
|
|
case 'online': |
|
85
|
|
|
$data = $this->shoutbox->shout_ajax_online(); |
|
86
|
|
|
break; |
|
87
|
|
|
|
|
88
|
|
|
case 'rules': |
|
89
|
|
|
$data = $this->shoutbox->shout_ajax_rules($val['priv']); |
|
90
|
|
|
break; |
|
91
|
|
|
|
|
92
|
|
|
case 'preview_rules': |
|
93
|
|
|
$data = $this->shoutbox->shout_ajax_preview_rules((string) $this->request->variable('content', '', true)); |
|
94
|
|
|
break; |
|
95
|
|
|
|
|
96
|
|
|
case 'date_format': |
|
97
|
|
|
$data = $this->shoutbox->shout_ajax_date_format((string) $this->request->variable('date', '', true)); |
|
98
|
|
|
break; |
|
99
|
|
|
|
|
100
|
|
|
case 'action_sound': |
|
101
|
|
|
$data = $this->shoutbox->shout_ajax_action_sound((int) $this->request->variable('sound', 1)); |
|
102
|
|
|
break; |
|
103
|
|
|
|
|
104
|
|
|
case 'cite': |
|
105
|
|
|
$data = $this->shoutbox->shout_ajax_cite($val['id']); |
|
106
|
|
|
break; |
|
107
|
|
|
|
|
108
|
|
|
case 'action_user': |
|
109
|
|
|
$data = $this->shoutbox->shout_ajax_action_user($val); |
|
110
|
|
|
break; |
|
111
|
|
|
|
|
112
|
|
|
case 'action_post': |
|
113
|
|
|
$data = $this->shoutbox->shout_ajax_action_post($val, (string) $this->request->variable('message', '', true)); |
|
114
|
|
|
break; |
|
115
|
|
|
|
|
116
|
|
|
case 'action_del': |
|
117
|
|
|
$data = $this->shoutbox->shout_ajax_action_del($val); |
|
118
|
|
|
break; |
|
119
|
|
|
|
|
120
|
|
|
case 'action_del_to': |
|
121
|
|
|
$data = $this->shoutbox->shout_ajax_action_del_to($val); |
|
122
|
|
|
break; |
|
123
|
|
|
|
|
124
|
|
|
case 'action_remove': |
|
125
|
|
|
$data = $this->shoutbox->shout_ajax_action_remove($val); |
|
126
|
|
|
break; |
|
127
|
|
|
|
|
128
|
|
|
case 'delete': |
|
129
|
|
|
$data = $this->shoutbox->shout_ajax_delete($val, (int) $this->request->variable('post', 0)); |
|
130
|
|
|
break; |
|
131
|
|
|
|
|
132
|
|
|
case 'purge': |
|
133
|
|
|
$data = $this->shoutbox->shout_ajax_purge($val); |
|
134
|
|
|
break; |
|
135
|
|
|
|
|
136
|
|
|
case 'purge_robot': |
|
137
|
|
|
$data = $this->shoutbox->shout_ajax_purge_robot($val); |
|
138
|
|
|
break; |
|
139
|
|
|
|
|
140
|
|
|
case 'edit': |
|
141
|
|
|
$data = $this->shoutbox->shout_ajax_edit($val, (int) $this->request->variable('shout_id', 0), (string) $this->request->variable('chat_message', '', true)); |
|
142
|
|
|
break; |
|
143
|
|
|
|
|
144
|
|
|
case 'post': |
|
145
|
|
|
$data = $this->shoutbox->shout_ajax_post($val, (string) $this->request->variable('chat_message', '', true), (string) $this->request->variable('name', '', true), (int) $this->request->variable('cite', 0)); |
|
146
|
|
|
break; |
|
147
|
|
|
|
|
148
|
|
|
case 'check': |
|
149
|
|
|
case 'check_pop': |
|
150
|
|
|
case 'check_priv': |
|
151
|
|
|
$data = $this->shoutbox->shout_ajax_check($val, (bool) $this->request->variable('on_bot', true)); |
|
152
|
|
|
break; |
|
153
|
|
|
|
|
154
|
|
|
case 'view': |
|
155
|
|
|
case 'view_pop': |
|
156
|
|
|
case 'view_priv': |
|
157
|
|
|
$data = $this->shoutbox->shout_ajax_view($val, (bool) $this->request->variable('on_bot', true), (int) $this->request->variable('start', 0)); |
|
158
|
|
|
break; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
// Send the response to the browser now |
|
162
|
|
|
$json_response = new \phpbb\json_response; |
|
163
|
|
|
$json_response->send($data, true); |
|
164
|
|
|
} |
|
165
|
|
|
} |
|
166
|
|
|
|
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