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