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 | require_once('pre.php'); |
||
3 | require_once('common/mvc/Views.class.php'); |
||
4 | require_once('common/include/HTTPRequest.class.php'); |
||
5 | require_once('www/project/export/project_export_utils.php'); |
||
6 | |||
7 | require_once('IMDao.class.php'); |
||
8 | require_once('IMDataAccess.class.php'); |
||
9 | require_once('JabbexFactory.class.php'); |
||
10 | |||
11 | require_once('IMMucLogManager.class.php'); |
||
12 | |||
13 | class IMViews extends Views { |
||
14 | |||
15 | protected $iconsPath; |
||
16 | |||
17 | function IMViews(&$controler, $view=null) { |
||
18 | $this->View($controler, $view); |
||
19 | $this->iconsPath = $controler->getIconPath(); |
||
20 | } |
||
21 | |||
22 | function getIconsPath() { |
||
23 | return $this->iconsPath; |
||
24 | } |
||
25 | |||
26 | function display($view='') { |
||
27 | if ($view == 'get_presence') { |
||
28 | $this->$view(); |
||
29 | } elseif ($view == 'export_muc_logs') { |
||
30 | $this->$view(); |
||
31 | } else { |
||
32 | parent::display($view); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | function header() { |
||
37 | $request = HTTPRequest::instance(); |
||
38 | $group_id = $request->get('group_id'); |
||
39 | |||
40 | if ($this->getControler()->view == 'codendi_im_admin') { |
||
41 | $GLOBALS['HTML']->header(array('title'=>$this->_getTitle(),'selected_top_tab' => 'admin')); |
||
42 | } else { |
||
43 | $GLOBALS['HTML']->header(array('title'=>$this->_getTitle(),'group' => $group_id,'toptab' => 'IM')); |
||
44 | if (user_ismember($request->get('group_id'))) { |
||
45 | echo '<b><a href="/plugins/IM/?group_id='. $request->get('group_id') .'&action=muc_logs">'. $GLOBALS['Language']->getText('plugin_im', 'toolbar_muc_logs') .'</a> | </b>'; |
||
46 | } |
||
47 | echo $this->_getHelp(); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | function _getHelp() { |
||
52 | return help_button('communication.html#instant-messaging-plug-in', false, $GLOBALS['Language']->getText('global', 'help')); |
||
53 | } |
||
54 | |||
55 | function _getTitle() { |
||
56 | return $GLOBALS['Language']->getText('plugin_im','title'); |
||
57 | } |
||
58 | |||
59 | function footer() { |
||
60 | $GLOBALS['HTML']->footer(array()); |
||
61 | } |
||
62 | |||
63 | // {{{ Views |
||
64 | function codendi_im_admin() { |
||
65 | echo '<h2><b>'.$GLOBALS['Language']->getText('plugin_im_admin','im_admin_title').'</b></h2>'; |
||
66 | echo '<h3><b>'.$GLOBALS['Language']->getText('plugin_im_admin','im_admin_warning').'</b></h3>'; |
||
67 | $this->_admin_synchronize_muc_and_grp(); |
||
68 | } |
||
69 | |||
70 | function get_presence() { |
||
71 | header('Content-type: application/json'); |
||
72 | $request = HTTPRequest::instance(); |
||
73 | if ($request->exist('jid')) { |
||
74 | $presence = $this->getControler()->getPlugin()->getPresence($request->get('jid')); |
||
75 | echo json_encode($presence); |
||
76 | } else if (is_array($request->get('jids'))) { |
||
77 | $presences = array(); |
||
78 | foreach($request->get('jids') as $jid) { |
||
79 | $presence = $this->getControler()->getPlugin()->getPresence($jid); |
||
80 | $presence['id'] = md5($jid); |
||
81 | $presences[] = $presence; |
||
82 | } |
||
83 | echo(json_encode($presences)); |
||
84 | } |
||
85 | } |
||
86 | // }}} |
||
87 | |||
88 | /** |
||
89 | * Display chat room of project $group_id |
||
90 | */ |
||
91 | function chat_room() { |
||
92 | $request = HTTPRequest::instance(); |
||
93 | |||
94 | $group_id = $request->get('group_id'); |
||
95 | $pm = ProjectManager::instance(); |
||
96 | $project = $pm->getProject($group_id); |
||
97 | $um = UserManager::instance(); |
||
98 | $user = $um->getCurrentUser(); |
||
99 | |||
100 | $plugin = $this->getControler()->getPlugin(); |
||
101 | $plugin_path = $plugin->getPluginPath(); |
||
102 | $im_object = JabbexFactory::getJabbexInstance(); |
||
103 | |||
104 | $jabberConf = $im_object->get_server_conf(); |
||
105 | |||
106 | $sessionId = session_hash(); |
||
107 | $server_dns = $jabberConf['server_dns']; |
||
108 | $conference_service = $jabberConf['conference_service']; |
||
109 | |||
110 | $room_name = $project->getUnixName(); |
||
111 | $user_unix_name = $user->getName(); |
||
112 | echo '<div id="chatroom">'; |
||
113 | echo '<h2 id="mucroom_title">'.$GLOBALS['Language']->getText('plugin_im', 'chatroom_title') .'</h2>'; |
||
114 | |||
115 | echo '<p id="mucroom_summary">'.$GLOBALS['Language']->getText('plugin_im', 'chatroom_summary') .'</p>'; |
||
116 | |||
117 | $user_projects = $user->getProjects(); |
||
118 | if (in_array($group_id, $user_projects)) { |
||
119 | |||
120 | echo '<div id="mucroom_timer">'; |
||
121 | echo $GLOBALS['Language']->getText('plugin_im','wait_loading'); |
||
122 | echo $GLOBALS['HTML']->getImage('ic/spinner.gif'); |
||
123 | echo '</div>'; |
||
124 | |||
125 | $url = $plugin_path . '/webmuc/muckl.php?username=' . $user_unix_name . '&sessid=' . $sessionId . '&host=' . $server_dns . '&cs=' . $conference_service . '&room=' . $room_name . '&group_id=' . $group_id; |
||
126 | echo '<iframe id="mucroom" src="'.$url.'" width="800" height="600" frameborder="0"></iframe>'; |
||
127 | |||
128 | echo '<script type="text/javascript" src="mucroom.js"></script>'; |
||
129 | echo '</div>'; |
||
130 | } else { |
||
131 | echo '<p class="feedback_error">'.$GLOBALS['Language']->getText('plugin_im', 'chatroom_onlymembers').'</p>'; |
||
132 | } |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * Display muc logs of project $group_id when coming from a cross reference |
||
137 | * using monitoring openfire's plugin |
||
138 | */ |
||
139 | function ref_muc_logs() { |
||
140 | $request = HTTPRequest::instance(); |
||
141 | $group_id = $request->get('group_id'); |
||
142 | $chat_log = $request->get('chat_log'); |
||
143 | $date_log = substr($chat_log, 0, 4)."-".substr($chat_log, 4, 2)."-".substr($chat_log, 6, 2); |
||
144 | $this->_display_muc_logs($group_id, $date_log, $date_log); |
||
145 | } |
||
146 | /** |
||
147 | * Display muc logs of project $group_id |
||
148 | * using monitoring openfire's plugin |
||
149 | */ |
||
150 | function muc_logs() { |
||
151 | $request = HTTPRequest::instance(); |
||
152 | $group_id = $request->get('group_id'); |
||
153 | |||
154 | $any = $GLOBALS['Language']->getText('global', 'any'); |
||
155 | |||
156 | if ($request->exist('log_start_date')) { |
||
157 | $start_date = $request->get('log_start_date'); |
||
158 | if ($start_date == '') { |
||
159 | $start_date = $any; |
||
160 | } |
||
161 | } else { |
||
162 | $week_ago = mktime( 0, 0, 0, date("m"), date("d") - 7, date("Y") ); |
||
163 | $start_date = date("Y-m-d", $week_ago); |
||
164 | } |
||
165 | |||
166 | $end_date = $request->get('log_end_date'); |
||
167 | if ($end_date == '') { |
||
168 | $end_date = $any; |
||
169 | } |
||
170 | |||
171 | $this->_display_muc_logs($group_id, $start_date, $end_date); |
||
172 | |||
173 | } |
||
174 | |||
175 | private function _display_muc_logs($group_id, $start_date, $end_date) { |
||
176 | $pm = ProjectManager::instance(); |
||
177 | $project = $pm->getProject($group_id); |
||
178 | $any = $GLOBALS['Language']->getText('global', 'any'); |
||
179 | |||
180 | echo '<h2>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_title') . '</h2>'; |
||
181 | |||
182 | echo '<form name="muclog_search" id="muclog_search" action="">'; |
||
183 | echo ' <fieldset>'; |
||
184 | echo ' <legend>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_search') . ' <img src="'.$this->iconsPath.'help.png" alt="' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_helpsearch') . '" title="' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_helpsearch') . '" /> </legend>'; |
||
185 | echo ' <p>'; |
||
186 | echo ' <label for="log_start_date">' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_start_date') . '</label>'; |
||
187 | echo $GLOBALS['HTML']->getDatePicker('log_start_date', 'log_start_date', $start_date); |
||
188 | echo ' </p>'; |
||
189 | echo ' <p>'; |
||
190 | echo ' <label for="log_end_date">' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_end_date') . '</label>'; |
||
191 | echo $GLOBALS['HTML']->getDatePicker('log_end_date', 'log_end_date', $end_date); |
||
192 | echo ' </p>'; |
||
193 | echo ' <p>'; |
||
194 | echo ' <label for="search_button"> </label>'; |
||
195 | echo ' <input id="search_button" type="submit" value="' . $GLOBALS['Language']->getText('plugin_im', 'search') . '">'; |
||
196 | echo ' </p>'; |
||
197 | echo ' </fieldset>'; |
||
198 | echo ' <input type="hidden" name="action" value="muc_logs" />'; |
||
199 | echo ' <input type="hidden" name="group_id" value="'.$group_id.'" />'; |
||
200 | echo '</form>'; |
||
201 | |||
202 | $mclm = IMMucLogManager::getMucLogManagerInstance(); |
||
203 | $conversations = null; |
||
204 | try { |
||
205 | if ($start_date == $any && $end_date == $any) { |
||
206 | $conversations = $mclm->getLogsByGroupName($project->getUnixName(true)); |
||
207 | } elseif ($start_date == $any && $end_date != $any) { |
||
208 | $conversations = $mclm->getLogsByGroupNameBeforeDate($project->getUnixName(true), $end_date); |
||
209 | } elseif ($start_date != $any && $end_date == $any) { |
||
210 | $conversations = $mclm->getLogsByGroupNameAfterDate($project->getUnixName(true), $start_date); |
||
211 | } else { |
||
212 | $conversations = $mclm->getLogsByGroupNameBetweenDates($project->getUnixName(true), $start_date, $end_date); |
||
213 | } |
||
214 | } catch (Exception $e) { |
||
215 | echo $e->getMessage(); |
||
216 | } |
||
217 | |||
218 | if (! $conversations || sizeof($conversations) == 0) { |
||
219 | echo $GLOBALS['Language']->getText('plugin_im', 'no_muc_logs'); |
||
220 | } else { |
||
221 | |||
222 | $purifier = Codendi_HTMLPurifier::instance(); |
||
223 | $uh = new UserHelper(); |
||
224 | |||
225 | $nick_color_arr = array(); // association array nickname => color |
||
226 | $available_colors = $GLOBALS['HTML']->getTextColors(); |
||
227 | |||
228 | echo '<table class="logs">'; |
||
229 | echo ' <tr>'; |
||
230 | echo ' <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_time') . '</th>'; |
||
231 | echo ' <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_user') . '</th>'; |
||
232 | echo ' <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_message') . '</th>'; |
||
233 | echo ' </tr>'; |
||
234 | $current_day = null; |
||
235 | $current_time_minute = null; |
||
236 | $last_conversation_activity = null; |
||
237 | foreach ($conversations as $conv) { |
||
238 | if ($conv->getDay() != $current_day) { |
||
239 | $current_day = $conv->getDay(); |
||
240 | echo ' <tr class="boxtitle">'; |
||
241 | echo ' <td colspan="3">'.$conv->getDay().'</td>'; |
||
242 | echo ' </tr>'; |
||
243 | } else { |
||
244 | if (($conv->getTimestamp() - $last_conversation_activity) > IMMucLog::DELAY_BETWEEN_CONVERSATIONS * 60) { |
||
245 | echo ' <tr class="conversation_separation">'; |
||
246 | echo ' <td colspan="3"><hr class="conversation_separation"></td>'; |
||
247 | echo ' </tr>'; |
||
248 | } |
||
249 | } |
||
250 | |||
251 | // if nickname hasn't its color yet, we give it a new one |
||
252 | if ( ! array_key_exists($conv->getNickname(), $nick_color_arr)) { |
||
253 | // if all the colors have been used, we start again with the same colors |
||
254 | if (sizeof($available_colors) == 0) { |
||
255 | $available_colors = $GLOBALS['HTML']->getChartColors(); |
||
256 | } |
||
257 | $current_color = array_pop($available_colors); // remove a color from the array, and set it to current color |
||
258 | $nick_color_arr[$conv->getNickname()] = $GLOBALS['HTML']->getColorCodeFromColorName($current_color); |
||
259 | } |
||
260 | |||
261 | echo ' <tr class="'.get_class($conv).'">'; |
||
262 | if ($conv->getTime() != $current_time_minute) { |
||
263 | $current_time_minute = $conv->getTime(); |
||
264 | echo ' <td class="log_time">'.$current_time_minute.'</td>'; |
||
265 | } else { |
||
266 | echo ' <td class="log_time"> </td>'; |
||
267 | } |
||
268 | if ($conv->getNickname() != null) { |
||
269 | echo ' <td class="log_nickname"><span title="'.$purifier->purify($uh->getDisplayNameFromUserName($conv->getUsername())).'" style="color: '. $nick_color_arr[$conv->getNickname()] . ';"><'.$purifier->purify($conv->getNickname(), CODENDI_PURIFIER_CONVERT_HTML).'></span></td>'; |
||
270 | } else { |
||
271 | echo ' <td class="log_nickname"> </td>'; |
||
272 | } |
||
273 | echo ' <td class="'.get_class($conv).'">'.$purifier->purify($conv->getMessage(), CODENDI_PURIFIER_BASIC, $group_id).'</td>'; |
||
274 | echo ' </tr>'; |
||
275 | |||
276 | // update last activity time |
||
277 | $last_conversation_activity = $conv->getTimestamp(); |
||
278 | |||
279 | } |
||
280 | echo '</table>'; |
||
281 | |||
282 | echo '<form action="" method="post" name="muc_logs_export_form" id="muc_logs_export_form">'; |
||
283 | echo ' <input name="type" value="export" type="hidden">'; |
||
284 | echo ' <font size="-1"><input value="'.$GLOBALS['Language']->getText('plugin_im', 'export_muc_logs').'" type="submit"></font><br>'; |
||
285 | echo '</form>'; |
||
286 | |||
287 | } |
||
288 | } |
||
289 | |||
290 | /** |
||
291 | * Export muc logs of project $group_id |
||
292 | * using monitoring openfire's plugin |
||
293 | */ |
||
294 | function export_muc_logs() { |
||
295 | $request = HTTPRequest::instance(); |
||
296 | $group_id = $request->get('group_id'); |
||
297 | $pm = ProjectManager::instance(); |
||
298 | $project = $pm->getProject($group_id); |
||
299 | |||
300 | $any = $GLOBALS['Language']->getText('global', 'any'); |
||
301 | |||
302 | if ($request->exist('log_start_date')) { |
||
303 | $start_date = $request->get('log_start_date'); |
||
304 | if ($start_date == '') { |
||
305 | $start_date = $any; |
||
306 | } |
||
307 | } else { |
||
308 | $week_ago = mktime( 0, 0, 0, date("m"), date("d") - 7, date("Y") ); |
||
309 | $start_date = date("Y-m-d", $week_ago); |
||
310 | } |
||
311 | |||
312 | $end_date = $request->get('log_end_date'); |
||
313 | if ($end_date == '') { |
||
314 | $end_date = $any; |
||
315 | } |
||
316 | |||
317 | $mclm = IMMucLogManager::getMucLogManagerInstance(); |
||
318 | $conversations = null; |
||
319 | try { |
||
320 | if ($start_date == $any && $end_date == $any) { |
||
321 | $conversations = $mclm->getLogsByGroupName($project->getUnixName(true)); |
||
322 | } elseif ($start_date == $any && $end_date != $any) { |
||
323 | $conversations = $mclm->getLogsByGroupNameBeforeDate($project->getUnixName(true), $end_date); |
||
324 | } elseif ($start_date != $any && $end_date == $any) { |
||
325 | $conversations = $mclm->getLogsByGroupNameAfterDate($project->getUnixName(true), $start_date); |
||
326 | } else { |
||
327 | $conversations = $mclm->getLogsByGroupNameBetweenDates($project->getUnixName(true), $start_date, $end_date); |
||
328 | } |
||
329 | } catch (Exception $e) { |
||
330 | echo $e->getMessage(); |
||
331 | } |
||
332 | |||
333 | $eol = "\n"; |
||
334 | $col_list = array('date', 'nickname', 'message'); |
||
335 | $lbl_list = array( |
||
336 | 'date' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_time'), |
||
337 | 'nickname' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_user'), |
||
338 | 'message' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_message') |
||
339 | ); |
||
340 | |||
341 | $file_name = 'muc_logs_'.$project->getUnixName(); |
||
342 | header ('Content-Type: text/csv'); |
||
343 | header ('Content-Disposition: filename='.$file_name.'.csv'); |
||
344 | |||
345 | if (! $conversations || sizeof($conversations) == 0) { |
||
346 | echo $GLOBALS['Language']->getText('plugin_im', 'no_muc_logs'); |
||
347 | } else { |
||
348 | |||
349 | // Build CSV header |
||
350 | echo build_csv_header($col_list, $lbl_list).$eol; |
||
351 | |||
352 | // Build CSV content |
||
353 | foreach ($conversations as $conv) { |
||
354 | $time = format_date(util_get_user_preferences_export_datefmt(), $conv->getTimestamp()); |
||
355 | if ($conv->getNickname() != null) { |
||
356 | $nick = $conv->getNickname(); |
||
357 | } else { |
||
358 | $nick = ''; |
||
359 | } |
||
360 | $message = $conv->getMessage(); |
||
361 | |||
362 | echo build_csv_record($col_list, array('date'=>$time, 'nickname'=>$nick, 'message'=>$message)).$eol; |
||
363 | |||
364 | } |
||
365 | } |
||
366 | |||
367 | } |
||
368 | |||
369 | /** |
||
370 | * Display forms to synchronize projects (site admin view) |
||
371 | */ |
||
372 | private function _admin_synchronize_muc_and_grp() { |
||
373 | $action = ''; |
||
374 | $nb_grp = 0 ; |
||
375 | $nb_muc = 0; |
||
376 | |||
377 | $im_dao = new IMDao(IMDataAccess::instance($this->getControler())); |
||
378 | |||
379 | $res_grp = $im_dao->search_group_without_shared_group(); |
||
380 | $res_grp = $res_grp->getResult(); |
||
381 | $res_muc = $im_dao->search_group_without_muc(); |
||
382 | $res_muc = $res_muc->getResult(); |
||
383 | |||
384 | // number of shared group to synchronize |
||
385 | $nb_grp = db_numrows($res_grp); |
||
386 | |||
387 | // number of muc room to synchronize |
||
388 | $nb_muc = db_numrows($res_muc); |
||
389 | |||
390 | $array_grp = array(); |
||
391 | if ($nb_grp > 0) { |
||
392 | $array_grp=result_column_to_array($res_grp,0); |
||
393 | } |
||
394 | |||
395 | $array_muc = array(); |
||
396 | if ($nb_muc > 0) { |
||
397 | $array_muc=result_column_to_array($res_muc,0); |
||
398 | } |
||
399 | |||
400 | $array_muc_and_grp = array_intersect($array_grp, $array_muc); |
||
401 | |||
402 | if (sizeof($array_muc_and_grp)) { |
||
403 | $array_muc_only = array_diff($array_muc, $array_muc_and_grp); |
||
404 | $array_grp_only = array_diff($array_grp, $array_muc_and_grp); |
||
405 | } else { |
||
406 | $array_muc_only = $array_muc; |
||
407 | $array_grp_only = $array_grp; |
||
408 | } |
||
409 | |||
410 | $pm = ProjectManager::instance(); |
||
411 | $purifier = Codendi_HTMLPurifier::instance(); |
||
412 | echo'<fieldset>'; |
||
413 | echo'<legend class="im_synchronize">'.$GLOBALS["Language"]->getText('plugin_im_admin','projects_to_sync').'</legend>'; |
||
414 | if ( $nb_grp != 0 || $nb_muc ) { |
||
415 | //************form |
||
416 | if (sizeof($array_muc_and_grp)) { |
||
417 | foreach ($array_muc_and_grp as $key => $val) { |
||
418 | $project = $pm->getProject($val); |
||
419 | $unix_group_name = $purifier->purify(strtolower($project->getUnixName())); |
||
420 | $group_name = $purifier->purify($project->getPublicName()); |
||
421 | $group_description = $purifier->purify($project->getDescription()); |
||
422 | $grp = $pm->getProject($val); // $val = group_id; |
||
423 | $group_id = $grp->getID(); |
||
424 | $project_members_ids = $grp->getMembersId(); |
||
425 | foreach ($project_members_ids as $key => $id) { |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
426 | $group_Owner_object = UserManager::instance()->getUserById($id); |
||
427 | if ($group_Owner_object->isMember($val,'A')) { |
||
428 | $group_Owner_name = $purifier->purify(trim($group_Owner_object->getName())); |
||
429 | } |
||
430 | } |
||
431 | |||
432 | //field label |
||
433 | $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','unix_group_name_label'); |
||
434 | $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_description_label'); |
||
435 | $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_Owner_name_label'); |
||
436 | $action_label = $GLOBALS["Language"]->getText('plugin_im_admin','action_label');//plugin_im_admin - unix_group_name_label |
||
437 | $action_on = $GLOBALS["Language"]->getText('plugin_im_admin','action_on_muc_and_grp'); |
||
438 | echo'<fieldset>'; |
||
439 | echo'<legend class="project_sync">'.$group_name.'</legend>'; |
||
440 | echo $unix_group_name_label.$unix_group_name.'<br>'; |
||
441 | echo $group_description_label.$group_description.'<br>'; |
||
442 | echo $group_Owner_name_label.$group_Owner_name.'<br>'; |
||
443 | echo $action_label.$action_on.'<br>'; |
||
444 | echo ' |
||
445 | <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST"> |
||
446 | <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_muc_and_grp"> |
||
447 | <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="'.$unix_group_name.'"> |
||
448 | <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="'.$group_name.'"> |
||
449 | <INPUT TYPE="HIDDEN" NAME="group_id" VALUE='.$group_id.'> |
||
450 | <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="'.$group_description.'"> |
||
451 | <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="'.$group_Owner_name.'"> |
||
452 | <INPUT type="submit" name="submit" value="'.$GLOBALS["Language"]->getText('plugin_im_admin','im_admin_synchro_muc').'"> |
||
453 | </FORM> |
||
454 | '; |
||
455 | echo'</fieldset>'; |
||
456 | } |
||
457 | } |
||
458 | |||
459 | if (sizeof($array_grp_only)) { |
||
460 | $pm = ProjectManager::instance(); |
||
461 | foreach ($array_grp_only as $key => $val) { |
||
462 | $project = $pm->getProject($val); |
||
463 | $unix_group_name = $purifier->purify(strtolower($project->getUnixName())); |
||
464 | $group_name = $purifier->purify($project->getPublicName()); |
||
465 | $group_description = $purifier->purify($project->getDescription()); |
||
466 | $grp = $pm->getProject($val); // $val = group_id; |
||
467 | $group_id = $grp->getID(); |
||
468 | $project_members_ids = $grp->getMembersId(); |
||
469 | foreach ($project_members_ids as $key => $id) { |
||
0 ignored issues
–
show
|
|||
470 | $group_Owner_object = UserManager::instance()->getUserById($id); |
||
471 | if ($group_Owner_object->isMember($val,'A')) { |
||
472 | $group_Owner_name = $purifier->purify($group_Owner_object->getName()); |
||
473 | } |
||
474 | } |
||
475 | |||
476 | //field label |
||
477 | $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','unix_group_name_label'); |
||
478 | $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_description_label'); |
||
479 | $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_Owner_name_label'); |
||
480 | $action_label = $GLOBALS["Language"]->getText('plugin_im_admin','action_label'); |
||
481 | $action_on = $GLOBALS["Language"]->getText('plugin_im_admin','action_on_grp'); |
||
482 | echo'<fieldset>'; |
||
483 | echo'<legend class="project_sync">'.$group_name.'</legend>'; |
||
484 | echo $unix_group_name_label.$unix_group_name.'<br>'; |
||
485 | echo $group_description_label.$group_description.'<br>'; |
||
486 | echo $group_Owner_name_label.$group_Owner_name.'<br>'; |
||
487 | echo $action_label.$action_on.'<br>'; |
||
488 | echo ' |
||
489 | <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST"> |
||
490 | <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_grp_only"> |
||
491 | <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="'.$unix_group_name.'"> |
||
492 | <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="'.$group_name.'"> |
||
493 | <INPUT TYPE="HIDDEN" NAME="group_id" VALUE='.$group_id.'> |
||
494 | <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="'.$group_description.'"> |
||
495 | <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="'.$group_Owner_name.'"> |
||
496 | <INPUT type="submit" name="submit" value="'.$GLOBALS["Language"]->getText('plugin_im_admin','im_admin_synchro_muc').'"> |
||
497 | </FORM> |
||
498 | '; |
||
499 | echo'</fieldset>'; |
||
500 | } |
||
501 | } |
||
502 | |||
503 | if (sizeof($array_muc_only)) { |
||
504 | $pm = ProjectManager::instance(); |
||
505 | foreach ($array_muc_only as $key => $val) { |
||
506 | $project = $pm->getProject($val); |
||
507 | $unix_group_name = $purifier->purify(strtolower($project->getUnixName())); |
||
508 | $group_name = $purifier->purify($project->getPublicName()); |
||
509 | $group_description = $purifier->purify($project->getDescription()); |
||
510 | $grp = $pm->getProject($val); // $val = group_id; |
||
511 | $group_id = $grp->getID(); |
||
512 | $project_members_ids = $grp->getMembersId(); |
||
513 | foreach ($project_members_ids as $key => $id){ |
||
0 ignored issues
–
show
|
|||
514 | $group_Owner_object = UserManager::instance()->getUserById($id); |
||
515 | if ($group_Owner_object->isMember($val,'A')) { |
||
516 | $group_Owner_name = $purifier->purify($group_Owner_object->getName()); |
||
517 | } |
||
518 | } |
||
519 | //field label |
||
520 | $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','unix_group_name_label'); |
||
521 | $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_description_label'); |
||
522 | $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin','group_Owner_name_label'); |
||
523 | $action_label = $GLOBALS["Language"]->getText('plugin_im_admin','action_label'); |
||
524 | $action_on = $GLOBALS["Language"]->getText('plugin_im_admin','action_on_muc'); |
||
525 | echo'<fieldset>'; |
||
526 | echo'<legend class="project_sync">'.$group_name.'</legend>'; |
||
527 | echo $unix_group_name_label.$unix_group_name.'<br>'; |
||
528 | echo $group_description_label.$group_description.'<br>'; |
||
529 | echo $group_Owner_name_label.$group_Owner_name.'<br>'; |
||
530 | echo $action_label.$action_on.'<br>'; |
||
531 | echo ' |
||
532 | <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST"> |
||
533 | <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_muc_only"> |
||
534 | <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="'.$unix_group_name.'"> |
||
535 | <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="'.$group_name.'"> |
||
536 | <INPUT TYPE="HIDDEN" NAME="group_id" VALUE='.$group_id.'> |
||
537 | <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="'.$group_description.'"> |
||
538 | <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="'.$group_Owner_name.'"> |
||
539 | <INPUT type="submit" name="submit" value="'.$GLOBALS["Language"]->getText('plugin_im_admin','im_admin_synchro_muc').'"> |
||
540 | </FORM> |
||
541 | '; |
||
542 | echo'</fieldset>'; |
||
543 | } |
||
544 | } |
||
545 | |||
546 | echo ' |
||
547 | <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST"> |
||
548 | <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_all"> |
||
549 | <INPUT type="submit" name="submit" value="'.$GLOBALS["Language"]->getText('plugin_im_admin','im_admin_synchro_all').'"> |
||
550 | </FORM>'; |
||
551 | } else { |
||
552 | echo $GLOBALS["Language"]->getText('plugin_im_admin','no_project_to_synchronized'); |
||
553 | } |
||
554 | echo'</fieldset>'; |
||
555 | } |
||
556 | |||
557 | } |
||
558 |