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