This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved |
||
4 | * This file is licensed under the GNU General Public License version 2. See the file COPYING. |
||
5 | * |
||
6 | * @author Marc Nazarian <[email protected]> |
||
7 | * |
||
8 | * IMMucLogManager |
||
9 | */ |
||
10 | |||
11 | require_once('common/plugin/PluginManager.class.php'); |
||
12 | require_once('IM.class.php'); |
||
13 | |||
14 | require_once('PluginIMMucConversationLogDao.class.php'); |
||
15 | require_once('PluginIMMucChangeTopicLogDao.class.php'); |
||
16 | require_once('PluginIMMucJoinTheRoomLogDao.class.php'); |
||
17 | require_once('PluginIMMucLeftTheRoomLogDao.class.php'); |
||
18 | |||
19 | require_once('IMMucConversationLog.class.php'); |
||
20 | require_once('IMMucSystemLog.class.php'); |
||
21 | |||
22 | class IMMucLogManager { |
||
23 | |||
24 | // the controler of the IM plugin |
||
25 | private $_controler; |
||
26 | private static $_muclogmanager_instance; |
||
27 | |||
28 | public static function getMucLogManagerInstance() { |
||
29 | if ( ! self::$_muclogmanager_instance) { |
||
30 | self::$_muclogmanager_instance = new IMMucLogManager(); |
||
31 | } |
||
32 | return self::$_muclogmanager_instance; |
||
33 | } |
||
34 | |||
35 | private function _getIMPlugin() { |
||
36 | $plugin_manager =& PluginManager::instance(); |
||
37 | $im_plugin = $plugin_manager->getPluginByName('IM'); |
||
38 | return $im_plugin; |
||
39 | } |
||
40 | |||
41 | public function IMMucLogManager() { |
||
42 | // set the IM plugin controler |
||
43 | $this->_controler = new IM($this->_getIMPlugin()); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
44 | } |
||
45 | |||
46 | public function getLogsByGroupName($codendi_unix_group_name) { |
||
47 | $logs = array(); |
||
48 | |||
49 | // user messages |
||
50 | $dao = new PluginIMMucConversationLogDao(IMDataAccess::instance($this->_controler)); |
||
51 | $dar = $dao->searchByMucName($codendi_unix_group_name); |
||
52 | if ($dar && $dar->valid()) { |
||
53 | while ($dar->valid()) { |
||
54 | $row = $dar->current(); |
||
55 | if ($row['body'] != null) { |
||
56 | $current_conv = new IMMucConversationLog($row['sentDate'], $row['nickname'], $row['fromJID'], $row['body']); |
||
57 | $logs[$row['sentDate']] = $current_conv; |
||
58 | } |
||
59 | $dar->next(); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | // |
||
64 | // system messages |
||
65 | // |
||
66 | // Change Topic |
||
67 | $dao = new PluginIMMucChangeTopicLogDao(IMDataAccess::instance($this->_controler)); |
||
68 | $dar = $dao->searchByMucName($codendi_unix_group_name); |
||
69 | if ($dar && $dar->valid()) { |
||
70 | while ($dar->valid()) { |
||
71 | $row = $dar->current(); |
||
72 | if ($row['subject'] != null) { |
||
73 | $current_conv = new IMMucChangeTopicSystemLog($row['logTime'], $row['nickname'], $row['subject']); |
||
74 | $logs[$row['logTime']] = $current_conv; |
||
75 | } |
||
76 | $dar->next(); |
||
77 | } |
||
78 | } |
||
79 | // join the room |
||
80 | $dao = new PluginIMMucJoinTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
81 | $dar = $dao->searchByMucName($codendi_unix_group_name); |
||
82 | if ($dar && $dar->valid()) { |
||
83 | while ($dar->valid()) { |
||
84 | $row = $dar->current(); |
||
85 | $current_conv = new IMMucJoinTheRoomSystemLog($row['joinedDate'], $row['nickname']); |
||
86 | $logs[$row['joinedDate']] = $current_conv; |
||
87 | $dar->next(); |
||
88 | } |
||
89 | } |
||
90 | // left the room |
||
91 | $dao = new PluginIMMucLeftTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
92 | $dar = $dao->searchByMucName($codendi_unix_group_name); |
||
93 | if ($dar && $dar->valid()) { |
||
94 | while ($dar->valid()) { |
||
95 | $row = $dar->current(); |
||
96 | $current_conv = new IMMucLeftTheRoomSystemLog($row['leftDate'], $row['nickname']); |
||
97 | $logs[$row['leftDate']] = $current_conv; |
||
98 | $dar->next(); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | // sort the events by date |
||
103 | ksort($logs); |
||
104 | |||
105 | return $logs; |
||
106 | } |
||
107 | |||
108 | public function getLogsByGroupNameBeforeDate($codendi_unix_group_name, $end_date) { |
||
109 | $logs = array(); |
||
110 | |||
111 | // user messages |
||
112 | $dao = new PluginIMMucConversationLogDao(IMDataAccess::instance($this->_controler)); |
||
113 | $dar = $dao->searchByMucNameBeforeDate($codendi_unix_group_name, $end_date); |
||
114 | if ($dar && $dar->valid()) { |
||
115 | while ($dar->valid()) { |
||
116 | $row = $dar->current(); |
||
117 | if ($row['body'] != null) { |
||
118 | $current_conv = new IMMucConversationLog($row['sentDate'], $row['nickname'], $row['nickname'], $row['body']); |
||
119 | $logs[$row['sentDate']] = $current_conv; |
||
120 | } |
||
121 | $dar->next(); |
||
122 | } |
||
123 | } |
||
124 | // |
||
125 | // system messages |
||
126 | // |
||
127 | // Change Topic |
||
128 | $dao = new PluginIMMucChangeTopicLogDao(IMDataAccess::instance($this->_controler)); |
||
129 | $dar = $dao->searchByMucNameBeforeDate($codendi_unix_group_name, $end_date); |
||
130 | if ($dar && $dar->valid()) { |
||
131 | while ($dar->valid()) { |
||
132 | $row = $dar->current(); |
||
133 | if ($row['subject'] != null) { |
||
134 | $current_conv = new IMMucChangeTopicSystemLog($row['logTime'], $row['nickname'], $row['subject']); |
||
135 | $logs[$row['logTime']] = $current_conv; |
||
136 | } |
||
137 | $dar->next(); |
||
138 | } |
||
139 | } |
||
140 | // join the room |
||
141 | $dao = new PluginIMMucJoinTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
142 | $dar = $dao->searchByMucNameBeforeDate($codendi_unix_group_name, $end_date); |
||
143 | if ($dar && $dar->valid()) { |
||
144 | while ($dar->valid()) { |
||
145 | $row = $dar->current(); |
||
146 | $current_conv = new IMMucJoinTheRoomSystemLog($row['joinedDate'], $row['nickname']); |
||
147 | $logs[$row['joinedDate']] = $current_conv; |
||
148 | $dar->next(); |
||
149 | } |
||
150 | } |
||
151 | // left the room |
||
152 | $dao = new PluginIMMucLeftTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
153 | $dar = $dao->searchByMucNameBeforeDate($codendi_unix_group_name, $end_date); |
||
154 | if ($dar && $dar->valid()) { |
||
155 | while ($dar->valid()) { |
||
156 | $row = $dar->current(); |
||
157 | $current_conv = new IMMucLeftTheRoomSystemLog($row['leftDate'], $row['nickname']); |
||
158 | $logs[$row['leftDate']] = $current_conv; |
||
159 | $dar->next(); |
||
160 | } |
||
161 | } |
||
162 | |||
163 | // sort the events by date |
||
164 | ksort($logs); |
||
165 | |||
166 | return $logs; |
||
167 | } |
||
168 | |||
169 | public function getLogsByGroupNameAfterDate($codendi_unix_group_name, $start_date) { |
||
170 | $logs = array(); |
||
171 | |||
172 | // user messages |
||
173 | $dao = new PluginIMMucConversationLogDao(IMDataAccess::instance($this->_controler)); |
||
174 | $dar = $dao->searchByMucNameAfterDate($codendi_unix_group_name, $start_date); |
||
175 | if ($dar && $dar->valid()) { |
||
176 | while ($dar->valid()) { |
||
177 | $row = $dar->current(); |
||
178 | if ($row['body'] != null) { |
||
179 | $current_conv = new IMMucConversationLog($row['sentDate'], $row['nickname'], $row['nickname'], $row['body']); |
||
180 | $logs[$row['sentDate']] = $current_conv; |
||
181 | } |
||
182 | $dar->next(); |
||
183 | } |
||
184 | } |
||
185 | // |
||
186 | // system messages |
||
187 | // |
||
188 | // Change Topic |
||
189 | $dao = new PluginIMMucChangeTopicLogDao(IMDataAccess::instance($this->_controler)); |
||
190 | $dar = $dao->searchByMucNameAfterDate($codendi_unix_group_name, $start_date); |
||
191 | if ($dar && $dar->valid()) { |
||
192 | while ($dar->valid()) { |
||
193 | $row = $dar->current(); |
||
194 | if ($row['subject'] != null) { |
||
195 | $current_conv = new IMMucChangeTopicSystemLog($row['logTime'], $row['nickname'], $row['subject']); |
||
196 | $logs[$row['logTime']] = $current_conv; |
||
197 | } |
||
198 | $dar->next(); |
||
199 | } |
||
200 | } |
||
201 | // join the room |
||
202 | $dao = new PluginIMMucJoinTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
203 | $dar = $dao->searchByMucNameAfterDate($codendi_unix_group_name, $start_date); |
||
204 | if ($dar && $dar->valid()) { |
||
205 | while ($dar->valid()) { |
||
206 | $row = $dar->current(); |
||
207 | $current_conv = new IMMucJoinTheRoomSystemLog($row['joinedDate'], $row['nickname']); |
||
208 | $logs[$row['joinedDate']] = $current_conv; |
||
209 | $dar->next(); |
||
210 | } |
||
211 | } |
||
212 | // left the room |
||
213 | $dao = new PluginIMMucLeftTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
214 | $dar = $dao->searchByMucNameAfterDate($codendi_unix_group_name, $start_date); |
||
215 | if ($dar && $dar->valid()) { |
||
216 | while ($dar->valid()) { |
||
217 | $row = $dar->current(); |
||
218 | $current_conv = new IMMucLeftTheRoomSystemLog($row['leftDate'], $row['nickname']); |
||
219 | $logs[$row['leftDate']] = $current_conv; |
||
220 | $dar->next(); |
||
221 | } |
||
222 | } |
||
223 | |||
224 | // sort the events by date |
||
225 | ksort($logs); |
||
226 | |||
227 | return $logs; |
||
228 | } |
||
229 | |||
230 | public function getLogsByGroupNameBetweenDates($codendi_unix_group_name, $start_date, $end_date) { |
||
231 | $logs = array(); |
||
232 | |||
233 | // user messages |
||
234 | $dao = new PluginIMMucConversationLogDao(IMDataAccess::instance($this->_controler)); |
||
235 | $dar = $dao->searchByMucNameBetweenDates($codendi_unix_group_name, $start_date, $end_date); |
||
236 | if ($dar && $dar->valid()) { |
||
237 | while ($dar->valid()) { |
||
238 | $row = $dar->current(); |
||
239 | if ($row['body'] != null) { |
||
240 | $current_conv = new IMMucConversationLog($row['sentDate'], $row['nickname'], $row['nickname'], $row['body']); |
||
241 | $logs[$row['sentDate']] = $current_conv; |
||
242 | } |
||
243 | $dar->next(); |
||
244 | } |
||
245 | } |
||
246 | // |
||
247 | // system messages |
||
248 | // |
||
249 | // Change Topic |
||
250 | $dao = new PluginIMMucChangeTopicLogDao(IMDataAccess::instance($this->_controler)); |
||
251 | $dar = $dao->searchByMucNameBetweenDates($codendi_unix_group_name, $start_date, $end_date); |
||
252 | if ($dar && $dar->valid()) { |
||
253 | while ($dar->valid()) { |
||
254 | $row = $dar->current(); |
||
255 | if ($row['subject'] != null) { |
||
256 | $current_conv = new IMMucChangeTopicSystemLog($row['logTime'], $row['nickname'], $row['subject']); |
||
257 | $logs[$row['logTime']] = $current_conv; |
||
258 | } |
||
259 | $dar->next(); |
||
260 | } |
||
261 | } |
||
262 | // join the room |
||
263 | $dao = new PluginIMMucJoinTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
264 | $dar = $dao->searchByMucNameBetweenDates($codendi_unix_group_name, $start_date, $end_date); |
||
265 | if ($dar && $dar->valid()) { |
||
266 | while ($dar->valid()) { |
||
267 | $row = $dar->current(); |
||
268 | $current_conv = new IMMucJoinTheRoomSystemLog($row['joinedDate'], $row['nickname']); |
||
269 | $logs[$row['joinedDate']] = $current_conv; |
||
270 | $dar->next(); |
||
271 | } |
||
272 | } |
||
273 | // left the room |
||
274 | $dao = new PluginIMMucLeftTheRoomLogDao(IMDataAccess::instance($this->_controler)); |
||
275 | $dar = $dao->searchByMucNameBetweenDates($codendi_unix_group_name, $start_date, $end_date); |
||
276 | if ($dar && $dar->valid()) { |
||
277 | while ($dar->valid()) { |
||
278 | $row = $dar->current(); |
||
279 | $current_conv = new IMMucLeftTheRoomSystemLog($row['leftDate'], $row['nickname']); |
||
280 | $logs[$row['leftDate']] = $current_conv; |
||
281 | $dar->next(); |
||
282 | } |
||
283 | } |
||
284 | |||
285 | // sort the events by date |
||
286 | ksort($logs); |
||
287 | |||
288 | return $logs; |
||
289 | } |
||
290 | |||
291 | } |
||
292 | ?> |
||
293 |