1 | <?php |
---|
2 | |
---|
3 | global $user, $lang, $conf, $errors; |
---|
4 | |
---|
5 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | Check Access and exit when user status is not ok | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | check_status(ACCESS_ADMINISTRATOR); |
---|
10 | |
---|
11 | if (!defined('UAM_PATH')) define('UAM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
12 | |
---|
13 | //ini_set('error_reporting', E_ALL); |
---|
14 | //ini_set('display_errors', true); |
---|
15 | |
---|
16 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
17 | include_once (PHPWG_ROOT_PATH.'/include/constants.php'); |
---|
18 | |
---|
19 | load_language('plugin.lang', UAM_PATH); |
---|
20 | load_language('help/plugin.lang', UAM_PATH); |
---|
21 | |
---|
22 | |
---|
23 | // +-----------------------------------------------------------------------+ |
---|
24 | // | Variables initialization | |
---|
25 | // +-----------------------------------------------------------------------+ |
---|
26 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
27 | |
---|
28 | $page['global'] = array(); |
---|
29 | $error = array(); |
---|
30 | $pattern = '/;/'; |
---|
31 | $replacement = '.'; |
---|
32 | |
---|
33 | $UAM_Password_Test_Score = 0; |
---|
34 | $UAM_Exclusionlist_Error = false; |
---|
35 | |
---|
36 | $dump_download = ''; |
---|
37 | |
---|
38 | // +-----------------------------------------------------------------------+ |
---|
39 | // | Tabssheet | |
---|
40 | // +-----------------------------------------------------------------------+ |
---|
41 | if (!isset($_GET['tab'])) |
---|
42 | $page['tab'] = 'global'; |
---|
43 | else |
---|
44 | $page['tab'] = $_GET['tab']; |
---|
45 | |
---|
46 | $tabsheet = new tabsheet(); |
---|
47 | $tabsheet->add('global', |
---|
48 | l10n('UAM_Tab_Global'), |
---|
49 | $my_base_url.'&tab=global'); |
---|
50 | $tabsheet->add('userlist', |
---|
51 | l10n('UAM_Tab_UserList'), |
---|
52 | $my_base_url.'&tab=userlist'); |
---|
53 | $tabsheet->add('usermanager', |
---|
54 | l10n('UAM_Tab_UserManager'), |
---|
55 | $my_base_url.'&tab=usermanager'); |
---|
56 | $tabsheet->add('ghosttracker', |
---|
57 | l10n('UAM_Tab_GhostTracker'), |
---|
58 | $my_base_url.'&tab=ghosttracker'); |
---|
59 | $tabsheet->select($page['tab']); |
---|
60 | $tabsheet->assign(); |
---|
61 | |
---|
62 | |
---|
63 | // +-----------------------------------------------------------------------+ |
---|
64 | // | Getting plugin version | |
---|
65 | // +-----------------------------------------------------------------------+ |
---|
66 | $plugin = PluginInfos(UAM_PATH); |
---|
67 | $version = $plugin['version']; |
---|
68 | |
---|
69 | |
---|
70 | // +----------------------------------------------------------+ |
---|
71 | // | FCK Editor for email text fields | |
---|
72 | // +----------------------------------------------------------+ |
---|
73 | $toolbar = 'Basic'; |
---|
74 | $width = '750px'; |
---|
75 | $height = '300px'; |
---|
76 | $areas = array(); |
---|
77 | array_push( $areas,'UAM_ConfirmMail_Custom_Txt1','UAM_ConfirmMail_Custom_Txt2','UAM_GTAutoDelText','UAM_USRAutoDelText'); |
---|
78 | |
---|
79 | if (function_exists('set_fckeditor_instance')) |
---|
80 | { |
---|
81 | $fcke_config = unserialize($conf['FCKEditor']); |
---|
82 | foreach($areas as $area) |
---|
83 | { |
---|
84 | if (!isset($fcke_config[$area])) |
---|
85 | { |
---|
86 | $fcke_config[$area] = false; |
---|
87 | } |
---|
88 | } |
---|
89 | $conf['FCKEditor'] = serialize($fcke_config); |
---|
90 | |
---|
91 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | // +-----------------------------------------------------------------------+ |
---|
96 | // | Tabssheet select | |
---|
97 | // +-----------------------------------------------------------------------+ |
---|
98 | |
---|
99 | switch ($page['tab']) |
---|
100 | { |
---|
101 | // ************************************************************************* |
---|
102 | // +-----------------------------------------------------------------------+ |
---|
103 | // | Global Config | |
---|
104 | // +-----------------------------------------------------------------------+ |
---|
105 | // ************************************************************************* |
---|
106 | case 'global': |
---|
107 | |
---|
108 | if (isset($_POST['submit']) and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']) and isset($_POST['UAM_RedirToProfile']) and isset($_POST['UAM_GTAuto']) and isset($_POST['UAM_GTAutoMail']) and isset($_POST['UAM_CustomPasswRetr']) and isset($_POST['UAM_USRAuto']) and isset($_POST['UAM_USRAutoMail']) and isset($_POST['UAM_Stuffs'])) |
---|
109 | { |
---|
110 | |
---|
111 | //General configuration settings |
---|
112 | $_POST['UAM_MailInfo_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_MailInfo_Text']))); |
---|
113 | |
---|
114 | $_POST['UAM_ConfirmMail_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Text']))); |
---|
115 | |
---|
116 | $_POST['UAM_GhostTracker_ReminderText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GhostTracker_ReminderText']))); |
---|
117 | |
---|
118 | $_POST['UAM_GTAutoDelText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoDelText']))); |
---|
119 | |
---|
120 | $_POST['UAM_GTAutoMailText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoMailText']))); |
---|
121 | |
---|
122 | $_POST['UAM_AdminValidationMail_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_AdminValidationMail_Text']))); |
---|
123 | |
---|
124 | $_POST['UAM_CustomPasswRetr_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_CustomPasswRetr_Text']))); |
---|
125 | |
---|
126 | $_POST['UAM_USRAutoDelText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoDelText']))); |
---|
127 | |
---|
128 | // Check if CR-LF exist at begining and end of mail exclusion list - If yes, removes them |
---|
129 | if (preg_match('/^[\s]+/', $_POST['UAM_MailExclusion_List'])) |
---|
130 | { |
---|
131 | array_push($page['errors'], l10n('UAM_mail_exclusionlist_error')); |
---|
132 | $UAM_Exclusionlist_Error = true; |
---|
133 | } |
---|
134 | |
---|
135 | // Consistency check between ConfirmMail and AutoMail - We cannot use GTAutoMail if ConfirmMail is disabled |
---|
136 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
137 | |
---|
138 | if (((isset($conf_UAM['1']) and ($conf_UAM['1'] == 'false' or $conf_UAM['1'] == 'local')) or ($_POST['UAM_Confirm_Mail'] == 'false' or $_POST['UAM_Confirm_Mail'] == 'local')) and $_POST['UAM_GTAutoMail'] == 'true') |
---|
139 | { |
---|
140 | $newvalue = 'false'; |
---|
141 | $_POST['UAM_GTAutoMail'] = $newvalue; |
---|
142 | array_push($page['errors'], l10n('UAM_Error_GTAutoMail_cannot_be_set_without_ConfirmMail')); |
---|
143 | } |
---|
144 | |
---|
145 | $newconf_UAM = array( |
---|
146 | $_POST['UAM_Mail_Info'], |
---|
147 | $_POST['UAM_Confirm_Mail'], |
---|
148 | (isset($_POST['UAM_No_Confirm_Group'])?$_POST['UAM_No_Confirm_Group']:''), |
---|
149 | (isset($_POST['UAM_Validated_Group'])?$_POST['UAM_Validated_Group']:''), |
---|
150 | (isset($_POST['UAM_Validated_Status'])?$_POST['UAM_Validated_Status']:''), |
---|
151 | $_POST['UAM_No_Comment_Anonymous'], |
---|
152 | $_POST['UAM_Username_Char'], |
---|
153 | $_POST['UAM_Username_List'], |
---|
154 | (isset($_POST['UAM_No_Confirm_Status'])?$_POST['UAM_No_Confirm_Status']:''), |
---|
155 | $_POST['UAM_MailInfo_Text'], |
---|
156 | $_POST['UAM_ConfirmMail_Text'], |
---|
157 | $_POST['UAM_MailExclusion'], |
---|
158 | $_POST['UAM_MailExclusion_List'], |
---|
159 | $_POST['UAM_Password_Enforced'], |
---|
160 | $_POST['UAM_Password_Score'], |
---|
161 | $_POST['UAM_AdminPassword_Enforced'], |
---|
162 | $_POST['UAM_GhostUser_Tracker'], |
---|
163 | $_POST['UAM_GhostTracker_DayLimit'], |
---|
164 | $_POST['UAM_GhostTracker_ReminderText'], |
---|
165 | $_POST['UAM_Add_LastVisit_Column'], |
---|
166 | $_POST['UAM_Admin_ConfMail'], |
---|
167 | $_POST['UAM_RedirToProfile'], |
---|
168 | $_POST['UAM_GTAuto'], |
---|
169 | $_POST['UAM_GTAutoMail'], |
---|
170 | $_POST['UAM_GTAutoDelText'], |
---|
171 | $_POST['UAM_GTAutoMailText'], |
---|
172 | (isset($_POST['UAM_Downgrade_Group'])?$_POST['UAM_Downgrade_Group']:''), |
---|
173 | (isset($_POST['UAM_Downgrade_Status'])?$_POST['UAM_Downgrade_Status']:''), |
---|
174 | $_POST['UAM_AdminValidationMail_Text'], |
---|
175 | $_POST['UAM_CustomPasswRetr'], |
---|
176 | $_POST['UAM_CustomPasswRetr_Text'], |
---|
177 | $_POST['UAM_USRAuto'], |
---|
178 | $_POST['UAM_USRAutoDelText'], |
---|
179 | $_POST['UAM_USRAutoMail'], |
---|
180 | $_POST['UAM_Stuffs'] |
---|
181 | ); |
---|
182 | |
---|
183 | $conf['UserAdvManager'] = serialize($newconf_UAM); |
---|
184 | |
---|
185 | $query = ' |
---|
186 | UPDATE '.CONFIG_TABLE.' |
---|
187 | SET value="'.addslashes($conf['UserAdvManager']).'" |
---|
188 | WHERE param="UserAdvManager" |
---|
189 | LIMIT 1 |
---|
190 | ;'; |
---|
191 | |
---|
192 | pwg_query($query); |
---|
193 | |
---|
194 | //Email confirmation settings |
---|
195 | $_POST['UAM_ConfirmMail_ReMail_Txt1'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_ReMail_Txt1']))); |
---|
196 | |
---|
197 | $_POST['UAM_ConfirmMail_ReMail_Txt2'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_ReMail_Txt2']))); |
---|
198 | |
---|
199 | $_POST['UAM_ConfirmMail_Custom_Txt1'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Custom_Txt1']))); |
---|
200 | |
---|
201 | $_POST['UAM_ConfirmMail_Custom_Txt2'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Custom_Txt2']))); |
---|
202 | |
---|
203 | $newconf_UAM_ConfirmMail = array ( |
---|
204 | $_POST['UAM_ConfirmMail_TimeOut'], |
---|
205 | $_POST['UAM_ConfirmMail_Delay'], |
---|
206 | $_POST['UAM_ConfirmMail_ReMail_Txt1'], |
---|
207 | $_POST['UAM_ConfirmMail_Remail'], |
---|
208 | $_POST['UAM_ConfirmMail_ReMail_Txt2'], |
---|
209 | $_POST['UAM_ConfirmMail_Custom_Txt1'], |
---|
210 | $_POST['UAM_ConfirmMail_Custom_Txt2']); |
---|
211 | |
---|
212 | $conf['UserAdvManager_ConfirmMail'] = serialize($newconf_UAM_ConfirmMail); |
---|
213 | |
---|
214 | $query = ' |
---|
215 | UPDATE '.CONFIG_TABLE.' |
---|
216 | SET value="'.addslashes($conf['UserAdvManager_ConfirmMail']).'" |
---|
217 | WHERE param="UserAdvManager_ConfirmMail" |
---|
218 | LIMIT 1 |
---|
219 | ;'; |
---|
220 | |
---|
221 | pwg_query($query); |
---|
222 | |
---|
223 | array_push($page['infos'], l10n('UAM_save_config')); |
---|
224 | } |
---|
225 | |
---|
226 | // Saving UAM tables and configuration settings |
---|
227 | if (isset($_POST['save'])) |
---|
228 | { |
---|
229 | $dump_download = (isset($_POST['dump_download'])) ? 'true' : 'false'; |
---|
230 | |
---|
231 | if(uam_dump($dump_download) and $dump_download == 'false') |
---|
232 | { |
---|
233 | array_push($page['infos'], l10n('UAM_Dump_OK')); |
---|
234 | } |
---|
235 | else |
---|
236 | { |
---|
237 | array_push($page['errors'], l10n('UAM_Dump_NOK')); |
---|
238 | } |
---|
239 | } |
---|
240 | |
---|
241 | //Testing password enforcement |
---|
242 | if (isset($_POST['PasswordTest']) and isset($_POST['UAM_Password_Test']) and !empty($_POST['UAM_Password_Test'])) |
---|
243 | { |
---|
244 | $UAM_Password_Test_Score = testpassword($_POST['UAM_Password_Test']); |
---|
245 | } |
---|
246 | else if (isset($_POST['PasswordTest']) and empty($_POST['UAM_Password_Test'])) |
---|
247 | { |
---|
248 | array_push($page['errors'], l10n('UAM_reg_err_login3')); |
---|
249 | } |
---|
250 | |
---|
251 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
252 | |
---|
253 | //Group setting for unvalidated, validated users and downgrade group |
---|
254 | $groups[-1] = '---------'; |
---|
255 | $No_Valid = -1; |
---|
256 | $Valid = -1; |
---|
257 | $Downgrade = -1; |
---|
258 | |
---|
259 | //Check groups list in database |
---|
260 | $query = ' |
---|
261 | SELECT id, name |
---|
262 | FROM '.GROUPS_TABLE.' |
---|
263 | ORDER BY name ASC |
---|
264 | ;'; |
---|
265 | |
---|
266 | $result = pwg_query($query); |
---|
267 | |
---|
268 | while ($row = pwg_db_fetch_assoc($result)) |
---|
269 | { |
---|
270 | $groups[$row['id']] = $row['name']; |
---|
271 | //configuration value for unvalidated users |
---|
272 | if (isset($conf_UAM[2]) and $conf_UAM[2] == $row['id']) |
---|
273 | { |
---|
274 | $No_Valid = $row['id']; |
---|
275 | } |
---|
276 | //configuration value for validated users |
---|
277 | if (isset($conf_UAM[3]) and $conf_UAM[3] == $row['id']) |
---|
278 | { |
---|
279 | $Valid = $row['id']; |
---|
280 | } |
---|
281 | //configuration value for downgrade users |
---|
282 | if (isset($conf_UAM[26]) and $conf_UAM[26] == $row['id']) |
---|
283 | { |
---|
284 | $Downgrade = $row['id']; |
---|
285 | } |
---|
286 | } |
---|
287 | |
---|
288 | //Template initialization for unvalidated users group |
---|
289 | $template->assign( |
---|
290 | 'No_Confirm_Group', |
---|
291 | array( |
---|
292 | 'group_options'=> $groups, |
---|
293 | 'group_selected' => $No_Valid |
---|
294 | ) |
---|
295 | ); |
---|
296 | //Template initialization for validated users group |
---|
297 | $template->assign( |
---|
298 | 'Validated_Group', |
---|
299 | array( |
---|
300 | 'group_options'=> $groups, |
---|
301 | 'group_selected' => $Valid |
---|
302 | ) |
---|
303 | ); |
---|
304 | //Template initialization for downgrade group |
---|
305 | $template->assign( |
---|
306 | 'Downgrade_Group', |
---|
307 | array( |
---|
308 | 'group_options'=> $groups, |
---|
309 | 'group_selected' => $Downgrade |
---|
310 | ) |
---|
311 | ); |
---|
312 | |
---|
313 | //Status setting for unvalidated, validated users and downgrade status |
---|
314 | $status_options[-1] = '------------'; |
---|
315 | $No_Valid_Status = -1; |
---|
316 | $Valid_Status = -1; |
---|
317 | $Downgrade_Status = -1; |
---|
318 | |
---|
319 | //Get unvalidate status values |
---|
320 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
321 | { |
---|
322 | $status_options[$status] = l10n('user_status_'.$status); |
---|
323 | if (isset($conf_UAM[8]) and $conf_UAM[8] == $status) |
---|
324 | { |
---|
325 | $No_Valid_Status = $status; |
---|
326 | } |
---|
327 | |
---|
328 | //Template initialization for unvalidated users status |
---|
329 | $template->assign( |
---|
330 | 'No_Confirm_Status', |
---|
331 | array( |
---|
332 | 'Status_options' => $status_options, |
---|
333 | 'Status_selected' => $No_Valid_Status |
---|
334 | ) |
---|
335 | ); |
---|
336 | } |
---|
337 | |
---|
338 | //Get validate status values |
---|
339 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
340 | { |
---|
341 | $status_options[$status] = l10n('user_status_'.$status); |
---|
342 | if (isset($conf_UAM[4]) and $conf_UAM[4] == $status) |
---|
343 | { |
---|
344 | $Valid_Status = $status; |
---|
345 | } |
---|
346 | |
---|
347 | //Template initialization for validated users status |
---|
348 | $template->assign( |
---|
349 | 'Confirm_Status', |
---|
350 | array( |
---|
351 | 'Status_options' => $status_options, |
---|
352 | 'Status_selected' => $Valid_Status |
---|
353 | ) |
---|
354 | ); |
---|
355 | } |
---|
356 | |
---|
357 | //Get downgrade status values |
---|
358 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
359 | { |
---|
360 | $status_options[$status] = l10n('user_status_'.$status); |
---|
361 | if (isset($conf_UAM[27]) and $conf_UAM[27] == $status) |
---|
362 | { |
---|
363 | $Downgrade_Status = $status; |
---|
364 | } |
---|
365 | |
---|
366 | //Template initialization for validated users status |
---|
367 | $template->assign( |
---|
368 | 'Downgrade_Status', |
---|
369 | array( |
---|
370 | 'Status_options' => $status_options, |
---|
371 | 'Status_selected' => $Downgrade_Status |
---|
372 | ) |
---|
373 | ); |
---|
374 | } |
---|
375 | |
---|
376 | //Save last opened paragraph in configuration tab |
---|
377 | $nb_para=(isset($_POST["nb_para"])) ? $_POST["nb_para"]:""; |
---|
378 | $nb_para2=(isset($_POST["nb_para2"])) ? $_POST["nb_para2"]:""; |
---|
379 | |
---|
380 | $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); |
---|
381 | |
---|
382 | // Template initialization for forms and data |
---|
383 | $template->assign( |
---|
384 | array( |
---|
385 | 'nb_para' => $nb_para, |
---|
386 | 'nb_para2' => $nb_para2, |
---|
387 | 'UAM_VERSION' => $version, |
---|
388 | 'UAM_PATH' => UAM_PATH, |
---|
389 | 'UAM_DUMP_DOWNLOAD' => $dump_download, |
---|
390 | 'UAM_MAIL_INFO_TRUE' => $conf_UAM[0]=='true' ? 'checked="checked"' : '' , |
---|
391 | 'UAM_MAIL_INFO_FALSE' => $conf_UAM[0]=='false' ? 'checked="checked"' : '' , |
---|
392 | 'UAM_MAILINFO_TEXT' => $conf_UAM[9], |
---|
393 | 'UAM_USERNAME_CHAR_TRUE' => $conf_UAM[6]=='true' ? 'checked="checked"' : '' , |
---|
394 | 'UAM_USERNAME_CHAR_FALSE' => $conf_UAM[6]=='false' ? 'checked="checked"' : '' , |
---|
395 | 'UAM_USERNAME_CHAR_LIST' => $conf_UAM[7], |
---|
396 | 'UAM_CONFIRM_MAIL_TRUE' => $conf_UAM[1]=='true' ? 'checked="checked"' : '' , |
---|
397 | 'UAM_CONFIRM_MAIL_FALSE' => $conf_UAM[1]=='false' ? 'checked="checked"' : '' , |
---|
398 | 'UAM_CONFIRM_MAIL_LOCAL' => $conf_UAM[1]=='local' ? 'checked="checked"' : '' , |
---|
399 | 'UAM_CONFIRMMAIL_TEXT' => $conf_UAM[10], |
---|
400 | 'UAM_No_Confirm_Group' => $conf_UAM[2], |
---|
401 | 'UAM_Validated_Group' => $conf_UAM[3], |
---|
402 | 'UAM_No_Confirm_Status' => $conf_UAM[8], |
---|
403 | 'UAM_Validated_Status' => $conf_UAM[4], |
---|
404 | 'UAM_NO_COMMENT_ANO_TRUE' => $conf_UAM[5]=='true' ? 'checked="checked"' : '' , |
---|
405 | 'UAM_NO_COMMENT_ANO_FALSE' => $conf_UAM[5]=='false' ? 'checked="checked"' : '' , |
---|
406 | 'UAM_MAILEXCLUSION_TRUE' => $conf_UAM[11]=='true' ? 'checked="checked"' : '' , |
---|
407 | 'UAM_MAILEXCLUSION_FALSE' => $conf_UAM[11]=='false' ? 'checked="checked"' : '' , |
---|
408 | 'UAM_MAILEXCLUSION_LIST' => $conf_UAM[12], |
---|
409 | 'UAM_PASSWORDENF_TRUE' => $conf_UAM[13]=='true' ? 'checked="checked"' : '' , |
---|
410 | 'UAM_PASSWORDENF_FALSE' => $conf_UAM[13]=='false' ? 'checked="checked"' : '' , |
---|
411 | 'UAM_PASSWORD_SCORE' => $conf_UAM[14], |
---|
412 | 'UAM_ADMINPASSWENF_TRUE' => $conf_UAM[15]=='true' ? 'checked="checked"' : '' , |
---|
413 | 'UAM_ADMINPASSWENF_FALSE' => $conf_UAM[15]=='false' ? 'checked="checked"' : '' , |
---|
414 | 'UAM_GHOSTRACKER_TRUE' => $conf_UAM[16]=='true' ? 'checked="checked"' : '' , |
---|
415 | 'UAM_GHOSTRACKER_FALSE' => $conf_UAM[16]=='false' ? 'checked="checked"' : '' , |
---|
416 | 'UAM_GHOSTRACKER_DAYLIMIT' => $conf_UAM[17], |
---|
417 | 'UAM_GHOSTRACKER_REMINDERTEXT' => $conf_UAM[18], |
---|
418 | 'UAM_ADDLASTVISIT_TRUE' => $conf_UAM[19]=='true' ? 'checked="checked"' : '' , |
---|
419 | 'UAM_ADDLASTVISIT_FALSE' => $conf_UAM[19]=='false' ? 'checked="checked"' : '' , |
---|
420 | 'UAM_ADMINCONFMAIL_TRUE' => $conf_UAM[20]=='true' ? 'checked="checked"' : '' , |
---|
421 | 'UAM_ADMINCONFMAIL_FALSE' => $conf_UAM[20]=='false' ? 'checked="checked"' : '' , |
---|
422 | 'UAM_REDIRTOPROFILE_TRUE' => $conf_UAM[21]=='true' ? 'checked="checked"' : '' , |
---|
423 | 'UAM_REDIRTOPROFILE_FALSE' => $conf_UAM[21]=='false' ? 'checked="checked"' : '' , |
---|
424 | 'UAM_GTAUTO_TRUE' => $conf_UAM[22]=='true' ? 'checked="checked"' : '' , |
---|
425 | 'UAM_GTAUTO_FALSE' => $conf_UAM[22]=='false' ? 'checked="checked"' : '' , |
---|
426 | 'UAM_GTAUTOMAIL_TRUE' => $conf_UAM[23]=='true' ? 'checked="checked"' : '' , |
---|
427 | 'UAM_GTAUTOMAIL_FALSE' => $conf_UAM[23]=='false' ? 'checked="checked"' : '' , |
---|
428 | 'UAM_GTAUTODEL_TEXT' => $conf_UAM[24], |
---|
429 | 'UAM_GTAUTOMAILTEXT' => $conf_UAM[25], |
---|
430 | 'UAM_Downgrade_Group' => $conf_UAM[26], |
---|
431 | 'UAM_Downgrade_Status' => $conf_UAM[27], |
---|
432 | 'UAM_ADMINVALIDATIONMAIL_TEXT' => $conf_UAM[28], |
---|
433 | 'UAM_CUSTOMPASSWRETR_TRUE' => $conf_UAM[29]=='true' ? 'checked="checked"' : '' , |
---|
434 | 'UAM_CUSTOMPASSWRETR_FALSE' => $conf_UAM[29]=='false' ? 'checked="checked"' : '' , |
---|
435 | 'UAM_CUSTOMPASSWRETR_TEXT' => $conf_UAM[30], |
---|
436 | 'UAM_USRAUTO_TRUE' => $conf_UAM[31]=='true' ? 'checked="checked"' : '' , |
---|
437 | 'UAM_USRAUTO_FALSE' => $conf_UAM[31]=='false' ? 'checked="checked"' : '' , |
---|
438 | 'UAM_USRAUTODEL_TEXT' => $conf_UAM[32], |
---|
439 | 'UAM_USRAUTOMAIL_TRUE' => $conf_UAM[33]=='true' ? 'checked="checked"' : '' , |
---|
440 | 'UAM_USRAUTOMAIL_FALSE' => $conf_UAM[33]=='false' ? 'checked="checked"' : '' , |
---|
441 | 'UAM_STUFFS_TRUE' => $conf_UAM[34]=='true' ? 'checked="checked"' : '' , |
---|
442 | 'UAM_STUFFS_FALSE' => $conf_UAM[34]=='false' ? 'checked="checked"' : '' , |
---|
443 | 'UAM_PASSWORD_TEST_SCORE' => $UAM_Password_Test_Score, |
---|
444 | 'UAM_ERROR_REPORTS4' => $UAM_Exclusionlist_Error, |
---|
445 | 'UAM_CONFIRMMAIL_TIMEOUT_TRUE' => $conf_UAM_ConfirmMail[0]=='true' ? 'checked="checked"' : '' , |
---|
446 | 'UAM_CONFIRMMAIL_TIMEOUT_FALSE' => $conf_UAM_ConfirmMail[0]=='false' ? 'checked="checked"' : '' , |
---|
447 | 'UAM_CONFIRMMAIL_DELAY' => $conf_UAM_ConfirmMail[1], |
---|
448 | 'UAM_CONFIRMMAIL_REMAIL_TRUE' => $conf_UAM_ConfirmMail[3]=='true' ? 'checked="checked"' : '', |
---|
449 | 'UAM_CONFIRMMAIL_REMAIL_FALSE' => $conf_UAM_ConfirmMail[3]=='false' ? 'checked="checked"' : '', |
---|
450 | 'UAM_CONFIRMMAIL_REMAIL_TXT1' => $conf_UAM_ConfirmMail[2], |
---|
451 | 'UAM_CONFIRMMAIL_REMAIL_TXT2' => $conf_UAM_ConfirmMail[4], |
---|
452 | 'UAM_CONFIRMMAIL_CUSTOM_TXT1' => $conf_UAM_ConfirmMail[5], |
---|
453 | 'UAM_CONFIRMMAIL_CUSTOM_TXT2' => $conf_UAM_ConfirmMail[6], |
---|
454 | ) |
---|
455 | ); |
---|
456 | |
---|
457 | if (isset($_POST['audit'])) |
---|
458 | { |
---|
459 | $msg_error1 = ''; |
---|
460 | |
---|
461 | //Username without forbidden keys |
---|
462 | if ( isset($conf_UAM[6]) and $conf_UAM[6] == 'true' ) |
---|
463 | { |
---|
464 | $query = " |
---|
465 | SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']." |
---|
466 | FROM ".USERS_TABLE." |
---|
467 | ;"; |
---|
468 | |
---|
469 | $result = pwg_query($query); |
---|
470 | |
---|
471 | while($row = pwg_db_fetch_assoc($result)) |
---|
472 | { |
---|
473 | if (!ValidateUsername(stripslashes($row['username']))) |
---|
474 | $msg_error1 .= (($msg_error1 <> '') ? '<br>' : '') . l10n('UAM_Err_audit_username_char').stripslashes($row['username']); |
---|
475 | } |
---|
476 | } |
---|
477 | |
---|
478 | $msg_error2 = ''; |
---|
479 | |
---|
480 | //Email without forbidden domain |
---|
481 | if ( isset($conf_UAM[11]) and $conf_UAM[11] == 'true' ) |
---|
482 | { |
---|
483 | $query = " |
---|
484 | SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']." |
---|
485 | FROM ".USERS_TABLE." |
---|
486 | ;"; |
---|
487 | |
---|
488 | $result = pwg_query($query); |
---|
489 | |
---|
490 | while($row = pwg_db_fetch_assoc($result)) |
---|
491 | { |
---|
492 | $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[12]); |
---|
493 | for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++) |
---|
494 | { |
---|
495 | $pattern = '/'.$conf_MailExclusion[$i].'/'; |
---|
496 | if (preg_match($pattern, $row['mail_address'])) |
---|
497 | { |
---|
498 | $msg_error2 .= (($msg_error2 <> '') ? '<br>' : '') . l10n('UAM_Err_audit_email_forbidden').stripslashes($row['username']).' ('.$row['mail_address'].')'; |
---|
499 | } |
---|
500 | } |
---|
501 | } |
---|
502 | } |
---|
503 | |
---|
504 | if ($msg_error1 <> '') |
---|
505 | $errors[] = $msg_error1.'<br><br>'; |
---|
506 | |
---|
507 | if ($msg_error2 <> '') |
---|
508 | $errors[] = $msg_error2.'<br><br>'; |
---|
509 | |
---|
510 | if ($msg_error1 <> '' or $msg_error2 <> '') |
---|
511 | array_push($page['errors'], l10n('UAM_Err_audit_advise')); |
---|
512 | else |
---|
513 | array_push($page['infos'], l10n('UAM_audit_ok')); |
---|
514 | } |
---|
515 | |
---|
516 | |
---|
517 | // +-----------------------------------------------------------------------+ |
---|
518 | // | errors display | |
---|
519 | // +-----------------------------------------------------------------------+ |
---|
520 | if (isset ($errors) and count($errors) != 0) |
---|
521 | { |
---|
522 | $template->assign('errors',array()); |
---|
523 | foreach ($errors as $error) |
---|
524 | { |
---|
525 | array_push($page['errors'], $error); |
---|
526 | } |
---|
527 | } |
---|
528 | |
---|
529 | // +-----------------------------------------------------------------------+ |
---|
530 | // | templates display | |
---|
531 | // +-----------------------------------------------------------------------+ |
---|
532 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/global.tpl'); |
---|
533 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
534 | |
---|
535 | break; |
---|
536 | |
---|
537 | |
---|
538 | // ************************************************************************* |
---|
539 | // +-----------------------------------------------------------------------+ |
---|
540 | // | Users list page | |
---|
541 | // +-----------------------------------------------------------------------+ |
---|
542 | // ************************************************************************* |
---|
543 | case 'userlist': |
---|
544 | |
---|
545 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
546 | |
---|
547 | if (isset($conf_UAM[19]) and $conf_UAM[19]=='true') |
---|
548 | { |
---|
549 | // +-----------------------------------------------------------------------+ |
---|
550 | // | initialization | |
---|
551 | // +-----------------------------------------------------------------------+ |
---|
552 | |
---|
553 | if (!defined('PHPWG_ROOT_PATH')) |
---|
554 | { |
---|
555 | die('Hacking attempt!'); |
---|
556 | } |
---|
557 | |
---|
558 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
559 | |
---|
560 | // +-----------------------------------------------------------------------+ |
---|
561 | // | Check Access and exit when user status is not ok | |
---|
562 | // +-----------------------------------------------------------------------+ |
---|
563 | check_status(ACCESS_ADMINISTRATOR); |
---|
564 | |
---|
565 | |
---|
566 | // +-----------------------------------------------------------------------+ |
---|
567 | // | user list | |
---|
568 | // +-----------------------------------------------------------------------+ |
---|
569 | |
---|
570 | $page['filtered_users'] = get_user_list(); |
---|
571 | |
---|
572 | // +-----------------------------------------------------------------------+ |
---|
573 | // | user list | |
---|
574 | // +-----------------------------------------------------------------------+ |
---|
575 | |
---|
576 | $visible_user_list = array(); |
---|
577 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
578 | { |
---|
579 | $visible_user_list[] = $local_user; |
---|
580 | } |
---|
581 | |
---|
582 | foreach ($visible_user_list as $local_user) |
---|
583 | { |
---|
584 | // dates formating and compare |
---|
585 | $today = date("d-m-Y"); // Get today's date |
---|
586 | list($day, $month, $year) = explode('-', $today); // explode date of today |
---|
587 | $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp |
---|
588 | |
---|
589 | list($regdate, $regtime) = explode(' ', $local_user['lastvisit']); // Explode date and time from registration date |
---|
590 | list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date |
---|
591 | $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp |
---|
592 | |
---|
593 | $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps |
---|
594 | $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days |
---|
595 | |
---|
596 | if (isset($conf_UAM[16]) and $conf_UAM[16]=='true' and $conf_UAM[17] <> '') |
---|
597 | { |
---|
598 | if ($deltadays <= ($conf_UAM[17]/2)) |
---|
599 | { |
---|
600 | $display = 'green'; |
---|
601 | } |
---|
602 | |
---|
603 | if (($deltadays > ($conf_UAM[17]/2)) and ($deltadays < $conf_UAM[17])) |
---|
604 | { |
---|
605 | $display = 'orange'; |
---|
606 | } |
---|
607 | |
---|
608 | if ($deltadays >= $conf_UAM[17]) |
---|
609 | { |
---|
610 | $display = 'red'; |
---|
611 | } |
---|
612 | } |
---|
613 | else $display = ''; |
---|
614 | |
---|
615 | $template->append( |
---|
616 | 'users', |
---|
617 | array( |
---|
618 | 'ID' => $local_user['id'], |
---|
619 | 'USERNAME' => stripslashes($local_user['username']), |
---|
620 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
621 | 'LASTVISIT' => $local_user['lastvisit'], |
---|
622 | 'DAYS' => $deltadays, |
---|
623 | 'DISPLAY' => $display, |
---|
624 | ) |
---|
625 | ); |
---|
626 | } |
---|
627 | //Plugin version inserted |
---|
628 | $template->assign( |
---|
629 | array( |
---|
630 | 'UAM_VERSION' => $version, |
---|
631 | 'UAM_PATH' => UAM_PATH, |
---|
632 | ) |
---|
633 | ); |
---|
634 | // +-----------------------------------------------------------------------+ |
---|
635 | // | errors display | |
---|
636 | // +-----------------------------------------------------------------------+ |
---|
637 | if ( isset ($errors) and count($errors) != 0) |
---|
638 | { |
---|
639 | $template->assign('errors',array()); |
---|
640 | foreach ($errors as $error) |
---|
641 | { |
---|
642 | array_push($page['errors'], $error); |
---|
643 | } |
---|
644 | } |
---|
645 | |
---|
646 | // +-----------------------------------------------------------------------+ |
---|
647 | // | templates display | |
---|
648 | // +-----------------------------------------------------------------------+ |
---|
649 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/userlist.tpl'); |
---|
650 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
651 | } |
---|
652 | else |
---|
653 | { |
---|
654 | array_push($page['errors'], l10n('UAM_Err_Userlist_Settings')); |
---|
655 | } |
---|
656 | break; |
---|
657 | |
---|
658 | |
---|
659 | // ************************************************************************* |
---|
660 | // +-----------------------------------------------------------------------+ |
---|
661 | // | Users manager page | |
---|
662 | // +-----------------------------------------------------------------------+ |
---|
663 | // ************************************************************************* |
---|
664 | case 'usermanager': |
---|
665 | |
---|
666 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
667 | |
---|
668 | $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); |
---|
669 | |
---|
670 | if (isset($conf_UAM[1]) and ($conf_UAM[1]=='true' or $conf_UAM[1]=='local') and ((isset($conf_UAM[2]) and $conf_UAM[2] <> '-1') or (isset($conf_UAM[8]) and $conf_UAM[8] <> '-1'))) |
---|
671 | { |
---|
672 | // +-----------------------------------------------------------------------+ |
---|
673 | // | initialization | |
---|
674 | // +-----------------------------------------------------------------------+ |
---|
675 | |
---|
676 | if (!defined('PHPWG_ROOT_PATH')) |
---|
677 | { |
---|
678 | die('Hacking attempt!'); |
---|
679 | } |
---|
680 | |
---|
681 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
682 | |
---|
683 | // +-----------------------------------------------------------------------+ |
---|
684 | // | Check Access and exit when user status is not ok | |
---|
685 | // +-----------------------------------------------------------------------+ |
---|
686 | check_status(ACCESS_ADMINISTRATOR); |
---|
687 | |
---|
688 | // +-----------------------------------------------------------------------+ |
---|
689 | // | user list | |
---|
690 | // +-----------------------------------------------------------------------+ |
---|
691 | |
---|
692 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
693 | |
---|
694 | // +-----------------------------------------------------------------------+ |
---|
695 | // | selected users | |
---|
696 | // +-----------------------------------------------------------------------+ |
---|
697 | if (isset($_POST['Del_Selected'])) |
---|
698 | { |
---|
699 | $collection = array(); |
---|
700 | |
---|
701 | switch ($_POST['target']) |
---|
702 | { |
---|
703 | case 'all' : |
---|
704 | { |
---|
705 | foreach($page['filtered_users'] as $local_user) |
---|
706 | { |
---|
707 | array_push($collection, $local_user['id']); |
---|
708 | } |
---|
709 | break; |
---|
710 | } |
---|
711 | case 'selection' : |
---|
712 | { |
---|
713 | if (isset($_POST['selection'])) |
---|
714 | { |
---|
715 | $collection = $_POST['selection']; |
---|
716 | } |
---|
717 | break; |
---|
718 | } |
---|
719 | } |
---|
720 | |
---|
721 | if (count($collection) == 0) |
---|
722 | { |
---|
723 | array_push($page['errors'], l10n('Select at least one user')); |
---|
724 | } |
---|
725 | } |
---|
726 | |
---|
727 | // +-----------------------------------------------------------------------+ |
---|
728 | // | delete users | |
---|
729 | // +-----------------------------------------------------------------------+ |
---|
730 | if (isset($_POST['Del_Selected']) and count($collection) > 0) |
---|
731 | { |
---|
732 | if (in_array($conf['guest_id'], $collection)) |
---|
733 | { |
---|
734 | array_push($page['errors'], l10n('Guest cannot be deleted')); |
---|
735 | } |
---|
736 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
737 | in_array($conf['default_user_id'], $collection)) |
---|
738 | { |
---|
739 | array_push($page['errors'], l10n('Default user cannot be deleted')); |
---|
740 | } |
---|
741 | if (in_array($conf['webmaster_id'], $collection)) |
---|
742 | { |
---|
743 | array_push($page['errors'], l10n('Webmaster cannot be deleted')); |
---|
744 | } |
---|
745 | if (in_array($user['id'], $collection)) |
---|
746 | { |
---|
747 | array_push($page['errors'], l10n('You cannot delete your account')); |
---|
748 | } |
---|
749 | |
---|
750 | if (count($page['errors']) == 0) |
---|
751 | { |
---|
752 | foreach ($collection as $user_id) |
---|
753 | { |
---|
754 | delete_user($user_id); |
---|
755 | } |
---|
756 | array_push( |
---|
757 | $page['infos'], |
---|
758 | l10n_dec( |
---|
759 | '%d user deleted', '%d users deleted', |
---|
760 | count($collection) |
---|
761 | ) |
---|
762 | ); |
---|
763 | |
---|
764 | foreach ($page['filtered_users'] as $filter_key => $filter_user) |
---|
765 | { |
---|
766 | if (in_array($filter_user['id'], $collection)) |
---|
767 | { |
---|
768 | unset($page['filtered_users'][$filter_key]); |
---|
769 | } |
---|
770 | } |
---|
771 | } |
---|
772 | } |
---|
773 | |
---|
774 | // +-----------------------------------------------------------------------+ |
---|
775 | // | Resend new validation key to users | |
---|
776 | // +-----------------------------------------------------------------------+ |
---|
777 | // +-----------------------------------------------------------------------+ |
---|
778 | // | selected users | |
---|
779 | // +-----------------------------------------------------------------------+ |
---|
780 | if (isset($_POST['Mail_With_Key'])) |
---|
781 | { |
---|
782 | $collection = array(); |
---|
783 | |
---|
784 | switch ($_POST['target']) |
---|
785 | { |
---|
786 | case 'all' : |
---|
787 | { |
---|
788 | foreach($page['filtered_users'] as $local_user) |
---|
789 | { |
---|
790 | array_push($collection, $local_user['id']); |
---|
791 | } |
---|
792 | break; |
---|
793 | } |
---|
794 | case 'selection' : |
---|
795 | { |
---|
796 | if (isset($_POST['selection'])) |
---|
797 | { |
---|
798 | $collection = $_POST['selection']; |
---|
799 | } |
---|
800 | break; |
---|
801 | } |
---|
802 | } |
---|
803 | |
---|
804 | if (count($collection) == 0) |
---|
805 | { |
---|
806 | array_push($page['errors'], l10n('Select at least one user')); |
---|
807 | } |
---|
808 | } |
---|
809 | // +-----------------------------------------------------------------------+ |
---|
810 | // | Resend new validation key to users | |
---|
811 | // +-----------------------------------------------------------------------+ |
---|
812 | if (isset($_POST['Mail_With_Key']) and count($collection) > 0) |
---|
813 | { |
---|
814 | if (in_array($conf['guest_id'], $collection)) |
---|
815 | { |
---|
816 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
817 | } |
---|
818 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
819 | in_array($conf['default_user_id'], $collection)) |
---|
820 | { |
---|
821 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
822 | } |
---|
823 | if (in_array($conf['webmaster_id'], $collection)) |
---|
824 | { |
---|
825 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
826 | } |
---|
827 | if (in_array($user['id'], $collection)) |
---|
828 | { |
---|
829 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
830 | } |
---|
831 | |
---|
832 | if (count($page['errors']) == 0) |
---|
833 | { |
---|
834 | foreach ($collection as $user_id) |
---|
835 | { |
---|
836 | $typemail = 1; |
---|
837 | $query = " |
---|
838 | SELECT id, username, mail_address |
---|
839 | FROM ".USERS_TABLE." |
---|
840 | WHERE id = '".$user_id."' |
---|
841 | ;"; |
---|
842 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
843 | |
---|
844 | ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],true); |
---|
845 | } |
---|
846 | array_push( |
---|
847 | $page['infos'], |
---|
848 | l10n_dec( |
---|
849 | 'UAM_%d_Mail_With_Key', 'UAM_%d_Mails_With_Key', |
---|
850 | count($collection) |
---|
851 | ) |
---|
852 | ); |
---|
853 | |
---|
854 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
855 | } |
---|
856 | } |
---|
857 | |
---|
858 | // +-----------------------------------------------------------------------+ |
---|
859 | // | Send reminder without new key to users | |
---|
860 | // +-----------------------------------------------------------------------+ |
---|
861 | // +-----------------------------------------------------------------------+ |
---|
862 | // | selected users | |
---|
863 | // +-----------------------------------------------------------------------+ |
---|
864 | if (isset($_POST['Mail_Without_Key'])) |
---|
865 | { |
---|
866 | $collection = array(); |
---|
867 | |
---|
868 | switch ($_POST['target']) |
---|
869 | { |
---|
870 | case 'all' : |
---|
871 | { |
---|
872 | foreach($page['filtered_users'] as $local_user) |
---|
873 | { |
---|
874 | array_push($collection, $local_user['id']); |
---|
875 | } |
---|
876 | break; |
---|
877 | } |
---|
878 | case 'selection' : |
---|
879 | { |
---|
880 | if (isset($_POST['selection'])) |
---|
881 | { |
---|
882 | $collection = $_POST['selection']; |
---|
883 | } |
---|
884 | break; |
---|
885 | } |
---|
886 | } |
---|
887 | |
---|
888 | if (count($collection) == 0) |
---|
889 | { |
---|
890 | array_push($page['errors'], l10n('Select at least one user')); |
---|
891 | } |
---|
892 | } |
---|
893 | // +-----------------------------------------------------------------------+ |
---|
894 | // | Send reminder without new key to users | |
---|
895 | // +-----------------------------------------------------------------------+ |
---|
896 | if (isset($_POST['Mail_Without_Key']) and count($collection) > 0) |
---|
897 | { |
---|
898 | if (in_array($conf['guest_id'], $collection)) |
---|
899 | { |
---|
900 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
901 | } |
---|
902 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
903 | in_array($conf['default_user_id'], $collection)) |
---|
904 | { |
---|
905 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
906 | } |
---|
907 | if (in_array($conf['webmaster_id'], $collection)) |
---|
908 | { |
---|
909 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
910 | } |
---|
911 | if (in_array($user['id'], $collection)) |
---|
912 | { |
---|
913 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
914 | } |
---|
915 | |
---|
916 | if (count($page['errors']) == 0) |
---|
917 | { |
---|
918 | foreach ($collection as $user_id) |
---|
919 | { |
---|
920 | $typemail = 2; |
---|
921 | $query = " |
---|
922 | SELECT id, username, mail_address |
---|
923 | FROM ".USERS_TABLE." |
---|
924 | WHERE id = '".$user_id."' |
---|
925 | ;"; |
---|
926 | |
---|
927 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
928 | |
---|
929 | ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],false); |
---|
930 | } |
---|
931 | array_push( |
---|
932 | $page['infos'], |
---|
933 | l10n_dec( |
---|
934 | 'UAM_%d_Reminder_Sent', 'UAM_%d_Reminders_Sent', |
---|
935 | count($collection) |
---|
936 | ) |
---|
937 | ); |
---|
938 | |
---|
939 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
940 | } |
---|
941 | } |
---|
942 | |
---|
943 | // +-----------------------------------------------------------------------+ |
---|
944 | // | Force validation | |
---|
945 | // +-----------------------------------------------------------------------+ |
---|
946 | // +-----------------------------------------------------------------------+ |
---|
947 | // | selected users | |
---|
948 | // +-----------------------------------------------------------------------+ |
---|
949 | if (isset($_POST['Force_Validation'])) |
---|
950 | { |
---|
951 | $collection = array(); |
---|
952 | |
---|
953 | switch ($_POST['target']) |
---|
954 | { |
---|
955 | case 'all' : |
---|
956 | { |
---|
957 | foreach($page['filtered_users'] as $local_user) |
---|
958 | { |
---|
959 | array_push($collection, $local_user['id']); |
---|
960 | } |
---|
961 | break; |
---|
962 | } |
---|
963 | case 'selection' : |
---|
964 | { |
---|
965 | if (isset($_POST['selection'])) |
---|
966 | { |
---|
967 | $collection = $_POST['selection']; |
---|
968 | } |
---|
969 | break; |
---|
970 | } |
---|
971 | } |
---|
972 | |
---|
973 | if (count($collection) == 0) |
---|
974 | { |
---|
975 | array_push($page['errors'], l10n('Select at least one user')); |
---|
976 | } |
---|
977 | } |
---|
978 | // +-----------------------------------------------------------------------+ |
---|
979 | // | Force validation | |
---|
980 | // +-----------------------------------------------------------------------+ |
---|
981 | if (isset($_POST['Force_Validation']) and count($collection) > 0) |
---|
982 | { |
---|
983 | if (in_array($conf['guest_id'], $collection)) |
---|
984 | { |
---|
985 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
986 | } |
---|
987 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
988 | in_array($conf['default_user_id'], $collection)) |
---|
989 | { |
---|
990 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
991 | } |
---|
992 | if (in_array($conf['webmaster_id'], $collection)) |
---|
993 | { |
---|
994 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
995 | } |
---|
996 | if (in_array($user['id'], $collection)) |
---|
997 | { |
---|
998 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
999 | } |
---|
1000 | |
---|
1001 | if (count($page['errors']) == 0) |
---|
1002 | { |
---|
1003 | foreach ($collection as $user_id) |
---|
1004 | { |
---|
1005 | ForceValidation($user_id); |
---|
1006 | validation_mail($user_id); |
---|
1007 | } |
---|
1008 | array_push( |
---|
1009 | $page['infos'], |
---|
1010 | l10n_dec( |
---|
1011 | 'UAM_%d_Validated_User', 'UAM_%d_Validated_Users', |
---|
1012 | count($collection) |
---|
1013 | ) |
---|
1014 | ); |
---|
1015 | |
---|
1016 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
1017 | } |
---|
1018 | } |
---|
1019 | |
---|
1020 | |
---|
1021 | // +-----------------------------------------------------------------------+ |
---|
1022 | // | groups list | |
---|
1023 | // +-----------------------------------------------------------------------+ |
---|
1024 | |
---|
1025 | $groups[-1] = '------------'; |
---|
1026 | |
---|
1027 | $query = ' |
---|
1028 | SELECT id, name |
---|
1029 | FROM '.GROUPS_TABLE.' |
---|
1030 | ORDER BY name ASC |
---|
1031 | ;'; |
---|
1032 | |
---|
1033 | $result = pwg_query($query); |
---|
1034 | |
---|
1035 | while ($row = pwg_db_fetch_assoc($result)) |
---|
1036 | { |
---|
1037 | $groups[$row['id']] = $row['name']; |
---|
1038 | } |
---|
1039 | |
---|
1040 | // +-----------------------------------------------------------------------+ |
---|
1041 | // | user list | |
---|
1042 | // +-----------------------------------------------------------------------+ |
---|
1043 | |
---|
1044 | $profile_url = get_root_url().'admin.php?page=profile&user_id='; |
---|
1045 | $perm_url = get_root_url().'admin.php?page=user_perm&user_id='; |
---|
1046 | |
---|
1047 | $visible_user_list = array(); |
---|
1048 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
1049 | { |
---|
1050 | $visible_user_list[] = $local_user; |
---|
1051 | } |
---|
1052 | |
---|
1053 | foreach ($visible_user_list as $local_user) |
---|
1054 | { |
---|
1055 | $groups_string = preg_replace( |
---|
1056 | '/(\d+)/e', |
---|
1057 | "\$groups['$1']", |
---|
1058 | implode( |
---|
1059 | ', ', |
---|
1060 | $local_user['groups'] |
---|
1061 | ) |
---|
1062 | ); |
---|
1063 | |
---|
1064 | $query = ' |
---|
1065 | SELECT user_id, reminder |
---|
1066 | FROM '.USER_CONFIRM_MAIL_TABLE.' |
---|
1067 | WHERE user_id = '.$local_user['id'].' |
---|
1068 | ;'; |
---|
1069 | $result = pwg_query($query); |
---|
1070 | |
---|
1071 | $row = pwg_db_fetch_assoc($result); |
---|
1072 | |
---|
1073 | if (isset($row['reminder']) and $row['reminder'] == 'true') |
---|
1074 | { |
---|
1075 | $reminder = l10n('UAM_Reminder_Sent_OK'); |
---|
1076 | } |
---|
1077 | else if ((isset($row['reminder']) and $row['reminder'] == 'false') or !isset($row['reminder'])) |
---|
1078 | { |
---|
1079 | $reminder = l10n('UAM_Reminder_Sent_NOK'); |
---|
1080 | } |
---|
1081 | |
---|
1082 | |
---|
1083 | if (isset($_POST['pref_submit']) |
---|
1084 | and isset($_POST['selection']) |
---|
1085 | and in_array($local_user['id'], $_POST['selection'])) |
---|
1086 | { |
---|
1087 | $checked = 'checked="checked"'; |
---|
1088 | } |
---|
1089 | else |
---|
1090 | { |
---|
1091 | $checked = ''; |
---|
1092 | } |
---|
1093 | |
---|
1094 | $properties = array(); |
---|
1095 | if ( $local_user['level'] != 0 ) |
---|
1096 | { |
---|
1097 | $properties[] = l10n( sprintf('Level %d', $local_user['level']) ); |
---|
1098 | } |
---|
1099 | $properties[] = |
---|
1100 | (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) |
---|
1101 | ? l10n('is_high_enabled') : l10n('is_high_disabled'); |
---|
1102 | |
---|
1103 | $expiration = expiration($local_user['id']); |
---|
1104 | |
---|
1105 | $template->append( |
---|
1106 | 'users', |
---|
1107 | array( |
---|
1108 | 'ID' => $local_user['id'], |
---|
1109 | 'CHECKED' => $checked, |
---|
1110 | 'U_PROFILE' => $profile_url.$local_user['id'], |
---|
1111 | 'U_PERM' => $perm_url.$local_user['id'], |
---|
1112 | 'USERNAME' => stripslashes($local_user['username']) |
---|
1113 | .($local_user['id'] == $conf['guest_id'] |
---|
1114 | ? '<BR>['.l10n('is_the_guest').']' : '') |
---|
1115 | .($local_user['id'] == $conf['default_user_id'] |
---|
1116 | ? '<BR>['.l10n('is_the_default').']' : ''), |
---|
1117 | 'STATUS' => l10n('user_status_' |
---|
1118 | .$local_user['status']), |
---|
1119 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
1120 | 'GROUPS' => $groups_string, |
---|
1121 | 'REGISTRATION' => $local_user['registration_date'], |
---|
1122 | 'REMINDER' => $reminder, |
---|
1123 | 'EXPIRATION' => $expiration, |
---|
1124 | ) |
---|
1125 | ); |
---|
1126 | } |
---|
1127 | |
---|
1128 | // Check if validation of register is made by admin or visitor |
---|
1129 | // If visitor, $Confirm_Local is used to mask useless buttons |
---|
1130 | $Confirm_Local = ""; |
---|
1131 | |
---|
1132 | if ($conf_UAM[1] == 'local') |
---|
1133 | { |
---|
1134 | $Confirm_Local = $conf_UAM[1]; |
---|
1135 | } |
---|
1136 | else |
---|
1137 | { |
---|
1138 | $Confirm_Local = ""; |
---|
1139 | } |
---|
1140 | |
---|
1141 | //Plugin version inserted |
---|
1142 | $template->assign( |
---|
1143 | array( |
---|
1144 | 'CONFIRM_LOCAL'=> $Confirm_Local, |
---|
1145 | 'UAM_VERSION' => $version, |
---|
1146 | 'UAM_PATH' => UAM_PATH, |
---|
1147 | ) |
---|
1148 | ); |
---|
1149 | |
---|
1150 | // +-----------------------------------------------------------------------+ |
---|
1151 | // | errors display | |
---|
1152 | // +-----------------------------------------------------------------------+ |
---|
1153 | if ( isset ($errors) and count($errors) != 0) |
---|
1154 | { |
---|
1155 | $template->assign('errors',array()); |
---|
1156 | foreach ($errors as $error) |
---|
1157 | { |
---|
1158 | array_push($page['errors'], $error); |
---|
1159 | } |
---|
1160 | } |
---|
1161 | |
---|
1162 | // +-----------------------------------------------------------------------+ |
---|
1163 | // | templates display | |
---|
1164 | // +-----------------------------------------------------------------------+ |
---|
1165 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/usermanager.tpl'); |
---|
1166 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
1167 | } |
---|
1168 | else |
---|
1169 | { |
---|
1170 | array_push($page['errors'], l10n('UAM_Err_UserManager_Settings')); |
---|
1171 | } |
---|
1172 | break; |
---|
1173 | |
---|
1174 | |
---|
1175 | // ************************************************************************* |
---|
1176 | // +-----------------------------------------------------------------------+ |
---|
1177 | // | Ghost Tracker page | |
---|
1178 | // +-----------------------------------------------------------------------+ |
---|
1179 | // ************************************************************************* |
---|
1180 | case 'ghosttracker': |
---|
1181 | |
---|
1182 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
1183 | |
---|
1184 | if (isset($conf_UAM[16]) and $conf_UAM[16]=='true') |
---|
1185 | { |
---|
1186 | // +-----------------------------------------------------------------------+ |
---|
1187 | // | initialization | |
---|
1188 | // +-----------------------------------------------------------------------+ |
---|
1189 | |
---|
1190 | if (!defined('PHPWG_ROOT_PATH')) |
---|
1191 | { |
---|
1192 | die('Hacking attempt!'); |
---|
1193 | } |
---|
1194 | |
---|
1195 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
1196 | |
---|
1197 | // +-----------------------------------------------------------------------+ |
---|
1198 | // | Check Access and exit when user status is not ok | |
---|
1199 | // +-----------------------------------------------------------------------+ |
---|
1200 | check_status(ACCESS_ADMINISTRATOR); |
---|
1201 | |
---|
1202 | // +-----------------------------------------------------------------------+ |
---|
1203 | // | user list | |
---|
1204 | // +-----------------------------------------------------------------------+ |
---|
1205 | |
---|
1206 | $page['filtered_users'] = get_ghost_user_list(); |
---|
1207 | |
---|
1208 | // +-----------------------------------------------------------------------+ |
---|
1209 | // | selected users | |
---|
1210 | // +-----------------------------------------------------------------------+ |
---|
1211 | if (isset($_POST['Del_Selected'])) |
---|
1212 | { |
---|
1213 | $collection = array(); |
---|
1214 | |
---|
1215 | switch ($_POST['target']) |
---|
1216 | { |
---|
1217 | case 'all' : |
---|
1218 | { |
---|
1219 | foreach($page['filtered_users'] as $local_user) |
---|
1220 | { |
---|
1221 | array_push($collection, $local_user['id']); |
---|
1222 | } |
---|
1223 | break; |
---|
1224 | } |
---|
1225 | case 'selection' : |
---|
1226 | { |
---|
1227 | if (isset($_POST['selection'])) |
---|
1228 | { |
---|
1229 | $collection = $_POST['selection']; |
---|
1230 | } |
---|
1231 | break; |
---|
1232 | } |
---|
1233 | } |
---|
1234 | |
---|
1235 | if (count($collection) == 0) |
---|
1236 | { |
---|
1237 | array_push($page['errors'], l10n('Select at least one user')); |
---|
1238 | } |
---|
1239 | } |
---|
1240 | |
---|
1241 | // +-----------------------------------------------------------------------+ |
---|
1242 | // | delete users | |
---|
1243 | // +-----------------------------------------------------------------------+ |
---|
1244 | if (isset($_POST['Del_Selected']) and count($collection) > 0) |
---|
1245 | { |
---|
1246 | if (in_array($conf['guest_id'], $collection)) |
---|
1247 | { |
---|
1248 | array_push($page['errors'], l10n('Guest cannot be deleted')); |
---|
1249 | } |
---|
1250 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
1251 | in_array($conf['default_user_id'], $collection)) |
---|
1252 | { |
---|
1253 | array_push($page['errors'], l10n('Default user cannot be deleted')); |
---|
1254 | } |
---|
1255 | if (in_array($conf['webmaster_id'], $collection)) |
---|
1256 | { |
---|
1257 | array_push($page['errors'], l10n('Webmaster cannot be deleted')); |
---|
1258 | } |
---|
1259 | if (in_array($user['id'], $collection)) |
---|
1260 | { |
---|
1261 | array_push($page['errors'], l10n('You cannot delete your account')); |
---|
1262 | } |
---|
1263 | |
---|
1264 | if (count($page['errors']) == 0) |
---|
1265 | { |
---|
1266 | foreach ($collection as $user_id) |
---|
1267 | { |
---|
1268 | delete_user($user_id); |
---|
1269 | } |
---|
1270 | array_push( |
---|
1271 | $page['infos'], |
---|
1272 | l10n_dec( |
---|
1273 | '%d user deleted', '%d users deleted', |
---|
1274 | count($collection) |
---|
1275 | ) |
---|
1276 | ); |
---|
1277 | |
---|
1278 | foreach ($page['filtered_users'] as $filter_key => $filter_user) |
---|
1279 | { |
---|
1280 | if (in_array($filter_user['id'], $collection)) |
---|
1281 | { |
---|
1282 | unset($page['filtered_users'][$filter_key]); |
---|
1283 | } |
---|
1284 | } |
---|
1285 | } |
---|
1286 | } |
---|
1287 | |
---|
1288 | // +-----------------------------------------------------------------------+ |
---|
1289 | // | Send ghost reminder | |
---|
1290 | // +-----------------------------------------------------------------------+ |
---|
1291 | // +-----------------------------------------------------------------------+ |
---|
1292 | // | selected users | |
---|
1293 | // +-----------------------------------------------------------------------+ |
---|
1294 | if (isset($_POST['Reminder_Email'])) |
---|
1295 | { |
---|
1296 | $collection = array(); |
---|
1297 | |
---|
1298 | switch ($_POST['target']) |
---|
1299 | { |
---|
1300 | case 'all' : |
---|
1301 | { |
---|
1302 | foreach($page['filtered_users'] as $local_user) |
---|
1303 | { |
---|
1304 | array_push($collection, $local_user['id']); |
---|
1305 | } |
---|
1306 | break; |
---|
1307 | } |
---|
1308 | case 'selection' : |
---|
1309 | { |
---|
1310 | if (isset($_POST['selection'])) |
---|
1311 | { |
---|
1312 | $collection = $_POST['selection']; |
---|
1313 | } |
---|
1314 | break; |
---|
1315 | } |
---|
1316 | } |
---|
1317 | |
---|
1318 | if (count($collection) == 0) |
---|
1319 | { |
---|
1320 | array_push($page['errors'], l10n('Select at least one user')); |
---|
1321 | } |
---|
1322 | } |
---|
1323 | // +-----------------------------------------------------------------------+ |
---|
1324 | // | Send ghost reminder | |
---|
1325 | // +-----------------------------------------------------------------------+ |
---|
1326 | if (isset($_POST['Reminder_Email']) and count($collection) > 0) |
---|
1327 | { |
---|
1328 | if (in_array($conf['guest_id'], $collection)) |
---|
1329 | { |
---|
1330 | array_push($page['errors'], l10n('UAM_No_reminder_for_Guest')); |
---|
1331 | } |
---|
1332 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
1333 | in_array($conf['default_user_id'], $collection)) |
---|
1334 | { |
---|
1335 | array_push($page['errors'], l10n('UAM_No_reminder_for_default_user')); |
---|
1336 | } |
---|
1337 | if (in_array($conf['webmaster_id'], $collection)) |
---|
1338 | { |
---|
1339 | array_push($page['errors'], l10n('UAM_No_reminder_for_Webmaster')); |
---|
1340 | } |
---|
1341 | if (in_array($user['id'], $collection)) |
---|
1342 | { |
---|
1343 | array_push($page['errors'], l10n('UAM_No_reminder_for_your_account')); |
---|
1344 | } |
---|
1345 | |
---|
1346 | if (count($page['errors']) == 0) |
---|
1347 | { |
---|
1348 | foreach ($collection as $user_id) |
---|
1349 | { |
---|
1350 | $query = " |
---|
1351 | SELECT id, username, mail_address |
---|
1352 | FROM ".USERS_TABLE." |
---|
1353 | WHERE id = '".$user_id."' |
---|
1354 | ;"; |
---|
1355 | |
---|
1356 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
1357 | |
---|
1358 | ghostreminder($user_id,stripslashes($data['username']),$data['mail_address']); |
---|
1359 | } |
---|
1360 | array_push( |
---|
1361 | $page['infos'], |
---|
1362 | l10n_dec( |
---|
1363 | 'UAM_%d_Reminder_Sent', 'UAM_%d_Reminders_Sent', |
---|
1364 | count($collection) |
---|
1365 | ) |
---|
1366 | ); |
---|
1367 | |
---|
1368 | $page['filtered_users'] = get_ghost_user_list(); |
---|
1369 | } |
---|
1370 | } |
---|
1371 | |
---|
1372 | if (isset($_POST['GhostTracker_Init']) and is_admin()) //Reset is only allowed for admins ! |
---|
1373 | { |
---|
1374 | $query1 = ' |
---|
1375 | SELECT * |
---|
1376 | FROM '.USER_LASTVISIT_TABLE.';'; |
---|
1377 | |
---|
1378 | $count = pwg_db_num_rows(pwg_query($query1)); |
---|
1379 | |
---|
1380 | if ($count <> 0) |
---|
1381 | { |
---|
1382 | $query = ' |
---|
1383 | SELECT DISTINCT u.id, |
---|
1384 | ui.status AS status |
---|
1385 | FROM '.USERS_TABLE.' AS u |
---|
1386 | INNER JOIN '.USER_INFOS_TABLE.' AS ui |
---|
1387 | ON u.id = ui.user_id |
---|
1388 | WHERE u.id NOT IN (SELECT user_id FROM '.USER_LASTVISIT_TABLE.') |
---|
1389 | AND status != "webmaster" |
---|
1390 | AND status != "guest" |
---|
1391 | AND status != "admin" |
---|
1392 | ORDER BY u.id ASC |
---|
1393 | ;'; |
---|
1394 | |
---|
1395 | $result = pwg_query($query); |
---|
1396 | |
---|
1397 | while ($row = pwg_db_fetch_assoc($result)) |
---|
1398 | { |
---|
1399 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
1400 | |
---|
1401 | $query = " |
---|
1402 | INSERT INTO ".USER_LASTVISIT_TABLE." (user_id, lastvisit, reminder) |
---|
1403 | VALUES ('".$row['id']."','".$dbnow."','false') |
---|
1404 | ;"; |
---|
1405 | pwg_query($query); |
---|
1406 | } |
---|
1407 | } |
---|
1408 | else if ($count == 0) |
---|
1409 | { |
---|
1410 | $query = ' |
---|
1411 | SELECT DISTINCT u.id, |
---|
1412 | ui.status AS status |
---|
1413 | FROM '.USERS_TABLE.' AS u |
---|
1414 | INNER JOIN '.USER_INFOS_TABLE.' AS ui |
---|
1415 | ON u.id = ui.user_id |
---|
1416 | WHERE status != "webmaster" |
---|
1417 | AND status != "guest" |
---|
1418 | AND status != "admin" |
---|
1419 | ORDER BY u.id ASC |
---|
1420 | ;'; |
---|
1421 | |
---|
1422 | $result = pwg_query($query); |
---|
1423 | |
---|
1424 | while($row = pwg_db_fetch_assoc($result)) |
---|
1425 | { |
---|
1426 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
1427 | |
---|
1428 | $query = " |
---|
1429 | INSERT INTO ".USER_LASTVISIT_TABLE." (user_id, lastvisit, reminder) |
---|
1430 | VALUES ('".$row['id']."','".$dbnow."','false') |
---|
1431 | ;"; |
---|
1432 | pwg_query($query); |
---|
1433 | } |
---|
1434 | } |
---|
1435 | |
---|
1436 | array_push($page['infos'], l10n('UAM_GhostTracker_Init_OK')); |
---|
1437 | } |
---|
1438 | |
---|
1439 | // +-----------------------------------------------------------------------+ |
---|
1440 | // | user list | |
---|
1441 | // +-----------------------------------------------------------------------+ |
---|
1442 | |
---|
1443 | $visible_user_list = array(); |
---|
1444 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
1445 | { |
---|
1446 | $visible_user_list[] = $local_user; |
---|
1447 | } |
---|
1448 | |
---|
1449 | foreach ($visible_user_list as $local_user) |
---|
1450 | { |
---|
1451 | $reminder = ''; |
---|
1452 | |
---|
1453 | if (isset($local_user['reminder']) and $local_user['reminder'] == 'true') |
---|
1454 | { |
---|
1455 | $reminder = l10n('UAM_Reminder_Sent_OK'); |
---|
1456 | } |
---|
1457 | else if (isset($local_user['reminder']) and $local_user['reminder'] == 'false') |
---|
1458 | { |
---|
1459 | $reminder = l10n('UAM_Reminder_Sent_NOK'); |
---|
1460 | } |
---|
1461 | |
---|
1462 | if (isset($_POST['pref_submit']) and isset($_POST['selection']) and in_array($local_user['id'], $_POST['selection'])) |
---|
1463 | { |
---|
1464 | $checked = 'checked="checked"'; |
---|
1465 | } |
---|
1466 | else |
---|
1467 | { |
---|
1468 | $checked = ''; |
---|
1469 | } |
---|
1470 | |
---|
1471 | $template->append( |
---|
1472 | 'users', |
---|
1473 | array( |
---|
1474 | 'ID' => $local_user['id'], |
---|
1475 | 'CHECKED' => $checked, |
---|
1476 | 'USERNAME' => stripslashes($local_user['username']), |
---|
1477 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
1478 | 'LASTVISIT' => $local_user['lastvisit'], |
---|
1479 | 'REMINDER' => $reminder, |
---|
1480 | ) |
---|
1481 | ); |
---|
1482 | } |
---|
1483 | |
---|
1484 | //Plugin version inserted |
---|
1485 | $template->assign( |
---|
1486 | array( |
---|
1487 | 'UAM_VERSION' => $version, |
---|
1488 | 'UAM_PATH' => UAM_PATH, |
---|
1489 | ) |
---|
1490 | ); |
---|
1491 | |
---|
1492 | // +-----------------------------------------------------------------------+ |
---|
1493 | // | errors display | |
---|
1494 | // +-----------------------------------------------------------------------+ |
---|
1495 | if ( isset ($errors) and count($errors) != 0) |
---|
1496 | { |
---|
1497 | $template->assign('errors',array()); |
---|
1498 | foreach ($errors as $error) |
---|
1499 | { |
---|
1500 | array_push($page['errors'], $error); |
---|
1501 | } |
---|
1502 | } |
---|
1503 | |
---|
1504 | // +-----------------------------------------------------------------------+ |
---|
1505 | // | templates display | |
---|
1506 | // +-----------------------------------------------------------------------+ |
---|
1507 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/ghosttracker.tpl'); |
---|
1508 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
1509 | } |
---|
1510 | else |
---|
1511 | { |
---|
1512 | array_push($page['errors'], l10n('UAM_Err_GhostTracker_Settings')); |
---|
1513 | } |
---|
1514 | |
---|
1515 | break; |
---|
1516 | } |
---|
1517 | ?> |
---|