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