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