- Timestamp:
- Sep 16, 2012, 4:58:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/include/functions.inc.php
r17918 r17944 19 19 array_push($menu, 20 20 array( 21 22 21 'NAME' => $name, 22 'URL' => get_root_url().'admin.php?page=plugin-'.basename(UAM_PATH) 23 23 ) 24 24 ); … … 67 67 { 68 68 69 69 $userid = get_userid($user['username']); 70 70 71 71 // Looking for existing entry in last visit table … … 524 524 { 525 525 if (count($collection) > 0) 526 {526 { 527 527 // Process if a non-admin nor webmaster user is logged 528 528 // --------------------------------------------------- 529 529 if (in_array($user['id'], $collection)) 530 530 { 531 531 // Check lastvisit reminder state 532 532 // ------------------------------ … … 561 561 redirect(UAM_PATH.'GT_del_account.php'); 562 562 } 563 }563 } 564 564 else // Process if an admin or webmaster user is logged 565 565 { … … 603 603 // Delete user from all groups 604 604 // --------------------------- 605 $query = ' 605 if ($conf_UAM[2] <> -1 and $conf_UAM[3] <> -1) 606 { 607 $query = ' 606 608 DELETE FROM '.USER_GROUP_TABLE.' 607 609 WHERE user_id = '.$user_id.' … … 612 614 ) 613 615 ;'; 614 pwg_query($query); 616 pwg_query($query); 617 } 615 618 616 619 // Change user status … … 666 669 // Reset confirmed user status to unvalidated 667 670 // ------------------------------------------ 668 $query = '671 $query = ' 669 672 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 670 673 SET date_check = NULL 671 674 WHERE user_id = '.$user_id.' 672 675 ;'; 673 pwg_query($query);676 pwg_query($query); 674 677 675 678 // Get users information for email notification 676 679 // -------------------------------------------- 677 $query = '680 $query = ' 678 681 SELECT id, username, mail_address 679 682 FROM '.USERS_TABLE.' 680 683 WHERE id = '.$user_id.' 681 684 ;'; 682 $data = pwg_db_fetch_assoc(pwg_query($query));685 $data = pwg_db_fetch_assoc(pwg_query($query)); 683 686 684 687 demotion_mail($user_id, $data['username'], $data['mail_address']); … … 732 735 { 733 736 if (count($collection) > 0) 734 {737 { 735 738 // Process if a non-admin nor webmaster user is logged 736 739 // --------------------------------------------------- 737 740 if (in_array($user['id'], $collection)) 738 {741 { 739 742 // Check ConfirmMail reminder state 740 743 // -------------------------------- … … 759 762 if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true') 760 763 { 761 $typemail = 1;764 $typemail = 1; 762 765 763 766 // Get current user informations … … 786 789 redirect(UAM_PATH.'USR_del_account.php'); 787 790 } 788 }791 } 789 792 else // Process if an admin or webmaster user is logged 790 793 { … … 913 916 914 917 $conf_UAM = unserialize($conf['UserAdvManager']); 915 916 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');917 918 $infos1_perso = "";918 919 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 920 921 $infos1_perso = ""; 919 922 $infos2_perso = ""; 920 923 $subject = ""; … … 1155 1158 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 1156 1159 1157 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');1160 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 1158 1161 1159 1162 // We have to get the user's language in database … … 1194 1197 if (isset($conf_UAM_ConfirmMail[2]) and $conf_UAM_ConfirmMail[2] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm) 1195 1198 { 1196 1199 // Management of Extension flags ([username], [mygallery], [myurl], [Kdays]) 1197 1200 // ------------------------------------------------------------------------- 1198 1201 $patterns[] = '#\[username\]#i'; … … 1220 1223 get_l10n_args('', ''), 1221 1224 ); 1222 }1225 } 1223 1226 1224 1227 // Set reminder true … … 1231 1234 pwg_query($query); 1232 1235 1233 break;1236 break; 1234 1237 1235 1238 case 2: //Generating email content for remind without a new key … … 1291 1294 )); 1292 1295 1293 // Switching back to default language1294 // ----------------------------------1295 switch_lang_back();1296 // Switching back to default language 1297 // ---------------------------------- 1298 switch_lang_back(); 1296 1299 } 1297 1300 … … 1310 1313 $subject = ""; 1311 1314 1312 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');1315 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 1313 1316 1314 1317 // We have to get the user's language in database … … 1374 1377 )); 1375 1378 1376 // Switching back to default language1377 // ----------------------------------1378 switch_lang_back();1379 // Switching back to default language 1380 // ---------------------------------- 1381 switch_lang_back(); 1379 1382 } 1380 1383 … … 1392 1395 $conf_UAM = unserialize($conf['UserAdvManager']); 1393 1396 1394 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');1395 1396 $custom_txt = "";1397 1397 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 1398 1399 $custom_txt = ""; 1400 $subject = ""; 1398 1401 1399 1402 // We have to get the user's language in database 1400 1403 // ---------------------------------------------- 1401 $query = '1404 $query = ' 1402 1405 SELECT user_id, language 1403 1406 FROM '.USER_INFOS_TABLE.' … … 1479 1482 )); 1480 1483 1481 // Switching back to default language1482 // ----------------------------------1483 switch_lang_back();1484 // Switching back to default language 1485 // ---------------------------------- 1486 switch_lang_back(); 1484 1487 } 1485 1488 … … 1497 1500 $conf_UAM = unserialize($conf['UserAdvManager']); 1498 1501 1499 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');1500 1501 $custom_txt = "";1502 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 1503 1504 $custom_txt = ""; 1502 1505 $subject = ""; 1503 1506 … … 1585 1588 )); 1586 1589 1587 // Switching back to default language1588 // ----------------------------------1589 switch_lang_back();1590 // Switching back to default language 1591 // ---------------------------------- 1592 switch_lang_back(); 1590 1593 } 1591 1594 … … 1793 1796 pwg_query($query); 1794 1797 1795 $query = '1798 $query = ' 1796 1799 UPDATE '.USER_INFOS_TABLE.' 1797 1800 SET registration_date = "'.$dbnow.'" 1798 1801 WHERE user_id = '.$user_id.' 1799 1802 ;'; 1800 pwg_query($query);1803 pwg_query($query); 1801 1804 1802 1805 return get_absolute_root_url().UAM_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID.'&userid='.$user_id; … … 1932 1935 if (!empty($registration_date)) 1933 1936 { 1934 // Verify Confirmmail with time limit ON1935 1936 if (isset ($conf_UAM_ConfirmMail[1]))1937 {1938 // Dates formating and compare1939 1940 $today = date("d-m-Y"); // Get today's date1941 list($day, $month, $year) = explode('-', $today); // explode date of today1942 $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp1943 1944 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date1945 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date1946 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp1947 1948 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps1949 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days1950 1951 // Condition with the value set for time limit1952 1953 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set1954 {1955 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));1956 1957 1958 1959 $query = '1937 // Verify Confirmmail with time limit ON 1938 // ------------------------------------- 1939 if (isset ($conf_UAM_ConfirmMail[1])) 1940 { 1941 // Dates formating and compare 1942 // --------------------------- 1943 $today = date("d-m-Y"); // Get today's date 1944 list($day, $month, $year) = explode('-', $today); // explode date of today 1945 $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp 1946 1947 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date 1948 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date 1949 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp 1950 1951 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps 1952 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days 1953 1954 // Condition with the value set for time limit 1955 // ------------------------------------------- 1956 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set 1957 { 1958 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1959 1960 // Update ConfirmMail table 1961 // ------------------------ 1962 $query = ' 1960 1963 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 1961 1964 SET date_check="'.$dbnow.'", reminder="false" 1962 1965 WHERE id = "'.$id.'" 1963 1966 ;'; 1964 pwg_query($query);1965 1966 1967 1968 1969 $query = '1967 pwg_query($query); 1968 1969 // Update LastVisit table - Force reminder field to false 1970 // Usefull when a user has been automatically downgraded and revalidate its registration 1971 // ------------------------------------------------------------------------------------- 1972 $query = ' 1970 1973 UPDATE '.USER_LASTVISIT_TABLE.' 1971 1974 SET reminder="false" 1972 1975 WHERE user_id = "'.$data['user_id'].'" 1973 1976 ;'; 1974 pwg_query($query);1977 pwg_query($query); 1975 1978 1976 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group1977 {1978 $query = '1979 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group 1980 { 1981 $query = ' 1979 1982 DELETE FROM '.USER_GROUP_TABLE.' 1980 1983 WHERE user_id = '.$data['user_id'].' 1981 1984 AND group_id = "'.$conf_UAM[2].'" 1982 1985 ;'; 1983 pwg_query($query);1984 }1985 1986 if ($conf_UAM[3] <> -1) // Add user to validated users group1987 {1988 $query = '1986 pwg_query($query); 1987 } 1988 1989 if ($conf_UAM[3] <> -1) // Add user to validated users group 1990 { 1991 $query = ' 1989 1992 INSERT INTO '.USER_GROUP_TABLE.' 1990 1993 (user_id, group_id) … … 1992 1995 ('.$data['user_id'].', "'.$conf_UAM[3].'") 1993 1996 ;'; 1994 pwg_query($query);1995 }1996 1997 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status1998 {1999 $query = '1997 pwg_query($query); 1998 } 1999 2000 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status 2001 { 2002 $query = ' 2000 2003 UPDATE '.USER_INFOS_TABLE.' 2001 2004 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'" 2002 2005 WHERE user_id = '.$data['user_id'].' 2003 2006 ;'; 2004 pwg_query($query);2005 }2006 2007 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level2008 {2009 $query = '2007 pwg_query($query); 2008 } 2009 2010 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level 2011 { 2012 $query = ' 2010 2013 UPDATE '.USER_INFOS_TABLE.' 2011 2014 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'" 2012 2015 WHERE user_id = '.$data['user_id'].' 2013 2016 ;'; 2014 pwg_query($query);2015 }2016 2017 // Refresh user's category cache2018 2019 invalidate_user_cache();2020 2021 return true;2022 }2023 elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds2024 {2025 return false;2026 }2027 }2028 // Verify Confirmmail with time limit OFF2029 2030 else2031 {2032 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));2033 2034 2035 2036 $query = '2017 pwg_query($query); 2018 } 2019 2020 // Refresh user's category cache 2021 // ----------------------------- 2022 invalidate_user_cache(); 2023 2024 return true; 2025 } 2026 elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds 2027 { 2028 return false; 2029 } 2030 } 2031 // Verify Confirmmail with time limit OFF 2032 // -------------------------------------- 2033 else 2034 { 2035 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 2036 2037 // Update ConfirmMail table 2038 // ------------------------ 2039 $query = ' 2037 2040 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 2038 2041 SET date_check="'.$dbnow.'" 2039 2042 WHERE id = "'.$id.'" 2040 2043 ;'; 2041 pwg_query($query);2042 2043 2044 2045 2046 $query = '2044 pwg_query($query); 2045 2046 // Update LastVisit table - Force reminder field to false 2047 // Usefull when a user has been automatically downgraded and revalidate its registration 2048 // ------------------------------------------------------------------------------------- 2049 $query = ' 2047 2050 UPDATE '.USER_LASTVISIT_TABLE.' 2048 2051 SET reminder="false" 2049 2052 WHERE user_id = "'.$data['user_id'].'" 2050 2053 ;'; 2051 2052 2053 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group2054 {2055 $query = '2054 pwg_query($query); 2055 2056 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group 2057 { 2058 $query = ' 2056 2059 DELETE FROM '.USER_GROUP_TABLE.' 2057 2060 WHERE user_id = '.$data['user_id'].' 2058 2061 AND group_id = "'.$conf_UAM[2].'" 2059 2062 ;'; 2060 pwg_query($query);2061 }2062 2063 if ($conf_UAM[3] <> -1)2064 {2065 $query = '2063 pwg_query($query); 2064 } 2065 2066 if ($conf_UAM[3] <> -1) 2067 { 2068 $query = ' 2066 2069 DELETE FROM '.USER_GROUP_TABLE.' 2067 2070 WHERE user_id = '.$data['user_id'].' 2068 2071 AND group_id = "'.$conf_UAM[3].'" 2069 2072 ;'; 2070 pwg_query($query);2071 2072 $query = '2073 pwg_query($query); 2074 2075 $query = ' 2073 2076 INSERT INTO '.USER_GROUP_TABLE.' 2074 2077 (user_id, group_id) … … 2076 2079 ('.$data['user_id'].', "'.$conf_UAM[3].'") 2077 2080 ;'; 2078 pwg_query($query);2079 }2080 2081 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status2082 {2083 $query = '2081 pwg_query($query); 2082 } 2083 2084 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status 2085 { 2086 $query = ' 2084 2087 UPDATE '.USER_INFOS_TABLE.' 2085 2088 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'" 2086 2089 WHERE user_id = '.$data['user_id'].' 2087 2090 ;'; 2088 pwg_query($query);2089 }2090 2091 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level2092 {2093 $query = '2091 pwg_query($query); 2092 } 2093 2094 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level 2095 { 2096 $query = ' 2094 2097 UPDATE '.USER_INFOS_TABLE.' 2095 2098 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'" 2096 2099 WHERE user_id = '.$data['user_id'].' 2097 2100 ;'; 2098 pwg_query($query); 2099 } 2100 2101 // Refresh user's category cache 2102 // ----------------------------- 2103 invalidate_user_cache(); 2104 2105 return true; 2101 pwg_query($query); 2102 } 2103 2104 // Refresh user's category cache 2105 // ----------------------------- 2106 invalidate_user_cache(); 2107 2108 return true; 2109 } 2110 } 2106 2111 } 2107 } 2112 else if (!empty($data) and !is_null($data['date_check'])) 2113 { 2114 return false; 2115 } 2108 2116 } 2109 else if (!empty($data) and !is_null($data['date_check']))2110 {2111 return false;2112 }2113 }2114 2117 else 2115 2118 return false; … … 2247 2250 $conf_UAM = unserialize($conf['UserAdvManager']); 2248 2251 2249 if (isset($email) and isset($conf_UAM[11]) and $conf_UAM[11] <> '') 2250 { 2251 $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]); 2252 for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++) 2252 if (isset($email) and isset($conf_UAM[11]) and $conf_UAM[11] <> '') 2253 2253 { 2254 $pattern = '/'.$conf_MailExclusion[$i].'/i'; 2255 if (preg_match($pattern, $email)) 2256 { 2257 return true; 2258 } 2254 $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]); 2255 for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++) 2256 { 2257 $pattern = '/'.$conf_MailExclusion[$i].'/i'; 2258 if (preg_match($pattern, $email)) 2259 { 2260 return true; 2261 } 2262 } 2259 2263 } 2260 }2261 2264 else 2262 2265 { … … 2274 2277 function get_unvalid_user_list() 2275 2278 { 2276 global $conf, $page;2279 global $conf, $page; 2277 2280 2278 // Get ConfirmMail configuration2281 // Get ConfirmMail configuration 2279 2282 // ----------------------------- 2280 2283 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); … … 2285 2288 $users = array(); 2286 2289 2287 // Search users depending expiration date2290 // Search users depending expiration date 2288 2291 // -------------------------------------- 2289 2292 $query = ' … … 2304 2307 OR TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) < "'.$conf_UAM_ConfirmMail[1].'")'; 2305 2308 2306 if ($conf_UAM[2] <> '-1' and $conf_UAM[7] == '-1')2309 if ($conf_UAM[2] <> '-1' and $conf_UAM[7] == '-1') 2307 2310 { 2308 2311 $query.= ' … … 2319 2322 AND ug.group_id = '.$conf_UAM[2]; 2320 2323 } 2324 2321 2325 $query.= ' 2322 2326 ORDER BY ui.registration_date ASC 2323 2327 ;'; 2324 2328 2325 $result = pwg_query($query);2329 $result = pwg_query($query); 2326 2330 2327 2331 while ($row = pwg_db_fetch_assoc($result)) 2328 2332 { 2329 $user = $row;2333 $user = $row; 2330 2334 $user['groups'] = array(); 2331 2335 2332 2336 array_push($users, $user); 2333 }2334 2335 // Add groups list2337 } 2338 2339 // Add groups list 2336 2340 // --------------- 2337 2341 $user_ids = array(); 2338 2342 foreach ($users as $i => $user) 2339 2343 { 2340 $user_ids[$i] = $user['id'];2341 }2342 2343 $user_nums = array_flip($user_ids);2344 $user_ids[$i] = $user['id']; 2345 } 2346 2347 $user_nums = array_flip($user_ids); 2344 2348 2345 2349 if (count($user_ids) > 0) 2346 2350 { 2347 $query = '2351 $query = ' 2348 2352 SELECT user_id, group_id 2349 2353 FROM '.USER_GROUP_TABLE.' … … 2351 2355 ;'; 2352 2356 2353 $result = pwg_query($query);2357 $result = pwg_query($query); 2354 2358 2355 2359 while ($row = pwg_db_fetch_assoc($result)) 2356 2360 { 2357 array_push(2358 $users[$user_nums[$row['user_id']]]['groups'],2361 array_push( 2362 $users[$user_nums[$row['user_id']]]['groups'], 2359 2363 $row['group_id'] 2360 ); 2364 ); 2365 } 2361 2366 } 2362 } 2363 2364 return $users; 2367 2368 return $users; 2365 2369 } 2366 2370 … … 2375 2379 function get_unvalid_user_autotasks() 2376 2380 { 2377 global $conf, $page;2381 global $conf, $page; 2378 2382 2379 // Get ConfirmMail configuration2383 // Get ConfirmMail configuration 2380 2384 // ----------------------------- 2381 2385 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); … … 2383 2387 $users = array(); 2384 2388 2385 // search users depending expiration date2389 // search users depending expiration date 2386 2390 // -------------------------------------- 2387 2391 $query = ' … … 2395 2399 ORDER BY ui.registration_date ASC;'; 2396 2400 2397 $result = pwg_query($query);2398 2401 $result = pwg_query($query); 2402 2399 2403 while ($row = pwg_db_fetch_assoc($result)) 2400 2404 { 2401 2405 array_push($users, $row); 2402 }2403 2404 return $users;2406 } 2407 2408 return $users; 2405 2409 } 2406 2410 … … 2414 2418 function get_ghost_user_list() 2415 2419 { 2416 global $conf, $page;2420 global $conf, $page; 2417 2421 2418 2422 $conf_UAM = unserialize($conf['UserAdvManager']); 2419 2423 2420 2424 $users = array(); 2421 2425 2422 // Search users depending expiration date2426 // Search users depending expiration date 2423 2427 // -------------------------------------- 2424 2428 $query = ' … … 2434 2438 ORDER BY lv.lastvisit ASC;'; 2435 2439 2436 $result = pwg_query($query);2440 $result = pwg_query($query); 2437 2441 2438 2442 while ($row = pwg_db_fetch_assoc($result)) 2439 2443 { 2440 $user = $row;2444 $user = $row; 2441 2445 $user['groups'] = array(); 2442 2446 2443 2447 array_push($users, $user); 2444 }2445 2446 // Add groups list2448 } 2449 2450 // Add groups list 2447 2451 // --------------- 2448 2452 $user_ids = array(); … … 2450 2454 { 2451 2455 $user_ids[$i] = $user['id']; 2452 }2453 2454 return $users;2456 } 2457 2458 return $users; 2455 2459 } 2456 2460 … … 2464 2468 function get_ghosts_autotasks() 2465 2469 { 2466 global $conf, $page;2470 global $conf, $page; 2467 2471 2468 2472 $conf_UAM = unserialize($conf['UserAdvManager']); … … 2470 2474 $users = array(); 2471 2475 2472 // Search users depending expiration date and reminder sent2476 // Search users depending expiration date and reminder sent 2473 2477 // -------------------------------------------------------- 2474 2478 $query = ' … … 2481 2485 ORDER BY lv.lastvisit ASC;'; 2482 2486 2483 $result = pwg_query($query);2487 $result = pwg_query($query); 2484 2488 2485 2489 while ($row = pwg_db_fetch_assoc($result)) 2486 2490 { 2487 2491 array_push($users, $row); 2488 }2489 2490 return $users;2492 } 2493 2494 return $users; 2491 2495 } 2492 2496 … … 2500 2504 function get_user_list() 2501 2505 { 2502 global $conf, $page;2506 global $conf, $page; 2503 2507 2504 2508 $users = array(); 2505 2509 2506 // Search users depending expiration date with exclusion of Adult_Content generic users2510 // Search users depending expiration date with exclusion of Adult_Content generic users 2507 2511 // ------------------------------------------------------------------------------------ 2508 2512 $query = ' … … 2520 2524 ;'; 2521 2525 2522 $result = pwg_query($query);2526 $result = pwg_query($query); 2523 2527 2524 2528 while ($row = pwg_db_fetch_assoc($result)) 2525 2529 { 2526 $user = $row;2530 $user = $row; 2527 2531 $user['groups'] = array(); 2528 2532 2529 2533 array_push($users, $user); 2530 }2531 2532 // Add groups list2534 } 2535 2536 // Add groups list 2533 2537 // --------------- 2534 2538 $user_ids = array(); 2535 2539 foreach ($users as $i => $user) 2536 2540 { 2537 2538 }2539 2540 return $users;2541 $user_ids[$i] = $user['id']; 2542 } 2543 2544 return $users; 2541 2545 } 2542 2546 … … 2554 2558 global $conf, $page; 2555 2559 2556 // Get ConfirmMail configuration2560 // Get ConfirmMail configuration 2557 2561 // ----------------------------- 2558 2562 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 2559 2563 2560 // Get UAM configuration2564 // Get UAM configuration 2561 2565 // --------------------- 2562 2566 $conf_UAM = unserialize($conf['UserAdvManager']); 2563 2567 2564 $query = '2568 $query = ' 2565 2569 SELECT registration_date 2566 2570 FROM '.USER_INFOS_TABLE.' 2567 2571 WHERE user_id = '.$id.' 2568 2572 ;'; 2569 list($registration_date) = pwg_db_fetch_row(pwg_query($query));2573 list($registration_date) = pwg_db_fetch_row(pwg_query($query)); 2570 2574 2571 2575 // Time limit process 2572 2576 // ******************************************** 2573 if (!empty($registration_date))2574 { 2575 // Dates formating and compare2576 2577 $today = date("d-m-Y"); // Get today's date2578 list($day, $month, $year) = explode('-', $today); // explode date of today2579 $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp2577 if (!empty($registration_date)) 2578 { 2579 // Dates formating and compare 2580 // --------------------------- 2581 $today = date("d-m-Y"); // Get today's date 2582 list($day, $month, $year) = explode('-', $today); // explode date of today 2583 $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp 2580 2584 2581 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date2582 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date2583 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp2585 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date 2586 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date 2587 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp 2584 2588 2585 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps2586 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days2587 2588 // Condition with the value set for time limit2589 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps 2590 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days 2591 2592 // Condition with the value set for time limit 2589 2593 // ------------------------------------------- 2590 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set 2591 { 2592 return false; 2594 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set 2595 { 2596 return false; 2597 } 2598 else 2599 { 2600 return true; 2601 } 2593 2602 } 2594 else2595 {2596 return true;2597 }2598 }2599 2603 } 2600 2604 … … 2609 2613 * Thanx to MathieuGut from http://m-gut.developpez.com 2610 2614 */ 2611 function testpassword($password) // Le mot de passe passé en paramètre -$password given by user2612 { 2613 2614 // Initialisation des variables -Variables initiation2615 // -------------------- -------------------------------2615 function testpassword($password) // $password given by user 2616 { 2617 2618 // Variables initiation 2619 // -------------------- 2616 2620 $points = 0; 2617 2621 $point_lowercase = 0; … … 2620 2624 $point_characters = 0; 2621 2625 2622 // On récupère la longueur du mot de passe -Getting password lengh2623 // ---------------------- ------------------------------------------2626 // Getting password lengh 2627 // ---------------------- 2624 2628 $length = strlen($password); 2625 2626 // On fait une boucle pour lire chaque lettre -Loop to read password characters2629 2630 // Loop to read password characters 2627 2631 for($i = 0; $i < $length; $i++) 2628 2632 { 2629 // On sélectionne une à une chaque lettre -Select each letters2630 // $i étant à 0 lors du premier passage de la boucle - $iis 0 at first turn2631 // --------------------- ----------------------------------------------------2633 // Select each letters 2634 // $i is 0 at first turn 2635 // --------------------- 2632 2636 $letters = $password[$i]; 2633 2637 2634 2638 if ($letters>='a' && $letters<='z') 2635 2639 { 2636 // On ajoute 1 point pour une minuscule -Adding 1 point to score for a lowercase2637 // --------------------------------------- ---------------------------------------2638 $points = $points + 1;2639 2640 // On rajoute le bonus pour une minuscule -Adding bonus points for lowercase2641 // --------------------------------- -----------------------------------------2640 // Adding 1 point to score for a lowercase 2641 // --------------------------------------- 2642 $points = $points + 1; 2643 2644 // Adding bonus points for lowercase 2645 // --------------------------------- 2642 2646 $point_lowercase = 1; 2643 2647 } 2644 2648 else if ($letters>='A' && $letters <='Z') 2645 2649 { 2646 // On ajoute 2 points pour une majuscule -Adding 2 points to score for uppercase2647 // -------------------------------------- ----------------------------------------2650 // Adding 2 points to score for uppercase 2651 // -------------------------------------- 2648 2652 $points = $points + 2; 2649 2653 2650 // On rajoute le bonus pour une majuscule -Adding bonus points for uppercase2651 // --------------------------------- -----------------------------------------2654 // Adding bonus points for uppercase 2655 // --------------------------------- 2652 2656 $point_uppercase = 2; 2653 2657 } 2654 2658 else if ($letters>='0' && $letters<='9') 2655 2659 { 2656 // On ajoute 3 points pour un chiffre -Adding 3 points to score for numbers2657 // ------------------------------------ -------------------------------------2660 // Adding 3 points to score for numbers 2661 // ------------------------------------ 2658 2662 $points = $points + 3; 2659 2663 2660 // On rajoute le bonus pour un chiffre -Adding bonus points for numbers2661 // ------------------------------- --------------------------------------2664 // Adding bonus points for numbers 2665 // ------------------------------- 2662 2666 $point_numbers = 3; 2663 2667 } 2664 2668 else 2665 2669 { 2666 // On ajoute 5 points pour un caractère autre -Adding 5 points to score for special characters2667 // ----------------------------------------------- ---------------------------------------------2670 // Adding 5 points to score for special characters 2671 // ----------------------------------------------- 2668 2672 $points = $points + 5; 2669 2673 2670 // On rajoute le bonus pour un caractère autre -Adding bonus points for special characters2671 // ------------------------------------------ ----------------------------------------------2674 // Adding bonus points for special characters 2675 // ------------------------------------------ 2672 2676 $point_characters = 5; 2673 2677 } 2674 2678 } 2675 2679 2676 // Calcul du coefficient points/longueur - calculating the coefficient points/length2677 // ----------------------------------------- ----------------------------------------2680 // Calculating the coefficient points/length 2681 // ----------------------------------------- 2678 2682 $step1 = $points / $length; 2679 2683 2680 // Calcul du coefficient de la diversité des types de caractères... - Calculation of the diversity of character types...2681 // -------------------------------------------------- -------------------------------------------------------------------2684 // Calculation of the diversity of character types... 2685 // -------------------------------------------------- 2682 2686 $step2 = $point_lowercase + $point_uppercase + $point_numbers + $point_characters; 2683 2687 2684 // Multipl ication du coefficient de diversité avec celui de la longueur - Multiplying the coefficient of diversity with that of the length2685 // ---------------------------------------------------------------- ----------------------------------------------------------------------------2688 // Multiplying the coefficient of diversity with that of the length 2689 // ---------------------------------------------------------------- 2686 2690 $score = $step1 * $step2; 2687 2691 2688 // Multipl ication du resultat par la longueur de la chaine - Multiplying the result by the length of the string2689 // -------------------------------------------------- ----------------------------------------------------------2692 // Multiplying the result by the length of the string 2693 // -------------------------------------------------- 2690 2694 $finalscore = $score * $length; 2691 2695 … … 2898 2902 $ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE); 2899 2903 $j=0; 2900 2904 2901 2905 while($j < count($ListTables)) 2902 2906 {
Note: See TracChangeset
for help on using the changeset viewer.