Compare commits
1096 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 498b0ade38 | |||
| 6885225a8e | |||
| 1846d0a2c2 | |||
| f9c6edc8da | |||
| d19db94df3 | |||
| 9330f3e1fa | |||
| 8a30c5bec2 | |||
| e073353ff2 | |||
| b7e6e7a119 | |||
| 13733eb075 | |||
| 99b8fb5541 | |||
| 6ac660f4ac | |||
| 63dcec6662 | |||
| efdcc40927 | |||
| 8a6afdde27 | |||
| 0fece2d628 | |||
| e0734f6277 | |||
| 2e3a3337b1 | |||
| ebf0aeec86 | |||
| e875530645 | |||
| b475fec548 | |||
| 7eb7ca6786 | |||
| ef62ec7c66 | |||
| 06b9f960de | |||
| 1992b70a32 | |||
| 7eb43d9d01 | |||
| f8b6fda2a7 | |||
| 5bb3fdc73d | |||
| 93a4a32e2e | |||
| 7a38e689f2 | |||
| 5ba0a8b71e | |||
| 1e3f87b91e | |||
| b17cc53447 | |||
| cf7f20fc54 | |||
| 365b745202 | |||
| db8d52b560 | |||
| 602572d131 | |||
| 71186e4168 | |||
| 627e2cb6f5 | |||
| 0b75065449 | |||
| 63bcf21fbf | |||
| fc5e568fbf | |||
| 5194a4f938 | |||
| 82e0a886c2 | |||
| e57069e318 | |||
| c26c206276 | |||
| 8a16c85e8c | |||
| bdb0e3e233 | |||
| 97f4bb9fde | |||
| 02d0084a51 | |||
| 5af25dd922 | |||
| 665ba7679d | |||
| 0b32c364a1 | |||
| e041c56184 | |||
| dbc804de90 | |||
| 07715b2c5e | |||
| 04a3e8b1f0 | |||
| ab9cba84ae | |||
| f374ad64d1 | |||
| 435c0a785b | |||
| e5c825ab8a | |||
| c4c28a7468 | |||
| abf7d22073 | |||
| 48f1234896 | |||
| defb0f64f0 | |||
| f2f07143e3 | |||
| 0759221a5e | |||
| 3744e9ef24 | |||
| 0455e362ae | |||
| c5f0168382 | |||
| cc980ff6e5 | |||
| 65dc989055 | |||
| 38d739257d | |||
| 2c16f768ed | |||
| 254dfd1f0f | |||
| d944e872b7 | |||
| 1e1e2438c6 | |||
| 32579e3d1c | |||
| ed16449ba6 | |||
| 0c6b31f211 | |||
| 867ab98575 | |||
| b4de8efe5d | |||
| ea9700180d | |||
| 8e07f16724 | |||
| aa54c77cf7 | |||
| 02875a7622 | |||
| c6c934b578 | |||
| f0e870d0cf | |||
| c54c59e7d8 | |||
| 32af0dbef2 | |||
| 3da1e9c5f4 | |||
| 206c91a1c4 | |||
| 44bba1e66c | |||
| 62d6eb1f83 | |||
| c1dfbdaea4 | |||
| f38b8c88bf | |||
| 6e8e2bb04c | |||
| 988e9b0f64 | |||
| 7d80c9a0fe | |||
| 619c19d863 | |||
| 13eef19b99 | |||
| 50a8e2b90c | |||
| ddf17a0c4e | |||
| d84da076cc | |||
| c8b5ebc8e3 | |||
| d749b452d3 | |||
| ef1720eb6f | |||
| b95a25b7a8 | |||
| ec53ceed49 | |||
| c157c72d4c | |||
| 3835cc29f3 | |||
| aa44e74ce3 | |||
| 9300321849 | |||
| 64511f27aa | |||
| 522e4ab8c3 | |||
| 0ad6f487be | |||
| 255b8281b6 | |||
| d5e89c7964 | |||
| 906faa5a1f | |||
| f038db5c7c | |||
| fff59beb90 | |||
| 6e5dfc1b4b | |||
| d448df5a1c | |||
| 4bfc6cbdfd | |||
| c99f31c86b | |||
| 89eedbe1cb | |||
| 60c540f5a6 | |||
| 345a24669b | |||
| 87806bd4bc | |||
| 0d47dafb08 | |||
| 105eb2d512 | |||
| bd68242fb0 | |||
| bf4dde1e29 | |||
| 2340efe201 | |||
| aa87f6cb14 | |||
| 571709c448 | |||
| bec23ebe9c | |||
| e88e09a1f1 | |||
| 12d3294e0a | |||
| 4ec9d6b07d | |||
| dc5f29bf8c | |||
| 0088d8ce7e | |||
| a90d5b6082 | |||
| c9af47a031 | |||
| f7a197e8fa | |||
| 623e2d59d1 | |||
| e0260731dc | |||
| 1282d92329 | |||
| 1fdfed864f | |||
| 4bf780bf99 | |||
| 240363ac49 | |||
| c68631a272 | |||
| e5b7520dce | |||
| 4b51c3fb2f | |||
| d8bfab810c | |||
| 242f42a49f | |||
| f2d7523e1d | |||
| a1b6cb7da4 | |||
| 1f56978e1a | |||
| 8c4f5bc33f | |||
| 1f72738c04 | |||
| c6d9053948 | |||
| 274a1cc850 | |||
| 9165153bd3 | |||
| a478b383cd | |||
| 4e4955b55e | |||
| fb7e6a9a0d | |||
| 62f0cff4ce | |||
| 4c9c6f0ddb | |||
| 4bea11eae5 | |||
| 740972a826 | |||
| a53b72f516 | |||
| 224ac0b90f | |||
| f6fd87d97b | |||
| 7fa260c83c | |||
| 877f1e2485 | |||
| a17912002b | |||
| a9aaede659 | |||
| d2436bf26b | |||
| 3fa20034ae | |||
| 2e13c2864f | |||
| 15a9e839f2 | |||
| 847bb2fd19 | |||
| 6d139a20d6 | |||
| a262b1c15e | |||
| 302348cb4d | |||
| d183669cc1 | |||
| 6c1f6b016d | |||
| 983927938a | |||
| 7cfae72475 | |||
| 5e195c8235 | |||
| b1fbc8be30 | |||
| f7fa56821d | |||
| 62b4a55e5c | |||
| 8fb75b1d7a | |||
| c5ade93e96 | |||
| dcbdab7312 | |||
| 933b96a3a8 | |||
| 490e14d6cc | |||
| 93f1172f98 | |||
| e19a4892a9 | |||
| 5f75ca701e | |||
| b5655a6578 | |||
| 9a825e9082 | |||
| ecca8c346b | |||
| f057ecd40c | |||
| 418deec57c | |||
| 73254d7861 | |||
| 3f9e92b025 | |||
| 1f3ef341bd | |||
| c607a0ea03 | |||
| a83cdea8e3 | |||
| 6792aa17f6 | |||
| 63620c1d78 | |||
| 218ff7fb75 | |||
| 0680a761f7 | |||
| 43d67c7d22 | |||
| 5b526573d0 | |||
| 8fc7b48708 | |||
| c03ace0bdb | |||
| 9c29e6bfc6 | |||
| 27e053a25a | |||
| 1d64431c90 | |||
| f02cc7bf03 | |||
| 8e3391e166 | |||
| 165d5ca1a3 | |||
| 743fd57f2c | |||
| 7527707dd5 | |||
| 2eedb5babd | |||
| fa31cbab04 | |||
| 9ea6e88ff2 | |||
| a2c075aaac | |||
| 7387acb1e0 | |||
| 8e3cb48829 | |||
| 19161949aa | |||
| 5d3a303539 | |||
| 39a3b2af0f | |||
| 5d23030fc8 | |||
| 94446a8d68 | |||
| a9b2d797dc | |||
| ed7646af01 | |||
| e7dc0e4f15 | |||
| 95151a7493 | |||
| f6b8d22716 | |||
| cc518e4615 | |||
| e8b3db0f95 | |||
| 9d3e59b7ba | |||
| 7f3981ef41 | |||
| 4d16e6f650 | |||
| 6962ab2a64 | |||
| 5fa8b35428 | |||
| 6c831d73d3 | |||
| bfe239f1e6 | |||
| b2c1183316 | |||
| 7b518b7227 | |||
| 66c041bd00 | |||
| 9db58d015f | |||
| 1be35acd87 | |||
| 34e3e0b732 | |||
| cede8c8fa3 | |||
| 0df32c07c7 | |||
| 390b1cf724 | |||
| 4d7928e235 | |||
| 32f87cd80f | |||
| 1cf107ac7d | |||
| c251af9516 | |||
| 8005dfec30 | |||
| c393c9a44c | |||
| c2697aeeb2 | |||
| 0283b62467 | |||
| 17a0ab80ed | |||
| 210a02693d | |||
| 9acd97389e | |||
| dca379c260 | |||
| 48b58815eb | |||
| c913f22058 | |||
| c66edc0c29 | |||
| 90ffb070d0 | |||
| 37d795053c | |||
| 33df4820bf | |||
| 73ef9f11ba | |||
| 70e5759150 | |||
| 8a942e9c79 | |||
| 5774e05b33 | |||
| 90aab3868b | |||
| 3d70d2f8df | |||
| db75ffa618 | |||
| 56cab517e9 | |||
| d4f421493b | |||
| ad1630ae86 | |||
| 0445685775 | |||
| 7894f66662 | |||
| 82a3bbd629 | |||
| 6e695a1f4e | |||
| f978083108 | |||
| 4c3a837f21 | |||
| 970ea98196 | |||
| ca4fc3a908 | |||
| 489b2e19de | |||
| c6bd449dea | |||
| f1591379e8 | |||
| 54d264ea7c | |||
| f69f513d28 | |||
| ec7a9479f9 | |||
| d35218a111 | |||
| 394cc4a484 | |||
| db15d5d552 | |||
| 0d2ee05aa1 | |||
| 4eb9d73cc7 | |||
| 6b52c45e95 | |||
| 99f7c8df47 | |||
| 2192e94ef2 | |||
| b0e7781eb8 | |||
| 069dbaa91e | |||
| 6a971ac82a | |||
| b219363c03 | |||
| a148872083 | |||
| 0ca23ab0d6 | |||
| 7177a7a93d | |||
| 736956b1d0 | |||
| 3e26020006 | |||
| 25effd9682 | |||
| 020ce4787f | |||
| 3580b97516 | |||
| 6ad7a2da89 | |||
| 193cc59ca3 | |||
| 7c013eab3f | |||
| 0d003551eb | |||
| 07c92f644f | |||
| a1dc1a26db | |||
| ce6d939f26 | |||
| 493288848b | |||
| 77d587b42e | |||
| d186e24dff | |||
| 139fa3dee6 | |||
| 3f35d9da9d | |||
| 61faff2eec | |||
| c0d5964594 | |||
| e72a18576f | |||
| b18e27ea93 | |||
| ee8dd77019 | |||
| 350d29e7d8 | |||
| e8206e91b4 | |||
| 986f2bc884 | |||
| 1170f42f3a | |||
| 2054096041 | |||
| 4a04703937 | |||
| f733a88518 | |||
| 9f18286f31 | |||
| d23e60ad43 | |||
| 3c6a14ee12 | |||
| 69c6d6ca42 | |||
| 3af0788f9c | |||
| 9676a2860c | |||
| 2888dc67e1 | |||
| 71c3e668a5 | |||
| b678200478 | |||
| dfd0732d37 | |||
| 31b8823ff3 | |||
| 5e20081493 | |||
| 4e3b92aecc | |||
| e6edcdaff7 | |||
| 3c14b202eb | |||
| 763d96c685 | |||
| c90bfc60d2 | |||
| 91b3b50d28 | |||
| c3801e8c66 | |||
| e418ebf500 | |||
| ba6b4afc8b | |||
| e15dace905 | |||
| a648c81aac | |||
| 1a46de2f48 | |||
| 74680e68ed | |||
| 9e7d048f50 | |||
| 465679ab04 | |||
| f8e7cfb677 | |||
| 9306b4f5c5 | |||
| 1aeb49ce6e | |||
| 913f427e3b | |||
| e41ba00a95 | |||
| 557ab204c0 | |||
| 5125790ba9 | |||
| ca2b78b2d9 | |||
| 3a23a33f2a | |||
| 2624b8cfb2 | |||
| 58b44a97b8 | |||
| fb8f96c38d | |||
| 957e659644 | |||
| 139f64ab4c | |||
| ad5903f32c | |||
| 255d79e8bb | |||
| f82d20ef83 | |||
| cc455ee55f | |||
| 2612942b3f | |||
| 741af83691 | |||
| e19d0aa40c | |||
| a770bee3b4 | |||
| 9ae6f20211 | |||
| b2a7f16b29 | |||
| 7e380f7a62 | |||
| 0564d9f348 | |||
| e249546b1f | |||
| 13aac2d528 | |||
| 73018ff695 | |||
| dca6c88184 | |||
| 407dddf80a | |||
| 4c13c8322e | |||
| 5b3a9f3add | |||
| ace21471a1 | |||
| f6fea7895e | |||
| d54f58e745 | |||
| 20654b5f22 | |||
| ea99602131 | |||
| 00d541cb6f | |||
| 1b1d73538f | |||
| 1bbbf98c7b | |||
| f5f2ac2a84 | |||
| 98925bbd7f | |||
| 237287ac73 | |||
| 18aa02efdd | |||
| 48f758e26d | |||
| 9f01a22de1 | |||
| 0e247d1d4f | |||
| c7642843ba | |||
| 698945eb18 | |||
| 45efd8efad | |||
| 3816ad3b25 | |||
| 632859fca9 | |||
| ba83cc409d | |||
| 68abb79baf | |||
| 0538ad9c0c | |||
| 2e094399fd | |||
| 4c65f3cd14 | |||
| b7d40f71bc | |||
| edc70eac69 | |||
| a5ba72c655 | |||
| 3d7b0284aa | |||
| 96ed80ac0d | |||
| bbfd4e747b | |||
| 08570d71d5 | |||
| 550af6d0d2 | |||
| 931d8ad7c1 | |||
| 7bab64e437 | |||
| c7ad4ebfe4 | |||
| a45e98117b | |||
| a4b578acba | |||
| 8f55f04cae | |||
| f35e2e78bd | |||
| a3f57335a6 | |||
| 1d29db2505 | |||
| 4d6f2b14bf | |||
| ed5cf1be35 | |||
| bd7b9afc2b | |||
| 8bb45b3018 | |||
| d21d4c769c | |||
| 9ebf1ff327 | |||
| 02aad242c2 | |||
| 0cc6a219c4 | |||
| 7987cbb64c | |||
| 0345ccddab | |||
| f89efbdcd7 | |||
| ab3b0e99bc | |||
| 564c86821e | |||
| 61b8c43f38 | |||
| f39309cba8 | |||
| f1be9a633d | |||
| 74226d322e | |||
| 1f5f554d2b | |||
| b671a8f0aa | |||
| aa2b1ba10d | |||
| 094a70b7a1 | |||
| acbbc1e3d3 | |||
| 8794dfd840 | |||
| 325d9bd4d6 | |||
| a671e19ae8 | |||
| fbc1f0e5ba | |||
| ab84aff0ec | |||
| 85b22635ac | |||
| f1678f0ed1 | |||
| 857570c420 | |||
| f07e806dd8 | |||
| 556e66c964 | |||
| 0cc7163e28 | |||
| 3b384c750f | |||
| 28580a7575 | |||
| 02671df098 | |||
| 141dd0001f | |||
| 011bdd6a6c | |||
| 71b860de73 | |||
| 0e4d297634 | |||
| 45a8715ca3 | |||
| 9fe384b2f4 | |||
| 00611f4a3e | |||
| 1aae2de951 | |||
| 97578db412 | |||
| 80f7917245 | |||
| 14bb4c1ad9 | |||
| 5fe44967f8 | |||
| 9c2e402dd8 | |||
| 5c3a8f2654 | |||
| 85becf9549 | |||
| 8218ad778c | |||
| 2a0280735f | |||
| de09e4e445 | |||
| 78356e70e8 | |||
| e23cfada9c | |||
| b6e64bdc3f | |||
| 49022d40e1 | |||
| c40ff3464d | |||
| 4f569a8a67 | |||
| 31620715c6 | |||
| b685c67b66 | |||
| a8ee70a946 | |||
| bb0d1297d8 | |||
| e9b129a6a4 | |||
| 0872afb8d2 | |||
| 8bafccf4c4 | |||
| cb856ad077 | |||
| eb791e1258 | |||
| 30e04e5e2a | |||
| 42fd1a8187 | |||
| 654689ef2d | |||
| a312c55950 | |||
| 1406339b9f | |||
| 1a139531bf | |||
| ec74ba1539 | |||
| d1a734f2e3 | |||
| 5508ecf266 | |||
| 5bf4ae7fdb | |||
| c602026c33 | |||
| 8ca823ad43 | |||
| 1674b69f3c | |||
| 59c1249cae | |||
| 2a8167fcc1 | |||
| 063970335d | |||
| 072758e96a | |||
| d43aa0e36a | |||
| 0ffeb32266 | |||
| 3854fcb9f6 | |||
| d10296c0e1 | |||
| 14316a329b | |||
| 2cc8826edb | |||
| 9e864f2546 | |||
| 1a92acfb1b | |||
| a3c6822887 | |||
| a64573c79c | |||
| 4c15367f44 | |||
| 0153d1b515 | |||
| 3c2e8010af | |||
| 151744819b | |||
| 77cd174025 | |||
| a2ae4ee63b | |||
| 388370bf88 | |||
| 116c28e0e9 | |||
| 87b8241498 | |||
| f5024e6deb | |||
| fb56caace7 | |||
| 56ae2b7f26 | |||
| 643e83fd60 | |||
| 50ea3cc486 | |||
| 823844e709 | |||
| 779de749eb | |||
| 99312493b6 | |||
| 0f4aa108d9 | |||
| 8e6e45aa1a | |||
| 040ea6d217 | |||
| 2e47bfb16b | |||
| 3702d88a6e | |||
| 185441df1a | |||
| 1394c591c6 | |||
| 278b82afec | |||
| 5842492ff6 | |||
| c335b24901 | |||
| 3e70580216 | |||
| ae3071a0df | |||
| d778032a9e | |||
| 9d88867d0f | |||
| 49d4be8ba5 | |||
| 7ca341ae94 | |||
| b16206af1c | |||
| 741859448b | |||
| fd6024c0be | |||
| 9037920594 | |||
| 203968ccae | |||
| 9eb290680b | |||
| 1510c6c913 | |||
| faed109b67 | |||
| a0a264068f | |||
| 8db9017fd8 | |||
| 96b4500a91 | |||
| 2fbc9fcb8b | |||
| f9085923a2 | |||
| c612c32231 | |||
| f8d1a60893 | |||
| 947c93bc0a | |||
| f63a256c87 | |||
| cdfbc956fc | |||
| 9922fbf9d6 | |||
| 31df961fd2 | |||
| 288b5b4028 | |||
| e94ed1ae6e | |||
| 57be0ec8f7 | |||
| 1b7d1827de | |||
| b10c986edc | |||
| 18dd81c215 | |||
| 2468aba863 | |||
| c4826181c8 | |||
| 54ad70b035 | |||
| 66feb0092d | |||
| c852b07683 | |||
| 133e54629f | |||
| 7d9881cdea | |||
| 95ae6fbf1f | |||
| 169d90353f | |||
| dd6f51b926 | |||
| 8dea9afdee | |||
| 91b1bf8572 | |||
| 948cff69a6 | |||
| 1f1df4b191 | |||
| df226eb12d | |||
| 88d8fff6d7 | |||
| afd64674a5 | |||
| 26eee29f1e | |||
| 3c6767e8ad | |||
| 5bdab31478 | |||
| e883fe1ab2 | |||
| fa6947c2cd | |||
| 8536a9fbc6 | |||
| 19a7b0aaff | |||
| d3b10b9746 | |||
| 38aa918f2f | |||
| 3a9ad62295 | |||
| efd1898dc0 | |||
| 719faf3548 | |||
| e155f2040b | |||
| ec8d4ea9cd | |||
| 0425032153 | |||
| d00f6bbccf | |||
| 2e43c17e57 | |||
| 8d7c19f5d1 | |||
| e99f828c35 | |||
| 5d65584d34 | |||
| 92cb423293 | |||
| 7c3f0706a0 | |||
| 9ebd5c666d | |||
| df5be4fb9c | |||
| 75b281a8a1 | |||
| dc01248261 | |||
| e4aad71ea4 | |||
| 79d00fd3af | |||
| 9456e28c08 | |||
| 7649ed1209 | |||
| 87042d5731 | |||
| efcbd12a39 | |||
| 8efcefe411 | |||
| 751f367170 | |||
| 528029df3f | |||
| b6a671d653 | |||
| d8a7a8f691 | |||
| 09e3e4efb6 | |||
| e7d53ba351 | |||
| 558d74308f | |||
| 1ba41a5caf | |||
| 41cc574f95 | |||
| 5a7aef9c1c | |||
| 152f2f68ce | |||
| 7f761c27eb | |||
| 0ce6c76982 | |||
| 6219090e2c | |||
| a0ea30a741 | |||
| a40cd98d67 | |||
| d84e26d2c4 | |||
| c8d51449f7 | |||
| b2fb1d4096 | |||
| 2459ecc419 | |||
| 48441521aa | |||
| 2101eddc89 | |||
| 33cc11661b | |||
| 7e507929e6 | |||
| e671b92a2a | |||
| 53f5364123 | |||
| 5b2f502112 | |||
| 34126fd8f1 | |||
| fed8004f56 | |||
| 74a2040332 | |||
| 9a5d3d9d3d | |||
| cda98581a5 | |||
| 5e75f98c71 | |||
| 2dc20107b9 | |||
| cd6323f517 | |||
| cee5f24cc3 | |||
| a2e587548e | |||
| 56e5cb78a8 | |||
| 5a3951e035 | |||
| bc1982446c | |||
| eb3deee548 | |||
| 262bc9a40b | |||
| b8d8a34565 | |||
| a29910300d | |||
| d79dfb8586 | |||
| 30f5739a46 | |||
| 1e51f8fa07 | |||
| 3211d8b265 | |||
| c9ab907641 | |||
| c095ae4364 | |||
| c9534efc10 | |||
| 7edb720ac8 | |||
| 244cb43dff | |||
| 2b72207cc3 | |||
| a9aecc7b14 | |||
| c814ba2c1e | |||
| 8823667015 | |||
| 6ffb4d547c | |||
| 3434f2553a | |||
| 1877680610 | |||
| 8fc5a75c11 | |||
| eda7a6b347 | |||
| 5d4b57cb07 | |||
| 502e8e4c30 | |||
| 93f56c2a9d | |||
| 98e8766b5b | |||
| 5d5f22570f | |||
| 88540a03e6 | |||
| 7a222aa46e | |||
| 0dbc56ee8b | |||
| 7c3bf2a16b | |||
| c0d26d69f8 | |||
| d33c47e381 | |||
| 75d6eaaf31 | |||
| 6c5baec1b5 | |||
| fdc6e017b5 | |||
| c7d80b3a25 | |||
| 2979aead19 | |||
| 68e9ee7163 | |||
| 7b462b46f0 | |||
| 8297db894e | |||
| 4babe7c31f | |||
| 000f9787f6 | |||
| 020fe631c3 | |||
| 970166d4ac | |||
| df6447ef65 | |||
| 203b990fb0 | |||
| ab6bd700d8 | |||
| e629e57a2b | |||
| a8cd1b57da | |||
| 89d98b923b | |||
| de13f5b6fd | |||
| 098a26f514 | |||
| 802f6e34d7 | |||
| d0494b6ec0 | |||
| f8faba784a | |||
| a3534169ae | |||
| c447099bda | |||
| 14c5382464 | |||
| e70e08fa8e | |||
| 2328428fe1 | |||
| 123dcabe68 | |||
| 1c1b5fc676 | |||
| 89f02fd6b2 | |||
| 3efca70fda | |||
| 24ab562c73 | |||
| 3dcb2cda36 | |||
| e3d41efc04 | |||
| 1b3fa338bb | |||
| 5a01c73780 | |||
| ba33284ca1 | |||
| 5a661304aa | |||
| f653c544e9 | |||
| 52d3a9e351 | |||
| b94db131e5 | |||
| 7cc7b0c033 | |||
| 81c049d9c2 | |||
| d119a6f42f | |||
| f032a4bebd | |||
| 8b45b8e0a6 | |||
| 27b1710b01 | |||
| 98928f94e9 | |||
| 0ee8a5280e | |||
| 4855134e63 | |||
| 96be763dc5 | |||
| 8a8d3515d3 | |||
| b59914d977 | |||
| 4dc48514e5 | |||
| ac470e064e | |||
| 4b3f2d3739 | |||
| b8ca891023 | |||
| 70acd53078 | |||
| f1cac46f00 | |||
| 990ae1bb9d | |||
| 904eea079b | |||
| 676174682e | |||
| 870c9c02b3 | |||
| 7356223a7d | |||
| 9deccd7a44 | |||
| 5580a59ba7 | |||
| 7bf7c697d3 | |||
| c539258b52 | |||
| 0c9945f5c6 | |||
| 74ec307700 | |||
| f4687e66e7 | |||
| b4ed6f7392 | |||
| 54d9b6d847 | |||
| 83941d0192 | |||
| 9109202550 | |||
| 669b80b1e2 | |||
| 49f5a957cd | |||
| c35b90ebed | |||
| 68f67bbe75 | |||
| 099d1c8f62 | |||
| e599ca7241 | |||
| 19226c30b5 | |||
| ccd33d6b19 | |||
| 4de6676739 | |||
| ae817db2f8 | |||
| e93291d5ee | |||
| cfe0874655 | |||
| 75ed3a0add | |||
| 6b3eca01f2 | |||
| 51f90f8839 | |||
| 99797689e6 | |||
| 841dca3991 | |||
| 28fb4d1027 | |||
| e54510d166 | |||
| 72cd33b6f4 | |||
| c10708e9ce | |||
| ef1da4973c | |||
| bd4c23edf3 | |||
| 8354fc630f | |||
| 737b745890 | |||
| abd67b8e7f | |||
| b70a71f3eb | |||
| 673b34647a | |||
| 1539445279 | |||
| 9346aeddae | |||
| fba5ee935b | |||
| 2edb5cbdc4 | |||
| b3ed7949fb | |||
| 4100f63ab4 | |||
| 06553cdb82 | |||
| 34a90b1d22 | |||
| 598100a16b | |||
| 514dc2d92a | |||
| beca85894e | |||
| 022acf5df4 | |||
| 7d39e1b828 | |||
| 300185b2e4 | |||
| 20dce6a07d | |||
| d630b81286 | |||
| a59b768dee | |||
| 338f490b98 | |||
| 37bff835b0 | |||
| d0a2161941 | |||
| 757bc06941 | |||
| a20f71c7ef | |||
| 8a60457e13 | |||
| 90dc0f3071 | |||
| 7cdb6ee4a9 | |||
| 5a8100234f | |||
| 1c6f3513d9 | |||
| fcfe44d8b4 | |||
| 28f18faa37 | |||
| 8e4a35943c | |||
| 18284d3f65 | |||
| 45ee48d990 | |||
| abae4967bc | |||
| 6417390ca5 | |||
| 32db125642 | |||
| 13b78aa854 | |||
| 877c237cf5 | |||
| 8ed5c68a7f | |||
| 54b9c5feb0 | |||
| 03c03e08cc | |||
| 3dc3b31e77 | |||
| 51f2cdd803 | |||
| b12c6f2b1c | |||
| 2c15845dfb | |||
| f4b987c7a4 | |||
| 61bfc7eaa1 | |||
| f6a9b4c9b8 | |||
| cd268329ef | |||
| 32b0172953 | |||
| 56d0ff42c0 | |||
| fc137768fd | |||
| 5220582ed7 | |||
| 0b3cc31c2e | |||
| e1cd6c73e5 | |||
| 82df9925b8 | |||
| bbe0467bff | |||
| 58c8f24909 | |||
| a5c1df9bcf | |||
| b2744afe61 | |||
| 6d969cd512 | |||
| 03c358e331 | |||
| 0db058ef58 | |||
| 1bc0bbb4ef | |||
| 32932231fd | |||
| 9cdfe34923 | |||
| 36c04a1bdb | |||
| 73fcfef178 | |||
| f52a0de1c5 | |||
| ea9af5b1a2 | |||
| 1ac5aabb2f | |||
| ee7a11dc62 | |||
| ca6f03263d | |||
| 77a53d26bb | |||
| 414b66be32 | |||
| b5558e5742 | |||
| 9dbb215cf6 | |||
| 0a85b6161b | |||
| eb34ba19a9 | |||
| 8a48b86836 | |||
| 0196475e23 | |||
| 8245849ef9 | |||
| 0b5a4199d0 | |||
| 3dd157d0ee | |||
| 51528c6d6e | |||
| d07ae54371 | |||
| 4f497b2c4e | |||
| 482221882b | |||
| fab9a8452a | |||
| 0c7d5e2966 | |||
| 50ab9935c0 | |||
| 1e81a1295e | |||
| 200f64d220 | |||
| 1b1bd5929b | |||
| e489cc2f8d | |||
| 827100874d | |||
| 160684c811 | |||
| afbb79e1c6 | |||
| 1cd4d9dffe | |||
| f548abb84c | |||
| 1f44541d17 | |||
| 1cefec56ed | |||
| aeae7ec39d | |||
| 471e1be772 | |||
| 3e5d5d5741 | |||
| f1deee8860 | |||
| c08b2ecf09 | |||
| fae700ba1c | |||
| 7b8cd330a3 | |||
| 5645145115 | |||
| ad91f3744e | |||
| 7bf21a5064 | |||
| 3b37251a8a | |||
| 80d7317a79 | |||
| 47d75826be | |||
| 8478d321ec | |||
| 9e9511ca48 | |||
| 451761a403 | |||
| f5a587ce76 | |||
| ffb13064dc | |||
| d359ac1491 | |||
| 7521250967 | |||
| 0b0f2f864b | |||
| ed0acd0904 | |||
| b3f877de05 | |||
| 552254834b | |||
| 894722ed9c | |||
| dcc09c507e | |||
| da76b7ee70 | |||
| 3a041e458c | |||
| 134f59345f | |||
| 1769403fbd | |||
| eb923b5cc1 | |||
| 8e9fca4fff | |||
| bcc37dd0c1 | |||
| 58e84d7044 | |||
| c58364c3d3 | |||
| f6a54f01e3 | |||
| 678530de2b | |||
| ca6e796485 | |||
| 5d6dccfa8e | |||
| e941d7248b | |||
| fec02d75b9 | |||
| ab7005bfa4 | |||
| 2dd8e071a8 | |||
| e041eb354e | |||
| d6358f2d18 | |||
| 6ba9ac7e71 | |||
| 5e1cef5b04 | |||
| 5789b52a35 | |||
| eab947dabd | |||
| 2b2cdcd504 | |||
| d4833f2103 | |||
| f285e9514a | |||
| fc05711af3 | |||
| 603042b740 | |||
| 386aed2335 | |||
| 4e48f83df8 | |||
| 7b57c10fb9 | |||
| 1ea523a8b1 | |||
| 34d1510980 | |||
| db6988d87f | |||
| c5edbc12e8 | |||
| fa9e2d8b58 | |||
| 57aafd33f7 | |||
| c9ff03bdf4 | |||
| e967dcc1a7 | |||
| 15fbde6aee | |||
| 50b474966c | |||
| eeb28d3ff4 | |||
| 0f4452fcd0 | |||
| 343c223111 | |||
| 726f2a45dc | |||
| 6f23f8985a | |||
| 752569765e | |||
| 0570c31a3b | |||
| d1bbb75333 | |||
| 9822b38f10 | |||
| dc2ea6fb26 | |||
| 941f70858d | |||
| 3b0dc8cd12 | |||
| 5358318b6f | |||
| e88bc4a2c1 | |||
| 4970ebb19c | |||
| a6ec1e9dd0 | |||
| e0033fb83c | |||
| c5fbfafa62 | |||
| 5e0da4b5ee | |||
| 4b952ed3ff | |||
| c28f197deb | |||
| b63b4c2c19 | |||
| 1994116184 | |||
| d2d4b56c83 | |||
| 439e93b27f | |||
| 5234b78232 | |||
| cc701ed021 | |||
| 06ff2489ae | |||
| aac7fcb6fe | |||
| 9f34d8341a | |||
| 921899fc20 | |||
| f3768c4094 | |||
| 24ec59cd3c | |||
| 47b0cf06a3 | |||
| 7a3fa1280f | |||
| 2628f0bc16 | |||
| 070a606c68 | |||
| 8ef593442b | |||
| 83a66c9f3b | |||
| f312622c4e | |||
| 5fa1dcdb43 | |||
| f2c0c26767 | |||
| f96fdd4505 | |||
| 4e36e57bcb | |||
| dc99997eac | |||
| 32a6bb301e | |||
| b1062ec362 | |||
| 14a6c97e6c | |||
| a78a688961 | |||
| 661b8d9dec | |||
| 909abddce3 | |||
| 5678d4e4fa | |||
| ee9568e574 | |||
| 60b5a1e50a | |||
| 44f2b37760 | |||
| c3b4148b48 | |||
| 8569a0b96f | |||
| 1b14f9daf5 | |||
| 0d2521b4d3 | |||
| 29a8cc034b | |||
| 5862de1d22 | |||
| 2022d08058 | |||
| e3d945e86a | |||
| b3225d1a2f | |||
| d029c122af | |||
| eb1bf09594 | |||
| 6fdadd110b | |||
| b57ddf7b1d | |||
| 3c7d829b22 | |||
| 4a1db8bd3d | |||
| ed548587ab | |||
| dbd1755a42 | |||
| 09d1d1ac2e | |||
| 90f3a22a0b | |||
| 753775479c | |||
| c47b3a935b | |||
| 2eff9d1367 | |||
| 1437b25532 | |||
| 4e39b6ff35 | |||
| 01c48affff | |||
| d6949b0238 | |||
| f60ecf6045 | |||
| f0af72d2f9 | |||
| 9f51b7c925 | |||
| 4ad794c524 | |||
| 4aec47adba | |||
| f38de13d68 | |||
| e6096b71e5 | |||
| 8a789e52cc | |||
| bbb0032181 | |||
| 3751aaf098 | |||
| 75e27a12be | |||
| c19977a6f5 | |||
| 3d6d2b8153 | |||
| 7f4ea06814 | |||
| 3dda8f3cf3 |
@@ -9,6 +9,7 @@ require_once $CFG->libdir.'/adminlib.php';
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
$auth = required_param('auth', PARAM_SAFEDIR);
|
||||
$CFG->pagepath = 'auth/' . $auth;
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$err = array();
|
||||
|
||||
@@ -50,7 +51,7 @@ if ($frm = data_submitted()) {
|
||||
$frm = get_config("auth/$auth");
|
||||
}
|
||||
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
|
||||
+8
-3
@@ -54,7 +54,7 @@
|
||||
if (!$block = blocks_get_record($multiple)) {
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
$block->multiple = intval(!$block->multiple);
|
||||
update_record('block', $block);
|
||||
}
|
||||
|
||||
@@ -179,8 +179,13 @@
|
||||
if($blockobject->has_config()) {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
|
||||
$count = count_records('block_instance', 'blockid', $blockid);
|
||||
|
||||
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
|
||||
// and it should not show up on course search page
|
||||
$count = count_records_sql('SELECT COUNT(*)
|
||||
FROM '.$CFG->prefix.'block_instance
|
||||
WHERE blockid = '.$blockid.' AND
|
||||
pagetype = \'course-view\'');
|
||||
if ($count>0) {
|
||||
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
|
||||
+3
-3
@@ -224,8 +224,8 @@
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if (!empty($CFG->deleteincompleteusers)) {
|
||||
$cuttime = $timenow - ($CFG->deleteincompleteusers * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
@@ -364,7 +364,7 @@
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
$timetocheck = strtotime("today $CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
|
||||
+46
-6
@@ -117,6 +117,16 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ctyperecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
@@ -167,6 +177,16 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ctyperecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
@@ -180,6 +200,11 @@
|
||||
<ON_OK message="questioncwqpfsok" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="globalswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0" requires="1.9">
|
||||
@@ -200,8 +225,9 @@
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.0" level="required">
|
||||
<PHP version="5.2.4" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
@@ -214,9 +240,9 @@
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
@@ -229,12 +255,26 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
<ON_CHECK message="globalswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
|
||||
+193
-1
@@ -525,11 +525,203 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
return 'Error counter was cleared.';
|
||||
} else {
|
||||
return '<p>Session errors can be caused by:<ul><li>unresolved problem in server software (aka random switching of users),</li><li>blocked or modified cookies,</li><li>deleting of active session files.</li></ul></p><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter.</a></p>';
|
||||
return '<p>Session errors can be caused by:</p><ul>' .
|
||||
'<li>unresolved problem in server software (aka random switching of users),</li>' .
|
||||
'<li>blocked or modified cookies,</li>' .
|
||||
'<li>deleting of active session files.</li>' .
|
||||
'</ul><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter</a></p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000012 extends problem_base {
|
||||
function title() {
|
||||
return 'Random questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
return record_exists_select('question', "qtype = 'random' AND parent <> id");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For random questions, question.parent should equal question.id. ' .
|
||||
'There are some questions in your database for which this is not true. ' .
|
||||
'One way that this could have happened is for random questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
|
||||
'<pre>UPDATE ' . $CFG->prefix . 'question SET parent = id WHERE qtype = \'random\' and parent <> id;</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000013 extends problem_base {
|
||||
function title() {
|
||||
return 'Multi-answer questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
$positionexpr = sql_position(sql_concat("','", "q.id", "','"),
|
||||
sql_concat("','", "qma.sequence", "','"));
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question_multianswer qma ON $positionexpr > 0
|
||||
WHERE qma.question <> q.parent") ||
|
||||
record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE q.category <> parent_q.category");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For each sub-question whose id is listed in ' .
|
||||
'question_multianswer.sequence, its question.parent field should equal ' .
|
||||
'question_multianswer.question; and each sub-question should be in the same ' .
|
||||
'category as its parent. There are questions in your database for ' .
|
||||
'which this is not the case. One way that this could have happened is ' .
|
||||
'for multi-answer questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
|
||||
'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
|
||||
'<a href="http://cvs.moodle.org/moodle/question/type/multianswer/db/upgrade.php?revision=1.1.10.2&view=markup">/question/type/multianswer/db/upgrade.php' .
|
||||
'from the 1.9 stable branch</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000014 extends problem_base {
|
||||
function title() {
|
||||
return 'Only multianswer and random questions should be the parent of another question';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>You have questions that violate this in your databse. ' .
|
||||
'You will need to investigate to determine how this happened.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>It is impossible to give a solution without knowing more about ' .
|
||||
' how the problem was caused. You may be able to get help from the ' .
|
||||
'<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000017 extends problem_base {
|
||||
function title() {
|
||||
return 'Question categories tree structure';
|
||||
}
|
||||
function find_problems() {
|
||||
static $answer = null;
|
||||
|
||||
if (is_null($answer)) {
|
||||
$categories = get_records('question_categories', '', '', 'id');
|
||||
|
||||
// Look for missing parents.
|
||||
$missingparent = array();
|
||||
foreach ($categories as $category) {
|
||||
if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
|
||||
$missingparent[$category->id] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for loops.
|
||||
$loops = array();
|
||||
while (!empty($categories)) {
|
||||
$current = array_pop($categories);
|
||||
$thisloop = array($current->id => $current);
|
||||
while (true) {
|
||||
if (isset($thisloop[$current->parent])) {
|
||||
// Loop detected
|
||||
$loops[$current->id] = $thisloop;
|
||||
break;
|
||||
} else if (!isset($categories[$current->parent])) {
|
||||
// Got to the top level, or a category we already know is OK.
|
||||
break;
|
||||
} else {
|
||||
// Continue following the path.
|
||||
$current = $categories[$current->parent];
|
||||
$thisloop[$current->id] = $current;
|
||||
unset($categories[$current->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$answer = array($missingparent, $loops);
|
||||
}
|
||||
|
||||
return $answer;
|
||||
}
|
||||
function exists() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
return !empty($missingparent) || !empty($loops);
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$description = '<p>The question categories should be arranged into tree ' .
|
||||
' structures by the question_categories.parent field. Sometimes ' .
|
||||
' this tree structure gets messed up.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$description .= '<p>The following categories are missing their parents:</p><ul>';
|
||||
foreach ($missingparent as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$description .= '<p>The following categories form a loop of parents:</p><ul>';
|
||||
foreach ($loops as $loop) {
|
||||
$description .= "<li><ul>\n";
|
||||
foreach ($loop as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . " has parent $cat->parent</li>\n";
|
||||
}
|
||||
$description .= "</ul></li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$solution = '<p>Consider executing the following SQL queries. These fix ' .
|
||||
'the problem by moving some categories to the top level.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
return $solution;
|
||||
}
|
||||
}
|
||||
|
||||
class problem_00000x extends problem_base {
|
||||
function title() {
|
||||
|
||||
+24
-5
@@ -282,11 +282,16 @@
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
@@ -409,6 +414,9 @@
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check all auth plugins and upgrade if necessary
|
||||
upgrade_plugins('auth','auth',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all course formats and upgrade if necessary
|
||||
upgrade_plugins('format','course/format',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
@@ -539,15 +547,26 @@
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_box(get_string('globalsquoteswarning', 'admin'), 'generalbox adminwarning');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_box(get_string('globalswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
||||
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (substr($CFG->wwwroot, -1) == '/') {
|
||||
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
||||
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
$strinstallation = get_string('installation', 'install');
|
||||
@@ -582,7 +601,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
'<a href="http://docs.moodle.org/en/Release">'.$CFG->release.'</a> ('.$CFG->version.')<br />'.
|
||||
'<a href="http://docs.moodle.org/en/Release" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
||||
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
||||
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
||||
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
||||
|
||||
@@ -46,7 +46,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -48,7 +48,14 @@
|
||||
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
|
||||
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
|
||||
|
||||
if (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
if ($publish != 1 && $subscribe != 1) {
|
||||
if (false == $host2service) {
|
||||
// We don't have or need a record - do nothing!
|
||||
} else {
|
||||
// We don't need the record - delete it
|
||||
delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
|
||||
}
|
||||
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
$host2service = new stdClass();
|
||||
$host2service->hostid = $_POST['hostid'];
|
||||
$host2service->serviceid = $key;
|
||||
|
||||
@@ -76,7 +76,7 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c0">wwwroot:</td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
|
||||
@@ -50,6 +50,11 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (!empty($form->wwwroot)) {
|
||||
// ensure we remove trailing slashes
|
||||
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
|
||||
|
||||
// ensure the wwwroot starts with a http or https prefix
|
||||
if (strtolower(substr($form->wwwroot, 0, 4)) != 'http') {
|
||||
$form->wwwroot = 'http://'.$form->wwwroot;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
@@ -91,6 +96,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
|
||||
$mnet_peer->deleted = $form->deleted;
|
||||
$mnet_peer->updateparams->deleted = $form->deleted;
|
||||
}
|
||||
|
||||
if (isset($form->public_key)) {
|
||||
@@ -101,9 +107,10 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
} else {
|
||||
$oldkey = $mnet_peer->public_key;
|
||||
$mnet_peer->public_key = $form->public_key;
|
||||
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
$mnet_peer->updateparams->public_key = $form->public_key;
|
||||
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
$mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
if ($mnet_peer->public_key_expires == false) {
|
||||
$mnet_peer->public_key == $oldkey;
|
||||
$errmsg = '<br />';
|
||||
foreach ($mnet_peer->error as $err) {
|
||||
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
// if the config.html contains a hidden form field giving
|
||||
// the module name then the form does not have to prefix all
|
||||
// its variable names, we will do it here.
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($modid == '0') { // special
|
||||
}
|
||||
else {
|
||||
$modname = get_field("modules","name","id",$modid);
|
||||
require_once('mod/'.$modname.'/lib.php');
|
||||
include_once('mod/'.$modname.'/lib.php');
|
||||
}
|
||||
$function = $modname.'_process_email';
|
||||
|
||||
|
||||
@@ -43,9 +43,8 @@
|
||||
</label>
|
||||
<?php check_theme_arrows(); ?>
|
||||
<p class="arrow_button">
|
||||
<input name="add" id="add" type="submit" value="<?php echo ' '.$THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
|
||||
<br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo ' '.$THEME->rarrow.' '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
|
||||
<input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$THEME->rarrow; ?>" title="<?php print_string('remove'); ?>" />
|
||||
</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
@@ -58,7 +57,7 @@
|
||||
<?php
|
||||
$i=0;
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
|
||||
+15
-6
@@ -163,7 +163,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@@ -197,11 +199,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($showall) {
|
||||
$searchtext = '';
|
||||
$previoussearch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
@@ -293,8 +300,9 @@
|
||||
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
}
|
||||
|
||||
$usercount = count_records_sql($countselect . $from . $where) - count($contextusers);
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -320,8 +328,9 @@
|
||||
AND r.roleid = '.$roleid.'
|
||||
'.$selectsql.')
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
$usercount = count_records_select('user', $select) - count($contextusers);
|
||||
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
|
||||
}
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
|
||||
@@ -113,7 +113,8 @@ $contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
// prepare legacy defaults
|
||||
if (!empty($role->legacytype)) {
|
||||
|
||||
@@ -119,9 +119,12 @@
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$rolename = get_field('role', 'name', 'id', $newroleid);
|
||||
add_to_log(SITEID, 'role', 'add', 'admin/roles/manage.php?action=add', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
@@ -228,10 +231,11 @@
|
||||
unassign_capability($lcap, $roleid);
|
||||
}
|
||||
}
|
||||
|
||||
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@@ -342,6 +346,8 @@
|
||||
// dupilcate all the capabilities
|
||||
role_cap_duplicate($sourcerole, $newrole);
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $newrole);
|
||||
add_to_log(SITEID, 'role', 'duplicate', 'admin/roles/manage.php?roleid='.$newrole.'&action=duplicate', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
@@ -352,6 +358,8 @@
|
||||
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
reset_role_capabilities($roleid);
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log(SITEID, 'role', 'reset', 'admin/roles/manage.php?roleid='.$roleid.'&action=reset', $rolename, '', $USER->id);
|
||||
redirect('manage.php?action=view&roleid='.$roleid);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
redirect($baseurl);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', '
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', get_string('emailchangeconfirmation', 'admin'), get_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $ADMIN->add('server', $temp, 0);
|
||||
|
||||
// "email" settingpage
|
||||
$temp = new admin_settingpage('mail', get_string('mail','admin'));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
|
||||
@@ -155,6 +155,15 @@ $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('delet
|
||||
6 => get_string('numhours', '', 6),
|
||||
1 => get_string('numhours', '', 1))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'),
|
||||
168 => get_string('numdays', '', 7),
|
||||
144 => get_string('numdays', '', 6),
|
||||
120 => get_string('numdays', '', 5),
|
||||
96 => get_string('numdays', '', 4),
|
||||
72 => get_string('numdays', '', 3),
|
||||
48 => get_string('numdays', '', 2),
|
||||
24 => get_string('numdays', '', 1))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
|
||||
1000 => get_string('numdays', '', 1000),
|
||||
365 => get_string('numdays', '', 365),
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
if (!$ok or !confirm_sesskey()) {
|
||||
$message = '<br /><br />';
|
||||
$message .= $CFG->dataroot.'/temp/olson.txt<br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezones.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezones/">http://download.moodle.org/timezones/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezones.txt">'.$CFG->dirroot.'/lib/timezones.txt</a><br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezone.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezone/">http://download.moodle.org/timezone/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezone.txt">'.$CFG->dirroot.'/lib/timezone.txt</a><br />';
|
||||
$message .= '<br />';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
/// Next, look for a CSV file locally
|
||||
|
||||
$source = $CFG->dataroot.'/temp/timezones.txt';
|
||||
$source = $CFG->dataroot.'/temp/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) {
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -64,17 +64,17 @@
|
||||
|
||||
/// Otherwise, let's try moodle.org's copy
|
||||
|
||||
$source = 'http://download.moodle.org/timezones/';
|
||||
$source = 'http://download.moodle.org/timezone/';
|
||||
if (!$importdone and ini_get('allow_url_fopen')) {
|
||||
if (is_readable($source) && $contents = file_get_contents($source)) { // Grab whole page
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezones.txt', 'w')) { // Make local copy
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezone.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $contents);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezones.txt', 'timezone')) { // Parse it
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezone.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezones.txt');
|
||||
unlink($CFG->dataroot.'/temp/timezone.txt');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
/// Final resort, use the copy included in Moodle
|
||||
|
||||
$source = $CFG->dirroot.'/lib/timezones.txt';
|
||||
$source = $CFG->dirroot.'/lib/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) { // Distribution file
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('upgradesettings', $adminroot); // now hidden page
|
||||
|
||||
|
||||
@@ -104,8 +104,6 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
"maildisplay" => 1,
|
||||
"htmleditor" => 1,
|
||||
"autosubscribe" => 1,
|
||||
"idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"course1" => 1,
|
||||
"course2" => 1,
|
||||
"course3" => 1,
|
||||
|
||||
+16
-4
@@ -118,8 +118,9 @@
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
// not sure if this is needed. unenrol_student($user->id); // From all courses
|
||||
delete_records('role_assignments', 'userid', $user->id); // unassign all roles
|
||||
// Removing a user may have more requirements than just removing their role assignments.
|
||||
// Use 'role_unassign' to make sure that all necessary actions occur.
|
||||
role_unassign(0, $user->id);
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
} else {
|
||||
@@ -202,7 +203,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere, false);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
@@ -303,7 +304,18 @@
|
||||
|
||||
$mainadmin = get_admin();
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$override = new object();
|
||||
$override->firstname = 'firstname';
|
||||
$override->lastname = 'lastname';
|
||||
$fullnamelanguage = get_string('fullnamedisplay', '', $override);
|
||||
if (($CFG->fullnamedisplay == 'firstname lastname') or
|
||||
($CFG->fullnamedisplay == 'firstname') or
|
||||
($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
|
||||
$fullnamedisplay = "$firstname / $lastname";
|
||||
} else { // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname')
|
||||
$fullnamedisplay = "$lastname / $firstname";
|
||||
}
|
||||
$table->head = array ($fullnamedisplay, $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
|
||||
@@ -130,6 +130,18 @@ class get_db_directories extends XMLDBAction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, course formats (course/format/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('course/format', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/course/format/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, enrolment plugins (enrol/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('enrol', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -141,7 +153,7 @@ class get_db_directories extends XMLDBAction {
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Now, groups
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/group/db';
|
||||
|
||||
+1
-1
@@ -1123,4 +1123,4 @@ if (!empty($this->config->attrcreators)) {
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -173,6 +173,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
if ($rs = $authdb->Execute($sql)) {
|
||||
if ( $rs->RecordCount() == 1 ) {
|
||||
$fields_obj = rs_fetch_record($rs);
|
||||
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
|
||||
foreach ($selectfields as $localname=>$externalname) {
|
||||
$result[$localname] = $textlib->convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
|
||||
}
|
||||
@@ -429,6 +430,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
print_error('auth_dbcantconnect','auth');
|
||||
} else if ( $rs->RecordCount() ) {
|
||||
while ($rec = rs_fetch_next_record($rs)) {
|
||||
$rec = (object)array_change_key_case((array)$rec , CASE_LOWER);
|
||||
array_push($result, $rec->username);
|
||||
}
|
||||
}
|
||||
|
||||
+70
-22
@@ -45,11 +45,36 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$this->config->{$key} = $value[$this->config->user_type];
|
||||
}
|
||||
}
|
||||
//hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) { // Can't send empty filter
|
||||
$this->config->objectclass='objectClass=*';
|
||||
} else if (stripos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
$this->config->objectclass = 'objectClass='.$this->config->objectclass;
|
||||
|
||||
// Hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) {
|
||||
// Can't send empty filter
|
||||
$this->config->objectclass='(objectClass=*)';
|
||||
} else if (stripos($this->config->objectclass, 'objectClass=') === 0) {
|
||||
// Value is 'objectClass=some-string-here', so just add ()
|
||||
// around the value (filter _must_ have them).
|
||||
$this->config->objectclass = '('.$this->config->objectclass.')';
|
||||
} else if (stripos($this->config->objectclass, '(') !== 0) {
|
||||
// Value is 'some-string-not-starting-with-left-parentheses',
|
||||
// which is assumed to be the objectClass matching value.
|
||||
// So build a valid filter with it.
|
||||
$this->config->objectclass = '(objectClass='.$this->config->objectclass.')';
|
||||
} else {
|
||||
// There is an additional possible value
|
||||
// '(some-string-here)', that can be used to specify any
|
||||
// valid filter string, to select subsets of users based
|
||||
// on any criteria. For example, we could select the users
|
||||
// whose objectClass is 'user' and have the
|
||||
// 'enabledMoodleUser' attribute, with something like:
|
||||
//
|
||||
// (&(objectClass=user)(enabledMoodleUser=1))
|
||||
//
|
||||
// This is only used in the functions that deal with the
|
||||
// whole potential set of users (currently sync_users()
|
||||
// and get_user_list() only).
|
||||
//
|
||||
// In this particular case we don't need to do anything,
|
||||
// so leave $this->config->objectclass as is.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -97,7 +122,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
else {
|
||||
@ldap_close($ldapconnection);
|
||||
print_error('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
print_error('auth_ldap_noconnect','auth','',$this->config->host_url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +298,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$newuser['userpassword'] = $extpassword;
|
||||
break;
|
||||
default:
|
||||
print_error('auth_ldap_unsupportedusertype','auth',$this->config->user_type);
|
||||
print_error('auth_ldap_unsupportedusertype','auth','',$this->config->user_type);
|
||||
}
|
||||
$uadd = ldap_add($ldapconnection, $this->config->user_attribute.'="'.$this->ldap_addslashes($userobject->username).','.$this->config->create_context.'"', $newuser);
|
||||
ldap_close($ldapconnection);
|
||||
@@ -303,7 +328,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
$user_dn = $this->ldap_find_userdn($ldapconnection, $extusername);
|
||||
$search_attribs = array($this->config->expireattr);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, 'objectclass=*', $search_attribs);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||
if ($sr) {
|
||||
$info = $this->ldap_get_entries($ldapconnection, $sr);
|
||||
if (!empty ($info) and !empty($info[0][$this->config->expireattr][0])) {
|
||||
@@ -400,7 +425,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
//// get user's list from ldap to sql in a scalable fashion
|
||||
////
|
||||
// prepare some data we'll need
|
||||
$filter = "(&(".$this->config->user_attribute."=*)(".$this->config->objectclass."))";
|
||||
$filter = '(&('.$this->config->user_attribute.'=*)'.$this->config->objectclass.')';
|
||||
|
||||
$contexts = explode(";",$this->config->contexts);
|
||||
|
||||
@@ -431,7 +456,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
do {
|
||||
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
|
||||
$value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8');
|
||||
array_push($fresult, $value);
|
||||
// usernames are __always__ lowercase.
|
||||
array_push($fresult, moodle_strtolower($value));
|
||||
if (count($fresult) >= $bulk_insert_records) {
|
||||
$this->ldap_bulk_insert($fresult, $temptable);
|
||||
$fresult = array();
|
||||
@@ -694,7 +720,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id);
|
||||
if (empty($user)) { // trouble
|
||||
error_log("Cannot update non-existent user: ".stripslashes($username));
|
||||
print_error('auth_dbusernotexist','auth',$username);
|
||||
print_error('auth_dbusernotexist','auth','',$username);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -834,6 +860,21 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return true; // just change auth and skip update
|
||||
}
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
|
||||
// Before doing anything else, make sure really need to update anything
|
||||
// in the external LDAP server.
|
||||
$update_external = false;
|
||||
foreach ($attrmap as $key => $ldapkeys) {
|
||||
if (!empty($this->config->{'field_updateremote_'.$key})) {
|
||||
$update_external = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$update_external) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$extoldusername = $textlib->convert($olduser->username, 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
@@ -841,7 +882,6 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$search_attribs = array();
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
foreach ($attrmap as $key => $values) {
|
||||
if (!is_array($values)) {
|
||||
$values = array($values);
|
||||
@@ -862,9 +902,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$user_entry = $this->ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (empty($user_entry)) {
|
||||
$error = 'ldap: Could not find user while updating externally. '.
|
||||
'Details follow: search base: \''.$user_dn.'\'; search filter: \''.
|
||||
$this->config->objectclass.'\'; search attributes: ';
|
||||
foreach ($search_attribs as $attrib) {
|
||||
$error .= $attrib.' ';
|
||||
}
|
||||
error_log($error);
|
||||
return false; // old user not found!
|
||||
} else if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
error_log('ldap: Strange! More than one user record found in ldap. Only using the first one.');
|
||||
return false;
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -890,6 +937,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
$nuvalue = $textlib->convert($newuser->$key, 'utf-8', $this->config->ldapencoding);
|
||||
empty($nuvalue) ? $nuvalue = array() : $nuvalue;
|
||||
$ouvalue = $textlib->convert($olduser->$key, 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
foreach ($ldapkeys as $ldapkey) {
|
||||
@@ -1019,7 +1067,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
//Update password expiration time, grace logins count
|
||||
$search_attribs = array($this->config->expireattr, 'passwordExpirationInterval','loginGraceLimit' );
|
||||
$sr = ldap_read($ldapconnection, $user_dn, 'objectclass=*', $search_attribs);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||
if ($sr) {
|
||||
$info=$this->ldap_get_entries($ldapconnection, $sr);
|
||||
$newattrs = array();
|
||||
@@ -1156,7 +1204,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
'rfc2307' => 'shadowExpire',
|
||||
'rfc2307bis' => 'shadowExpire',
|
||||
'samba' => '', //No support yet
|
||||
'ad' => '', //No support yet
|
||||
'ad' => 'pwdLastSet',
|
||||
'default' => ''
|
||||
);
|
||||
return $default;
|
||||
@@ -1367,7 +1415,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
//If any of servers are alive we have already returned connection
|
||||
print_error('auth_ldap_noconnect_all','auth',$this->config->user_type);
|
||||
print_error('auth_ldap_noconnect_all','auth', '', $debuginfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1458,7 +1506,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
|
||||
if ($filter=="*") {
|
||||
$filter = "(&(".$this->config->user_attribute."=*)(".$this->config->objectclass."))";
|
||||
$filter = '(&('.$this->config->user_attribute.'=*)'.$this->config->objectclass.')';
|
||||
}
|
||||
|
||||
$contexts = explode(";",$this->config->contexts);
|
||||
@@ -1650,7 +1698,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
if (!isset($config->forcechangepassword))
|
||||
{$config->forcechangepassword = 0; }
|
||||
if (!isset($config->stdchangepassword))
|
||||
{$config->forcechangepassword = 0; }
|
||||
{$config->stdchangepassword = 0; }
|
||||
if (!isset($config->passtype))
|
||||
{$config->passtype = 'plaintext'; }
|
||||
if (!isset($config->changepasswordurl))
|
||||
@@ -1671,7 +1719,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
set_config('bind_dn', $config->bind_dn, 'auth/ldap');
|
||||
set_config('bind_pw', $config->bind_pw, 'auth/ldap');
|
||||
set_config('version', $config->version, 'auth/ldap');
|
||||
set_config('objectclass', $config->objectclass, 'auth/ldap');
|
||||
set_config('objectclass', trim($config->objectclass), 'auth/ldap');
|
||||
set_config('memberattribute', $config->memberattribute, 'auth/ldap');
|
||||
set_config('memberattribute_isdn', $config->memberattribute_isdn, 'auth/ldap');
|
||||
set_config('creators', $config->creators, 'auth/ldap');
|
||||
@@ -1738,7 +1786,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
// If UF_DONT_EXPIRE_PASSWD flag is set in user's
|
||||
// userAccountControl attribute, the password doesn't expire.
|
||||
$sr = ldap_read($ldapconn, $user_dn, 'objectclass=*',
|
||||
$sr = ldap_read($ldapconn, $user_dn, '(objectClass=*)',
|
||||
array('userAccountControl'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error getting userAccountControl for $user_dn");
|
||||
@@ -1784,7 +1832,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
// details below).
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
$sr = ldap_read($ldapconn, ROOTDSE, 'objectclass=*',
|
||||
$sr = ldap_read($ldapconn, ROOTDSE, '(objectClass=*)',
|
||||
array('defaultNamingContext'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error querying rootDSE for Active Directory");
|
||||
@@ -1794,7 +1842,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$domaindn = $info[0]['defaultNamingContext'][0];
|
||||
|
||||
$sr = ldap_read ($ldapconn, $domaindn, 'objectclass=*',
|
||||
$sr = ldap_read ($ldapconn, $domaindn, '(objectClass=*)',
|
||||
array('maxPwdAge'));
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$maxpwdage = $info[0]['maxPwdAge'][0];
|
||||
|
||||
+10
-7
@@ -89,7 +89,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// session okay, try getting the user
|
||||
if (!$user = get_complete_user_data('id', $mnet_session->userid)) {
|
||||
if (!$user = get_record('user', 'id', $mnet_session->userid)) {
|
||||
echo mnet_server_fault(3, get_string('authfail_usermismatch', 'mnet'));
|
||||
exit;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$userdata['session.gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
|
||||
$userdata['picture'] = $user->picture;
|
||||
if (!empty($user->picture)) {
|
||||
$imagefile = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$imagefile = make_user_directory($user->id, true) . "/f1.jpg";
|
||||
if (file_exists($imagefile)) {
|
||||
$userdata['imagehash'] = sha1(file_get_contents($imagefile));
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
// verify the remote host is configured locally before attempting RPC call
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot)) {
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot, 'deleted', 0)) {
|
||||
error(get_string('notpermittedtoland', 'mnet'));
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// add the remote user to the database if necessary, and if allowed
|
||||
// TODO: refactor into a separate function
|
||||
if (! $localuser->id) {
|
||||
if (empty($localuser) || ! $localuser->id) {
|
||||
if (empty($this->config->auto_add_remote_users)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// TODO: fetch image if it has changed
|
||||
if ($key == 'imagehash') {
|
||||
$dirname = "{$CFG->dataroot}/users/{$localuser->id}";
|
||||
$dirname = make_user_directory($localuser->id, true);
|
||||
$filename = "$dirname/f1.jpg";
|
||||
|
||||
$localhash = '';
|
||||
@@ -1262,8 +1262,8 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG;
|
||||
|
||||
if ($user = get_record('user', 'username', addslashes($username), 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
$filename1 = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$filename2 = "{$CFG->dataroot}/users/{$user->id}/f2.jpg";
|
||||
$filename1 = make_user_directory($user->id, true) . "/f1.jpg";
|
||||
$filename2 = make_user_directory($user->id, true) . "/f2.jpg";
|
||||
$return = array();
|
||||
if (file_exists($filename1)) {
|
||||
$return['f1'] = base64_encode(file_get_contents($filename1));
|
||||
@@ -1311,9 +1311,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
svc.apiversion,
|
||||
h2s.id as h2s_id
|
||||
FROM
|
||||
{$CFG->prefix}mnet_host h,
|
||||
{$CFG->prefix}mnet_service svc,
|
||||
{$CFG->prefix}mnet_host2service h2s
|
||||
WHERE
|
||||
h.deleted = '0' AND
|
||||
h.id = h2s.hostid AND
|
||||
h2s.hostid = '$mnethostid' AND
|
||||
h2s.serviceid = svc.id AND
|
||||
svc.name = '$servicename' AND
|
||||
|
||||
@@ -58,29 +58,56 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
|
||||
//inform the user.
|
||||
// TODO: Move this logic to one function to be shared by any (manual, scheduled) backup
|
||||
if ($backupprefs->backup_users == 2) {
|
||||
if ($allmods = get_records("modules") ) {
|
||||
if ($allmods = get_records('modules') ) {
|
||||
foreach ($allmods as $mod) {
|
||||
/// Reset global user_info settings to "no" (0)
|
||||
$modname = $mod->name;
|
||||
$var = "backup_user_info_".$modname;
|
||||
$var = 'backup_user_info_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
$var = "backup_".$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
if ($modname == "exercise" || $modname == "workshop") {
|
||||
/// Reset each instance userinfo settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module userinfo to no (0)
|
||||
$backupprefs->mods[$modname]->userinfo = 0;
|
||||
/// Set the instances to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->userinfo = 0;
|
||||
$var = 'backup_user_info_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
/// If modules are workshop or exercise, disable their backup completely
|
||||
if ($modname == 'exercise' || $modname == 'workshop') {
|
||||
$var = 'backup_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
/// Reset each instance backup settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module backup to no (0)
|
||||
$backupprefs->mods[$modname]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instances';
|
||||
$backupprefs->$var = 0;
|
||||
/// Set the instances backup to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
}
|
||||
|
||||
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
|
||||
echo "<hr />";
|
||||
}
|
||||
|
||||
+31
-11
@@ -387,7 +387,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (!isset($$var)) {
|
||||
@@ -401,6 +401,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now set instances
|
||||
if ($coursemods = get_course_mods($course->id)) {
|
||||
foreach ($coursemods as $mod) {
|
||||
@@ -415,8 +416,15 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally, clean all the $preferences->mods[] not having instances. Nothing to backup about them
|
||||
foreach ($preferences->mods as $modname => $mod) {
|
||||
if (!isset($mod->instances)) {
|
||||
unset($preferences->mods[$modname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Convert other parameters
|
||||
if ($status) {
|
||||
$preferences->backup_metacourse = $backup_config->backup_sche_metacourse;
|
||||
@@ -429,7 +437,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$preferences->backup_destination = $backup_config->backup_sche_destination;
|
||||
$preferences->backup_keep = $backup_config->backup_sche_keep;
|
||||
}
|
||||
|
||||
|
||||
//Calculate the backup string
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating backup name");
|
||||
@@ -474,7 +482,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$keep_name .= moodle_strtolower($backup_shortname)."-";
|
||||
//And finally, clean everything
|
||||
$keep_name = clean_filename($keep_name);
|
||||
|
||||
|
||||
$preferences->backup_name = $backup_name;
|
||||
$preferences->keep_name = $keep_name;
|
||||
}
|
||||
@@ -643,10 +651,10 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," categories & questions");
|
||||
$status = backup_question_categories($backup_file,$preferences);
|
||||
}
|
||||
|
||||
|
||||
//Print logs if selected
|
||||
if ($status) {
|
||||
if ($preferences->backup_logs) {
|
||||
if ($preferences->backup_logs) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," logs");
|
||||
$status = backup_log_info($backup_file,$preferences);
|
||||
}
|
||||
@@ -657,7 +665,13 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," scales");
|
||||
$status = backup_scales_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
|
||||
//Print groupings info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groupings");
|
||||
$status = backup_groupings_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print groups info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groups");
|
||||
@@ -682,9 +696,9 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
$mods_to_backup = false;
|
||||
//Check if we have any mod to backup
|
||||
foreach ($preferences->mods as $module) {
|
||||
if ($module->backup) {
|
||||
if ($module->backup) {
|
||||
$mods_to_backup = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//If we have to backup some module
|
||||
if ($mods_to_backup) {
|
||||
@@ -703,7 +717,13 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
//Backup course format data, if any.
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," course format data");
|
||||
$status = backup_format_data($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
if ($status) {
|
||||
$status = backup_course_end($backup_file,$preferences);
|
||||
}
|
||||
@@ -713,7 +733,7 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
backup_close_xml($backup_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Now, if selected, copy user files
|
||||
if ($status) {
|
||||
if ($preferences->backup_user_files) {
|
||||
|
||||
+133
-187
@@ -2,82 +2,78 @@
|
||||
//This file contains all the function needed in the backup utility
|
||||
//except the mod-related funtions that are into every backuplib.php inside
|
||||
//every mod directory
|
||||
|
||||
//Calculate the number of users to backup and put their ids in backup_ids
|
||||
//Return an array of info (name,value)
|
||||
function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
//$backup_users=0-->all
|
||||
// 1-->course (needed + enrolled)
|
||||
// 2-->none
|
||||
|
||||
global $CFG;
|
||||
global $db;
|
||||
/**
|
||||
* This function calculates the users to be added to backup based in the
|
||||
* settings defined at backup. All the resulting user ids are sent to
|
||||
* backup_ids for later usage.
|
||||
* @param int $courseid id of the course to backup
|
||||
* @param int $backup_unique_code unique code of the backup being executed
|
||||
* @param int $backup_unique_code setting specifying what users to export (0=all, 1=needed, 2=none)
|
||||
* @param int $backup_messages flag (true/false) defining if messages must be
|
||||
* considered to extract needed users
|
||||
* @return array one array (key, value) sumarizing the result of the function (number of users)
|
||||
*/
|
||||
function user_check_backup($courseid,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$count_users = 0;
|
||||
$backupable_users = array();
|
||||
|
||||
//If we've selected none, simply return 0
|
||||
if ($backup_users == 0 or $backup_users == 1) {
|
||||
|
||||
//Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($course, $backup_messages);
|
||||
if ($backup_users == 0) { /// All users
|
||||
$backupable_users = backup_get_all_users();
|
||||
|
||||
//Calculate enrolled users (students + teachers)
|
||||
$enrolled_users = backup_get_enrolled_users($course);
|
||||
} else if ($backup_users == 1) { /// Needed users
|
||||
|
||||
//Calculate all users (every record in users table)
|
||||
$all_users = backup_get_all_users();
|
||||
/// Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($courseid, $backup_messages);
|
||||
|
||||
//Calculate course users (needed + enrolled)
|
||||
//First, needed
|
||||
$course_users = $needed_users;
|
||||
|
||||
//Now, enrolled
|
||||
/// Calculate enrolled users (having course:view cap)
|
||||
$enrolled_users = backup_get_enrolled_users($courseid);
|
||||
|
||||
/// Calculate backupable users (needed + enrolled)
|
||||
/// First, needed
|
||||
$backupable_users = $needed_users;
|
||||
|
||||
/// Now, enrolled
|
||||
if ($enrolled_users) {
|
||||
foreach ($enrolled_users as $enrolled_user) {
|
||||
$course_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
$backupable_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
}
|
||||
}
|
||||
|
||||
//Now, depending of parameters, create $backupable_users
|
||||
if ($backup_users == 0) {
|
||||
$backupable_users = $all_users;
|
||||
} else {
|
||||
$backupable_users = $course_users;
|
||||
}
|
||||
|
||||
//If we have backupable users
|
||||
if ($backupable_users) {
|
||||
//Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
//Is needed user (exists in needed_users)
|
||||
if (isset($needed_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} else if (isset($course_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} // Yu: also needed because they can view course
|
||||
// might need another variable
|
||||
|
||||
//Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
//Insert the record id. backup_users decide it.
|
||||
//When all users
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
//Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
}
|
||||
|
||||
//Prepare Info
|
||||
//Gets the user data
|
||||
/// If we have backupable users
|
||||
if ($backupable_users) {
|
||||
/// Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
/// Is needed user or enrolled user, mark it as needed
|
||||
if (isset($needed_users[$backupable_user->id]) || isset($enrolled_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} /// Yu: also needed because they can view course
|
||||
/// might need another variable
|
||||
|
||||
/// Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
/// TODO: Change this call inserting to a standard backup_putid() call
|
||||
/// And read data acordingly with backup_getid() when needed.
|
||||
/// TODO: Also analyse it the "needed" info is really needed for anything. Drop if not.
|
||||
/// Insert the user to the backup_ids table. backup_user_info() will use that info
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
/// Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
|
||||
/// Prepare Info
|
||||
/// Gets the user data
|
||||
$info[0][0] = get_string("users");
|
||||
$info[0][1] = $count_users;
|
||||
|
||||
@@ -313,7 +309,7 @@
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$backup_unique_code."/user_files",true);
|
||||
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$backup_unique_code."/user_files",true);
|
||||
|
||||
return $status;
|
||||
}
|
||||
@@ -667,7 +663,7 @@
|
||||
/// write local course overrides here?
|
||||
write_role_overrides_xml($bf, $context, 3);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 3);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 3);
|
||||
//Print header end
|
||||
fwrite ($bf,end_tag("HEADER",2,true));
|
||||
} else {
|
||||
@@ -918,7 +914,7 @@
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End Block
|
||||
fwrite ($bf,end_tag('BLOCK',3,true));
|
||||
}
|
||||
@@ -1054,9 +1050,9 @@
|
||||
// get all the role_capabilities overrides in this mod
|
||||
write_role_overrides_xml($bf, $context, 6);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 6);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 6);
|
||||
/// write role_assign code here
|
||||
|
||||
|
||||
fwrite ($bf,end_tag("MOD",5,true));
|
||||
}
|
||||
//check for next
|
||||
@@ -1151,26 +1147,10 @@
|
||||
/// write assign/override code for context_userid
|
||||
|
||||
$user->isneeded = strpos($user->info,"needed");
|
||||
//Output every user role (with its associated info)
|
||||
/*
|
||||
$user->isadmin = strpos($user->info,"admin");
|
||||
$user->iscoursecreator = strpos($user->info,"coursecreator");
|
||||
$user->isteacher = strpos($user->info,"teacher");
|
||||
$user->isstudent = strpos($user->info,"student");
|
||||
|
||||
|
||||
if ($user->isadmin!==false or
|
||||
$user->iscoursecreator!==false or
|
||||
$user->isteacher!==false or
|
||||
$user->isstudent!==false or
|
||||
$user->isneeded!==false) {
|
||||
*/
|
||||
|
||||
fwrite ($bf,start_tag("ROLES",4,true));
|
||||
if ($user->info != "needed" && $user->info!="") {
|
||||
//Begin ROLES tag
|
||||
|
||||
//PRINT ROLE INFO
|
||||
//Admins
|
||||
$roles = explode(",", $user->info);
|
||||
foreach ($roles as $role) {
|
||||
if ($role!="" && $role!="needed") {
|
||||
@@ -1178,66 +1158,10 @@
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,$role));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if ($user->isadmin!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"admin"));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//CourseCreator
|
||||
if ($user->iscoursecreator!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"coursecreator"));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//Teacher
|
||||
if ($user->isteacher!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"teacher"));
|
||||
//Get specific info for teachers
|
||||
$tea = get_record("user_teachers","userid",$user->old_id,"course",$preferences->backup_course);
|
||||
fwrite ($bf,full_tag("AUTHORITY",6,false,$tea->authority));
|
||||
fwrite ($bf,full_tag("TEA_ROLE",6,false,$tea->role));
|
||||
fwrite ($bf,full_tag("EDITALL",6,false,$tea->editall));
|
||||
fwrite ($bf,full_tag("TIMESTART",6,false,$tea->timestart));
|
||||
fwrite ($bf,full_tag("TIMEEND",6,false,$tea->timeend));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
|
||||
fwrite ($bf,full_tag("ENROL",6,false,$tea->enrol));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//Student
|
||||
if ($user->isstudent!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"student"));
|
||||
//Get specific info for students
|
||||
$stu = get_record("user_students","userid",$user->old_id,"course",$preferences->backup_course);
|
||||
fwrite ($bf,full_tag("TIMESTART",6,false,$stu->timestart));
|
||||
fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
|
||||
fwrite ($bf,full_tag("TIME",6,false,$stu->time));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
|
||||
fwrite ($bf,full_tag("ENROL",6,false,$stu->enrol));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
//Needed
|
||||
if ($user->isneeded!==false) {
|
||||
//Print ROLE start
|
||||
@@ -1270,7 +1194,7 @@
|
||||
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End User tag
|
||||
fwrite ($bf,end_tag("USER",3,true));
|
||||
//Do some output
|
||||
@@ -1698,9 +1622,15 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get groups_members
|
||||
$groups_members = groups_get_member_records($groupid);
|
||||
|
||||
//Get groups_members that are being included in backup
|
||||
$groups_members = get_records_sql("SELECT gm.*
|
||||
FROM {$CFG->prefix}groups_members gm,
|
||||
{$CFG->prefix}backup_ids bi
|
||||
WHERE gm.groupid = $groupid
|
||||
AND bi.backup_code = $preferences->backup_unique_code
|
||||
AND bi.table_name = 'user'
|
||||
AND bi.old_id = gm.userid");
|
||||
|
||||
//Pring groups_members header
|
||||
if ($groups_members) {
|
||||
//Pring groups_members header
|
||||
@@ -1849,6 +1779,16 @@
|
||||
|
||||
global $CFG,$preferences;
|
||||
|
||||
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
|
||||
/// heavy interlinking. Just a few cpu cycles saved.
|
||||
if ($content === NULL) {
|
||||
return NULL;
|
||||
} else if ($content === '') {
|
||||
return '';
|
||||
} else if (is_numeric($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Use one static variable to cache all the require_once calls that,
|
||||
//under PHP5 seems to increase load too much, and we are requiring
|
||||
//them here thousands of times (one per content). MDL-8700.
|
||||
@@ -1911,26 +1851,29 @@
|
||||
//in temp/backup/$backup_code dir
|
||||
$status = check_and_create_user_files_dir($preferences->backup_unique_code);
|
||||
|
||||
//Now iterate over directories under "users" to check if that user must be
|
||||
//copied to backup
|
||||
//Now iterate over directories under "user" to check if that user must be copied to backup
|
||||
|
||||
// Method to get a list of userid=>array(basedir => $basedir, userfolder => $userfolder)
|
||||
$userlist = get_user_directories();
|
||||
|
||||
$rootdir = $CFG->dataroot."/users";
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$preferences->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/user_files/".$dir);
|
||||
}
|
||||
foreach ($userlist as $userid => $userinfo) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = count_records("backup_ids","backup_code",$preferences->backup_unique_code, "table_name","user", "old_id",$userid);
|
||||
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$parts = explode('/', $userinfo['userfolder']);
|
||||
$status = true;
|
||||
|
||||
if (is_array($parts)) {
|
||||
$group = $parts[0];
|
||||
$userid = $parts[1];
|
||||
|
||||
// Create group dir first
|
||||
$status = check_dir_exists("$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/". $group, true);
|
||||
}
|
||||
$status = $status && backup_copy_file($userinfo['basedir'] . '/' . $userinfo['userfolder'],
|
||||
"$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/{$userinfo['userfolder']}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2300,40 +2243,43 @@
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_OVERRIDES", $startlevel, true));
|
||||
}
|
||||
|
||||
|
||||
/* function to print xml for assignment */
|
||||
function write_role_assignments_xml($bf, $context, $startlevel) {
|
||||
function write_role_assignments_xml($bf, $preferences, $context, $startlevel) {
|
||||
/// write role_assign code here
|
||||
fwrite ($bf, start_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
|
||||
|
||||
if ($roles = get_roles_with_assignment_on_context($context)) {
|
||||
foreach ($roles as $role) {
|
||||
foreach ($roles as $role) {
|
||||
fwrite ($bf, start_tag("ROLE", $startlevel+1, true));
|
||||
fwrite ($bf, full_tag("ID", $startlevel+2, false, $role->id));
|
||||
fwrite ($bf, full_tag("NAME", $startlevel+2, false, $role->name));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, start_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
if ($assignments = get_users_from_role_on_context($role, $context)) {
|
||||
foreach ($assignments as $assignment) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
/// Role assignments are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $assignment->userid)) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
while($filename = readdir($opendirectory)) {
|
||||
while(false !== ($filename = readdir($opendirectory))) {
|
||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||
$subdirs[] = $filename;
|
||||
}
|
||||
|
||||
+6
-6
@@ -119,7 +119,7 @@
|
||||
}
|
||||
|
||||
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
|
||||
while($entry = readdir($handle)) {
|
||||
while(false !== ($entry = readdir($handle))) {
|
||||
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
|
||||
$dir_subdirs[] = $dir. $slash .$entry;
|
||||
}
|
||||
@@ -143,7 +143,7 @@
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (rmdir($dir_subdirs[$i]) == FALSE) {
|
||||
if (remove_dir($dir_subdirs[$i]) == FALSE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -215,7 +215,7 @@
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -299,10 +299,10 @@
|
||||
if (!is_dir($to_file)) {
|
||||
//echo "<br />Creating ".$to_file; //Debug
|
||||
umask(0000);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
+3
-2
@@ -55,7 +55,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -105,7 +106,7 @@
|
||||
print_header("$site->shortname: $strcourserestore", $site->fullname,
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
|
||||
print_heading(get_string("restorecancelled"));
|
||||
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
print_continue("$CFG->wwwroot/course/view.php?id=".$id);
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
} else {
|
||||
$optdimmed = '';
|
||||
}
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
}
|
||||
print_simple_box_end();
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<td align=\"right\">";
|
||||
print_string("shortname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"15\" size=\"10\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"15\" size=\"10\" value=\"".s($form1->shortname)."\" alt=\"".get_string("shortname")."\" />" ;
|
||||
helpbutton("courseshortname", get_string("shortname")) ;
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
echo "</td>";
|
||||
@@ -233,7 +233,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<td align=\"right\">";
|
||||
print_string("fullname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"$form1->fullname\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
echo "<td><input type=\"text\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"".s($form1->fullname)."\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
helpbutton("coursefullname", get_string("fullname")) ;
|
||||
if (isset($err["fullname"])) formerr($err["fullname"]);
|
||||
echo"</td></tr>";
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+221
-94
@@ -71,6 +71,42 @@
|
||||
echo "<ul>";
|
||||
}
|
||||
|
||||
// Recode links in the course summary.
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('course');
|
||||
}
|
||||
$course = get_record('course', 'id', $restore->course_id, '', '', '', '', 'id,summary');
|
||||
$coursesummary = restore_decode_content_links_worker($course->summary, $restore);
|
||||
if ($coursesummary != $course->summary) {
|
||||
$course->summary = addslashes($coursesummary);
|
||||
if (!update_record('course', $course)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
// Recode links in section summaries.
|
||||
$sections = get_records('course_sections', 'course', $restore->course_id, 'id', 'id,summary');
|
||||
if ($sections) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('sections');
|
||||
}
|
||||
foreach ($sections as $section) {
|
||||
$sectionsummary = restore_decode_content_links_worker($section->summary, $restore);
|
||||
if ($sectionsummary != $section->summary) {
|
||||
$section->summary = addslashes($sectionsummary);
|
||||
if (!update_record('course_sections', $section)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Restore links in modules.
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
@@ -800,6 +836,11 @@
|
||||
continue;
|
||||
}
|
||||
$getid = backup_getid($restore->backup_unique_code, $parts[1], $instance->pageid);
|
||||
|
||||
if (empty($getid->new_id)) {
|
||||
// Failed, perhaps the module was not included in the restore MDL-13554
|
||||
continue;
|
||||
}
|
||||
$instance->pageid = $getid->new_id;
|
||||
}
|
||||
else {
|
||||
@@ -855,10 +896,22 @@
|
||||
|
||||
//Add this instance
|
||||
$instance->blockid = $blocks[$instance->name]->id;
|
||||
|
||||
if ($newid = insert_record('block_instance', $instance)) {
|
||||
if (!empty($instance->id)) { // this will only be set if we come from 1.7 and above backups
|
||||
backup_putid ($restore->backup_unique_code,"block_instance",$instance->id,$newid);
|
||||
|
||||
if (!empty($instance->id)) {
|
||||
$oldid = $instance->id;
|
||||
} else {
|
||||
$oldid = 0;
|
||||
}
|
||||
|
||||
if ($instance->id = insert_record('block_instance', $instance)) {
|
||||
// Create block instance
|
||||
if (!$blockobj = block_instance($instance->name, $instance)) {
|
||||
$status = false;
|
||||
break;
|
||||
}
|
||||
// Save oldid after block restore process because info will be over-written with blank string
|
||||
if ($oldid) {
|
||||
backup_putid ($restore->backup_unique_code,"block_instance",$oldid,$instance->id);
|
||||
}
|
||||
} else {
|
||||
$status = false;
|
||||
@@ -1497,7 +1550,7 @@
|
||||
//in backup_ids->info will be the real info (serialized)
|
||||
$info = restore_read_xml_users($restore,$xml_file);
|
||||
}
|
||||
|
||||
|
||||
//Now, get evey user_id from $info and user data from $backup_ids
|
||||
//and create the necessary records (users, user_students, user_teachers
|
||||
//user_course_creators and user_admins
|
||||
@@ -1508,15 +1561,37 @@
|
||||
|
||||
$languages = get_list_of_languages();
|
||||
|
||||
/// Iterate over all users loaded from xml
|
||||
$counter = 0;
|
||||
foreach ($info->users as $userid) {
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$user = $rec->info;
|
||||
foreach (array_keys(get_object_vars($user)) as $field) {
|
||||
if (!is_array($user->$field)) {
|
||||
$user->$field = backup_todb($user->$field);
|
||||
if (is_null($user->$field)) {
|
||||
$user->$field = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, recode some languages (Moodle 1.5)
|
||||
if ($user->lang == 'ma_nt') {
|
||||
$user->lang = 'mi_nt';
|
||||
}
|
||||
|
||||
//Country list updates - MDL-13060
|
||||
//Any user whose country code has been deleted or modified needs to be assigned a valid one.
|
||||
$country_update_map = array(
|
||||
'ZR' => 'CD',
|
||||
'TP' => 'TL',
|
||||
'FX' => 'FR',
|
||||
'KO' => 'RS',
|
||||
'CS' => 'RS',
|
||||
'WA' => 'GB');
|
||||
if (array_key_exists($user->country, $country_update_map)) {
|
||||
$user->country = $country_update_map[$user->country];
|
||||
}
|
||||
|
||||
//If language does not exist here - use site default
|
||||
if (!array_key_exists($user->lang, $languages)) {
|
||||
@@ -1588,17 +1663,13 @@
|
||||
if ($create_user) {
|
||||
//Unset the id because it's going to be inserted with a new one
|
||||
unset ($user->id);
|
||||
//We addslashes to necessary fields
|
||||
$user->username = addslashes($user->username);
|
||||
$user->firstname = addslashes($user->firstname);
|
||||
$user->lastname = addslashes($user->lastname);
|
||||
$user->email = addslashes($user->email);
|
||||
$user->institution = addslashes($user->institution);
|
||||
$user->department = addslashes($user->department);
|
||||
$user->address = addslashes($user->address);
|
||||
$user->city = addslashes($user->city);
|
||||
$user->url = addslashes($user->url);
|
||||
$user->description = restore_decode_absolute_links(addslashes($user->description));
|
||||
// relink the descriptions
|
||||
$user->description = restore_decode_absolute_links($user->description);
|
||||
|
||||
/// Disable pictures based on global setting of existing empty value (old backups can contain wrong empties)
|
||||
if (!empty($CFG->disableuserimages) || empty($user->picture)) {
|
||||
$user->picture = 0;
|
||||
}
|
||||
|
||||
//We need to analyse the AUTH field to recode it:
|
||||
// - if the field isn't set, we are in a pre 1.4 backup and we'll
|
||||
@@ -1630,7 +1701,7 @@
|
||||
|
||||
//We are going to create the user
|
||||
//The structure is exactly as we need
|
||||
$newid = insert_record ("user",$user);
|
||||
$newid = insert_record ("user", addslashes_recursive($user));
|
||||
//Put the new id
|
||||
$status = backup_putid($restore->backup_unique_code,"user",$userid,$newid,"new");
|
||||
}
|
||||
@@ -1771,9 +1842,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Do some output
|
||||
$counter++;
|
||||
if ($counter % 10 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 200 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
} /// End of loop over all the users loaded from xml
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -2220,9 +2302,10 @@
|
||||
sql_compare_text($literal_description);
|
||||
}
|
||||
$gro_db = get_record_sql("SELECT *
|
||||
FROM {$CFG->prefix}groups
|
||||
WHERE courseid = $restore->course_id AND
|
||||
name = '{$gro->name}'" . $description_clause);
|
||||
FROM {$CFG->prefix}groups g, {$CFG->prefix}groups_courses_groups gcg
|
||||
WHERE gcg.courseid = $restore->course_id
|
||||
AND g.id = gcg.groupid
|
||||
AND g.name = '{$gro->name}'" . $description_clause, true);
|
||||
//If it doesn't exist, create
|
||||
if (!$gro_db) {
|
||||
$create_group = true;
|
||||
@@ -2517,19 +2600,6 @@
|
||||
//Assign it to admin
|
||||
$eve->userid = $adminid;
|
||||
}
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
if (!empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$max_rec = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$eve->repeatid = empty($max_rec) ? 1 : $max_rec->repeatid + 1;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
}
|
||||
|
||||
//We have to recode the groupid field
|
||||
$group = backup_getid($restore->backup_unique_code,"groups",$eve->groupid);
|
||||
@@ -2542,6 +2612,22 @@
|
||||
|
||||
//The structure is equal to the db, so insert the event
|
||||
$newid = insert_record ("event",$eve);
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
//The repeatid now refers to the id of the original event. (see Bug#5956)
|
||||
if ($newid && !empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$eve->repeatid = $newid;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
$eve->id = $newid;
|
||||
// update the record to contain the correct repeatid
|
||||
update_record('event',$eve);
|
||||
}
|
||||
} else {
|
||||
//get current event id
|
||||
$newid = $eve_db->id;
|
||||
@@ -2569,8 +2655,18 @@
|
||||
//step in the restore execution, because we need to have it
|
||||
//finished to know all the oldid, newid equivaleces
|
||||
function restore_decode_absolute_links($content) {
|
||||
|
||||
global $CFG,$restore;
|
||||
|
||||
global $CFG,$restore;
|
||||
|
||||
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
|
||||
/// heavy interlinking. Just a few cpu cycles saved.
|
||||
if ($content === NULL) {
|
||||
return NULL;
|
||||
} else if ($content === '') {
|
||||
return '';
|
||||
} else if (is_numeric($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Now decode wwwroot and file.php calls
|
||||
$search = array ("$@FILEPHP@$");
|
||||
@@ -2606,48 +2702,53 @@
|
||||
|
||||
$counter = 0;
|
||||
|
||||
//First, we check to "users" exists and create is as necessary
|
||||
// 'users' is the old users folder, 'user' is the new one, with a new hierarchy. Detect which one is here and treat accordingly
|
||||
//in CFG->dataroot
|
||||
$dest_dir = $CFG->dataroot."/users";
|
||||
$dest_dir = $CFG->dataroot."/user";
|
||||
$status = check_dir_exists($dest_dir,true);
|
||||
|
||||
//Now, we iterate over "user_files" records to check if that user dir must be
|
||||
//copied (and renamed) to the "users" dir.
|
||||
$rootdir = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code."/user_files";
|
||||
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
$counter = 0;
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$restore->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If thar user exists in backup_ids
|
||||
if ($data) {
|
||||
//Only it user has been created now
|
||||
//or if it existed previously, but he hasn't image (see bug 1123)
|
||||
if ((strpos($data->info,"new") !== false) or
|
||||
(!check_dir_exists($dest_dir."/".$data->new_id,false))) {
|
||||
//Copy the old_dir to its new location (and name) !!
|
||||
//Only if destination doesn't exists
|
||||
if (!file_exists($dest_dir."/".$data->new_id)) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$dest_dir."/".$data->new_id,true);
|
||||
$counter ++;
|
||||
}
|
||||
//Do some output
|
||||
if ($counter % 2 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 40 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
$userlist = array();
|
||||
|
||||
if (is_dir($rootdir) && ($list = list_directories ($rootdir))) {
|
||||
$counter = 0;
|
||||
foreach ($list as $dir) {
|
||||
// If there are directories in this folder, we are in the new user hierarchy
|
||||
if ($newlist = list_directories("$rootdir/$dir")) {
|
||||
foreach ($newlist as $olduserid) {
|
||||
$userlist[$olduserid] = "$rootdir/$dir/$olduserid";
|
||||
}
|
||||
} else {
|
||||
$userlist[$dir] = "$rootdir/$dir";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($userlist as $olduserid => $backup_location) {
|
||||
//Look for dir like username in backup_ids
|
||||
//If that user exists in backup_ids
|
||||
if ($user = backup_getid($restore->backup_unique_code,"user",$olduserid)) {
|
||||
//Only if user has been created now or if it existed previously, but he hasn't got an image (see bug 1123)
|
||||
$newuserdir = make_user_directory($user->new_id, true); // Doesn't create the folder, just returns the location
|
||||
|
||||
// restore images if new user or image does not exist yet
|
||||
if (!empty($user->new) or !check_dir_exists($newuserdir)) {
|
||||
if (make_user_directory($user->new_id)) { // Creates the folder
|
||||
$status = backup_copy_file($backup_location, $newuserdir, true);
|
||||
$counter ++;
|
||||
}
|
||||
//Do some output
|
||||
if ($counter % 2 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 40 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3242,6 +3343,18 @@
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
// MDL-14326 remove empty course modules instance's (credit goes to John T. Macklin from Remote Learner)
|
||||
$course_modules_inst_zero = get_records_sql("SELECT id, course, instance
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE id = '$cm_module->new_id' AND
|
||||
instance = '0'");
|
||||
|
||||
if($course_modules_inst_zero){ // Clean up the invalid instances
|
||||
foreach($course_modules_inst_zero as $course_modules_inst){
|
||||
delete_records('course_modules', 'id',$course_modules_inst->id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3281,7 +3394,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into INFO zone
|
||||
//if ($this->tree[2] == "INFO") //Debug
|
||||
@@ -3295,7 +3408,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into INFO zone
|
||||
//if ($this->tree[2] == "INFO") //Debug
|
||||
@@ -3310,7 +3423,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into COURSE_HEADER zone
|
||||
//if ($this->tree[3] == "HEADER") //Debug
|
||||
@@ -3324,7 +3437,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into BLOCKS zone
|
||||
//if ($this->tree[3] == "BLOCKS") //Debug
|
||||
@@ -3338,7 +3451,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into SECTIONS zone
|
||||
//if ($this->tree[3] == "SECTIONS") //Debug
|
||||
@@ -3352,7 +3465,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Accumulate all the data inside this tag
|
||||
if (isset($this->tree[3]) && $this->tree[3] == "FORMATDATA") {
|
||||
@@ -3375,7 +3488,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into METACOURSE zone
|
||||
//if ($this->tree[3] == "METACOURSE") //Debug
|
||||
@@ -3390,7 +3503,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GRADEBOOK zone
|
||||
//if ($this->tree[3] == "GRADEBOOK") //Debug
|
||||
@@ -3426,7 +3539,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into MESSAGES zone
|
||||
//if ($this->tree[3] == "MESSAGES") //Debug
|
||||
@@ -3453,7 +3566,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into QUESTION_CATEGORIES zone
|
||||
//if ($this->tree[3] == "QUESTION_CATEGORIES") //Debug
|
||||
@@ -3481,7 +3594,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into SCALES zone
|
||||
//if ($this->tree[3] == "SCALES") //Debug
|
||||
@@ -3508,7 +3621,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GROUPS zone
|
||||
//if ($this->tree[3] == "GROUPS") //Debug
|
||||
@@ -3535,7 +3648,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GROUPINGS zone
|
||||
//if ($this->tree[3] == "GROUPINGS") //Debug
|
||||
@@ -3563,7 +3676,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into EVENTS zone
|
||||
//if ($this->tree[3] == "EVENTS") //Debug
|
||||
@@ -3591,7 +3704,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into MODULES zone
|
||||
//if ($this->tree[3] == "MODULES") //Debug
|
||||
@@ -3619,7 +3732,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into LOGS zone
|
||||
//if ($this->tree[3] == "LOGS") //Debug
|
||||
@@ -3642,7 +3755,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
echo $this->level.str_repeat(" ",$this->level*2)."<".$tagName."><br />\n"; //Debug
|
||||
}
|
||||
@@ -5475,11 +5588,20 @@
|
||||
$fp = fopen($xml_file,"r")
|
||||
or $status = false;
|
||||
if ($status) {
|
||||
while ($data = fread($fp, 4096) and !$moodle_parser->finished)
|
||||
xml_parse($xml_parser, $data, feof($fp))
|
||||
or die(sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
// MDL-9290 performance improvement on reading large xml
|
||||
$lasttime = time(); // crmas
|
||||
while ($data = fread($fp, 4096) and !$moodle_parser->finished) {
|
||||
|
||||
if ((time() - $lasttime) > 5) {
|
||||
$lasttime = time();
|
||||
backup_flush(1);
|
||||
}
|
||||
|
||||
xml_parse($xml_parser, $data, feof($fp))
|
||||
or die(sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
//Get info from parser
|
||||
@@ -5629,6 +5751,11 @@
|
||||
$info = restore_read_xml_info ($xml_file);
|
||||
//Reading course_header from file
|
||||
$course_header = restore_read_xml_course_header ($xml_file);
|
||||
|
||||
if(!is_object($course_header)){
|
||||
// ensure we fail if there is no course header
|
||||
$course_header = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
@@ -6759,7 +6886,7 @@
|
||||
foreach ($overrides as $override) {
|
||||
$override->capability = $override->name;
|
||||
$oldmodifier = backup_getid($restore->backup_unique_code,"user",$override->modifierid);
|
||||
$override->modifierid = $oldmodifier->new_id?$oldmodifier->new_id:0; // new modifier id here
|
||||
$override->modifierid = !empty($oldmodifier->new_id)?$oldmodifier->new_id:0; // new modifier id here
|
||||
$override->roleid = $role->new_id; // restored new role id
|
||||
|
||||
// hack to make the correct contextid for course level imports
|
||||
|
||||
@@ -172,30 +172,9 @@ class block_admin extends block_list {
|
||||
}
|
||||
}
|
||||
|
||||
/// Should the following two be in this block?
|
||||
|
||||
|
||||
/// View own activity report
|
||||
// if ($course->showreports) {
|
||||
// $this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&user='.$USER->id.'">'.get_string('activityreport').'</a>';
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" alt="" />';
|
||||
// }
|
||||
|
||||
|
||||
/// Edit your own profile
|
||||
|
||||
// $fullname = fullname($USER, has_capability('moodle/site:viewfullnames', $context));
|
||||
// $editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
// if (empty($USER->description)) {
|
||||
// //Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
// $text = get_string('profile').' '.get_string('missingdescription');
|
||||
// $this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
|
||||
// } else {
|
||||
// $this->content->items[]= $editmyprofile;
|
||||
// }
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
|
||||
/// Link to the user own profile
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$course->id.'">'.get_string('profile').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ class block_admin_tree extends block_base {
|
||||
$this->tempcontent .= " ";
|
||||
}
|
||||
$this->tempcontent .= '<a href="#" onclick="toggle(\'vh_span'. $this->spancounter .'\');return false">';
|
||||
$this->tempcontent .= '<span id="vh_span' . $this->spancounter . 'indicator"><img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" /></span> ';
|
||||
$this->tempcontent .= '<span id="vh_span' . $this->spancounter . 'indicator"><img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" /></span> ';
|
||||
|
||||
$this->tempcontent .= $visiblename . '</a><br /><span id="vh_span' . $this->spancounter . '">' . "\n";
|
||||
$this->currentdepth++;
|
||||
$this->spancounter++;
|
||||
@@ -66,12 +67,12 @@ class block_admin_tree extends block_base {
|
||||
if (is_a($content, 'admin_settingpage')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
$this->create_item($content->visiblename,$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=' . $content->name,$CFG->wwwroot .'/blocks/admin_tree/item.gif', $class);
|
||||
$this->create_item($content->visiblename,$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=' . $content->name,$CFG->pixpath .'/i/item.gif', $class);
|
||||
}
|
||||
} else if (is_a($content, 'admin_externalpage')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
$this->create_item($content->visiblename, $content->url, $CFG->wwwroot . '/blocks/admin_tree/item.gif', $class);
|
||||
$this->create_item($content->visiblename, $content->url, $CFG->pixpath . '/i/item.gif', $class);
|
||||
}
|
||||
} else if (is_a($content, 'admin_category')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
@@ -144,11 +145,11 @@ class block_admin_tree extends block_base {
|
||||
$this->content->text .= 'function toggle(spanid) {' . "\n";
|
||||
$this->content->text .= ' if (getspan(spanid).innerHTML == "") {' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = vh_content[spanid];' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' } else {' . "\n";
|
||||
$this->content->text .= ' vh_content[spanid] = getspan(spanid).innerHTML;' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = "";' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' }' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
@@ -156,13 +157,13 @@ class block_admin_tree extends block_base {
|
||||
$this->content->text .= ' if (getspan(spanid).innerHTML !== "") {' . "\n";
|
||||
$this->content->text .= ' vh_content[spanid] = getspan(spanid).innerHTML;' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = "";' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' }' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
$this->content->text .= 'function expand(spanid) {' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = vh_content[spanid];' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
$this->content->text .= 'function expandall() {' . "\n";
|
||||
|
||||
@@ -45,6 +45,12 @@ class block_calendar_month extends block_base {
|
||||
// We 'll need this later
|
||||
calendar_set_referring_course($courseshown);
|
||||
|
||||
// MDL-9059, set to show this course when admins go into a course, then unset it.
|
||||
if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$courseset = true;
|
||||
$SESSION->cal_courses_shown[$COURSE->id] = $COURSE;
|
||||
}
|
||||
|
||||
// Be VERY careful with the format for default courses arguments!
|
||||
// Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
|
||||
calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse);
|
||||
@@ -63,6 +69,11 @@ class block_calendar_month extends block_base {
|
||||
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
|
||||
|
||||
}
|
||||
|
||||
// MDL-9059, unset this so that it doesn't stay in session
|
||||
if (!empty($courseset)) {
|
||||
unset($SESSION->cal_courses_shown[$COURSE->id]);
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ class block_course_list extends block_list {
|
||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
|
||||
$this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a> ...";
|
||||
}
|
||||
$this->get_remote_courses();
|
||||
if ($this->content->items) { // make sure we don't return an empty list
|
||||
return $this->content;
|
||||
}
|
||||
}
|
||||
$this->get_remote_courses();
|
||||
if ($this->content->items) { // make sure we don't return an empty list
|
||||
return $this->content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,5 +208,17 @@ class block_glossary_random extends block_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executed after block instance has been created, we use it to recode
|
||||
* the glossary config setting to point to the new (restored) one
|
||||
*/
|
||||
function after_restore($restore) {
|
||||
/// We need to transform the glossary->id from the original one to the restored one
|
||||
if ($rec = backup_getid($restore->backup_unique_code, 'glossary', $this->config->glossary)) {
|
||||
$this->config->glossary = $rec->new_id;
|
||||
$this->instance_config_commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -15,7 +15,7 @@ class block_loancalc extends block_base {
|
||||
|
||||
$this->content->text = '
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
//<![CDATA[
|
||||
function Next()
|
||||
{
|
||||
submitScreen("Next");
|
||||
@@ -148,7 +148,7 @@ function comp(v) { // general entry point for all cases
|
||||
|
||||
}
|
||||
} // function comp
|
||||
]]>
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<h1></h1>
|
||||
|
||||
@@ -9,6 +9,10 @@ class block_messages extends block_base {
|
||||
function get_content() {
|
||||
global $USER, $CFG;
|
||||
|
||||
if (!$CFG->messaging) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ class block_mnet_hosts extends block_list {
|
||||
WHERE
|
||||
h.id != '{$CFG->mnet_localhost_id}' AND
|
||||
h.id = h2s_IDP.hostid AND
|
||||
h.deleted = 0 AND
|
||||
h2s_IDP.serviceid = s_IDP.id AND
|
||||
s_IDP.name = 'sso_idp' AND
|
||||
h2s_IDP.publish = '1' AND
|
||||
|
||||
@@ -259,17 +259,17 @@ class block_base {
|
||||
$title = '<div class="title">';
|
||||
|
||||
if (!empty($CFG->allowuserblockhiding)) {
|
||||
//Accessibility: added static 'alt' text for the +- icon.
|
||||
//TODO (nfreear): language string 'hide OR show block'
|
||||
$title .= '<div class="hide-show">'.
|
||||
'<a title="'.get_string('showhideblock','access').
|
||||
'" href="#" onclick="elementToggleHide(this, true, function(el) {'.
|
||||
'return findParentNode(el, \'DIV\', \'sideblock\'); '.
|
||||
'}, \''.$CFG->pixpath.'\' ); return false;">'.
|
||||
'<img src="'.$CFG->pixpath.'/spacer.gif" '.
|
||||
'id = "togglehide_inst'.$this->instance->id.'" '.
|
||||
'alt="'.get_string('showhideblock','access').'" class="hide-show-image" /></a></div>';
|
||||
}
|
||||
//Accessibility: added 'alt' text for the +- icon.
|
||||
//Theme the buttons using, Admin - Miscellaneous - smartpix.
|
||||
$strshow = addslashes_js(get_string('showblocka', 'access', strip_tags($this->title)));
|
||||
$strhide = addslashes_js(get_string('hideblocka', 'access', strip_tags($this->title)));
|
||||
$title .= '<input type="image" src="'.$CFG->pixpath.'/t/switch_minus.gif" '.
|
||||
'id="togglehide_inst'.$this->instance->id.'" '.
|
||||
'onclick="elementToggleHide(this, true, function(el) {'.
|
||||
'return findParentNode(el, \'DIV\', \'sideblock\'); },'.
|
||||
' \''.$strshow.'\', \''.$strhide.'\'); return false;" '.
|
||||
'alt="'.$strhide.'" title="'.$strhide.'" class="hide-show-image" />';
|
||||
}
|
||||
|
||||
//Accesssibility: added H2 (was in, weblib.php: print_side_block)
|
||||
$title .= '<h2>'.$this->title.'</h2>';
|
||||
|
||||
@@ -89,7 +89,7 @@ class block_online_users extends block_base {
|
||||
// user has a hidden role assigned at this context or any parent contexts,
|
||||
// ignore this user
|
||||
|
||||
$SQL = "SELECT id,id FROM {$CFG->prefix}role_assignments
|
||||
$SQL = "SELECT id FROM {$CFG->prefix}role_assignments
|
||||
WHERE userid = $puser->id
|
||||
AND contextid $pcontext
|
||||
AND hidden = 1";
|
||||
|
||||
@@ -8,7 +8,7 @@ class block_participants extends block_list {
|
||||
|
||||
function get_content() {
|
||||
|
||||
global $CFG;
|
||||
global $CFG, $COURSE;
|
||||
|
||||
if (empty($this->instance)) {
|
||||
$this->content = '';
|
||||
@@ -20,7 +20,8 @@ class block_participants extends block_list {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$currentcontext = get_context_instance(CONTEXT_COURSE, $this->instance->pageid)) {
|
||||
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
|
||||
if (!$currentcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id)) {
|
||||
$this->content = '';
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
This block is a revamping of the Google Summer Of Code Project (2006) on Global Search engine
|
||||
for Moodle. New block version is completed and internationalized according to Moodle multilengual support.
|
||||
|
||||
This block instanciates a startup database model for the search engine.
|
||||
|
||||
## Installing
|
||||
|
||||
You need installing the following elements in order the global search to be available :
|
||||
|
||||
1. The global search bloc (this block)
|
||||
2. update the /search root package from CVS
|
||||
3. The antiword libraries
|
||||
4. The xpdf libraries
|
||||
|
||||
Both last libraries are provided as a patch called "global_search_libraries" in the contrib section.
|
||||
@@ -1,21 +1,25 @@
|
||||
<?php
|
||||
|
||||
/* This is the global search shortcut block - a single query can be entered, and
|
||||
the user will be redirected to the query page where they can enter more
|
||||
advanced queries, and view the results of their search. When searching from
|
||||
this block, the broadest possible selection of documents is searched.
|
||||
|
||||
Author: Michael Champanis (mchampan)
|
||||
Date: 2006 06 25
|
||||
|
||||
Todo: make strings -> get_string()
|
||||
* the user will be redirected to the query page where they can enter more
|
||||
* advanced queries, and view the results of their search. When searching from
|
||||
* this block, the broadest possible selection of documents is searched.
|
||||
*
|
||||
*
|
||||
* Todo: make strings -> get_string()
|
||||
*
|
||||
* @package search
|
||||
* @subpackage search block
|
||||
* @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
|
||||
* @date: 2006 06 25
|
||||
*/
|
||||
|
||||
class block_search extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = "Global Search"; //get_string()
|
||||
$this->version = 2006062500;
|
||||
$this->title = get_string('blockname', 'block_search');
|
||||
$this->cron = 1;
|
||||
$this->version = 2008031500;
|
||||
} //init
|
||||
|
||||
// only one instance of this block is required
|
||||
@@ -45,8 +49,8 @@
|
||||
//lazy check for the moment
|
||||
if (check_php_version("5.0.0")) {
|
||||
//fetch values if defined in admin, otherwise use defaults
|
||||
$label = (isset($CFG->block_search_text)) ? $CFG->block_search_text : "Search Moodle";
|
||||
$button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : "Go";
|
||||
$label = (!empty($CFG->block_search_text)) ? $CFG->block_search_text : get_string('searchmoodle', 'block_search');
|
||||
$button = (!empty($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go', 'block_search');
|
||||
|
||||
//basic search form
|
||||
$this->content->text =
|
||||
@@ -68,7 +72,17 @@
|
||||
function specialisation() {
|
||||
//empty!
|
||||
} //specialisation
|
||||
|
||||
/**
|
||||
* wraps up to search engine cron
|
||||
*
|
||||
*/
|
||||
function cron(){
|
||||
global $CFG;
|
||||
|
||||
include($CFG->dirroot.'/search/cron.php');
|
||||
}
|
||||
|
||||
} //block_search
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,19 +1,146 @@
|
||||
<div style="text-align:center;">
|
||||
<label for="block_search_text">Search label</label>
|
||||
<input id="block_search_text" type="text" name="block_search_text" value="<?php
|
||||
if(isset($CFG->block_search_text)) {
|
||||
p($CFG->block_search_text);
|
||||
} else {
|
||||
p("Search Moodle");
|
||||
} ?>"/><br/>
|
||||
|
||||
<label for="block_search_button">Button label</label>
|
||||
<input id="block_search_button" type="text" name="block_search_button" value="<?php
|
||||
if(isset($CFG->block_search_button)) {
|
||||
p($CFG->block_search_button);
|
||||
} else {
|
||||
p("Go");
|
||||
} ?>"/><br/><br/>
|
||||
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<table cellspacing="5">
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configsearchtext', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_text" type="text" name="block_search_text" value="<?php
|
||||
if(isset($CFG->block_search_text)) {
|
||||
p($CFG->block_search_text);
|
||||
} else {
|
||||
p(get_string('searchmoodle', 'block_search'));
|
||||
} ?>"/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configbuttonlabel', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_button" type="text" name="block_search_button" value="<?php
|
||||
if(isset($CFG->block_search_button)) {
|
||||
p($CFG->block_search_button);
|
||||
} else {
|
||||
p(get_string('go', 'block_search'));
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configenablefileindexing', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="1" <?php
|
||||
if(isset($CFG->block_search_enable_file_indexing) && $CFG->block_search_enable_file_indexing) {
|
||||
echo " checked=\"checked\" ";
|
||||
} ?> /> <?php print_string('yes') ?> -
|
||||
<input id="block_search_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="0" <?php
|
||||
if(!isset($CFG->block_search_enable_file_indexing) || !$CFG->block_search_enable_file_indexing) {
|
||||
echo " checked=\"checked\" ";
|
||||
} ?> /> <?php print_string('no') ?>
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configfiletypes', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_filetypes" type="text" name="block_search_filetypes" value="<?php
|
||||
if(isset($CFG->block_search_filetypes)) {
|
||||
p($CFG->block_search_filetypes);
|
||||
} else {
|
||||
p("PDF,TXT,HTML,PPT,XML,DOC,HTM");
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('usemoodleroot', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<?php
|
||||
$usemoodleroot = (isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
|
||||
$notusemoodleroot = (!isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
|
||||
?>
|
||||
<input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $usemoodleroot ?> value="1"/> <?php print_string('yes') ?> -
|
||||
<input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $notusemoodleroot ?> value="0"/> <?php print_string('no') ?>
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configpdftotextcmd', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_pdf_to_text_cmd" type="text" size="60" name="block_search_pdf_to_text_cmd" value="<?php
|
||||
if(isset($CFG->block_search_pdf_to_text_cmd)) {
|
||||
p($CFG->block_search_pdf_to_text_cmd);
|
||||
} else {
|
||||
$encoding = ($CFG->unicodedb) ? "-enc UTF-8" : "-enc ISO-8859-1" ;
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("lib/xpdf/win32/pdftotext.exe -eol dos $encoding -q");
|
||||
}
|
||||
else{
|
||||
p("lib/xpdf/linux/pdftotext $encoding -eol unix -q");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configwordtotextcmd', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_word_to_text_cmd" type="text" size="60" name="block_search_word_to_text_cmd" value="<?php
|
||||
if(isset($CFG->block_search_word_to_text_cmd)) {
|
||||
p($CFG->block_search_word_to_text_cmd);
|
||||
} else {
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("lib/antiword/win32/antiword/antiword.exe ");
|
||||
}
|
||||
else{
|
||||
p("lib/antiword/linux/usr/bin/antiword");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configwordtotextenv', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_word_to_text_env" type="text" size="60" name="block_search_word_to_text_env" value="<?php
|
||||
if(isset($CFG->block_search_word_to_text_env)) {
|
||||
echo stripslashes($CFG->block_search_word_to_text_env);
|
||||
} else {
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("HOME={$CFG->dirroot}\\lib\\antiword\\win32");
|
||||
}
|
||||
else{
|
||||
p("ANTIWORDHOME={$CFG->dirroot}/lib/antiword/linux/usr/share/antiword");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configlimitindexbody', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_limit_index_body" type="text" size="8" name="block_search_limit_index_body" value="<?php
|
||||
if(isset($CFG->block_search_limit_index_body)) {
|
||||
p($CFG->block_search_limit_index_body);
|
||||
} else {
|
||||
p('');
|
||||
} ?>"/> <?php print_string('bytes', 'block_search') ?><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" colspan="2">
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="blocks/search/db" VERSION="20070811" COMMENT="XMLDB file for Moodle search engine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="block_search_documents" COMMENT="table to store search index backups">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="docid"/>
|
||||
<FIELD NAME="docid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="doctype"/>
|
||||
<FIELD NAME="doctype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="none" SEQUENCE="false" ENUM="false" PREVIOUS="docid" NEXT="itemtype"/>
|
||||
<FIELD NAME="itemtype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="standard" SEQUENCE="false" ENUM="false" PREVIOUS="doctype" NEXT="title"/>
|
||||
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemtype" NEXT="url"/>
|
||||
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="title" NEXT="docdate"/>
|
||||
<FIELD NAME="docdate" TYPE="datetime" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="updated"/>
|
||||
<FIELD NAME="updated" TYPE="datetime" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="docdate" NEXT="courseid"/>
|
||||
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="updated" NEXT="groupid"/>
|
||||
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="mdl_search_docid" UNIQUE="false" FIELDS="docid" NEXT="mdl_search_doctype"/>
|
||||
<INDEX NAME="mdl_search_doctype" UNIQUE="false" FIELDS="doctype" PREVIOUS="mdl_search_docid" NEXT="mdl_search_itemtype"/>
|
||||
<INDEX NAME="mdl_search_itemtype" UNIQUE="false" FIELDS="itemtype" PREVIOUS="mdl_search_doctype"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
function search_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 2006062500 and $result) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to pgsql
|
||||
|
||||
function search_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 2006062500 and $result) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
@@ -31,6 +31,81 @@ function xmldb_block_search_upgrade($oldversion=0) {
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
if ($result && $oldversion < 2007071302) {
|
||||
|
||||
/// Define table search_documents to be created
|
||||
$table = new XMLDBTable('search_documents');
|
||||
|
||||
/// Drop it if it existed before
|
||||
|
||||
drop_table($table, true, false);
|
||||
|
||||
/// Adding fields to table search_documents
|
||||
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->addFieldInfo('docid', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('doctype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none');
|
||||
$table->addFieldInfo('itemtype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard');
|
||||
$table->addFieldInfo('title', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('url', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('docdate', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('updated', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('groupid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
|
||||
/// Adding keys to table search_documents
|
||||
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
/// Adding indexes to table search_documents
|
||||
$table->addIndexInfo('mdl_search_docid', XMLDB_INDEX_NOTUNIQUE, array('docid'));
|
||||
$table->addIndexInfo('mdl_search_doctype', XMLDB_INDEX_NOTUNIQUE, array('doctype'));
|
||||
$table->addIndexInfo('mdl_search_itemtype', XMLDB_INDEX_NOTUNIQUE, array('itemtype'));
|
||||
|
||||
/// Launch create table for search_documents
|
||||
$result = $result && create_table($table);
|
||||
}
|
||||
|
||||
/// Rename table search_documents to block_search_documents and
|
||||
/// fix some defaults (MDL-10572)
|
||||
if ($result && $oldversion < 2007081100) {
|
||||
|
||||
/// Define table search_documents to be renamed to block_search_documents
|
||||
$table = new XMLDBTable('search_documents');
|
||||
|
||||
/// Launch rename table for block_search_documents
|
||||
$result = $result && rename_table($table, 'block_search_documents');
|
||||
|
||||
/// Changing the default of field doctype on table block_search_documents to none
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('doctype');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none', 'docid');
|
||||
|
||||
/// Launch change of default for field doctype
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field itemtype on table block_search_documents to standard
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('itemtype');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard', 'doctype');
|
||||
|
||||
/// Launch change of default for field itemtype
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field title on table block_search_documents to drop it
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('title');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'itemtype');
|
||||
|
||||
/// Launch change of default for field title
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field url on table block_search_documents to drop it
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('url');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'title');
|
||||
|
||||
/// Launch change of default for field url
|
||||
$result = $result && change_field_default($table, $field);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,13 @@ switch ($filtertype) {
|
||||
if (!$user = get_record('user', 'id', $filterselect)) {
|
||||
error('Incorrect user id');
|
||||
}
|
||||
if ($user->deleted) {
|
||||
print_header();
|
||||
print_heading(get_string('userdeleted'));
|
||||
print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
if ($USER->id == $filterselect) {
|
||||
if (!has_capability('moodle/blog:create', $sitecontext)
|
||||
and !has_capability('moodle/blog:view', $sitecontext)) {
|
||||
|
||||
+2
-2
@@ -144,9 +144,9 @@
|
||||
global $USER, $CFG, $COURSE, $ME;
|
||||
|
||||
$template['body'] = format_text($blogEntry->summary, $blogEntry->format);
|
||||
//$template['title'] = '<a name="'. $blogEntry->subject .'"></a>';
|
||||
$template['title'] = '<a id=b"'. s($blogEntry->id) .'" />';
|
||||
//enclose the title in nolink tags so that moodle formatting doesn't autolink the text
|
||||
$template['title'] = '<span class="nolink">'.$blogEntry->subject.'</span>';
|
||||
$template['title'] .= '<span class="nolink">'. format_string($blogEntry->subject) .'</span>';
|
||||
$template['userid'] = $blogEntry->userid;
|
||||
$template['author'] = fullname(get_record('user','id',$blogEntry->userid));
|
||||
$template['lastmod'] = userdate($blogEntry->lastmodified);
|
||||
|
||||
+17
-13
@@ -97,6 +97,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
$form = null;
|
||||
|
||||
switch($action) {
|
||||
case 'delete':
|
||||
$title = get_string('deleteevent', 'calendar');
|
||||
@@ -153,25 +155,23 @@
|
||||
}
|
||||
|
||||
execute_sql('UPDATE '.$CFG->prefix.'event SET '.
|
||||
'name = '.$db->qstr($form->name).','.
|
||||
'description = '.$db->qstr($form->description).','.
|
||||
'name = \''.$form->name.'\','.
|
||||
'description = \''.$form->description.'\','.
|
||||
'timestart = '.$timestartoffset.','.
|
||||
'timeduration = '.$form->timeduration.','.
|
||||
'timemodified = '.time().' WHERE repeatid = '.$event->repeatid);
|
||||
|
||||
|
||||
/// Log the event update.
|
||||
$form->name = stripslashes($form->name); //To avoid double-slashes
|
||||
add_to_log($form->courseid, 'calendar', 'edit all', 'event.php?action=edit&id='.$form->id, $form->name);
|
||||
add_to_log($form->courseid, 'calendar', 'edit all', 'event.php?action=edit&id='.$form->id, stripslashes($form->name));
|
||||
}
|
||||
|
||||
else {
|
||||
// Update this
|
||||
$form->timemodified = time();
|
||||
update_record('event', $form);
|
||||
|
||||
|
||||
/// Log the event update.
|
||||
$form->name = stripslashes($form->name); //To avoid double-slashes
|
||||
add_to_log($form->courseid, 'calendar', 'edit', 'event.php?action=edit&id='.$form->id, $form->name);
|
||||
add_to_log($form->courseid, 'calendar', 'edit', 'event.php?action=edit&id='.$form->id, stripslashes($form->name));
|
||||
}
|
||||
|
||||
// OK, now redirect to day view
|
||||
@@ -212,13 +212,14 @@
|
||||
if (count($err) == 0) {
|
||||
$form->timemodified = time();
|
||||
|
||||
if ($form->repeat) {
|
||||
$fetch = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$form->repeatid = empty($fetch) ? 1 : $fetch->repeatid + 1;
|
||||
}
|
||||
|
||||
/// Get the event id for the log record.
|
||||
$eventid = insert_record('event', $form, true);
|
||||
|
||||
/// Use the event id as the repeatid to link repeat entries together
|
||||
if ($form->repeat) {
|
||||
$form->repeatid = $form->id = $eventid;
|
||||
update_record('event', $form); // update the row, to set its repeatid
|
||||
}
|
||||
|
||||
/// Log the event entry.
|
||||
add_to_log($form->courseid, 'calendar', 'add', 'event.php?action=edit&id='.$eventid, stripslashes($form->name));
|
||||
@@ -255,6 +256,8 @@
|
||||
break;
|
||||
}
|
||||
|
||||
$form = stripslashes_recursive($form);
|
||||
|
||||
// Let's see if we are supposed to provide a referring course link
|
||||
// but NOT for the "main page" course
|
||||
if($SESSION->cal_course_referer != SITEID &&
|
||||
@@ -297,6 +300,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
echo '</td></tr></table>';
|
||||
redirect(CALENDAR_URL.'view.php?view=day&course='.$urlcourse.'&cal_d='.$_REQUEST['d'].'&cal_m='.$_REQUEST['m'].'&cal_y='.$_REQUEST['y']);
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<form method="get" action="view.php" id="cancel">
|
||||
<p>
|
||||
|
||||
<input type="submit" value=" <?php print_string('cancel') ?> ">
|
||||
<input type="submit" value=" <?php print_string('cancel') ?> " />
|
||||
<input type="hidden" name="view" value="day" />
|
||||
<input type="hidden" name="cal_m" value="<?php echo $m; ?>" />
|
||||
<input type="hidden" name="cal_d" value="<?php echo $d; ?>" />
|
||||
|
||||
@@ -47,9 +47,9 @@ function generate_url() {
|
||||
preset_time = "recentupcoming";
|
||||
}
|
||||
|
||||
url = "<?php echo $CFG->wwwroot; ?>/calendar/export_execute.php?preset_what=" + preset_what + "&preset_time=" + preset_time + "&username=<?php echo $usernameencoded; ?>&authtoken=<?php echo $authtoken; ?>";
|
||||
document.getElementById("url").innerText = url;
|
||||
document.getElementById("url").innerHTML = url; //Need this as well, for Firefox
|
||||
urlstr = "<?php echo $CFG->wwwroot; ?>/calendar/export_execute.php?preset_what=" + preset_what + "&preset_time=" + preset_time + "&username=<?php echo $usernameencoded; ?>&authtoken=<?php echo $authtoken; ?>";
|
||||
document.getElementById("url").innerText = urlstr;
|
||||
document.getElementById("url").innerHTML = urlstr; //Need this as well, for Firefox
|
||||
|
||||
document.getElementById("urlbox").style.display = "block";
|
||||
}
|
||||
|
||||
@@ -30,12 +30,24 @@ $allowed_time = array('weeknow', 'weeknext', 'monthnow', 'monthnext', 'recentupc
|
||||
if(!empty($what) && !empty($time)) {
|
||||
if(in_array($what, $allowed_what) && in_array($time, $allowed_time)) {
|
||||
$courses = get_my_courses($user->id, NULL, 'id, visible, shortname');
|
||||
|
||||
$include_user = ($what == 'all');
|
||||
if ($include_user) {
|
||||
//Also include site (global) events
|
||||
|
||||
if ($what == 'all') {
|
||||
$users = $user->id;
|
||||
$groups = array();
|
||||
foreach ($courses as $course) {
|
||||
$course_groups = groups_get_all_groups($course->id, $user->id);
|
||||
if ($course_groups) {
|
||||
$groups = $groups + array_keys($course_groups);
|
||||
}
|
||||
}
|
||||
if (empty($groups)) {
|
||||
$groups = false;
|
||||
}
|
||||
$courses[SITEID] = new stdClass;
|
||||
$courses[SITEID]->shortname = get_string('globalevents', 'calendar');
|
||||
} else {
|
||||
$users = false;
|
||||
$groups = false;
|
||||
}
|
||||
|
||||
switch($time) {
|
||||
@@ -99,7 +111,7 @@ if(!empty($what) && !empty($time)) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
$whereclause = calendar_sql_where($timestart, $timeend, $include_user ? array($user->id) : false, false, array_keys($courses), false);
|
||||
$whereclause = calendar_sql_where($timestart, $timeend, $users, $groups, array_keys($courses), false);
|
||||
if($whereclause === false) {
|
||||
$events = array();
|
||||
}
|
||||
|
||||
+5
-4
@@ -294,7 +294,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
$popup = calendar_get_popup(true, false);
|
||||
$cell = '<a href="#" '.$popup.'>'.$day.'</a>';
|
||||
}
|
||||
$cell = '<span class="accesshide">'.$today.' </span>'.$cell;
|
||||
$cell = get_accesshide($today.' ').$cell;
|
||||
}
|
||||
|
||||
// Just display it
|
||||
@@ -1198,13 +1198,14 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
|
||||
else if(isset($USER->groupmember[$courseid])) {
|
||||
//changed to 2D array
|
||||
foreach ($USER->groupmember[$courseid] as $groupid){
|
||||
$grouparray[] = $groupid;
|
||||
$rec = get_record('groups_courses_groups', 'courseid', $courseid, 'groupid', $groupid);
|
||||
//$grouparray[] = $groupid;
|
||||
$grouparray[] = $rec->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($groupids)) {
|
||||
$sql = "SELECT id, groupid
|
||||
$sql = "SELECT groupid, groupid
|
||||
FROM {$CFG->prefix}groups_courses_groups
|
||||
WHERE courseid IN (".implode(',', $groupids).')';
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"view.php\">$strcalendar</a> -> $strpreferences";
|
||||
<a href=\"view.php?course=$course->id\">$strcalendar</a> -> $strpreferences";
|
||||
} else {
|
||||
$navigation = "<a href=\"view.php\">$strcalendar</a> -> $strpreferences";
|
||||
$navigation = "<a href=\"view.php?course=$course->id\">$strcalendar</a> -> $strpreferences";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ class course_edit_form extends moodleform {
|
||||
|
||||
$mform->addElement('htmleditor','summary', get_string('summary'), array('rows'=> '10', 'cols'=>'65'));
|
||||
$mform->setHelpButton('summary', array('text', get_string('helptext')), true);
|
||||
$mform->setDefault('summary', get_string('defaultcoursesummary'));
|
||||
$mform->addRule('summary', get_string('missingsummary'), 'required', null, 'client');
|
||||
$mform->setType('summary', PARAM_RAW);
|
||||
|
||||
$courseformats = get_list_of_plugins('course/format');
|
||||
@@ -253,9 +251,9 @@ class course_edit_form extends moodleform {
|
||||
$mform->addElement('header','', get_string('groups', 'group'));
|
||||
|
||||
$choices = array();
|
||||
$choices[NOGROUPS] = get_string('no');
|
||||
$choices[SEPARATEGROUPS] = get_string('separate');
|
||||
$choices[VISIBLEGROUPS] = get_string('visible');
|
||||
$choices[NOGROUPS] = get_string('groupsnone', 'group');
|
||||
$choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
|
||||
$choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
|
||||
$mform->addElement('select', 'groupmode', get_string('groupmode'), $choices);
|
||||
$mform->setHelpButton('groupmode', array('groupmode', get_string('groupmode')), true);
|
||||
$mform->setDefault('groupmode', 0);
|
||||
|
||||
@@ -204,10 +204,10 @@
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
echo '<div class="weekdates">'.$weekperiod.' ('.get_string('notavailable').')</div>';
|
||||
print_heading($weekperiod.' ('.get_string('notavailable').')', null, 3, 'weekdates');
|
||||
|
||||
} else {
|
||||
echo '<div class="weekdates">'.$weekperiod.'</div>';
|
||||
print_heading($weekperiod, null, 3, 'weekdates');
|
||||
|
||||
echo '<div class="summary">';
|
||||
$summaryformatoptions->noclean = true;
|
||||
|
||||
@@ -228,12 +228,14 @@
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$weekperiod = $weekday.' - '.$endweekday;
|
||||
|
||||
echo '<div class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
echo '<div class="weekdates">'.$currenttext.$weekday.' - '.$endweekday.' ('.get_string('notavailable').')</div>';
|
||||
print_heading($currenttext.$weekperiod.' ('.get_string('notavailable').')', null, 3, 'weekdates');
|
||||
|
||||
} else {
|
||||
echo '<div class="weekdates">'.$currenttext.$weekday.' - '.$endweekday.'</div>';
|
||||
print_heading($currenttext.$weekperiod, null, 3, 'weekdates');
|
||||
|
||||
echo '<div class="summary">';
|
||||
$summaryformatoptions->noclean = true;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<td valign="top">
|
||||
<label for="removeselect"><?php echo count($alreadycourses) . " ". $stralreadycourses ?></label>
|
||||
<br />
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
|
||||
onFocus="getElementById('studentform').add.disabled=true;
|
||||
getElementById('studentform').remove.disabled=false;
|
||||
getElementById('studentform').addselect.selectedIndex=-1;">
|
||||
@@ -29,7 +29,7 @@
|
||||
<td valign="top">
|
||||
<label for="addselect"><?php echo $numcourses . " " . $strpotentialcourses ?></label>
|
||||
<br />
|
||||
<select name="addselect[]" size="20" id="addselect" multiple
|
||||
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
|
||||
onFocus="getElementById('studentform').add.disabled=false;
|
||||
getElementById('studentform').remove.disabled=true;
|
||||
getElementById('studentform').removeselect.selectedIndex=-1;">
|
||||
|
||||
+5
-11
@@ -46,13 +46,13 @@
|
||||
/// If data for a new category was submitted, then add it
|
||||
if ($form = data_submitted() and confirm_sesskey() and has_capability('moodle/category:create', $context)) {
|
||||
if (!empty($form->addcategory)) {
|
||||
unset($newcategory);
|
||||
$newcategory->name = stripslashes_safe($form->addcategory);
|
||||
$newcategory = new object();
|
||||
$newcategory->name = $form->addcategory;
|
||||
$newcategory->sortorder = 999;
|
||||
if (!insert_record('course_categories', $newcategory)) {
|
||||
notify("Could not insert the new category '" . format_string($newcategory->name) . "'");
|
||||
notify("Could not insert the new category '" . format_string(stripslashes($newcategory->name)) . "'");
|
||||
} else {
|
||||
notify(get_string('categoryadded', '', format_string($newcategory->name)));
|
||||
notify(get_string('categoryadded', '', format_string(stripslashes($newcategory->name))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,13 +298,7 @@
|
||||
echo '</table>';
|
||||
|
||||
echo '<div class="buttons">';
|
||||
/// Print link to create a new course
|
||||
if (has_capability('moodle/course:create', $context)) {
|
||||
unset($options);
|
||||
$options['category'] = $category->id;
|
||||
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
|
||||
}
|
||||
|
||||
|
||||
if (has_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->enablecourserequests)) {
|
||||
print_single_button('pending.php',NULL, get_string('coursespending'), 'get');
|
||||
}
|
||||
|
||||
+5
-1
@@ -28,6 +28,11 @@
|
||||
require_login();
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (!(course_parent_visible($course) || $course->visible) && !has_capability('moodle/course:viewhiddencourses', $context)) {
|
||||
error(get_string('coursehidden'), $CFG->wwwroot .'/');
|
||||
}
|
||||
|
||||
print_header(get_string("summaryof", "", $course->fullname));
|
||||
|
||||
print_heading(format_string($course->fullname) . '<br />(' . format_string($course->shortname) . ')');
|
||||
@@ -50,7 +55,6 @@
|
||||
|
||||
echo filter_text(text_to_html($course->summary),$course->id);
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if ($managerroles = get_config('', 'coursemanager')) {
|
||||
$coursemanagerroles = split(',', $managerroles);
|
||||
foreach ($coursemanagerroles as $roleid) {
|
||||
|
||||
+30
-26
@@ -326,7 +326,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
|
||||
|
||||
if ($modaction) {
|
||||
$firstletter = substr($modaction, 0, 1);
|
||||
if (ctype_alpha($firstletter)) {
|
||||
if (preg_match('/[[:alpha:]]/', $firstletter)) {
|
||||
$where .= " AND\n lower(l.action) LIKE '%" . strtolower($modaction) . "%'";
|
||||
} else if ($firstletter == '-') {
|
||||
$where .= " AND\n lower(l.action) NOT LIKE '%" . strtolower(substr($modaction, 1)) . "%'";
|
||||
@@ -389,7 +389,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
|
||||
|
||||
if ($modaction) {
|
||||
$firstletter = substr($modaction, 0, 1);
|
||||
if (ctype_alpha($firstletter)) {
|
||||
if (preg_match('/[[:alpha:]]/', $firstletter)) {
|
||||
$joins[] = "lower(l.action) LIKE '%" . strtolower($modaction) . "%'";
|
||||
} else if ($firstletter == '-') {
|
||||
$joins[] = "lower(l.action) NOT LIKE '%" . strtolower(substr($modaction, 1)) . "%'";
|
||||
@@ -463,7 +463,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
|
||||
|
||||
print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
|
||||
|
||||
echo '<table class="logtable genearlbox boxaligncenter" summary="">'."\n";
|
||||
echo '<table class="logtable generalbox boxaligncenter" summary="">'."\n";
|
||||
// echo "<table class=\"logtable\" cellpadding=\"3\" cellspacing=\"0\" summary=\"\">\n";
|
||||
echo "<tr>";
|
||||
if ($course->id == SITEID) {
|
||||
@@ -973,7 +973,7 @@ function print_overview($courses) {
|
||||
if ($modules = get_records('modules')) {
|
||||
foreach ($modules as $mod) {
|
||||
if (file_exists(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php')) {
|
||||
require_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php');
|
||||
include_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php');
|
||||
$fname = $mod->name.'_print_overview';
|
||||
if (function_exists($fname)) {
|
||||
$fname($courses,$htmlarray);
|
||||
@@ -1122,23 +1122,27 @@ function print_recent_activity($course) {
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
|
||||
|
||||
foreach ($mods as $mod) { // Each module gets it's own logs and prints them
|
||||
include_once($CFG->dirroot.'/mod/'.$mod->name.'/lib.php');
|
||||
$print_recent_activity = $mod->name.'_print_recent_activity';
|
||||
if (function_exists($print_recent_activity)) {
|
||||
//
|
||||
// NOTE:
|
||||
// $isteacher (second parameter below) is to be deprecated!
|
||||
//
|
||||
// TODO:
|
||||
// 1) Make sure that all _print_recent_activity functions are
|
||||
// not using the $isteacher value.
|
||||
// 2) Eventually, remove the $isteacher parameter from the
|
||||
// function calls.
|
||||
//
|
||||
$modcontent = $print_recent_activity($course, $viewfullnames, $timestart);
|
||||
if ($modcontent) {
|
||||
$content = true;
|
||||
if (file_exists($CFG->dirroot.'/mod/'.$mod->name.'/lib.php')) {
|
||||
include_once($CFG->dirroot.'/mod/'.$mod->name.'/lib.php');
|
||||
$print_recent_activity = $mod->name.'_print_recent_activity';
|
||||
if (function_exists($print_recent_activity)) {
|
||||
//
|
||||
// NOTE:
|
||||
// $isteacher (second parameter below) is to be deprecated!
|
||||
//
|
||||
// TODO:
|
||||
// 1) Make sure that all _print_recent_activity functions are
|
||||
// not using the $isteacher value.
|
||||
// 2) Eventually, remove the $isteacher parameter from the
|
||||
// function calls.
|
||||
//
|
||||
$modcontent = $print_recent_activity($course, $viewfullnames, $timestart);
|
||||
if ($modcontent) {
|
||||
$content = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/// Really need to indicate an error here to admins. Is there a way to do this?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1486,7 +1490,7 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
|
||||
continue;
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/mod/$modname/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$modname/lib.php");
|
||||
$gettypesfunc = $modname.'_get_types';
|
||||
if (function_exists($gettypesfunc)) {
|
||||
$types = $gettypesfunc();
|
||||
@@ -1938,15 +1942,15 @@ function print_course_search($value="", $return=false, $format="plain") {
|
||||
} else if ($format == 'short') {
|
||||
$output = '<form id="'.$id.'" action="'.$CFG->wwwroot.'/course/search.php" method="get">';
|
||||
$output .= '<fieldset class="coursesearchbox invisiblefieldset">';
|
||||
$output .= '<label for="coursesearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="coursesearchbox" size="12" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<label for="shortsearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="shortsearchbox" size="12" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.get_string('go').'" />';
|
||||
$output .= '</fieldset></form>';
|
||||
} else if ($format == 'navbar') {
|
||||
$output = '<form id="coursesearchnavbar" action="'.$CFG->wwwroot.'/course/search.php" method="get">';
|
||||
$output .= '<fieldset class="coursesearchbox invisiblefieldset">';
|
||||
$output .= '<label for="coursesearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="coursesearchbox" size="20" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<label for="navsearchbox">'.$strsearchcourses.': </label>';
|
||||
$output .= '<input type="text" id="navsearchbox" size="20" name="search" alt="'.s($strsearchcourses).'" value="'.s($value, true).'" />';
|
||||
$output .= '<input type="submit" value="'.get_string('go').'" />';
|
||||
$output .= '</fieldset></form>';
|
||||
}
|
||||
@@ -2526,7 +2530,7 @@ function move_courses ($courseids, $categoryid) {
|
||||
// figure out a sortorder that we can use in the destination category
|
||||
$sortorder = get_field_sql('SELECT MIN(sortorder)-1 AS min
|
||||
FROM ' . $CFG->prefix . 'course WHERE category=' . $categoryid);
|
||||
if ($sortorder === false) {
|
||||
if (is_null($sortorder) || $sortorder === false) {
|
||||
// the category is empty
|
||||
// rather than let the db default to 0
|
||||
// set it to > 100 and avoid extra work in fix_coursesortorder()
|
||||
|
||||
+2
-1
@@ -57,8 +57,9 @@
|
||||
print_error('nologinas');
|
||||
}
|
||||
$context = $systemcontext;
|
||||
} else if (has_capability('moodle/user:loginas', $coursecontext)) {
|
||||
} else {
|
||||
require_login($course);
|
||||
require_capability('moodle/user:loginas', $coursecontext);
|
||||
if (!has_capability('moodle/course:view', $coursecontext, $userid, false)) {
|
||||
error('This user is not in this course!');
|
||||
}
|
||||
|
||||
+6
-2
@@ -269,8 +269,12 @@
|
||||
}
|
||||
|
||||
rebuild_course_cache($course->id);
|
||||
|
||||
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
|
||||
|
||||
if (isset($fromform->submitbutton)) {
|
||||
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
|
||||
} else {
|
||||
redirect("$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
exit;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
require_once ($CFG->libdir.'/formslib.php');
|
||||
/**
|
||||
* This class adds extra methods to form wrapper specific to be used for module
|
||||
* add / update forms (mod/{modname}.mod_form.php replaces deprecared mod/{modname}/mod.html
|
||||
* add / update forms (mod/{modname}.mod_form.php replaces deprecated mod/{modname}/mod.html
|
||||
*
|
||||
*/
|
||||
class moodleform_mod extends moodleform {
|
||||
@@ -150,6 +150,39 @@ class moodleform_mod extends moodleform {
|
||||
return array('visible'=>$visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriding formslib's add_action_buttons() method, to add an extra submit "save changes and return" button.
|
||||
*
|
||||
* @param bool $cancel
|
||||
* @param string $submitlabel
|
||||
* @param string $submit2label
|
||||
* @return void
|
||||
*/
|
||||
function add_action_buttons($cancel=true, $submitlabel=null, $submit2label=null) {
|
||||
if (is_null($submitlabel)) {
|
||||
$submitlabel = get_string('savechangesanddisplay');
|
||||
}
|
||||
|
||||
if (is_null($submit2label)) {
|
||||
$submit2label = get_string('savechangesandreturntocourse');
|
||||
}
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
//when two elements we need a group
|
||||
$buttonarray=array();
|
||||
$buttonarray[] = &$mform->createElement('submit', 'submitbutton', $submitlabel);
|
||||
$buttonarray[] = &$mform->createElement('submit', 'submitbutton2', $submit2label);
|
||||
|
||||
if ($cancel) {
|
||||
$buttonarray[] = &$mform->createElement('cancel');
|
||||
}
|
||||
|
||||
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
|
||||
$mform->setType('buttonar', PARAM_RAW);
|
||||
$mform->closeHeaderBefore('buttonar');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+6
-3
@@ -22,10 +22,13 @@
|
||||
|
||||
// place at beginning of category
|
||||
fix_course_sortorder();
|
||||
if (empty($CFG->defaultrequestedcategory)) {
|
||||
$CFG->defaultrequestedcategory = 1; //yuk, but default to miscellaneous.
|
||||
|
||||
if (empty($CFG->defaultrequestcategory) or !record_exists('course_categories', 'id', $CFG->defaultrequestcategory)) {
|
||||
// default to first top level directory, hacky but means things don't break
|
||||
$CFG->defaultrequestcategory = get_field('course_categories', 'id', 'parent', '0');
|
||||
}
|
||||
$course->category = $CFG->defaultrequestedcategory;
|
||||
|
||||
$course->category = $CFG->defaultrequestcategory;
|
||||
$course->sortorder = get_field_sql("SELECT min(sortorder)-1 FROM {$CFG->prefix}course WHERE category=$course->category");
|
||||
if (empty($course->sortorder)) {
|
||||
$course->sortorder = 1000;
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
$module = get_record('modules','id',$moduleid);
|
||||
$modulename = get_string('modulename',$module->name);
|
||||
|
||||
require_once($CFG->dirroot.'/mod/'.$module->name.'/lib.php');
|
||||
include_once($CFG->dirroot.'/mod/'.$module->name.'/lib.php');
|
||||
|
||||
$viewfun = $module->name.'_get_view_actions';
|
||||
$postfun = $module->name.'_get_post_actions';
|
||||
|
||||
@@ -83,6 +83,7 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
move_section($course, $id, $value);
|
||||
break;
|
||||
}
|
||||
rebuild_course_cache($course->id);
|
||||
break;
|
||||
|
||||
case 'resource':
|
||||
@@ -130,6 +131,7 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
moveto_module($mod, $section, $beforemod);
|
||||
break;
|
||||
}
|
||||
rebuild_course_cache($course->id);
|
||||
break;
|
||||
|
||||
case 'course':
|
||||
|
||||
+3
-1
@@ -127,7 +127,9 @@
|
||||
$courses = array();
|
||||
foreach ($blocks as $block) {
|
||||
$courseid = $block->pageid;
|
||||
if ($courseid==0) {
|
||||
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
|
||||
// and it should not show up on course search page
|
||||
if ($courseid==0 || $block->pagetype != 'course-view') {
|
||||
continue;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
$userid = optional_param('user', 0, PARAM_INT); //course
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
if($userid == $USER->id){
|
||||
// the rest of this code assumes $userid=0 means
|
||||
// you are unassigning yourself, so set this for the
|
||||
// correct capabiliy checks & language later
|
||||
$userid = 0;
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error('Invalid course id');
|
||||
}
|
||||
|
||||
+11
-1
@@ -17,12 +17,22 @@
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
//require_login($course);
|
||||
$COURSE = clone($course);
|
||||
|
||||
if (! $user = get_record("user", "id", $user)) {
|
||||
error("User ID is incorrect");
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
if ($user->deleted) {
|
||||
print_header();
|
||||
print_heading(get_string('userdeleted'));
|
||||
print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
|
||||
|
||||
@@ -198,21 +198,17 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
|
||||
$message = "Order must be settled. Try VOID, check Cut-Off time if it fails!";
|
||||
return AN_RETURNZERO;
|
||||
}
|
||||
if (empty($extra->amount)) {
|
||||
$message = "No valid amount!";
|
||||
return AN_RETURNZERO;
|
||||
}
|
||||
$timenowsettle = authorize_getsettletime(time());
|
||||
$timediff = $timenowsettle - (120 * 3600 * 24);
|
||||
if ($order->settletime < $timediff) {
|
||||
$message = "Order must be credited within 120 days!";
|
||||
return AN_RETURNZERO;
|
||||
}
|
||||
if (empty($extra)) {
|
||||
$message = "Need extra fields to REFUND!";
|
||||
return AN_RETURNZERO;
|
||||
}
|
||||
$total = floatval($extra->sum) + floatval($extra->amount);
|
||||
if (($extra->amount == 0) || ($total > $order->amount)) {
|
||||
$message = "Can be credited up to original amount.";
|
||||
return AN_RETURNZERO;
|
||||
}
|
||||
|
||||
$poststring .= '&x_type=CREDIT&x_trans_id=' . urlencode($order->transid);
|
||||
$poststring .= '&x_currency_code=' . urlencode($order->currency);
|
||||
$poststring .= '&x_invoice_num=' . urlencode($extra->orderid);
|
||||
@@ -299,7 +295,7 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
|
||||
$responsecode = intval($response[0]);
|
||||
if ($responsecode == AN_APPROVED || $responsecode == AN_REVIEW)
|
||||
{
|
||||
$transid = intval($response[6]);
|
||||
$transid = floatval($response[6]);
|
||||
if ($test || $transid == 0) {
|
||||
return $responsecode; // don't update original transaction in test mode.
|
||||
}
|
||||
@@ -336,7 +332,6 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
|
||||
$extra->status = AN_STATUS_CREDIT;
|
||||
$extra->transid = $transid;
|
||||
$extra->settletime = authorize_getsettletime(time());
|
||||
unset($extra->sum); // this is not used in refunds table.
|
||||
if (! $extra->id = insert_record('enrol_authorize_refunds', $extra)) {
|
||||
unset($extra->id);
|
||||
email_to_admin("Error while trying to insert data " .
|
||||
|
||||
@@ -69,18 +69,6 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if (substr($CFG->wwwroot, 0, 5) !== 'https') { /* https && loginhttps */ ?>
|
||||
<tr valign="top">
|
||||
<td align="right">loginhttps:</td>
|
||||
<td><?php
|
||||
echo (empty($CFG->loginhttps) ? "<span style=\"color:red\"><b>off</b></span>" : "<font color=\"green\">on</font>");
|
||||
$a->url = "$CFG->wwwroot/$CFG->admin/settings.php?section=httpsecurity";
|
||||
echo '<br />'; print_string("logindesc", "enrol_authorize", $a);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } /* end: https && loginhttps */ ?>
|
||||
|
||||
<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizesettings", "enrol_authorize") ?></h4></td></tr>
|
||||
|
||||
<tr valign="top">
|
||||
@@ -130,7 +118,7 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
<tr valign="top">
|
||||
<td align="right">an_authcode:</td>
|
||||
<td><?php print_checkbox('an_authcode', '1', !empty($frm->an_authcode)) ?>
|
||||
<?php helpbutton('authcode', '', 'enrol/authorize'); ?><br />
|
||||
<?php helpbutton('authcode', 'authcode', 'enrol/authorize'); ?><br />
|
||||
<?php print_string("adminauthcode", "enrol_authorize") ?></td>
|
||||
</tr>
|
||||
|
||||
@@ -148,7 +136,7 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
foreach ($allpaymentmethods as $key) {
|
||||
if ($key == AN_METHOD_CC) {
|
||||
print_checkbox('acceptmethods[]', AN_METHOD_CC, in_array(AN_METHOD_CC, $paymentmethodsenabled), get_string('method'.AN_METHOD_CC,'enrol_authorize'));
|
||||
echo("<ul>"); // blockquote breaks <span> and <br> tags
|
||||
echo("<ul>"); // blockquote breaks <span> and <br> tags
|
||||
$acceptedccs = array_keys(get_list_of_creditcards());
|
||||
$allccs = get_list_of_creditcards(true);
|
||||
foreach ($allccs as $key => $val) {
|
||||
@@ -160,7 +148,7 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
}
|
||||
elseif ($key == AN_METHOD_ECHECK) {
|
||||
print_checkbox('acceptmethods[]', AN_METHOD_ECHECK, in_array(AN_METHOD_ECHECK, $paymentmethodsenabled), get_string('method'.AN_METHOD_ECHECK,'enrol_authorize'));
|
||||
echo("<ul>"); // blockquote breaks <span> and <br> tags
|
||||
echo("<ul>"); // blockquote breaks <span> and <br> tags
|
||||
$echecktypesenabled = get_list_of_bank_account_types();
|
||||
$allechecktypes = get_list_of_bank_account_types(true);
|
||||
foreach ($allechecktypes as $key) {
|
||||
@@ -175,7 +163,7 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
|
||||
<?php helpbutton('orderreview', '', 'enrol/authorize'); ?>
|
||||
<?php helpbutton('orderreview', 'orderreview', 'enrol/authorize'); ?>
|
||||
</h4></td></tr>
|
||||
|
||||
<tr valign="top">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<FIELD NAME="ccname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="refundinfo" NEXT="courseid"/>
|
||||
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ccname" NEXT="userid"/>
|
||||
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="transid"/>
|
||||
<FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
|
||||
<FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
|
||||
<FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid" NEXT="timecreated"/>
|
||||
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="settletime"/>
|
||||
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="amount"/>
|
||||
@@ -35,7 +35,7 @@
|
||||
<FIELD NAME="orderid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="status"/>
|
||||
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="orderid" NEXT="amount"/>
|
||||
<FIELD NAME="amount" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="transid"/>
|
||||
<FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
|
||||
<FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
|
||||
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
@@ -47,4 +47,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
|
||||
// MySQL commands for upgrading this enrolment module
|
||||
@@ -56,7 +56,7 @@ function enrol_authorize_upgrade($oldversion=0) {
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `orderid` (`orderid`));");
|
||||
// defaults.
|
||||
if ($courses = get_records_select('course', '', '', 'id, cost, currency')) {
|
||||
if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) {
|
||||
foreach ($courses as $course) {
|
||||
execute_sql("UPDATE {$CFG->prefix}enrol_authorize
|
||||
SET amount = '$course->cost', currency = '$course->currency'
|
||||
@@ -70,7 +70,7 @@ function enrol_authorize_upgrade($oldversion=0) {
|
||||
table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid');
|
||||
table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null');
|
||||
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
|
||||
if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) {
|
||||
if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) {
|
||||
include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php");
|
||||
foreach ($settlements as $settlement) {
|
||||
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" .
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
|
||||
// PostgreSQL commands for upgrading this enrolment module
|
||||
@@ -67,7 +67,7 @@ function enrol_authorize_upgrade($oldversion=0) {
|
||||
);");
|
||||
modify_database("","CREATE INDEX prefix_enrol_authorize_refunds_orderid_idx ON prefix_enrol_authorize_refunds (orderid);");
|
||||
// defaults.
|
||||
if ($courses = get_records_select('course', '', '', 'id, cost, currency')) {
|
||||
if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) {
|
||||
foreach ($courses as $course) {
|
||||
execute_sql("UPDATE {$CFG->prefix}enrol_authorize
|
||||
SET amount = '$course->cost', currency = '$course->currency'
|
||||
@@ -81,7 +81,7 @@ function enrol_authorize_upgrade($oldversion=0) {
|
||||
table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid');
|
||||
table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null');
|
||||
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
|
||||
if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) {
|
||||
if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) {
|
||||
include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php");
|
||||
foreach ($settlements as $settlement) {
|
||||
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" .
|
||||
|
||||
@@ -59,6 +59,46 @@ function xmldb_enrol_authorize_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2006112902) {
|
||||
/// enrol_authorize.transid
|
||||
/// Define index transid (not unique) to be dropped form enrol_authorize
|
||||
$table = new XMLDBTable('enrol_authorize');
|
||||
$index = new XMLDBIndex('transid');
|
||||
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
drop_index($table, $index);
|
||||
|
||||
/// Changing precision of field transid on table enrol_authorize to (20)
|
||||
$table = new XMLDBTable('enrol_authorize');
|
||||
$field = new XMLDBField('transid');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'userid');
|
||||
change_field_precision($table, $field);
|
||||
|
||||
/// Launch add index transid again
|
||||
$table = new XMLDBTable('enrol_authorize');
|
||||
$index = new XMLDBIndex('transid');
|
||||
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
add_index($table, $index);
|
||||
|
||||
/// enrol_authorize_refunds.transid
|
||||
/// Define index transid (not unique) to be dropped form enrol_authorize_refunds
|
||||
$table = new XMLDBTable('enrol_authorize_refunds');
|
||||
$index = new XMLDBIndex('transid');
|
||||
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
drop_index($table, $index);
|
||||
|
||||
/// Changing precision of field transid on table enrol_authorize_refunds to (20)
|
||||
$table = new XMLDBTable('enrol_authorize_refunds');
|
||||
$field = new XMLDBField('transid');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, null, null, '0', 'amount');
|
||||
change_field_precision($table, $field);
|
||||
|
||||
/// Launch add index transid again
|
||||
$table = new XMLDBTable('enrol_authorize_refunds');
|
||||
$index = new XMLDBIndex('transid');
|
||||
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
add_index($table, $index);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+22
-19
@@ -96,7 +96,6 @@ class enrolment_plugin_authorize
|
||||
|
||||
if ($course->password) {
|
||||
$password = '';
|
||||
$teacher = get_teacher($course->id);
|
||||
include($CFG->dirroot.'/enrol/manual/enrol.html');
|
||||
}
|
||||
|
||||
@@ -104,6 +103,13 @@ class enrolment_plugin_authorize
|
||||
}
|
||||
|
||||
|
||||
function print_enrolmentkeyfrom($course)
|
||||
{
|
||||
$manual = enrolment_factory::factory('manual');
|
||||
$manual->print_enrolmentkeyfrom($course);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates registration forms and enrols student to course.
|
||||
*
|
||||
@@ -212,7 +218,7 @@ class enrolment_plugin_authorize
|
||||
redirect($CFG->wwwroot, get_string("reviewnotify", "enrol_authorize"), '30');
|
||||
}
|
||||
else {
|
||||
enrol_into_course($course, $USER, 'manual');
|
||||
enrol_into_course($course, $USER, 'authorize');
|
||||
redirect("$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
return;
|
||||
@@ -235,7 +241,7 @@ class enrolment_plugin_authorize
|
||||
$a->orderid = $order->id;
|
||||
$emailsubject = get_string('adminnewordersubject', 'enrol_authorize', $a);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if ($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments')) {
|
||||
if (($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments'))) {
|
||||
foreach ($paymentmanagers as $paymentmanager) {
|
||||
email_to_user($paymentmanager, $USER, $emailsubject, $emailmessage);
|
||||
}
|
||||
@@ -245,7 +251,7 @@ class enrolment_plugin_authorize
|
||||
}
|
||||
|
||||
// Credit card captured, ENROL student now...
|
||||
if (enrol_into_course($course, $USER, 'manual')) {
|
||||
if (enrol_into_course($course, $USER, 'authorize')) {
|
||||
if (!empty($CFG->enrol_mailstudents)) {
|
||||
send_welcome_messages($order->id);
|
||||
}
|
||||
@@ -407,7 +413,7 @@ class enrolment_plugin_authorize
|
||||
global $CFG;
|
||||
$mconfig = get_config('enrol/authorize');
|
||||
|
||||
if (! check_openssl_loaded()) {
|
||||
if (!check_openssl_loaded()) {
|
||||
notify('PHP must be compiled with SSL support (--with-openssl)');
|
||||
}
|
||||
|
||||
@@ -430,13 +436,14 @@ class enrolment_plugin_authorize
|
||||
$captureday = intval($frm->an_capture_day);
|
||||
$emailexpired = intval($frm->an_emailexpired);
|
||||
if ($captureday > 0 || $emailexpired > 0) {
|
||||
if ((time() - intval($mconfig->an_lastcron) > 3600 * 24)) {
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if ((time() - intval($lastcron) > 3600 * 24)) {
|
||||
notify(get_string('admincronsetup', 'enrol_authorize'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($count = count_records('enrol_authorize', 'status', AN_STATUS_AUTH)) {
|
||||
if (($count = count_records('enrol_authorize', 'status', AN_STATUS_AUTH))) {
|
||||
$a = new stdClass;
|
||||
$a->count = $count;
|
||||
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
|
||||
@@ -505,7 +512,8 @@ class enrolment_plugin_authorize
|
||||
$emailexpired = ($emailexpired > 5) ? 5 : (($emailexpired < 0) ? 0 : $emailexpired);
|
||||
|
||||
if (!empty($reviewval) && ($captureday > 0 || $emailexpired > 0)) {
|
||||
if (time() - intval($mconfig->an_lastcron) > 3600 * 24) {
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - intval($lastcron) > 3600 * 24) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -517,8 +525,7 @@ class enrolment_plugin_authorize
|
||||
set_config('an_sorttype', $sorttype);
|
||||
|
||||
// https and openssl library is required
|
||||
if ((substr($CFG->wwwroot, 0, 5) !== 'https' and empty($CFG->loginhttps)) or
|
||||
!check_openssl_loaded()) {
|
||||
if ((substr($CFG->wwwroot, 0, 5) !== 'https' and empty($CFG->loginhttps)) or !check_openssl_loaded()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -574,7 +581,6 @@ class enrolment_plugin_authorize
|
||||
$settlementtime = authorize_getsettletime($timenow);
|
||||
$timediff30 = $settlementtime - (30 * $oneday);
|
||||
$mconfig = get_config('enrol/authorize');
|
||||
set_config('an_lastcron', $timenow, 'enrol/authorize');
|
||||
|
||||
mtrace("Processing authorize cron...");
|
||||
|
||||
@@ -586,10 +592,7 @@ class enrolment_plugin_authorize
|
||||
}
|
||||
|
||||
mtrace(" scheduled capture", ": ");
|
||||
if (empty($CFG->an_review) or
|
||||
(!empty($CFG->an_test)) or
|
||||
(intval($CFG->an_capture_day) < 1) or
|
||||
(!check_openssl_loaded())) {
|
||||
if (empty($CFG->an_review) or (!empty($CFG->an_test)) or (intval($CFG->an_capture_day) < 1) or (!check_openssl_loaded())) {
|
||||
mtrace("disabled");
|
||||
return; // order review disabled or test mode or manual capture or openssl wasn't loaded.
|
||||
}
|
||||
@@ -615,6 +618,7 @@ class enrolment_plugin_authorize
|
||||
mtrace("blocked");
|
||||
return;
|
||||
}
|
||||
set_config('an_lastcron', $timenow, 'enrol/authorize');
|
||||
|
||||
mtrace(" $ordercount orders are being processed now", ": ");
|
||||
|
||||
@@ -641,7 +645,7 @@ class enrolment_plugin_authorize
|
||||
$timeend = $order->settletime + $course->enrolperiod;
|
||||
}
|
||||
$user = get_record('user', 'id', $order->userid);
|
||||
if (role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'manual')) {
|
||||
if (role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'authorize')) {
|
||||
$this->log .= "User($user->id) has been enrolled to course($course->id).\n";
|
||||
if (!empty($CFG->enrol_mailstudents)) {
|
||||
$sendem[] = $order->id;
|
||||
@@ -717,8 +721,7 @@ class enrolment_plugin_authorize
|
||||
// get_users_by_capability() does not handling user level resolving
|
||||
// After user resolving, get_admin() to get_users_by_capability()
|
||||
$adminuser = get_admin();
|
||||
$select = "status IN(".AN_STATUS_UNDERREVIEW.",".AN_STATUS_APPROVEDREVIEW.") " .
|
||||
"AND (timecreated<'$onepass') AND (timecreated>'$timediff60')";
|
||||
$select = "status IN(".AN_STATUS_UNDERREVIEW.",".AN_STATUS_APPROVEDREVIEW.") AND (timecreated<'$onepass') AND (timecreated>'$timediff60')";
|
||||
$count = count_records_select('enrol_authorize', $select);
|
||||
if ($count) {
|
||||
$a = new stdClass;
|
||||
@@ -780,7 +783,7 @@ class enrolment_plugin_authorize
|
||||
foreach($courseinfos as $courseinfo) {
|
||||
$lastcourse = $courseinfo->courseid;
|
||||
$context = get_context_instance(CONTEXT_COURSE, $lastcourse);
|
||||
if ($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments')) {
|
||||
if (($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments'))) {
|
||||
$a = new stdClass;
|
||||
$a->course = $courseinfo->shortname;
|
||||
$a->pending = $courseinfo->cnt;
|
||||
|
||||
@@ -17,9 +17,10 @@ class enrol_authorize_form extends moodleform
|
||||
$mform =& $this->_form;
|
||||
$course = $this->_customdata['course'];
|
||||
|
||||
$mform->addElement('header', '', ' ' . get_string('paymentrequired'), '');
|
||||
if ($othermethodstr = $this->other_method_available($paymentmethod)) {
|
||||
$mform->addElement('static', '', '<div align="right">' . $othermethodstr . ' </div>', '');
|
||||
$mform->addElement('header', 'general', get_string('paymentrequired'));
|
||||
$othermethodstr = $this->other_method_available($paymentmethod);
|
||||
if ($othermethodstr) {
|
||||
$mform->addElement('static', '', '<div align="right">' . $othermethodstr . '</div>', '');
|
||||
}
|
||||
|
||||
$mform->addElement('hidden', 'id', $course->id);
|
||||
@@ -28,11 +29,10 @@ class enrol_authorize_form extends moodleform
|
||||
$mform->addElement('hidden', 'paymentmethod', $paymentmethod);
|
||||
$mform->setType('paymentmethod', PARAM_ALPHA);
|
||||
|
||||
$firstlastnamestr = (AN_METHOD_CC == $paymentmethod) ?
|
||||
get_string('nameoncard', 'enrol_authorize') : get_string('echeckfirslasttname', 'enrol_authorize');
|
||||
$firstlastnamestr = (AN_METHOD_CC == $paymentmethod) ? get_string('nameoncard', 'enrol_authorize') : get_string('echeckfirslasttname', 'enrol_authorize');
|
||||
$firstlastnamegrp = array();
|
||||
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'firstname', '', 'size="8"');
|
||||
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'lastname', '', 'size="8"');
|
||||
$firstlastnamegrp[] = &$mform->createElement('text', 'firstname', '', 'size="16"');
|
||||
$firstlastnamegrp[] = &$mform->createElement('text', 'lastname', '', 'size="16"');
|
||||
$mform->addGroup($firstlastnamegrp, 'firstlastgrp', $firstlastnamestr, ' ', false);
|
||||
$firstlastnamegrprules = array();
|
||||
$firstlastnamegrprules['firstname'][] = array(get_string('missingfirstname'), 'required', null, 'client');
|
||||
@@ -45,31 +45,26 @@ class enrol_authorize_form extends moodleform
|
||||
|
||||
if (AN_METHOD_CC == $paymentmethod)
|
||||
{
|
||||
$mform->addElement('text', 'cc', get_string('ccno', 'enrol_authorize'), 'size="20"');
|
||||
$mform->addElement('passwordreveal', 'cc', get_string('ccno', 'enrol_authorize'), 'size="20"');
|
||||
$mform->setType('cc', PARAM_ALPHANUM);
|
||||
$mform->setDefault('cc', '');
|
||||
$mform->addRule('cc', get_string('missingcc', 'enrol_authorize'), 'required', null, 'client');
|
||||
$mform->addRule('cc', get_string('ccinvalid', 'enrol_authorize'), 'numeric', null, 'client');
|
||||
|
||||
$creditcardsmenu = array('' => get_string('choose')) + get_list_of_creditcards();
|
||||
$mform->addElement('select', 'cctype', get_string('cctype', 'enrol_authorize'), $creditcardsmenu);
|
||||
$mform->setType('cctype', PARAM_ALPHA);
|
||||
$mform->addRule('cctype', get_string('missingcctype', 'enrol_authorize'), 'required', null, 'client');
|
||||
$mform->setDefault('cctype', '');
|
||||
|
||||
$monthsmenu = array('' => get_string('choose'));
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$monthsmenu[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
|
||||
}
|
||||
$yearsmenu = array('' => get_string('choose'));
|
||||
$nowdate = getdate();
|
||||
$nowyear = $nowdate["year"] - 1;
|
||||
for ($i = $nowyear; $i <= $nowyear + 11; $i++) {
|
||||
$yearsmenu[$i] = $i;
|
||||
$startyear = $nowdate["year"] - 1;
|
||||
$endyear = $startyear + 20;
|
||||
$yearsmenu = array('' => get_string('choose'));
|
||||
for ($i = $startyear; $i < $endyear; $i++) {
|
||||
$yearsmenu[$i] = $i;
|
||||
}
|
||||
$ccexpiregrp = array();
|
||||
$ccexpiregrp[] = &MoodleQuickForm::createElement('select', 'ccexpiremm', '', $monthsmenu);
|
||||
$ccexpiregrp[] = &MoodleQuickForm::createElement('select', 'ccexpireyyyy', '', $yearsmenu);
|
||||
$ccexpiregrp[] = &$mform->createElement('select', 'ccexpiremm', '', $monthsmenu);
|
||||
$ccexpiregrp[] = &$mform->createElement('select', 'ccexpireyyyy', '', $yearsmenu);
|
||||
$mform->addGroup($ccexpiregrp, 'ccexpiregrp', get_string('ccexpire', 'enrol_authorize'), ' ', false);
|
||||
$ccexpiregrprules = array();
|
||||
$ccexpiregrprules['ccexpiremm'][] = array(get_string('missingccexpire', 'enrol_authorize'), 'required', null, 'client');
|
||||
@@ -79,7 +74,13 @@ class enrol_authorize_form extends moodleform
|
||||
$mform->setType('ccexpireyyyy', PARAM_INT);
|
||||
$mform->setDefault('ccexpiremm', '');
|
||||
$mform->setDefault('ccexpireyyyy', '');
|
||||
|
||||
|
||||
$creditcardsmenu = array('' => get_string('choose')) + get_list_of_creditcards();
|
||||
$mform->addElement('select', 'cctype', get_string('cctype', 'enrol_authorize'), $creditcardsmenu);
|
||||
$mform->setType('cctype', PARAM_ALPHA);
|
||||
$mform->addRule('cctype', get_string('missingcctype', 'enrol_authorize'), 'required', null, 'client');
|
||||
$mform->setDefault('cctype', '');
|
||||
|
||||
$mform->addElement('text', 'cvv', get_string('ccvv', 'enrol_authorize'), 'size="4"');
|
||||
$mform->setHelpButton('cvv', array('cvv',get_string('ccvv', 'enrol_authorize'),'enrol/authorize'), true);
|
||||
$mform->setType('cvv', PARAM_ALPHANUM);
|
||||
@@ -89,11 +90,12 @@ class enrol_authorize_form extends moodleform
|
||||
|
||||
if (!empty($CFG->an_authcode)) {
|
||||
$ccauthgrp = array();
|
||||
$ccauthgrp[] = &MoodleQuickForm::createElement('checkbox', 'haveauth', null, get_string('haveauthcode', 'enrol_authorize'));
|
||||
$ccauthgrp[] = &MoodleQuickForm::createElement('static', 'nextline', null, '<br />');
|
||||
$ccauthgrp[] = &MoodleQuickForm::createElement('text', 'ccauthcode', '', 'size="8"');
|
||||
$ccauthgrp[] = &$mform->createElement('checkbox', 'haveauth', null, get_string('haveauthcode', 'enrol_authorize'));
|
||||
$ccauthgrp[] = &$mform->createElement('static', 'nextline', null, '<br />');
|
||||
$ccauthgrp[] = &$mform->createElement('text', 'ccauthcode', '', 'size="8"');
|
||||
$mform->addGroup($ccauthgrp, 'ccauthgrp', get_string('authcode', 'enrol_authorize'), ' ', false);
|
||||
$mform->setHelpButton('ccauthgrp', array('authcode',get_string('authcode', 'enrol_authorize'),'enrol/authorize'), true);
|
||||
|
||||
$ccauthgrprules = array();
|
||||
$ccauthgrprules['ccauthcode'][] = array(get_string('missingccauthcode', 'enrol_authorize'), 'numeric', null, 'client');
|
||||
$mform->addGroupRule('ccauthgrp', $ccauthgrprules);
|
||||
@@ -110,9 +112,9 @@ class enrol_authorize_form extends moodleform
|
||||
$mform->addRule('ccaddress', get_string('missingaddress', 'enrol_authorize'), 'required', null, 'client');
|
||||
|
||||
$citystategrp = array();
|
||||
$citystategrp[] = &MoodleQuickForm::createElement('text', 'cccity', '', 'size="14"');
|
||||
$citystategrp[] = &MoodleQuickForm::createElement('static', 'sep', null, ' - ');
|
||||
$citystategrp[] = &MoodleQuickForm::createElement('text', 'ccstate', '', 'size="8"');
|
||||
$citystategrp[] = &$mform->createElement('text', 'cccity', '', 'size="14"');
|
||||
$citystategrp[] = &$mform->createElement('static', 'sep', null, ' - ');
|
||||
$citystategrp[] = &$mform->createElement('text', 'ccstate', '', 'size="8"');
|
||||
$mform->addGroup($citystategrp, 'citystategrp', get_string('city') . ' - ' . get_string('state'), ' ', false);
|
||||
$citystategrprules = array();
|
||||
$citystategrprules['cccity'][] = array(get_string('missingcity'), 'required', null, 'client');
|
||||
@@ -170,7 +172,6 @@ class enrol_authorize_form extends moodleform
|
||||
$mform->setType('cczip', PARAM_ALPHANUM);
|
||||
$mform->setDefault('cczip', '');
|
||||
$mform->addRule('cczip', get_string('missingzip', 'enrol_authorize'), 'required', null, 'client');
|
||||
$mform->addRule('cczip', get_string('missingzip', 'enrol_authorize'), 'numeric', null, 'client');
|
||||
|
||||
$this->add_action_buttons(false, get_string('sendpaymentbutton', 'enrol_authorize'));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
/// Load libraries
|
||||
require_once('../../config.php');
|
||||
require_once('const.php');
|
||||
require_once('locallib.php');
|
||||
require_once('localfuncs.php');
|
||||
require_once('authorizenetlib.php');
|
||||
|
||||
/// Parameters
|
||||
$orderid = optional_param('order', 0, PARAM_INT);
|
||||
|
||||
@@ -40,7 +40,7 @@ function prevent_double_paid($course)
|
||||
$sql .= 'AND status='.AN_STATUS_NONE;
|
||||
}
|
||||
|
||||
if ($recid = get_field_sql($sql)) {
|
||||
if (($recid = get_field_sql($sql))) {
|
||||
$a = new stdClass;
|
||||
$a->orderid = $recid;
|
||||
$a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$a->orderid";
|
||||
|
||||
@@ -4,9 +4,6 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.');
|
||||
}
|
||||
|
||||
require_once('const.php');
|
||||
require_once('authorizenetlib.php');
|
||||
|
||||
define('ORDER_CAPTURE', 'capture');
|
||||
define('ORDER_DELETE', 'delete');
|
||||
define('ORDER_REFUND', 'refund');
|
||||
@@ -53,7 +50,7 @@ function authorize_print_orders($courseid, $userid)
|
||||
$sql .= "WHERE (e.userid='$userid') ";
|
||||
}
|
||||
$sql .= "ORDER BY c.sortorder, c.fullname";
|
||||
if ($popupcrs = get_records_sql_menu($sql)) {
|
||||
if (($popupcrs = get_records_sql_menu($sql))) {
|
||||
$popupcrs = array($SITE->id => $SITE->fullname) + $popupcrs;
|
||||
echo "<table border='0' width='100%' cellspacing='0' cellpadding='3' class='generaltable generalbox'>";
|
||||
echo "<tr>";
|
||||
@@ -155,7 +152,7 @@ function authorize_print_orders($courseid, $userid)
|
||||
$where .= "AND (e.userid = '" . $userid . "') ";
|
||||
}
|
||||
|
||||
if ($sort = $table->get_sql_sort()) {
|
||||
if (($sort = $table->get_sql_sort())) {
|
||||
$sort = ' ORDER BY ' . $sort;
|
||||
}
|
||||
|
||||
@@ -163,7 +160,7 @@ function authorize_print_orders($courseid, $userid)
|
||||
$table->initialbars($totalcount > $perpage);
|
||||
$table->pagesize($perpage, $totalcount);
|
||||
|
||||
if ($records = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
|
||||
if (($records = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size()))) {
|
||||
foreach ($records as $record) {
|
||||
$actionstatus = authorize_get_status_action($record);
|
||||
$color = authorize_get_status_color($actionstatus->status);
|
||||
@@ -279,7 +276,7 @@ function authorize_print_order_details($orderno)
|
||||
else {
|
||||
if (empty($CFG->an_test)) {
|
||||
$user = get_record('user', 'id', $order->userid);
|
||||
if (enrol_into_course($course, $user, 'manual')) {
|
||||
if (enrol_into_course($course, $user, 'authorize')) {
|
||||
if (!empty($CFG->enrol_mailstudents)) {
|
||||
send_welcome_messages($order->id);
|
||||
}
|
||||
@@ -305,17 +302,14 @@ function authorize_print_order_details($orderno)
|
||||
error(get_string('youcantdo', 'enrol_authorize', $a));
|
||||
}
|
||||
|
||||
$extra = new stdClass;
|
||||
$extra->sum = 0.0;
|
||||
$extra->orderid = $orderno;
|
||||
|
||||
$refunded = 0.0;
|
||||
$sql = "SELECT SUM(amount) AS refunded FROM {$CFG->prefix}enrol_authorize_refunds " .
|
||||
"WHERE (orderid = '" . $orderno . "') AND (status = '" . AN_STATUS_CREDIT . "')";
|
||||
|
||||
if ($refund = get_record_sql($sql)) {
|
||||
$extra->sum = floatval($refund->refunded);
|
||||
if (($refundval = get_field_sql($sql))) {
|
||||
$refunded = floatval($refundval);
|
||||
}
|
||||
$upto = format_float($order->amount - $extra->sum, 2);
|
||||
$upto = format_float($order->amount - $refunded, 2);
|
||||
if ($upto <= 0) {
|
||||
error("Refunded to original amount.");
|
||||
}
|
||||
@@ -334,6 +328,8 @@ function authorize_print_order_details($orderno)
|
||||
$strcanbecredit<br /><input type='submit' name='".ORDER_REFUND."' value='$authstrs->refund' />");
|
||||
}
|
||||
else {
|
||||
$extra = new stdClass;
|
||||
$extra->orderid = $orderno;
|
||||
$extra->amount = $amount;
|
||||
$message = '';
|
||||
$success = authorize_action($order, $message, $extra, AN_ACTION_CREDIT);
|
||||
@@ -565,7 +561,7 @@ function authorize_get_status_action($order)
|
||||
|
||||
$canmanage = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $order->courseid));
|
||||
|
||||
if (intval($order->transid) == 0) { // test transaction or new order
|
||||
if (floatval($order->transid) == 0) { // test transaction or new order
|
||||
if ($order->timecreated < $newordertime) {
|
||||
if ($canmanage) {
|
||||
$ret->actions = array(ORDER_DELETE);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
print_heading_with_help($struploadcsv, 'uploadcsv', 'enrol/authorize');
|
||||
|
||||
/// Handle CSV file
|
||||
if ($form = data_submitted() && confirm_sesskey()) {
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$um = new upload_manager('csvfile', false, false, null, false, 0);
|
||||
if ($um->preprocess_files()) {
|
||||
$filename = $um->files['csvfile']['tmp_name'];
|
||||
@@ -115,7 +115,7 @@ function authorize_process_csv($filename)
|
||||
$settlementdate = strtotime($data[$csvfields['Settlement Date/Time']]);
|
||||
|
||||
if ($transstatus == 'Approved Review' || $transstatus == 'Review Failed') {
|
||||
if ($order = get_record('enrol_authorize', 'transid', $transid)) {
|
||||
if (($order = get_record('enrol_authorize', 'transid', $transid))) {
|
||||
$order->status = ($transstatus == 'Approved Review') ? AN_STATUS_APPROVEDREVIEW : AN_STATUS_REVIEWFAILED;
|
||||
update_record('enrol_authorize', $order);
|
||||
$updated++; // Updated order status
|
||||
@@ -124,7 +124,7 @@ function authorize_process_csv($filename)
|
||||
}
|
||||
|
||||
if (!empty($reftransid) && is_numeric($reftransid) && 'Settled Successfully' == $transstatus && 'Credit' == $transtype) {
|
||||
if ($order = get_record('enrol_authorize', 'transid', $reftransid)) {
|
||||
if (($order = get_record('enrol_authorize', 'transid', $reftransid))) {
|
||||
if (AN_METHOD_ECHECK == $order->paymentmethod) {
|
||||
$refund = get_record('enrol_authorize_refunds', 'transid', $transid);
|
||||
if ($refund) {
|
||||
@@ -195,14 +195,14 @@ function authorize_process_csv($filename)
|
||||
}
|
||||
|
||||
// If user wasn't enrolled, enrol now. Ignore otherwise. Because admin user might submit this file again.
|
||||
if ($role = get_default_course_role($course)) {
|
||||
if (($role = get_default_course_role($course))) {
|
||||
if (! user_has_role_assignment($user->id, $role->id, $coursecontext->id)) {
|
||||
$timestart = $timeend = 0;
|
||||
if ($course->enrolperiod) {
|
||||
$timestart = time();
|
||||
$timeend = $timestart + $course->enrolperiod;
|
||||
}
|
||||
if (role_assign($role->id, $user->id, 0, $coursecontext->id, $timestart, $timeend, 0, 'manual')) {
|
||||
if (role_assign($role->id, $user->id, 0, $coursecontext->id, $timestart, $timeend, 0, 'authorize')) {
|
||||
$imported++;
|
||||
if (!empty($CFG->enrol_mailstudents)) {
|
||||
$sendem[] = $order->id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
$plugin->version = 2006112901;
|
||||
$plugin->version = 2006112902;
|
||||
$plugin->requires = 2006100401;
|
||||
|
||||
?>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<tr>
|
||||
<td align="right">enrol_dbpass:</td>
|
||||
<td>
|
||||
<input size="15" type="text" name="enrol_dbpass" value="<?php echo $frm->enrol_dbpass ?>" />
|
||||
<input size="15" type="password" name="enrol_dbpass" value="<?php echo $frm->enrol_dbpass ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("dbpass","enrol_database") ?>
|
||||
|
||||
+61
-57
@@ -4,11 +4,11 @@ require_once($CFG->dirroot.'/enrol/enrol.class.php');
|
||||
|
||||
class enrolment_plugin_database {
|
||||
|
||||
var $log;
|
||||
var $log;
|
||||
|
||||
/*
|
||||
* For the given user, let's go out and look in an external database
|
||||
* for an authoritative list of enrolments, and then adjust the
|
||||
* for an authoritative list of enrolments, and then adjust the
|
||||
* local Moodle assignments to match.
|
||||
*/
|
||||
function setup_enrolments(&$user) {
|
||||
@@ -32,7 +32,7 @@ function setup_enrolments(&$user) {
|
||||
//error_log('[ENROL_DB] found ' . count($roles) . ' roles:');
|
||||
|
||||
foreach($roles as $role) {
|
||||
|
||||
|
||||
//error_log('[ENROL_DB] setting up enrolments for '.$role->shortname);
|
||||
|
||||
/// Get the authoritative list of enrolments from the external database table
|
||||
@@ -45,10 +45,10 @@ function setup_enrolments(&$user) {
|
||||
|
||||
/// Check if a particular role has been forced by the plugin site-wide
|
||||
/// (if we aren't doing a role-based select)
|
||||
if (!$have_role && $CFG->enrol_db_defaultcourseroleid) {
|
||||
if (!$have_role && $CFG->enrol_db_defaultcourseroleid) {
|
||||
$role = get_record('role', 'id', $CFG->enrol_db_defaultcourseroleid);
|
||||
}
|
||||
|
||||
|
||||
/// Whether to fetch the default role on a per-course basis (below) or not.
|
||||
$use_default_role = !$role;
|
||||
|
||||
@@ -60,7 +60,7 @@ function setup_enrolments(&$user) {
|
||||
} else {
|
||||
error_log('[ENROL_DB] Using config default for roles: '.$role->shortname);
|
||||
}*/
|
||||
|
||||
|
||||
if ($rs = $enroldb->Execute("SELECT {$CFG->enrol_remotecoursefield} as enrolremotecoursefield
|
||||
FROM {$CFG->enrol_dbtable}
|
||||
WHERE {$CFG->enrol_remoteuserfield} = " . $useridfield .
|
||||
@@ -84,6 +84,7 @@ function setup_enrolments(&$user) {
|
||||
|
||||
$courselist = array();
|
||||
while ($fields_obj = rs_fetch_next_record($rs)) { // Make a nice little array of courses to process
|
||||
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
|
||||
$courselist[] = $fields_obj->enrolremotecoursefield;
|
||||
}
|
||||
rs_close($rs);
|
||||
@@ -120,14 +121,14 @@ function setup_enrolments(&$user) {
|
||||
if ($use_default_role) {
|
||||
$role = get_default_course_role($course);
|
||||
}
|
||||
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
|
||||
// Couldn't get a role or context, skip.
|
||||
if (!$role || !$context) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Search the role assignments to see if this user
|
||||
// already has this role in this context. If it is, we
|
||||
// skip to the next course.
|
||||
@@ -139,7 +140,7 @@ function setup_enrolments(&$user) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//error_log('[ENROL_DB] Enrolling user in course '.$course->idnumber);
|
||||
role_assign($role->id, $user->id, 0, $context->id, 0, 0, 0, 'database');
|
||||
}
|
||||
@@ -156,7 +157,7 @@ function setup_enrolments(&$user) {
|
||||
} else {
|
||||
error_log('[ENROL_DB] Couldn\'t get rows from external db: '.$enroldb->ErrorMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->enrol_disconnect($enroldb);
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@ function sync_enrolments($role = null) {
|
||||
|
||||
// Connect to the external database
|
||||
$enroldb = $this->enrol_connect();
|
||||
if (!$enroldb) {
|
||||
if (!$enroldb) {
|
||||
notify("enrol/database cannot connect to server");
|
||||
return false;
|
||||
}
|
||||
@@ -183,12 +184,12 @@ function sync_enrolments($role = null) {
|
||||
} else {
|
||||
echo "=== Syncing enrolments for default role ===\n";
|
||||
}
|
||||
|
||||
|
||||
// first, pack the sortorder...
|
||||
fix_course_sortorder();
|
||||
|
||||
list($have_role, $remote_role_name, $remote_role_value) = $this->role_fields($enroldb, $role);
|
||||
|
||||
|
||||
if (!$have_role) {
|
||||
if (!empty($CFG->enrol_db_defaultcourseroleid)
|
||||
and $role = get_record('role', 'id', $CFG->enrol_db_defaultcourseroleid)) {
|
||||
@@ -197,7 +198,7 @@ function sync_enrolments($role = null) {
|
||||
echo "!!! WARNING: Role specified by caller, but no (or invalid) role configuration !!!\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get enrolments per-course
|
||||
$sql = "SELECT DISTINCT {$CFG->enrol_remotecoursefield} " .
|
||||
" FROM {$CFG->enrol_dbtable} " .
|
||||
@@ -216,10 +217,11 @@ function sync_enrolments($role = null) {
|
||||
begin_sql();
|
||||
$extcourses = array();
|
||||
while ($extcourse_obj = rs_fetch_next_record($rs)) { // there are more course records
|
||||
$extcourse = $extcourse_obj->{$CFG->enrol_remotecoursefield};
|
||||
$extcourse_obj = (object)array_change_key_case((array)$extcourse_obj , CASE_LOWER);
|
||||
$extcourse = $extcourse_obj->{strtolower($CFG->enrol_remotecoursefield)};
|
||||
array_push($extcourses, $extcourse);
|
||||
|
||||
// does the course exist in moodle already?
|
||||
// does the course exist in moodle already?
|
||||
$course = false;
|
||||
$course = get_record( 'course',
|
||||
$CFG->enrol_localcoursefield,
|
||||
@@ -253,7 +255,7 @@ function sync_enrolments($role = null) {
|
||||
if (!$have_role) {
|
||||
$role = get_default_course_role($course);
|
||||
}
|
||||
|
||||
|
||||
// get a list of the student ids the are enrolled
|
||||
// in the external db -- hopefully it'll fit in memory...
|
||||
$extenrolments = array();
|
||||
@@ -261,7 +263,7 @@ function sync_enrolments($role = null) {
|
||||
" FROM {$CFG->enrol_dbtable} " .
|
||||
" WHERE {$CFG->enrol_remotecoursefield} = " . $enroldb->quote($extcourse) .
|
||||
($have_role ? ' AND '.$remote_role_name.' = '.$remote_role_value : '');
|
||||
|
||||
|
||||
$crs = $enroldb->Execute($sql);
|
||||
if (!$crs) {
|
||||
trigger_error($enroldb->ErrorMsg() .' STATEMENT: '. $sql);
|
||||
@@ -273,12 +275,13 @@ function sync_enrolments($role = null) {
|
||||
|
||||
// slurp results into an array
|
||||
while ($crs_obj = rs_fetch_next_record($crs)) {
|
||||
array_push($extenrolments, $crs_obj->{$CFG->enrol_remoteuserfield});
|
||||
$crs_obj = (object)array_change_key_case((array)$crs_obj , CASE_LOWER);
|
||||
array_push($extenrolments, $crs_obj->{strtolower($CFG->enrol_remoteuserfield)});
|
||||
}
|
||||
rs_close($crs); // release the handle
|
||||
|
||||
//
|
||||
// prune enrolments
|
||||
// prune enrolments to users that are no longer in ext auth
|
||||
// hopefully they'll fit in the max buffer size for the RDBMS
|
||||
//
|
||||
// TODO: This doesn't work perfectly. If we are operating without
|
||||
@@ -298,7 +301,7 @@ function sync_enrolments($role = null) {
|
||||
AND ra.roleid = ". $role->id . ($extenrolments
|
||||
? " AND u.{$CFG->enrol_localuserfield} NOT IN (".join(", ", array_map(array(&$db, 'quote'), $extenrolments)).")"
|
||||
: ''));
|
||||
|
||||
|
||||
if ($to_prune) {
|
||||
foreach ($to_prune as $role_assignment) {
|
||||
if (role_unassign($role->id, $role_assignment->userid, 0, $role_assignment->contextid)){
|
||||
@@ -308,9 +311,9 @@ function sync_enrolments($role = null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// insert current enrolments
|
||||
// insert current enrolments
|
||||
// bad we can't do INSERT IGNORE with postgres...
|
||||
//
|
||||
foreach ($extenrolments as $member) {
|
||||
@@ -321,7 +324,7 @@ function sync_enrolments($role = null) {
|
||||
LEFT OUTER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
|
||||
AND ra.roleid = {$role->id}
|
||||
AND ra.contextid = {$context->id}
|
||||
WHERE u.{$CFG->enrol_localuserfield} = ".$db->quote($member) .
|
||||
WHERE u.{$CFG->enrol_localuserfield} = ".$db->quote($member) .
|
||||
" AND (u.deleted IS NULL OR u.deleted=0) ";
|
||||
|
||||
$ers = $db->Execute($sql);
|
||||
@@ -330,7 +333,7 @@ function sync_enrolments($role = null) {
|
||||
return false;
|
||||
}
|
||||
if ( $ers->RecordCount() == 0 ) { // if this returns empty, it means we don't have the student record.
|
||||
// should not happen -- but skip it anyway
|
||||
// should not happen -- but skip it anyway
|
||||
trigger_error('weird! no user record entry?');
|
||||
continue;
|
||||
}
|
||||
@@ -342,7 +345,7 @@ function sync_enrolments($role = null) {
|
||||
if ($enrolmentid) { // already enrolled - skip
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (role_assign($role->id, $userid, 0, $context->id, 0, 0, 0, 'database')){
|
||||
error_log( "Assigned role {$role->shortname} to user {$userid} in course {$course->id} (" . format_string($course->shortname) . ")");
|
||||
} else {
|
||||
@@ -367,13 +370,13 @@ function sync_enrolments($role = null) {
|
||||
$sql = "
|
||||
SELECT ra.roleid, ra.userid, ra.contextid
|
||||
FROM {$CFG->prefix}role_assignments ra
|
||||
LEFT OUTER JOIN ({$CFG->prefix}context cn
|
||||
JOIN {$CFG->prefix}course c ON cn.contextlevel = ".CONTEXT_COURSE." AND cn.instanceid = c.id)
|
||||
ON ra.contextid = cn.id
|
||||
WHERE ra.enrol = 'database'" .
|
||||
JOIN {$CFG->prefix}context cn ON cn.id = ra.contextid
|
||||
JOIN {$CFG->prefix}course c ON c.id = cn.instanceid
|
||||
WHERE ra.enrol = 'database'
|
||||
AND cn.contextlevel = ".CONTEXT_COURSE." " .
|
||||
($have_role ? ' AND ra.roleid = '.$role->id : '') .
|
||||
($extcourses
|
||||
? " AND (c.id IS NULL OR c.{$CFG->enrol_localcoursefield} NOT IN (" . join(",", array_map(array(&$db, 'quote'), $extcourses)) . "))"
|
||||
? " AND c.{$CFG->enrol_localcoursefield} NOT IN (" . join(",", array_map(array(&$db, 'quote'), $extcourses)) . ")"
|
||||
: '');
|
||||
|
||||
$ers = $db->Execute($sql);
|
||||
@@ -381,8 +384,9 @@ function sync_enrolments($role = null) {
|
||||
trigger_error($db->ErrorMsg() .' STATEMENT: '. $sql);
|
||||
return false;
|
||||
}
|
||||
if ( $ers->RecordCount() > 0 ) {
|
||||
if ( $ers->RecordCount() > 0 ) {
|
||||
while ($user_obj = rs_fetch_next_record($ers)) {
|
||||
$user_obj = (object)array_change_key_case((array)$user_obj , CASE_LOWER);
|
||||
$roleid = $user_obj->roleid;
|
||||
$user = $user_obj->userid;
|
||||
$contextid = $user_obj->contextid;
|
||||
@@ -390,15 +394,15 @@ function sync_enrolments($role = null) {
|
||||
error_log( "Unassigned role {$roleid} from user $user in context $contextid");
|
||||
} else {
|
||||
error_log( "Failed unassign role {$roleid} from user $user in context $contextid");
|
||||
}
|
||||
}
|
||||
}
|
||||
rs_close($ers); // release the handle
|
||||
}
|
||||
commit_sql();
|
||||
|
||||
|
||||
// we are done now, a bit of housekeeping
|
||||
fix_course_sortorder();
|
||||
|
||||
|
||||
$this->enrol_disconnect($enroldb);
|
||||
return true;
|
||||
}
|
||||
@@ -412,19 +416,19 @@ function get_access_icons($course) {
|
||||
function config_form($frm) {
|
||||
global $CFG;
|
||||
|
||||
$vars = array('enrol_dbhost', 'enrol_dbuser', 'enrol_dbpass',
|
||||
'enrol_dbname', 'enrol_dbtable',
|
||||
'enrol_localcoursefield', 'enrol_localuserfield',
|
||||
$vars = array('enrol_dbhost', 'enrol_dbuser', 'enrol_dbpass',
|
||||
'enrol_dbname', 'enrol_dbtable',
|
||||
'enrol_localcoursefield', 'enrol_localuserfield',
|
||||
'enrol_remotecoursefield', 'enrol_remoteuserfield',
|
||||
'enrol_db_autocreate', 'enrol_db_category', 'enrol_db_template',
|
||||
'enrol_db_autocreate', 'enrol_db_category', 'enrol_db_template',
|
||||
'enrol_db_localrolefield', 'enrol_db_remoterolefield',
|
||||
'enrol_remotecoursefield', 'enrol_remoteuserfield',
|
||||
'enrol_db_ignorehiddencourse');
|
||||
'enrol_db_ignorehiddencourse', 'enrol_db_defaultcourseroleid');
|
||||
|
||||
foreach ($vars as $var) {
|
||||
if (!isset($frm->$var)) {
|
||||
$frm->$var = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
include("$CFG->dirroot/enrol/database/config.html");
|
||||
}
|
||||
@@ -486,7 +490,7 @@ function process_config($config) {
|
||||
$config->enrol_db_autocreate = '';
|
||||
}
|
||||
set_config('enrol_db_autocreate', $config->enrol_db_autocreate);
|
||||
|
||||
|
||||
if (!isset($config->enrol_db_category)) {
|
||||
$config->enrol_db_category = '';
|
||||
}
|
||||
@@ -506,7 +510,7 @@ function process_config($config) {
|
||||
$config->enrol_db_localrolefield = '';
|
||||
}
|
||||
set_config('enrol_db_localrolefield', $config->enrol_db_localrolefield);
|
||||
|
||||
|
||||
if (!isset($config->enrol_db_remoterolefield)) {
|
||||
$config->enrol_db_remoterolefield = '';
|
||||
}
|
||||
@@ -522,7 +526,7 @@ function process_config($config) {
|
||||
|
||||
// will create the moodle course from the template
|
||||
// course_ext is an array as obtained from ldap -- flattened somewhat
|
||||
// NOTE: if you pass true for $skip_fix_course_sortorder
|
||||
// NOTE: if you pass true for $skip_fix_course_sortorder
|
||||
// you will want to call fix_course_sortorder() after your are done
|
||||
// with course creation
|
||||
function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
@@ -558,15 +562,15 @@ function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
if (empty($course->$key)) {
|
||||
$course->$key = $template[$key];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$course->category = 1; // the misc 'catch-all' category
|
||||
if (!empty($CFG->enrol_db_category)){ //category = 0 or undef will break moodle
|
||||
$course->category = $CFG->enrol_db_category;
|
||||
}
|
||||
|
||||
// define the sortorder
|
||||
$sort = get_field_sql('SELECT COALESCE(MAX(sortorder)+1, 100) AS max ' .
|
||||
// define the sortorder
|
||||
$sort = get_field_sql('SELECT COALESCE(MAX(sortorder)+1, 100) AS max ' .
|
||||
' FROM ' . $CFG->prefix . 'course ' .
|
||||
' WHERE category=' . $course->category);
|
||||
$course->sortorder = $sort;
|
||||
@@ -575,14 +579,14 @@ function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
$course->startdate = time() + 3600 * 24;
|
||||
$course->timecreated = time();
|
||||
$course->visible = 1;
|
||||
|
||||
|
||||
// clear out id just in case
|
||||
unset($course->id);
|
||||
unset($course->id);
|
||||
|
||||
// truncate a few key fields
|
||||
$course->idnumber = substr($course->idnumber, 0, 100);
|
||||
$course->shortname = substr($course->shortname, 0, 15);
|
||||
|
||||
|
||||
// store it and log
|
||||
if ($newcourseid = insert_record("course", addslashes_object($course))) { // Set up new course
|
||||
$section = NULL;
|
||||
@@ -593,8 +597,8 @@ function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
blocks_repopulate_page($page); // Return value no
|
||||
|
||||
|
||||
if(!$skip_fix_course_sortorder){
|
||||
fix_course_sortorder();
|
||||
if(!$skip_fix_course_sortorder){
|
||||
fix_course_sortorder();
|
||||
}
|
||||
add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/database auto-creation");
|
||||
} else {
|
||||
@@ -602,7 +606,7 @@ function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
notify("Serious Error! Could not create the new course!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $newcourseid;
|
||||
}
|
||||
|
||||
@@ -622,7 +626,7 @@ function enrol_connect() {
|
||||
trigger_error("Error connecting to enrolment DB backend with: "
|
||||
. "$CFG->enrol_dbhost,$CFG->enrol_dbuser,$CFG->enrol_dbpass,$CFG->enrol_dbname");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// DB Disconnect
|
||||
@@ -642,7 +646,7 @@ function enrol_disconnect($enroldb) {
|
||||
*/
|
||||
function role_fields($enroldb, $role) {
|
||||
global $CFG;
|
||||
|
||||
|
||||
if ($have_role = !empty($role)
|
||||
&& !empty($CFG->enrol_db_remoterolefield)
|
||||
&& !empty($CFG->enrol_db_localrolefield)
|
||||
|
||||
@@ -667,7 +667,7 @@ function process_person_tag($tagcontents){
|
||||
$person->picture = 1;
|
||||
//Llibreria creada per nosaltres mateixos.
|
||||
require_once($CFG->dirroot.'/lib/gdlib.php');
|
||||
if ($usernew->picture = save_profile_image($id, $person->urlphoto,'users', true)) {
|
||||
if ($usernew->picture = save_profile_image($id, $person->urlphoto,'user')) {
|
||||
set_field('user', 'picture', $usernew->picture, 'id', $id); /// Note picture in DB
|
||||
}
|
||||
}
|
||||
@@ -804,7 +804,7 @@ function process_membership_tag($tagcontents){
|
||||
}elseif($CFG->enrol_imsunenrol){
|
||||
// Unenrol
|
||||
|
||||
if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext)) {
|
||||
if (! role_unassign($moodleroleid, $memberstoreobj->userid, 0, $rolecontext, 'imsenterprise')) {
|
||||
$this->log_line("Error unenrolling $memberstoreobj->userid from role $moodleroleid in course");
|
||||
}else{
|
||||
$membersuntally++;
|
||||
|
||||
@@ -129,7 +129,7 @@ if (!isset($frm->enrol_ldap_template)) {
|
||||
<tr>
|
||||
<td align="right">ldap_bind_pw:</td>
|
||||
<td>
|
||||
<input name="enrol_ldap_bind_pw" type="text" size="30" value="<?php echo $frm->enrol_ldap_bind_pw?>" />
|
||||
<input name="enrol_ldap_bind_pw" type="password" size="30" value="<?php echo $frm->enrol_ldap_bind_pw?>" />
|
||||
<?php if (isset($err["enrol_ldap_bind_pw"])) formerr($err["enrol_ldap_bind_pw"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("enrol_ldap_bind_pw","enrol_ldap") ?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user