Changeset 12271 for extensions/UserAdvManager/trunk/include
- Timestamp:
- Sep 30, 2011, 1:50:32 PM (13 years ago)
- Location:
- extensions/UserAdvManager/trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/include/functions.inc.php
r12239 r12271 40 40 41 41 // Admins, Guests and Adult_Content users are not tracked for Ghost Tracker or Users Tracker 42 // ----------------------------------------------------------------------------------------- 42 43 if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18") 43 44 { … … 48 49 49 50 // Looking for existing entry in last visit table 51 // ---------------------------------------------- 50 52 $query = ' 51 53 SELECT * … … 59 61 { 60 62 // If not, data are inserted in table 63 // ---------------------------------- 61 64 $query = ' 62 65 INSERT INTO '.USER_LASTVISIT_TABLE.' (user_id, lastvisit, reminder) … … 68 71 { 69 72 // If yes, data are updated in table 73 // --------------------------------- 70 74 $query = ' 71 75 UPDATE '.USER_LASTVISIT_TABLE.' … … 93 97 94 98 // Exclusion of Adult_Content users 99 // -------------------------------- 95 100 if ($register_user['username'] != "16" and $register_user['username'] != "18") 96 101 { … … 98 103 { 99 104 // This is to send an information email and set user to "waiting" group or status until admin validation 105 // ----------------------------------------------------------------------------------------------------- 100 106 $passwd = (isset($_POST['password'])) ? $_POST['password'] : ''; 101 107 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); … … 105 111 { 106 112 // This is to set user to "waiting" group or status until admin validation 113 // ----------------------------------------------------------------------- 107 114 SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation 108 115 } … … 110 117 { 111 118 // This is to send an information email without validation key 119 // ----------------------------------------------------------- 112 120 $passwd = (isset($_POST['password'])) ? $_POST['password'] : ''; 113 121 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); 114 122 } 115 123 // Sending registration confirmation by email 124 // ------------------------------------------ 116 125 elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true' or $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')) 117 126 { … … 144 153 { 145 154 // Cleanup for ConfirmMail table 155 // ----------------------------- 146 156 DeleteConfirmMail($user_id); 147 157 // Cleanup for LastVisit table 158 // --------------------------- 148 159 DeleteLastVisit($user_id); 149 160 // Cleanup Redirection settings 161 // ---------------------------- 150 162 DeleteRedir($user_id); 151 163 } … … 162 174 163 175 // Exclusion of Adult_Content users 176 // -------------------------------- 164 177 if ($user['username'] != "16" and $user['username'] != "18") 165 178 { … … 171 184 172 185 // Password enforcement control 186 // ---------------------------- 173 187 if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($conf_UAM[13])) 174 188 { … … 198 212 199 213 // Username without forbidden keys 214 // ------------------------------- 200 215 if (isset($conf_UAM[5]) and $conf_UAM[5] == 'true' and !empty($user['username']) and ValidateUsername($user['username']) and !is_admin()) 201 216 { … … 205 220 206 221 // Email without forbidden domains 222 // ------------------------------- 207 223 if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($user['email']) and ValidateEmailProvider($user['email']) and !is_admin()) 208 224 { … … 225 241 226 242 // Update first redirection parameter 243 // ---------------------------------- 227 244 if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true')) 228 245 { … … 242 259 243 260 // Special message display for password reset 261 // ------------------------------------------ 244 262 if ((isset($conf_UAM[38]) and $conf_UAM[38] == 'true')) 245 263 { … … 251 269 252 270 // Controls on profile page submission 271 // ----------------------------------- 253 272 if (isset($_POST['validate']) and !is_admin()) 254 273 { 255 274 // Email without forbidden domains 275 // ------------------------------- 256 276 if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($_POST['mail_address'])) 257 277 { … … 264 284 265 285 // Password reset control 286 // ---------------------- 266 287 if (isset($conf_UAM[38]) and $conf_UAM[38] == 'true' and UAM_check_pwgreset($user['id'])) 267 288 { 268 289 // if password not changed then pwdreset filed = true else pwdreset field = false 290 // ------------------------------------------------------------------------------ 269 291 if (!empty($_POST['use_new_pwd'])) 270 292 { … … 286 308 287 309 // Password enforcement control 310 // ---------------------------- 288 311 if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($conf_UAM[13])) 289 312 { … … 301 324 302 325 // Sending registration confirmation by email 326 // ------------------------------------------ 303 327 if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')) 304 328 { … … 316 340 317 341 // This is to send a new validation key 342 // ------------------------------------ 318 343 if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')) 319 344 … … 321 346 322 347 // This is to set the user to "waiting" group or status until admin validation 348 // --------------------------------------------------------------------------- 323 349 if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')) 324 350 … … 357 383 358 384 // Performing GhostTracker scheduled tasks 385 // --------------------------------------- 359 386 if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true')) 360 387 { … … 363 390 364 391 // Performing User validation scheduled tasks 392 // ------------------------------------------ 365 393 if ((isset($conf_UAM[30]) and $conf_UAM[30] == 'true')) 366 394 { … … 369 397 370 398 // Performing redirection to profile page on first login 399 // ----------------------------------------------------- 371 400 if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true')) 372 401 { … … 387 416 388 417 // Performing redirection to profile page for password reset 418 // --------------------------------------------------------- 389 419 if ((isset($conf_UAM[38]) and $conf_UAM[38] == 'true')) 390 420 { … … 453 483 } 454 484 455 // Ghost accounts auto group, status or privacy level downgrade with or without information email sending and autodeletion if user already reminded 485 // GhostTracker auto group, status or privacy level downgrade with or without information email sending and autodeletion if user already reminded 486 // ---------------------------------------------------------------------------------------------------------------------------------------------- 456 487 if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true') and ((isset($conf_UAM[25]) and $conf_UAM[25] <> -1) or (isset($conf_UAM[26]) and $conf_UAM[26] <> -1) or (isset($conf_UAM[37]) and $conf_UAM[37] <> -1))) 457 488 { … … 459 490 { 460 491 // Process if a non-admin nor webmaster user is logged 492 // --------------------------------------------------- 461 493 if (in_array($user['id'], $collection)) 462 494 { 463 495 // Check lastvisit reminder state 496 // ------------------------------ 464 497 $query = ' 465 498 SELECT reminder … … 479 512 480 513 // If user already reminded for ghost account 514 // ------------------------------------------ 481 515 if ($reminder) 482 516 { 483 // delete account 517 // Delete account 518 // -------------- 484 519 delete_user($user['id']); 485 520 486 521 // Logged-in user cleanup, session destruction and redirected to custom page 522 // ------------------------------------------------------------------------- 487 523 invalidate_user_cache(); 488 524 logout_user(); … … 495 531 { 496 532 // Check lastvisit reminder state 533 // ------------------------------ 497 534 $query = ' 498 535 SELECT reminder … … 512 549 513 550 // If never reminded before 551 // ------------------------ 514 552 if (!$reminder) 515 553 { 516 // Reset of lastvisit date 554 // Reset of lastvisit date 555 // ----------------------- 517 556 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 518 557 … … 525 564 526 565 // Auto change group and / or status 566 // --------------------------------- 527 567 // Delete user from all groups 568 // --------------------------- 528 569 $query = " 529 570 DELETE FROM ".USER_GROUP_TABLE." … … 538 579 539 580 // Change user status 581 // ------------------ 540 582 if ($conf_UAM[26] <> -1) 541 583 { … … 549 591 550 592 // Change user group 593 // ----------------- 551 594 if ($conf_UAM[25] <> -1) 552 595 { … … 561 604 562 605 // Change user privacy level 606 // ------------------------- 563 607 if ($conf_UAM[37] <> -1) 564 608 { … … 572 616 573 617 // Auto send email notification on group / status downgrade 618 // -------------------------------------------------------- 574 619 if (isset($conf_UAM[22]) and $conf_UAM[22] == 'true') 575 620 { 576 621 // Set reminder true 622 // ----------------- 577 623 $query = " 578 624 UPDATE ".USER_LASTVISIT_TABLE." … … 583 629 584 630 // Reset confirmed user status to unvalidated 631 // ------------------------------------------ 585 632 $query = ' 586 633 UPDATE '.USER_CONFIRM_MAIL_TABLE.' … … 591 638 592 639 // Get users information for email notification 640 // -------------------------------------------- 593 641 $query = ' 594 642 SELECT id, username, mail_address … … 603 651 elseif ($reminder) // If user already reminded for ghost account 604 652 { 605 // delete account 653 // Delete account 654 // -------------- 606 655 delete_user($user_id); 607 656 } … … 643 692 644 693 // Unvalidated accounts auto email sending and autodeletion if user already reminded 694 // --------------------------------------------------------------------------------- 645 695 if ((isset($conf_UAM[30]) and $conf_UAM[30] == 'true')) 646 696 { … … 648 698 { 649 699 // Process if a non-admin nor webmaster user is logged 700 // --------------------------------------------------- 650 701 if (in_array($user['id'], $collection)) 651 702 { 652 703 // Check ConfirmMail reminder state 704 // -------------------------------- 653 705 $query = ' 654 706 SELECT reminder … … 668 720 669 721 // If never reminded before, send reminder and set reminder True 722 // ------------------------------------------------------------- 670 723 if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true') 671 724 { … … 673 726 674 727 // Get current user informations 728 // ----------------------------- 675 729 $query = " 676 730 SELECT id, username, mail_address … … 684 738 685 739 // If already reminded before, delete user 740 // --------------------------------------- 686 741 if ($reminder) 687 742 { … … 690 745 691 746 // Logged-in user cleanup, session destruction and redirected to custom page 747 // ------------------------------------------------------------------------- 692 748 invalidate_user_cache(); 693 749 logout_user(); … … 700 756 { 701 757 // Check reminder state 758 // -------------------- 702 759 $query = ' 703 760 SELECT reminder … … 717 774 718 775 // If never reminded before, send reminder and set reminder True 776 // ------------------------------------------------------------- 719 777 if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true') 720 778 { … … 722 780 723 781 // Get current user informations 782 // ----------------------------- 724 783 $query = " 725 784 SELECT id, username, mail_address … … 733 792 elseif ($reminder) // If user already reminded for account validation 734 793 { 735 // delete account 794 // Delete account 795 // -------------- 736 796 delete_user($user_id); 737 797 } … … 756 816 757 817 // Admin user management 818 // --------------------- 758 819 if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') 759 820 { … … 761 822 { 762 823 // Email without forbidden domains 824 // ------------------------------- 763 825 if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email'])) 764 826 { … … 824 886 825 887 // We have to get the user's language in database 888 // ---------------------------------------------- 826 889 $query =' 827 890 SELECT user_id, language … … 832 895 833 896 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language 897 // ------------------------------------------------------------------------------------------------------------------------------- 834 898 if (empty($data)) 835 899 { 836 900 // And switch gallery to this language before using personalized and multilangual contents 901 // --------------------------------------------------------------------------------------- 837 902 $language = pwg_get_session_var( 'lang_switch', $user['language'] ); 838 903 switch_lang_to($language); … … 841 906 { 842 907 // And switch gallery to this language before using personalized and multilangual contents 843 $language = $data['language']; // Usefull for debugging 908 // --------------------------------------------------------------------------------------- 909 //$language = $data['language']; // Usefull for debugging 844 910 switch_lang_to($data['language']); 845 911 load_language('plugin.lang', UAM_PATH); … … 855 921 { 856 922 // Management of Extension flags ([username], [mygallery], [myurl]) 923 // ---------------------------------------------------------------- 857 924 $patterns[] = '#\[username\]#i'; 858 925 $replacements[] = $username; … … 907 974 } 908 975 909 if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm) 976 if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm) // Add confirmation link ? 910 977 { 911 978 $infos2 = array … … 915 982 ); 916 983 917 if (isset($conf_UAM[9]) and $conf_UAM[9] <> '') 984 if (isset($conf_UAM[9]) and $conf_UAM[9] <> '') // Add personal text in confirmation email ? 918 985 { 919 986 // Management of Extension flags ([username], [mygallery], [myurl], [Kdays]) 987 // ------------------------------------------------------------------------- 920 988 $patterns[] = '#\[username\]#i'; 921 989 $replacements[] = $username; … … 965 1033 966 1034 // Sending the email with subject and contents 1035 // ------------------------------------------- 967 1036 pwg_mail($email, array( 968 1037 'subject' => $subject, … … 971 1040 972 1041 // Switching back to default language 1042 // ---------------------------------- 973 1043 switch_lang_back(); 974 1044 } … … 992 1062 993 1063 // We have to get the user's language in database 1064 // ---------------------------------------------- 994 1065 $query =' 995 1066 SELECT user_id, language … … 1001 1072 1002 1073 // And switch gallery to this language before using personalized and multilangual contents 1074 // --------------------------------------------------------------------------------------- 1003 1075 switch_lang_to($data['language']); 1004 1076 … … 1013 1085 { 1014 1086 // Management of Extension flags ([username], [mygallery], [myurl], [Kdays]) 1087 // ------------------------------------------------------------------------- 1015 1088 $patterns[] = '#\[username\]#i'; 1016 1089 $replacements[] = $username; … … 1039 1112 } 1040 1113 1041 // Set reminder true 1114 // Set reminder true 1115 // ----------------- 1042 1116 $query = " 1043 1117 UPDATE ".USER_CONFIRM_MAIL_TABLE." … … 1055 1129 { 1056 1130 // Management of Extension flags ([username], [mygallery], [myurl], [Kdays]) 1131 // ------------------------------------------------------------------------- 1057 1132 $patterns[] = '#\[username\]#i'; 1058 1133 $replacements[] = $username; … … 1075 1150 } 1076 1151 1077 // Set reminder true 1152 // Set reminder true 1153 // ----------------- 1078 1154 $query = " 1079 1155 UPDATE ".USER_CONFIRM_MAIL_TABLE." … … 1092 1168 1093 1169 // Switching back to default language 1170 // ---------------------------------- 1094 1171 switch_lang_back(); 1095 1172 } … … 1113 1190 1114 1191 // We have to get the user's language in database 1192 // ---------------------------------------------- 1115 1193 $query =' 1116 1194 SELECT user_id, language … … 1122 1200 1123 1201 // And switch gallery to this language before using personalized and multilangual contents 1202 // --------------------------------------------------------------------------------------- 1124 1203 switch_lang_to($data['language']); 1125 1204 … … 1131 1210 { 1132 1211 // Management of Extension flags ([username], [mygallery], [myurl], [days]) 1212 // ------------------------------------------------------------------------ 1133 1213 $patterns[] = '#\[username\]#i'; 1134 1214 $replacements[] = $username; … … 1158 1238 1159 1239 // Switching back to default language 1240 // ---------------------------------- 1160 1241 switch_lang_back(); 1161 1242 } … … 1179 1260 1180 1261 // We have to get the user's language in database 1262 // ---------------------------------------------- 1181 1263 $query =' 1182 1264 SELECT user_id, language … … 1187 1269 1188 1270 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language 1271 // ------------------------------------------------------------------------------------------------------------------------------- 1189 1272 if (empty($data)) 1190 1273 { 1191 1274 // And switch gallery to this language before using personalized and multilangual contents 1275 // --------------------------------------------------------------------------------------- 1192 1276 $language = pwg_get_session_var( 'lang_switch', $user['language'] ); 1193 1277 switch_lang_to($language); … … 1196 1280 { 1197 1281 // And switch gallery to this language before using personalized and multilangual contents 1282 // --------------------------------------------------------------------------------------- 1198 1283 $language = $data['language']; // Usefull for debugging 1199 1284 switch_lang_to($data['language']); … … 1206 1291 { 1207 1292 // Management of Extension flags ([username], [mygallery], [myurl]) 1293 // ---------------------------------------------------------------- 1208 1294 $patterns[] = '#\[username\]#i'; 1209 1295 $replacements[] = stripslashes($username); … … 1235 1321 1236 1322 // Sending the email with subject and contents 1323 // ------------------------------------------- 1237 1324 pwg_mail($email, array( 1238 1325 'subject' => $subject, … … 1241 1328 1242 1329 // Switching back to default language 1330 // ---------------------------------- 1243 1331 switch_lang_back(); 1244 1332 } … … 1262 1350 1263 1351 // We have to get the user's language in database 1352 // ---------------------------------------------- 1264 1353 $query =' 1265 1354 SELECT user_id, language … … 1270 1359 1271 1360 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language 1361 // ------------------------------------------------------------------------------------------------------------------------------- 1272 1362 if (empty($data)) 1273 1363 { 1274 1364 // And switch gallery to this language before using personalized and multilangual contents 1365 // --------------------------------------------------------------------------------------- 1275 1366 $language = pwg_get_session_var( 'lang_switch', $user['language'] ); 1276 1367 switch_lang_to($language); … … 1279 1370 { 1280 1371 // And switch gallery to this language before using personalized and multilangual contents 1372 // --------------------------------------------------------------------------------------- 1281 1373 $language = $data['language']; // Usefull for debugging 1282 1374 switch_lang_to($data['language']); … … 1285 1377 1286 1378 // Retreive users email and user name from id 1379 // ------------------------------------------ 1287 1380 $query =' 1288 1381 SELECT id, username, mail_address … … 1297 1390 { 1298 1391 // Management of Extension flags ([username], [mygallery], [myurl]) 1392 // ---------------------------------------------------------------- 1299 1393 $patterns[] = '#\[username\]#i'; 1300 1394 $replacements[] = $result['username']; … … 1318 1412 1319 1413 // Sending the email with subject and contents 1414 // ------------------------------------------- 1320 1415 pwg_mail($result['mail_address'], array( 1321 1416 'subject' => $subject, … … 1324 1419 1325 1420 // Switching back to default language 1421 // ---------------------------------- 1326 1422 switch_lang_back(); 1327 1423 } … … 1387 1483 1388 1484 // Delete user from all groups 1485 // --------------------------- 1389 1486 $query = " 1390 1487 DELETE FROM ".USER_GROUP_TABLE." … … 1399 1496 1400 1497 // Set user unvalidated status 1498 // --------------------------- 1401 1499 if (!is_admin() and $conf_UAM[7] <> -1) 1402 1500 { … … 1410 1508 1411 1509 // Set user unvalidated group 1510 // -------------------------- 1412 1511 if (!is_admin() and $conf_UAM[2] <> -1) 1413 1512 { … … 1422 1521 1423 1522 // Set user unvalidated privacy level 1523 // ---------------------------------- 1424 1524 if (!is_admin() and $conf_UAM[35] <> -1) 1425 1525 { … … 1451 1551 1452 1552 // Groups cleanup 1553 // -------------- 1453 1554 $query = " 1454 1555 DELETE FROM ".USER_GROUP_TABLE." … … 1661 1762 { 1662 1763 // Verify Confirmmail with time limit ON 1764 // ------------------------------------- 1663 1765 if (isset ($conf_UAM_ConfirmMail[1])) 1664 1766 { 1665 // dates formating and compare 1767 // Dates formating and compare 1768 // --------------------------- 1666 1769 $today = date("d-m-Y"); // Get today's date 1667 1770 list($day, $month, $year) = explode('-', $today); // explode date of today … … 1676 1779 1677 1780 // Condition with the value set for time limit 1781 // ------------------------------------------- 1678 1782 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set 1679 1783 { 1680 1784 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1681 1785 1682 // Update ConfirmMail table 1786 // Update ConfirmMail table 1787 // ------------------------ 1683 1788 $query = ' 1684 1789 UPDATE '.USER_CONFIRM_MAIL_TABLE.' … … 1689 1794 1690 1795 // Update LastVisit table - Force reminder field to false 1691 // Usefull when a user has been automatically downgraded and revalidate its registration 1796 // Usefull when a user has been automatically downgraded and revalidate its registration 1797 // ------------------------------------------------------------------------------------- 1692 1798 $query = ' 1693 1799 UPDATE '.USER_LASTVISIT_TABLE.' … … 1739 1845 1740 1846 // Refresh user's category cache 1847 // ----------------------------- 1741 1848 invalidate_user_cache(); 1742 1849 … … 1749 1856 } 1750 1857 // Verify Confirmmail with time limit OFF 1858 // -------------------------------------- 1751 1859 else 1752 1860 { 1753 1861 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1754 1862 1755 // Update ConfirmMail table 1863 // Update ConfirmMail table 1864 // ------------------------ 1756 1865 $query = ' 1757 1866 UPDATE '.USER_CONFIRM_MAIL_TABLE.' … … 1762 1871 1763 1872 // Update LastVisit table - Force reminder field to false 1764 // Usefull when a user has been automatically downgraded and revalidate its registration 1873 // Usefull when a user has been automatically downgraded and revalidate its registration 1874 // ------------------------------------------------------------------------------------- 1765 1875 $query = ' 1766 1876 UPDATE '.USER_LASTVISIT_TABLE.' … … 1819 1929 1820 1930 // Refresh user's category cache 1931 // ----------------------------- 1821 1932 invalidate_user_cache(); 1822 1933 … … 2039 2150 2040 2151 // Get ConfirmMail configuration 2152 // ----------------------------- 2041 2153 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 2042 2154 // Get UAM configuration 2155 // --------------------- 2043 2156 $conf_UAM = unserialize($conf['UserAdvManager']); 2044 2157 2045 2158 $users = array(); 2046 2159 2047 // search users depending expiration date 2160 // Search users depending expiration date 2161 // -------------------------------------- 2048 2162 $query = ' 2049 2163 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, … … 2092 2206 } 2093 2207 2094 // add group lists 2208 // Add groups list 2209 // --------------- 2095 2210 $user_ids = array(); 2096 2211 foreach ($users as $i => $user) … … 2136 2251 2137 2252 // Get ConfirmMail configuration 2253 // ----------------------------- 2138 2254 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 2139 2255 … … 2141 2257 2142 2258 // search users depending expiration date 2259 // -------------------------------------- 2143 2260 $query = ' 2144 2261 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, … … 2176 2293 $users = array(); 2177 2294 2178 // search users depending expiration date 2295 // Search users depending expiration date 2296 // -------------------------------------- 2179 2297 $query = ' 2180 2298 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, … … 2199 2317 } 2200 2318 2201 // add group lists 2319 // Add groups list 2320 // --------------- 2202 2321 $user_ids = array(); 2203 2322 foreach ($users as $i => $user) … … 2224 2343 $users = array(); 2225 2344 2226 // search users depending expiration date and reminder sent 2345 // Search users depending expiration date and reminder sent 2346 // -------------------------------------------------------- 2227 2347 $query = ' 2228 2348 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, … … 2257 2377 $users = array(); 2258 2378 2259 // search users depending expiration date 2379 // Search users depending expiration date 2380 // -------------------------------------- 2260 2381 $query = ' 2261 2382 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, … … 2280 2401 } 2281 2402 2282 // add group lists 2403 // Add groups list 2404 // --------------- 2283 2405 $user_ids = array(); 2284 2406 foreach ($users as $i => $user) … … 2304 2426 2305 2427 // Get ConfirmMail configuration 2428 // ----------------------------- 2306 2429 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 2307 2430 2308 2431 // Get UAM configuration 2432 // --------------------- 2309 2433 $conf_UAM = unserialize($conf['UserAdvManager']); 2310 2434 … … 2320 2444 if (!empty($registration_date)) 2321 2445 { 2322 // dates formating and compare 2446 // Dates formating and compare 2447 // --------------------------- 2323 2448 $today = date("d-m-Y"); // Get today's date 2324 2449 list($day, $month, $year) = explode('-', $today); // explode date of today … … 2333 2458 2334 2459 // Condition with the value set for time limit 2460 // ------------------------------------------- 2335 2461 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set 2336 2462 { … … 2358 2484 2359 2485 // Initialisation des variables - Variables initiation 2486 // --------------------------------------------------- 2360 2487 $points = 0; 2361 2488 $point_lowercase = 0; … … 2364 2491 $point_characters = 0; 2365 2492 2366 // On récupère la longueur du mot de passe - Getting password lengh 2493 // On récupère la longueur du mot de passe - Getting password lengh 2494 // ---------------------------------------------------------------- 2367 2495 $length = strlen($password); 2368 2496 … … 2372 2500 // On sélectionne une à une chaque lettre - Select each letters 2373 2501 // $i étant à 0 lors du premier passage de la boucle - $i is 0 at first turn 2502 // ------------------------------------------------------------------------- 2374 2503 $letters = $password[$i]; 2375 2504 … … 2377 2506 { 2378 2507 // On ajoute 1 point pour une minuscule - Adding 1 point to score for a lowercase 2508 // ------------------------------------------------------------------------------ 2379 2509 $points = $points + 1; 2380 2510 2381 2511 // On rajoute le bonus pour une minuscule - Adding bonus points for lowercase 2512 // -------------------------------------------------------------------------- 2382 2513 $point_lowercase = 1; 2383 2514 } … … 2385 2516 { 2386 2517 // On ajoute 2 points pour une majuscule - Adding 2 points to score for uppercase 2518 // ------------------------------------------------------------------------------ 2387 2519 $points = $points + 2; 2388 2520 2389 2521 // On rajoute le bonus pour une majuscule - Adding bonus points for uppercase 2522 // -------------------------------------------------------------------------- 2390 2523 $point_uppercase = 2; 2391 2524 } … … 2393 2526 { 2394 2527 // On ajoute 3 points pour un chiffre - Adding 3 points to score for numbers 2528 // ------------------------------------------------------------------------- 2395 2529 $points = $points + 3; 2396 2530 2397 2531 // On rajoute le bonus pour un chiffre - Adding bonus points for numbers 2532 // --------------------------------------------------------------------- 2398 2533 $point_numbers = 3; 2399 2534 } … … 2401 2536 { 2402 2537 // On ajoute 5 points pour un caractère autre - Adding 5 points to score for special characters 2538 // -------------------------------------------------------------------------------------------- 2403 2539 $points = $points + 5; 2404 2540 2405 2541 // On rajoute le bonus pour un caractère autre - Adding bonus points for special characters 2542 // ---------------------------------------------------------------------------------------- 2406 2543 $point_characters = 5; 2407 2544 } … … 2409 2546 2410 2547 // Calcul du coefficient points/longueur - calculating the coefficient points/length 2548 // --------------------------------------------------------------------------------- 2411 2549 $step1 = $points / $length; 2412 2550 2413 2551 // Calcul du coefficient de la diversité des types de caractères... - Calculation of the diversity of character types... 2552 // --------------------------------------------------------------------------------------------------------------------- 2414 2553 $step2 = $point_lowercase + $point_uppercase + $point_numbers + $point_characters; 2415 2554 2416 2555 // Multiplication du coefficient de diversité avec celui de la longueur - Multiplying the coefficient of diversity with that of the length 2556 // -------------------------------------------------------------------------------------------------------------------------------------------- 2417 2557 $score = $step1 * $step2; 2418 2558 2419 2559 // Multiplication du resultat par la longueur de la chaine - Multiplying the result by the length of the string 2560 // ------------------------------------------------------------------------------------------------------------ 2420 2561 $finalscore = $score * $length; 2421 2562 … … 2486 2627 } 2487 2628 // IMPORTANT SECURITY ! 2629 // -------------------- 2488 2630 $plugin = array_map('htmlspecialchars', $plugin); 2489 2631 … … 2619 2761 2620 2762 // Query to get informations in database 2763 // ------------------------------------- 2621 2764 if (!empty($user_ids)) 2622 2765 { … … 2659 2802 2660 2803 // Initial backup folder creation and file initialisation 2804 // ------------------------------------------------------ 2661 2805 if (!is_dir(UAM_PATH.'/include/backup')) 2662 2806 mkdir(UAM_PATH.'/include/backup'); … … 2668 2812 2669 2813 // Saving UAM specific tables 2814 // -------------------------- 2670 2815 $ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE); 2671 2816 $j=0; … … 2708 2853 2709 2854 // Saving UAM configuration 2855 // ------------------------ 2710 2856 $insertions = "-- -------------------------------------------------------\n"; 2711 2857 $insertions .= "-- Insert UAM configuration in ".CONFIG_TABLE."\n"; … … 2734 2880 2735 2881 // Download generated dump file 2882 // ---------------------------- 2736 2883 if ($download == 'true') 2737 2884 { -
extensions/UserAdvManager/trunk/include/upgradedb.inc.php
r12247 r12271 29 29 { 30 30 // Get current plugin version 31 // -------------------------- 31 32 $plugin = PluginInfos(UAM_PATH); 32 33 $version = $plugin['version']; 33 34 34 35 // Update plugin version in #_config table 36 // --------------------------------------- 35 37 $query = ' 36 38 UPDATE '.CONFIG_TABLE.' … … 45 47 // Check #_plugin table consistency 46 48 // Only useful if a previous version upgrade has not worked correctly (rare case) 49 // ------------------------------------------------------------------------------ 47 50 $query = ' 48 51 SELECT version … … 133 136 { 134 137 // Create missing table 138 // -------------------- 135 139 $query = " 136 140 ALTER TABLE ".USER_CONFIRM_MAIL_TABLE." … … 141 145 142 146 // Upgrade plugin configuration 147 // ---------------------------- 143 148 global $conf; 144 149 … … 191 196 192 197 // Changing parameter name 198 // ----------------------- 193 199 $q = ' 194 200 UPDATE '.CONFIG_TABLE.' … … 206 212 207 213 // Upgrading ConfirmMail options 214 // ----------------------------- 208 215 $query = ' 209 216 SELECT value … … 235 242 236 243 // Upgrading options 244 // ----------------- 237 245 $query = ' 238 246 SELECT value … … 289 297 290 298 // Upgrading options 299 // ----------------- 291 300 $query = ' 292 301 SELECT value … … 313 322 314 323 // Insert a new config entry for futur plugin's version check 324 // ---------------------------------------------------------- 315 325 $query = ' 316 326 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) … … 329 339 330 340 // Upgrading options 341 // ----------------- 331 342 $query = ' 332 343 SELECT value … … 352 363 353 364 // Create new UAM entry in plugins table 365 // ------------------------------------- 354 366 $uam_new_version = "2.20.0"; 355 367 … … 361 373 pwg_query($query); 362 374 363 // Delete old plugin entry in plugins table 375 // Delete old plugin entry in plugins table 376 // ---------------------------------------- 364 377 $query = ' 365 378 DELETE FROM '.PLUGINS_TABLE.' … … 370 383 pwg_query($query); 371 384 372 // rename directory 385 // Rename directory 386 // ---------------- 373 387 if (!rename(PHPWG_PLUGINS_PATH.'NBC_UserAdvManager', PHPWG_PLUGINS_PATH.'UserAdvManager')) 374 388 { … … 384 398 385 399 // Upgrading options 400 // ----------------- 386 401 $query = ' 387 402 SELECT value … … 409 424 410 425 // Upgrading options 426 // ----------------- 411 427 $query = ' 412 428 SELECT value … … 435 451 436 452 // Upgrading options 453 // ----------------- 437 454 $query = ' 438 455 SELECT value … … 447 464 448 465 // Refactoring all configuration options 466 // ------------------------------------- 449 467 $Newconf_UAM[0] = $Newconf_UAM[0]; 450 468 $Newconf_UAM[1] = $Newconf_UAM[1]; … … 484 502 485 503 // unset obsolete conf 504 // ------------------- 486 505 unset ($Newconf_UAM[35]); 487 506 unset ($Newconf_UAM[36]); … … 501 520 502 521 // Upgrading options 522 // ----------------- 503 523 $query = ' 504 524 SELECT value … … 522 542 523 543 // Piwigo's native tables modifications for password reset function - Add pwdreset column 544 // -------------------------------------------------------------------------------------- 524 545 $query = ' 525 546 SHOW COLUMNS FROM '.USERS_TABLE.'
Note: See TracChangeset
for help on using the changeset viewer.