- Timestamp:
- Oct 28, 2009, 3:36:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php
r4124 r4135 36 36 l10n('Tab_UserManager'), 37 37 $my_base_url.'&tab=usermanager'); 38 $tabsheet->add('ghosttracker', 39 l10n('Tab_GhostTracker'), 40 $my_base_url.'&tab=ghosttracker'); 38 41 $tabsheet->select($page['tab']); 39 42 $tabsheet->assign(); … … 56 59 case 'global': 57 60 58 if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) )61 if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) and isset($_POST['UserAdvManager_GhostUser_Tracker'])) 59 62 { 60 63 $_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text'])); 61 64 $_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text'])); 62 65 63 $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'] ;66 $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'].';'.$_POST['UserAdvManager_GhostUser_Tracker']; 64 67 65 68 $conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager; … … 204 207 'UserAdvManager_ADMINPASSWENF_TRUE' => $conf_nbc_UserAdvManager[16]=='true' ? 'checked="checked"' : '' , 205 208 'UserAdvManager_ADMINPASSWENF_FALSE' => $conf_nbc_UserAdvManager[16]=='false' ? 'checked="checked"' : '' , 209 'UserAdvManager_GHOSTRACKER_TRUE' => $conf_nbc_UserAdvManager[17]=='true' ? 'checked="checked"' : '' , 210 'UserAdvManager_GHOSTRACKER_FALSE' => $conf_nbc_UserAdvManager[17]=='false' ? 'checked="checked"' : '' , 206 211 'UserAdvManager_PASSWORD_TEST_SCORE' => $UserAdvManager_Password_Test_Score, 207 212 ) … … 913 918 array_push($page['infos'], l10n('Err_UserManager_Settings')); 914 919 } 920 break; 921 922 923 // ************************************************************************* 924 // +-----------------------------------------------------------------------+ 925 // | Ghost Tracker page | 926 // +-----------------------------------------------------------------------+ 927 // ************************************************************************* 928 case 'ghosttracker': 929 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 930 931 if (isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17]=='true') 932 { 933 // +-----------------------------------------------------------------------+ 934 // | initialization | 935 // +-----------------------------------------------------------------------+ 936 937 if (!defined('PHPWG_ROOT_PATH')) 938 { 939 die('Hacking attempt!'); 940 } 941 942 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 943 944 // +-----------------------------------------------------------------------+ 945 // | Check Access and exit when user status is not ok | 946 // +-----------------------------------------------------------------------+ 947 check_status(ACCESS_ADMINISTRATOR); 948 949 $page['order_by_items'] = array( 950 'id' => l10n('registration_date'), 951 'username' => l10n('Username'), 952 'level' => l10n('Privacy level'), 953 'language' => l10n('language'), 954 ); 955 956 // +-----------------------------------------------------------------------+ 957 // | user list | 958 // +-----------------------------------------------------------------------+ 959 960 $page['filtered_users'] = get_unvalid_user_list(); 961 962 // +-----------------------------------------------------------------------+ 963 // | selected users | 964 // +-----------------------------------------------------------------------+ 965 if (isset($_POST['Del_Selected'])) 966 { 967 $collection = array(); 968 969 switch ($_POST['target']) 970 { 971 case 'all' : 972 { 973 foreach($page['filtered_users'] as $local_user) 974 { 975 array_push($collection, $local_user['id']); 976 } 977 break; 978 } 979 case 'selection' : 980 { 981 if (isset($_POST['selection'])) 982 { 983 $collection = $_POST['selection']; 984 } 985 break; 986 } 987 } 988 989 if (count($collection) == 0) 990 { 991 array_push($page['errors'], l10n('Select at least one user')); 992 } 993 } 994 995 // +-----------------------------------------------------------------------+ 996 // | delete users | 997 // +-----------------------------------------------------------------------+ 998 if (isset($_POST['Del_Selected']) and count($collection) > 0) 999 { 1000 if (in_array($conf['guest_id'], $collection)) 1001 { 1002 array_push($page['errors'], l10n('Guest cannot be deleted')); 1003 } 1004 if (($conf['guest_id'] != $conf['default_user_id']) and 1005 in_array($conf['default_user_id'], $collection)) 1006 { 1007 array_push($page['errors'], l10n('Default user cannot be deleted')); 1008 } 1009 if (in_array($conf['webmaster_id'], $collection)) 1010 { 1011 array_push($page['errors'], l10n('Webmaster cannot be deleted')); 1012 } 1013 if (in_array($user['id'], $collection)) 1014 { 1015 array_push($page['errors'], l10n('You cannot delete your account')); 1016 } 1017 1018 if (count($page['errors']) == 0) 1019 { 1020 foreach ($collection as $user_id) 1021 { 1022 delete_user($user_id); 1023 } 1024 array_push( 1025 $page['infos'], 1026 l10n_dec( 1027 '%d user deleted', '%d users deleted', 1028 count($collection) 1029 ) 1030 ); 1031 1032 foreach ($page['filtered_users'] as $filter_key => $filter_user) 1033 { 1034 if (in_array($filter_user['id'], $collection)) 1035 { 1036 unset($page['filtered_users'][$filter_key]); 1037 } 1038 } 1039 } 1040 } 1041 1042 // +-----------------------------------------------------------------------+ 1043 // | Resend new validation key to users | 1044 // +-----------------------------------------------------------------------+ 1045 // +-----------------------------------------------------------------------+ 1046 // | selected users | 1047 // +-----------------------------------------------------------------------+ 1048 if (isset($_POST['Mail_With_Key'])) 1049 { 1050 $collection = array(); 1051 1052 switch ($_POST['target']) 1053 { 1054 case 'all' : 1055 { 1056 foreach($page['filtered_users'] as $local_user) 1057 { 1058 array_push($collection, $local_user['id']); 1059 } 1060 break; 1061 } 1062 case 'selection' : 1063 { 1064 if (isset($_POST['selection'])) 1065 { 1066 $collection = $_POST['selection']; 1067 } 1068 break; 1069 } 1070 } 1071 1072 if (count($collection) == 0) 1073 { 1074 array_push($page['errors'], l10n('Select at least one user')); 1075 } 1076 } 1077 // +-----------------------------------------------------------------------+ 1078 // | Resend new validation key to users | 1079 // +-----------------------------------------------------------------------+ 1080 if (isset($_POST['Mail_With_Key']) and count($collection) > 0) 1081 { 1082 if (in_array($conf['guest_id'], $collection)) 1083 { 1084 array_push($page['errors'], l10n('No_validation_for_Guest')); 1085 } 1086 if (($conf['guest_id'] != $conf['default_user_id']) and 1087 in_array($conf['default_user_id'], $collection)) 1088 { 1089 array_push($page['errors'], l10n('No_validation_for_default_user')); 1090 } 1091 if (in_array($conf['webmaster_id'], $collection)) 1092 { 1093 array_push($page['errors'], l10n('No_validation_for_Webmaster')); 1094 } 1095 if (in_array($user['id'], $collection)) 1096 { 1097 array_push($page['errors'], l10n('No_validation_for_your_account')); 1098 } 1099 1100 if (count($page['errors']) == 0) 1101 { 1102 foreach ($collection as $user_id) 1103 { 1104 $typemail = 1; 1105 $query = " 1106 SELECT id, username, mail_address 1107 FROM ".USERS_TABLE." 1108 WHERE id = '".$user_id."' 1109 ;"; 1110 $data = mysql_fetch_array(pwg_query($query)); 1111 1112 ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true); 1113 } 1114 array_push( 1115 $page['infos'], 1116 l10n_dec( 1117 '%d_Mail_With_Key', '%d_Mails_With_Key', 1118 count($collection) 1119 ) 1120 ); 1121 1122 $page['filtered_users'] = get_unvalid_user_list(); 1123 } 1124 } 1125 1126 // +-----------------------------------------------------------------------+ 1127 // | Send reminder without new key to users | 1128 // +-----------------------------------------------------------------------+ 1129 // +-----------------------------------------------------------------------+ 1130 // | selected users | 1131 // +-----------------------------------------------------------------------+ 1132 if (isset($_POST['Mail_Without_Key'])) 1133 { 1134 $collection = array(); 1135 1136 switch ($_POST['target']) 1137 { 1138 case 'all' : 1139 { 1140 foreach($page['filtered_users'] as $local_user) 1141 { 1142 array_push($collection, $local_user['id']); 1143 } 1144 break; 1145 } 1146 case 'selection' : 1147 { 1148 if (isset($_POST['selection'])) 1149 { 1150 $collection = $_POST['selection']; 1151 } 1152 break; 1153 } 1154 } 1155 1156 if (count($collection) == 0) 1157 { 1158 array_push($page['errors'], l10n('Select at least one user')); 1159 } 1160 } 1161 // +-----------------------------------------------------------------------+ 1162 // | Send reminder without new key to users | 1163 // +-----------------------------------------------------------------------+ 1164 if (isset($_POST['Mail_Without_Key']) and count($collection) > 0) 1165 { 1166 if (in_array($conf['guest_id'], $collection)) 1167 { 1168 array_push($page['errors'], l10n('No_validation_for_Guest')); 1169 } 1170 if (($conf['guest_id'] != $conf['default_user_id']) and 1171 in_array($conf['default_user_id'], $collection)) 1172 { 1173 array_push($page['errors'], l10n('No_validation_for_default_user')); 1174 } 1175 if (in_array($conf['webmaster_id'], $collection)) 1176 { 1177 array_push($page['errors'], l10n('No_validation_for_Webmaster')); 1178 } 1179 if (in_array($user['id'], $collection)) 1180 { 1181 array_push($page['errors'], l10n('No_validation_for_your_account')); 1182 } 1183 1184 if (count($page['errors']) == 0) 1185 { 1186 foreach ($collection as $user_id) 1187 { 1188 $typemail = 2; 1189 $query = " 1190 SELECT id, username, mail_address 1191 FROM ".USERS_TABLE." 1192 WHERE id = '".$user_id."' 1193 ;"; 1194 1195 $data = mysql_fetch_array(pwg_query($query)); 1196 1197 ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false); 1198 } 1199 array_push( 1200 $page['infos'], 1201 l10n_dec( 1202 '%d_Reminder_Sent', '%d_Reminders_Sent', 1203 count($collection) 1204 ) 1205 ); 1206 1207 $page['filtered_users'] = get_unvalid_user_list(); 1208 } 1209 } 1210 1211 // +-----------------------------------------------------------------------+ 1212 // | Force validation | 1213 // +-----------------------------------------------------------------------+ 1214 // +-----------------------------------------------------------------------+ 1215 // | selected users | 1216 // +-----------------------------------------------------------------------+ 1217 if (isset($_POST['Force_Validation'])) 1218 { 1219 $collection = array(); 1220 1221 switch ($_POST['target']) 1222 { 1223 case 'all' : 1224 { 1225 foreach($page['filtered_users'] as $local_user) 1226 { 1227 array_push($collection, $local_user['id']); 1228 } 1229 break; 1230 } 1231 case 'selection' : 1232 { 1233 if (isset($_POST['selection'])) 1234 { 1235 $collection = $_POST['selection']; 1236 } 1237 break; 1238 } 1239 } 1240 1241 if (count($collection) == 0) 1242 { 1243 array_push($page['errors'], l10n('Select at least one user')); 1244 } 1245 } 1246 // +-----------------------------------------------------------------------+ 1247 // | Force validation | 1248 // +-----------------------------------------------------------------------+ 1249 if (isset($_POST['Force_Validation']) and count($collection) > 0) 1250 { 1251 if (in_array($conf['guest_id'], $collection)) 1252 { 1253 array_push($page['errors'], l10n('No_validation_for_Guest')); 1254 } 1255 if (($conf['guest_id'] != $conf['default_user_id']) and 1256 in_array($conf['default_user_id'], $collection)) 1257 { 1258 array_push($page['errors'], l10n('No_validation_for_default_user')); 1259 } 1260 if (in_array($conf['webmaster_id'], $collection)) 1261 { 1262 array_push($page['errors'], l10n('No_validation_for_Webmaster')); 1263 } 1264 if (in_array($user['id'], $collection)) 1265 { 1266 array_push($page['errors'], l10n('No_validation_for_your_account')); 1267 } 1268 1269 if (count($page['errors']) == 0) 1270 { 1271 foreach ($collection as $user_id) 1272 { 1273 $query = " 1274 SELECT id, username, mail_address 1275 FROM ".USERS_TABLE." 1276 WHERE id = '".$user_id."' 1277 ;"; 1278 1279 $data = mysql_fetch_array(pwg_query($query)); 1280 1281 ForceValidation($data['id']); 1282 } 1283 array_push( 1284 $page['infos'], 1285 l10n_dec( 1286 '%d_Validated_User', '%d_Validated_Users', 1287 count($collection) 1288 ) 1289 ); 1290 1291 $page['filtered_users'] = get_unvalid_user_list(); 1292 } 1293 } 1294 1295 1296 // +-----------------------------------------------------------------------+ 1297 // | groups list | 1298 // +-----------------------------------------------------------------------+ 1299 1300 $groups[-1] = '------------'; 1301 1302 $query = ' 1303 SELECT id, name 1304 FROM '.GROUPS_TABLE.' 1305 ORDER BY name ASC 1306 ;'; 1307 1308 $result = pwg_query($query); 1309 1310 while ($row = mysql_fetch_array($result)) 1311 { 1312 $groups[$row['id']] = $row['name']; 1313 } 1314 1315 // +-----------------------------------------------------------------------+ 1316 // | Template Init | 1317 // +-----------------------------------------------------------------------+ 1318 $base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list'; 1319 1320 if (isset($_GET['start']) and is_numeric($_GET['start'])) 1321 { 1322 $start = $_GET['start']; 1323 } 1324 else 1325 { 1326 $start = 0; 1327 } 1328 1329 $template->assign( 1330 array( 1331 'F_ADD_ACTION' => $base_url, 1332 'F_USERNAME' => @htmlentities($_GET['username']), 1333 'F_FILTER_ACTION' => get_root_url().'admin.php' 1334 ) 1335 ); 1336 1337 /* Hide radio-button if not allow to assign adviser */ 1338 if ($conf['allow_adviser']) 1339 { 1340 $template->assign('adviser', true); 1341 } 1342 1343 // +-----------------------------------------------------------------------+ 1344 // | user list | 1345 // +-----------------------------------------------------------------------+ 1346 1347 $profile_url = get_root_url().'admin.php?page=profile&user_id='; 1348 $perm_url = get_root_url().'admin.php?page=user_perm&user_id='; 1349 1350 $visible_user_list = array(); 1351 foreach ($page['filtered_users'] as $num => $local_user) 1352 { 1353 /* simulate LIMIT $start, $conf['users_page'] */ 1354 if ($num < $start) 1355 { 1356 continue; 1357 } 1358 if ($num >= $start + $conf['users_page']) 1359 { 1360 break; 1361 } 1362 1363 $visible_user_list[] = $local_user; 1364 } 1365 1366 foreach ($visible_user_list as $local_user) 1367 { 1368 $groups_string = preg_replace( 1369 '/(\d+)/e', 1370 "\$groups['$1']", 1371 implode( 1372 ', ', 1373 $local_user['groups'] 1374 ) 1375 ); 1376 1377 if (isset($_POST['pref_submit']) 1378 and isset($_POST['selection']) 1379 and in_array($local_user['id'], $_POST['selection'])) 1380 { 1381 $checked = 'checked="checked"'; 1382 } 1383 else 1384 { 1385 $checked = ''; 1386 } 1387 1388 $properties = array(); 1389 if ( $local_user['level'] != 0 ) 1390 { 1391 $properties[] = l10n( sprintf('Level %d', $local_user['level']) ); 1392 } 1393 $properties[] = 1394 (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) 1395 ? l10n('is_high_enabled') : l10n('is_high_disabled'); 1396 1397 $expiration = expiration($local_user['id']); 1398 1399 $template->append( 1400 'users', 1401 array( 1402 'ID' => $local_user['id'], 1403 'CHECKED' => $checked, 1404 'U_PROFILE' => $profile_url.$local_user['id'], 1405 'U_PERM' => $perm_url.$local_user['id'], 1406 'USERNAME' => $local_user['username'] 1407 .($local_user['id'] == $conf['guest_id'] 1408 ? '<BR />['.l10n('is_the_guest').']' : '') 1409 .($local_user['id'] == $conf['default_user_id'] 1410 ? '<BR />['.l10n('is_the_default').']' : ''), 1411 'STATUS' => l10n('user_status_'. 1412 $local_user['status']).(($local_user['adviser'] == 'true') 1413 ? '<BR />['.l10n('adviser').']' : ''), 1414 'EMAIL' => get_email_address_as_display_text($local_user['email']), 1415 'GROUPS' => $groups_string, 1416 'REGISTRATION' => $local_user['registration_date'], 1417 'EXPIRATION' => $expiration, 1418 ) 1419 ); 1420 } 1421 1422 // +-----------------------------------------------------------------------+ 1423 // | errors display | 1424 // +-----------------------------------------------------------------------+ 1425 if ( isset ($errors) and count($errors) != 0) 1426 { 1427 $template->assign('errors',array()); 1428 foreach ($errors as $error) 1429 { 1430 array_push($page['errors'], $error); 1431 } 1432 } 1433 1434 // +-----------------------------------------------------------------------+ 1435 // | templates display | 1436 // +-----------------------------------------------------------------------+ 1437 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/ghosttracker.tpl'); 1438 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 1439 } 1440 else 1441 { 1442 array_push($page['infos'], l10n('Err_GhostTracker_Settings')); 1443 } 915 1444 break; 916 1445 }
Note: See TracChangeset
for help on using the changeset viewer.