Compare commits
1606 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d78ec260b2 | |||
| 0572e4291d | |||
| 8bc1d327c2 | |||
| e0f57f0d56 | |||
| 6886503616 | |||
| bc93860e9f | |||
| 1ffd2c0ac6 | |||
| e1be60d66c | |||
| 727031451d | |||
| 947d3349ab | |||
| 2bb9c62bf8 | |||
| b65f805a91 | |||
| 4bc522672d | |||
| 1bb56f97c5 | |||
| a11b2d8e72 | |||
| 5a1920568c | |||
| dd85612a17 | |||
| 7e2aced51d | |||
| fe6e5f35b5 | |||
| de3499d458 | |||
| 26b131922b | |||
| f67882c305 | |||
| eed1c7ca5b | |||
| 34a2acfc72 | |||
| bb0aa83341 | |||
| dfae0ffa1b | |||
| c194ca1c70 | |||
| 90b52b9486 | |||
| b0e29954ae | |||
| ebd7bc06ce | |||
| 167a831615 | |||
| efedb70895 | |||
| 3f9fd1987c | |||
| 048373691e | |||
| baa0b3ceae | |||
| e289bd8030 | |||
| 509f876de8 | |||
| 6e21779482 | |||
| b65a82e1a4 | |||
| f6fc4e1891 | |||
| a4bc586138 | |||
| f0bcc27f90 | |||
| 75bbcfb74f | |||
| 014c522eb8 | |||
| f99f716464 | |||
| b1b4cdb7d8 | |||
| dda3fc5779 | |||
| 4e557706d3 | |||
| 0556edaf60 | |||
| 231e409849 | |||
| e7c9105d26 | |||
| 8323fb4279 | |||
| 28e95b14e2 | |||
| df4847fc1b | |||
| e0e0c00e94 | |||
| e19f5f4ce5 | |||
| f5f696be2a | |||
| 36d38823c0 | |||
| fadd42e097 | |||
| 23ae278546 | |||
| f86c86269e | |||
| 89eccbccb2 | |||
| 5d88d553ef | |||
| caba817fe7 | |||
| 419b95d2ad | |||
| 61bb817fd2 | |||
| a186848393 | |||
| 66738744f5 | |||
| 961ffe486f | |||
| 04bb266b3f | |||
| d672ecf8e8 | |||
| 4f4f20e7fb | |||
| b424feb1cd | |||
| 78ed8710e6 | |||
| 5ff601c49e | |||
| 186b0a1537 | |||
| f99ed7c86d | |||
| bdbb8f02b2 | |||
| 0c08447833 | |||
| c6b4a16884 | |||
| f5446711d2 | |||
| 919352d80a | |||
| 57c9510f1b | |||
| edf9554096 | |||
| 874833bf64 | |||
| aac5f17176 | |||
| 725685f9fb | |||
| cfbd464c72 | |||
| 1a730605aa | |||
| f33f60f78e | |||
| 2b33092aba | |||
| b874e680dc | |||
| aa604cfa06 | |||
| af8288c0e6 | |||
| 0920afeddc | |||
| 1ad377cf12 | |||
| e9ba213148 | |||
| 3fc8fbccd6 | |||
| eebb9e840d | |||
| d7ced1eca3 | |||
| cbcae60bb4 | |||
| cf71b80e65 | |||
| dc1a8255ba | |||
| 0b58276ad0 | |||
| 5d27c224dd | |||
| 015edfa92e | |||
| c0b9b34aea | |||
| c54982c11b | |||
| 1714e789f4 | |||
| 91d44be7b0 | |||
| edd33b96b3 | |||
| df63d62031 | |||
| ae066f4cae | |||
| fc1981bb71 | |||
| 3404e92ced | |||
| e2e41efc2a | |||
| 0e92e35575 | |||
| eb2a551ce4 | |||
| 82cb40f813 | |||
| dbc6368462 | |||
| f4afcf7efa | |||
| 05c7e459ac | |||
| 7608d5ccab | |||
| c798b55df4 | |||
| 5a9528b959 | |||
| 45d99c3807 | |||
| d26e72d1b2 | |||
| 2baa6afc82 | |||
| 0fcad934b6 | |||
| 9bee6187e4 | |||
| 4764cb3ee8 | |||
| f2614f737b | |||
| b7f2b64f2f | |||
| 3b53ec29f8 | |||
| 0498a4d517 | |||
| 7d0ffb0fe6 | |||
| d3564a90ad | |||
| d3ad764373 | |||
| 8a9febcdb0 | |||
| 0a78a5c67d | |||
| 16ce3928cc | |||
| 08c28a96f7 | |||
| 1ba840fdbb | |||
| cfca081765 | |||
| f6297ede8e | |||
| 50a79cfecc | |||
| 133f457cdc | |||
| 8f56f9d9a3 | |||
| 1c632b934d | |||
| 12b7c16ffc | |||
| 3580ad8ee1 | |||
| 5c6a0bad7b | |||
| 697463d868 | |||
| 8d20f40cb9 | |||
| 347f90e704 | |||
| b533156097 | |||
| 22bf0fd32c | |||
| 2c4f2d4004 | |||
| a2ed173893 | |||
| ec6b89399a | |||
| e2d52b4b88 | |||
| c8733890c3 | |||
| 5d72dbbe9d | |||
| b214c00f01 | |||
| c223acda18 | |||
| 41fe0508eb | |||
| 6673f18b1c | |||
| 97bc9f4934 | |||
| 07893c5239 | |||
| 4bedc06d42 | |||
| 93d8244508 | |||
| 77b7083885 | |||
| a9fce7695e | |||
| bf4c59aa42 | |||
| 6255297f0b | |||
| 6164fc9080 | |||
| a0d692e925 | |||
| 1bc5e06312 | |||
| eb6591ca8b | |||
| f005a30c52 | |||
| 73083f1705 | |||
| 2712b7f2dc | |||
| b9e6a03e3e | |||
| cd93c36de6 | |||
| 69e5b55d03 | |||
| e0a8a35867 | |||
| a34487e2e5 | |||
| bc1d20eea9 | |||
| 7efe75fcc4 | |||
| 1f7790ffe5 | |||
| c15b5c3c96 | |||
| 03648520cc | |||
| ea6f1fd569 | |||
| d6c42bb205 | |||
| e3128055a2 | |||
| 52c72b0079 | |||
| e5d17c3450 | |||
| ee0875740d | |||
| ec5a8430eb | |||
| 3fdb68a838 | |||
| 1ebce948ec | |||
| 8841cecde3 | |||
| aa4be76082 | |||
| af191f3be2 | |||
| 4cd5906993 | |||
| 907e4a312d | |||
| 8eda8b6521 | |||
| 16c5052e79 | |||
| c6144706fb | |||
| 8ab04045ff | |||
| a280860c4e | |||
| 5c8faf4728 | |||
| 9b71941eba | |||
| 45e27a011b | |||
| 53f6ee19bd | |||
| 42e28aa6ca | |||
| 0d8b628813 | |||
| 3f22efa141 | |||
| 2142a30406 | |||
| 1d671e8e4a | |||
| 211a42594f | |||
| 041396c760 | |||
| dadcf5cc42 | |||
| 0337694a7d | |||
| a936d39aed | |||
| f5c39e0b23 | |||
| 53aab8ffd4 | |||
| bc8f835f0d | |||
| b05c975e30 | |||
| 908a8949b3 | |||
| dc4495783d | |||
| 75ca3e0d01 | |||
| 49b5de5ae4 | |||
| 9725881e50 | |||
| 3b817c7251 | |||
| acb9bb129a | |||
| 480e735763 | |||
| 6b94ff60e6 | |||
| 6214b779ff | |||
| 9ce40f4de1 | |||
| c72a4079b1 | |||
| 8f5b6a9308 | |||
| 1138529ffa | |||
| 80289b2543 | |||
| 71f9356394 | |||
| dd48dfc480 | |||
| 95dfead3b1 | |||
| 22c22fe17c | |||
| 6e4dbffd0a | |||
| 6339452c3e | |||
| ffeb631f28 | |||
| a44ce185fa | |||
| 1c5d61d928 | |||
| b766a48f3f | |||
| eac3f48ca7 | |||
| 581ca3d354 | |||
| 6ac9c77179 | |||
| 31682b1276 | |||
| daf3c36c51 | |||
| 0ab95f8bf6 | |||
| 295ce0c81e | |||
| dda4bbbf25 | |||
| eee45d7fe6 | |||
| 838e92f788 | |||
| a904349624 | |||
| bfbe9c52c1 | |||
| 2e5815427b | |||
| 1c2d58cc99 | |||
| ebecdf8d14 | |||
| 82cb7fe78c | |||
| 9b2aa32147 | |||
| 196684087f | |||
| d86d8f5a99 | |||
| 4514f4bf4b | |||
| 4bcf2c2122 | |||
| ed4fd6c492 | |||
| 809651502d | |||
| ab717a9c26 | |||
| 9ffa6198f3 | |||
| 62ec0b2bd4 | |||
| c6b2e4fce9 | |||
| 82ad3312a7 | |||
| ca2af27934 | |||
| 19ec0f2df2 | |||
| 4adbf6cf72 | |||
| 91cee36fe6 | |||
| 0c93bd7340 | |||
| 4be4e29a3b | |||
| 8cd6f2b347 | |||
| 87aa917219 | |||
| 1221d87de8 | |||
| caa413ece1 | |||
| 4fb68891b0 | |||
| acd404e309 | |||
| 1f31378d11 | |||
| 273c8bf204 | |||
| db8a7ac9d1 | |||
| ef9b262c7c | |||
| 5ce8c064dd | |||
| 37c023fb5c | |||
| 2ac86cbd24 | |||
| 5573a51843 | |||
| f4f534c675 | |||
| aa34400457 | |||
| 8ebd0d9f4d | |||
| 1880a55e53 | |||
| 4fadd52878 | |||
| 87b9156edb | |||
| 39bf0df228 | |||
| 27a78fcd2d | |||
| 45debd50c5 | |||
| a4f3137661 | |||
| 1002d7e22a | |||
| 587813b713 | |||
| c21899e0dd | |||
| bcfbd8cbdf | |||
| 304182d210 | |||
| f4c0f3d062 | |||
| a871e630b2 | |||
| 5ceecdaaff | |||
| 964b1bb8c5 | |||
| 5aada1957d | |||
| 6e0c3e4e4d | |||
| 1e6eb9da35 | |||
| 960192ec0e | |||
| 66f8778519 | |||
| da30f2babd | |||
| 9ff3b4ab32 | |||
| f97583af41 | |||
| dfb723b481 | |||
| f40f3604c7 | |||
| 6483b3b16c | |||
| a3daa6c40d | |||
| bb9950d1cc | |||
| 4fb30fc90b | |||
| 50ae935fd6 | |||
| 3fcf436c16 | |||
| aa86e60148 | |||
| 529c18df40 | |||
| 88f3ed390f | |||
| 5008d3951f | |||
| 247879d0f3 | |||
| 3708bfc599 | |||
| 59d1acce89 | |||
| e95c8bc282 | |||
| c7ff87ee13 | |||
| 520b973c8d | |||
| f76a2d832d | |||
| 18e1b648b9 | |||
| b30533ad22 | |||
| 8e797520d7 | |||
| b552ea3586 | |||
| bc898bed7b | |||
| 13f4d81384 | |||
| 12fa8f82fc | |||
| cf5bb676dc | |||
| 02e7dadc05 | |||
| 439d39348d | |||
| 69860d5d10 | |||
| 84345a1d0d | |||
| 41617e6525 | |||
| 864fbeda4b | |||
| 748d925acb | |||
| f352ff4b83 | |||
| 3dc450db90 | |||
| 11bf8a95e2 | |||
| 6a219918c2 | |||
| 6f6506058f | |||
| cccd285acf | |||
| 14f42baf18 | |||
| 0dc4f14a26 | |||
| 3dbdd5caa3 | |||
| 38048ab4eb | |||
| 2329052916 | |||
| d715f651f4 | |||
| 597abe1a2c | |||
| 9a1dd76cfa | |||
| 488fec2e70 | |||
| ece92348bf | |||
| cf3ccea5e5 | |||
| ee87411fa9 | |||
| b8f8058211 | |||
| 29b30932c9 | |||
| 02bfbf0518 | |||
| 9d46c8fbbf | |||
| b77a1c30bd | |||
| 49240e1503 | |||
| 7ea370a056 | |||
| 323871cbf3 | |||
| d7fd82a2ca | |||
| 6794ccb2b3 | |||
| 392e59c88e | |||
| fdfe84df84 | |||
| dc751c555e | |||
| ef9e26dd33 | |||
| 28b9086750 | |||
| 85b70ad4f6 | |||
| 1110888aee | |||
| 43a8efaadc | |||
| 71ad20a5ca | |||
| ca133f6ec3 | |||
| c69e712116 | |||
| ce52f7c68c | |||
| 1aca4eeaf0 | |||
| 3e57e4b578 | |||
| d10350ce83 | |||
| e0fdaa9de0 | |||
| 2da97a4f23 | |||
| 5097b7269b | |||
| f88c5b545d | |||
| be8963b70c | |||
| 9bea47311f | |||
| be76a35ac3 | |||
| eceb6476e1 | |||
| b0cd3f5453 | |||
| 24c07163d0 | |||
| b95233e1e1 | |||
| ba1b4cd1ef | |||
| 21e00abf42 | |||
| 9c257d8057 | |||
| d0b9615cff | |||
| fcbae39803 | |||
| 25e5ce9a5f | |||
| 611e9f2a67 | |||
| 7936d32cf6 | |||
| bc8f1674e9 | |||
| 5d29fd70a3 | |||
| 6c8a956d90 | |||
| 1aee1e5a27 | |||
| 5e8255d651 | |||
| 6f8489e13d | |||
| b19909d9ae | |||
| 9084681497 | |||
| 305726a6a2 | |||
| 62f3bee984 | |||
| 0183e41239 | |||
| 3b5d49f20c | |||
| bdf5dce110 | |||
| c278e8bc8f | |||
| ed200fd420 | |||
| 44a718e930 | |||
| 5e4098df22 | |||
| 300ade82c4 | |||
| 275b342ce2 | |||
| 84d7815107 | |||
| cd1aa3bb76 | |||
| 4b70ac02cd | |||
| 2ad92ce59b | |||
| bdf0b64635 | |||
| fba486beb4 | |||
| 40bb4f3941 | |||
| f5084fcf1f | |||
| 75f97e398e | |||
| 450eb77b78 | |||
| 4caf41a177 | |||
| d9a1a6f021 | |||
| 880ae97916 | |||
| d10fd935b9 | |||
| d205581b9e | |||
| e3c424e08c | |||
| fa21044e08 | |||
| 5b696e30cc | |||
| 5c03a7d201 | |||
| 55c59f5050 | |||
| c9c54db3d8 | |||
| 826b485ce1 | |||
| bbbba10d73 | |||
| 493ac92129 | |||
| 084712eadc | |||
| 22f3e58605 | |||
| dc6ef09c49 | |||
| 3f9156bf56 | |||
| 52dce7612b | |||
| 552ae418de | |||
| 4db3f36034 | |||
| 9259bf1c0e | |||
| 9407c07c61 | |||
| 0b6c589f21 | |||
| 9da6b30269 | |||
| 5046d2353b | |||
| 81f99d24f7 | |||
| a80094eff3 | |||
| f4921fb310 | |||
| 6c709360f5 | |||
| 8969caa059 | |||
| 226c671af7 | |||
| ca8c7dbc52 | |||
| 1239139dd3 | |||
| fc1bdd6e88 | |||
| b207f15ca2 | |||
| 9dd4a457c8 | |||
| ea86a3aa8d | |||
| e33fc5a3ee | |||
| 1cbf76c5fb | |||
| 06d11b581a | |||
| c519c19ab8 | |||
| 357d918295 | |||
| 173e8c5dfb | |||
| 50e7e04949 | |||
| e1e9407acb | |||
| 3f7cc1f861 | |||
| 6a51d6a786 | |||
| 8c36f3b9a9 | |||
| 2da68b0b32 | |||
| 55005a51ce | |||
| c92d8dd677 | |||
| e1e7d03480 | |||
| 7ee50b87b8 | |||
| 687ce1c4e0 | |||
| 3db1ddedd3 | |||
| fc2df8c889 | |||
| 60a66a2bef | |||
| f7d555d577 | |||
| 974762e6f5 | |||
| ab5642fe19 | |||
| b1b45674dd | |||
| dee89d7ecc | |||
| 32caf9d6d9 | |||
| 91c6c3dc85 | |||
| 331ecbe5b6 | |||
| 46a4dde38c | |||
| 9b7d5f1aa8 | |||
| 706ea2faf3 | |||
| f8128f42a9 | |||
| 234e96d185 | |||
| 01b1fab671 | |||
| 61d29b99d8 | |||
| 8054e9aaad | |||
| ee4848432c | |||
| d3d4f4936e | |||
| d799be5424 | |||
| f24e0da312 | |||
| a8fbb9b4cd | |||
| cfc673c112 | |||
| 6dfe1cc67c | |||
| e796e306f8 | |||
| a7adb64678 | |||
| bfd12c4dd5 | |||
| 8eede3f475 | |||
| 9267fe2f43 | |||
| 1c09e6fe0c | |||
| 62fc4a966f | |||
| 7ba648a011 | |||
| 19798dc28d | |||
| 08f5787e35 | |||
| 5b99950ef1 | |||
| 21cd4715de | |||
| 9a9446e5b4 | |||
| d3b57e5566 | |||
| c70adc397a | |||
| a46a937d3e | |||
| c48083bc2d | |||
| 9d0466e2a6 | |||
| 938122d7d2 | |||
| 95f1ffc594 | |||
| 271013af0f | |||
| 9bfb07349b | |||
| c6982f0c26 | |||
| 0989530df9 | |||
| e32f1a5b98 | |||
| e23ec822d1 | |||
| cbc29c7237 | |||
| 3098552240 | |||
| 92addc1b42 | |||
| 2dc95960f4 | |||
| 146b674a33 | |||
| f7cc90e58c | |||
| a41779208c | |||
| c9b9c609ba | |||
| 9b602f0d3d | |||
| f4b35f935c | |||
| 667e06ed11 | |||
| 0628867164 | |||
| 39954f4087 | |||
| fdd3ed4939 | |||
| 951fd7910a | |||
| b6c96ce21d | |||
| ed0d8418ae | |||
| 2e83e24b6d | |||
| 87f156a9da | |||
| a2aa951267 | |||
| 21fa5360fc | |||
| f3d264801f | |||
| 5a0558be90 | |||
| 0f8a2e49ce | |||
| c36701675e | |||
| f87414c0bb | |||
| 92b7f24d0d | |||
| e8cd2b38cc | |||
| b42cae480f | |||
| 58c70cace9 | |||
| aa38cccbdf | |||
| c417f26c85 | |||
| f676fab333 | |||
| 286914ebf9 | |||
| 8a12b18716 | |||
| 6ffa6bf848 | |||
| 36be12128c | |||
| 16ba21692e | |||
| a335226982 | |||
| eb813e917e | |||
| 7c527b3b9d | |||
| f9d81b4e36 | |||
| 6f7cb89d17 | |||
| 19ac11bd63 | |||
| be61c13c00 | |||
| 5f7519cd0f | |||
| 46b515a48c | |||
| 6f304b3251 | |||
| 3aa003edc4 | |||
| 59cbc3ac9d | |||
| b72135d360 | |||
| 844aed0573 | |||
| e882741ec2 | |||
| 8dd34ce9bc | |||
| a6989f9cbd | |||
| dda9800184 | |||
| d03d9d7a5a | |||
| fb3557d4d9 | |||
| f895a66e50 | |||
| ff04b09e91 | |||
| d10e19dca1 | |||
| 3449775fb9 | |||
| 3ba9c859b6 | |||
| 54617ab56b | |||
| 77b81a215d | |||
| 722c4a9109 | |||
| c54f92b59c | |||
| 4b4a3f4d40 | |||
| ddb5da6113 | |||
| 6e04be55d7 | |||
| 09048346de | |||
| 9b7b42cc07 | |||
| 4cfaa3c85e | |||
| e722d7ab26 | |||
| ad2c6a55d1 | |||
| bf92014116 | |||
| 7bda2db46d | |||
| 1422989b6a | |||
| 27cde347a0 | |||
| 321097aa82 | |||
| 190437b919 | |||
| 7ce2b7d43e | |||
| 52abd5d7c4 | |||
| 0d3703f0e8 | |||
| 439aad511a | |||
| 62d35d727c | |||
| 7ce5c00bf1 | |||
| 850ca88325 | |||
| dd9312b2c7 | |||
| 2dfa65ae3e | |||
| 339bb9b746 | |||
| 63336df702 | |||
| f7d5bed2d2 | |||
| f073013d11 | |||
| d376f25fd2 | |||
| 8aa656699c | |||
| da6677db3e | |||
| 1e53ed8af3 | |||
| 2b241253e4 | |||
| 8e4b3a8cd8 | |||
| f8895a0de5 | |||
| 5aeb342d09 | |||
| 3a13ab606b | |||
| b68ae6fca7 | |||
| d09a98edf8 | |||
| 48cc1a0e6a | |||
| d27de862a6 | |||
| 0b9a7f7bc6 | |||
| ebd87f75a9 | |||
| 2966e43548 | |||
| 9c85777a62 | |||
| a7e4899de4 | |||
| c9dc3ac1a5 | |||
| 6f45d0516c | |||
| fc711515be | |||
| 37c2fe3e1a | |||
| 0bf78b45f3 | |||
| 53f2fb98ac | |||
| df9134b4e0 | |||
| df01c2f983 | |||
| f08efe8517 | |||
| dcf93f8107 | |||
| b5f523ab6e | |||
| a728edc61f | |||
| 309bb4021d | |||
| f98c2af902 | |||
| ea5aabd1da | |||
| de0489fd9f | |||
| 9caa000b8b | |||
| 1a4a3b3380 | |||
| 56fc04e3af | |||
| 5ceb953522 | |||
| eedcf27a55 | |||
| fc56e73e49 | |||
| 7a543c5cfb | |||
| 3cb6bd2c35 | |||
| 66eefc5b26 | |||
| 616f3a0584 | |||
| df3311ee1e | |||
| 7d4ed65730 | |||
| 09eb1ec39c | |||
| d11ec62bd3 | |||
| 3ac3641547 | |||
| 0b1d21c0c3 | |||
| 597cd7728e | |||
| 791fbc5687 | |||
| ea714cfdbd | |||
| 4e0d03df62 | |||
| 6172153106 | |||
| be1aef7fc4 | |||
| 45541efc8e | |||
| 26f421782d | |||
| e7bbf42c5a | |||
| 122722c7aa | |||
| e27f1fc122 | |||
| 4ca7cf3473 | |||
| b961b2249f | |||
| 1bb8b3818f | |||
| 146bc3bcf1 | |||
| d74e64100c | |||
| c2baadf060 | |||
| f9b27a7f86 | |||
| d42dbcc1e7 | |||
| 7cc37fafdc | |||
| f98049b035 | |||
| 443768b8aa | |||
| 9cb2c25061 | |||
| 1a5e5787aa | |||
| e1397186a9 | |||
| 326129c87f | |||
| 0a45ab2fb2 | |||
| c5e4aebf29 | |||
| b74504fff3 | |||
| 1e825b9dc1 | |||
| 7211a3733a | |||
| cb7c915b10 | |||
| e9b9c28e44 | |||
| d09757da3f | |||
| 67ca52345c | |||
| 3e7759c3b6 | |||
| 43c99d82f1 | |||
| f18e948bda | |||
| e3eff7bf1c | |||
| e98649d7f1 | |||
| c30e73badc | |||
| 181190d81b | |||
| 8f290d7868 | |||
| c9bbb97a8d | |||
| 0bb51a9c00 | |||
| 0145441c4d | |||
| 3cd4774c59 | |||
| 7badfb42c7 | |||
| 2ba01076aa | |||
| 13e0414d47 | |||
| 72a5176d95 | |||
| fb68fa74e3 | |||
| d696377711 | |||
| 0adcc16ccf | |||
| 945bd325c4 | |||
| de06df20a4 | |||
| f35c9f6f19 | |||
| f15eba9879 | |||
| ef7c98d04e | |||
| f68ff717aa | |||
| 356e897da9 | |||
| 1729e73566 | |||
| a352220a48 | |||
| 5ad59d2b07 | |||
| fb733f80e3 | |||
| c6d8a02649 | |||
| 28701c2fef | |||
| 0038bff79e | |||
| 78a40f0c7f | |||
| 650d657bb0 | |||
| 396d2eefe7 | |||
| 8c961e6c84 | |||
| c9f6285685 | |||
| dbf8cae35e | |||
| fc9d151810 | |||
| ceb6ed3ab2 | |||
| d5a23c5f04 | |||
| 1027fcce3b | |||
| e48c333640 | |||
| 346a83d25f | |||
| e904a8315b | |||
| a0eb0c7b14 | |||
| b43c3213ab | |||
| 8632e95b13 | |||
| 20414f20ff | |||
| 65c78f2904 | |||
| fdaeef002a | |||
| 3cba887fca | |||
| 0ece80c088 | |||
| e3494d2af5 | |||
| 5aeaecaa1e | |||
| 379447d88f | |||
| 54b6d16e8c | |||
| bfeb2678df | |||
| 4c5b0669a0 | |||
| 312191a8e9 | |||
| ade44744d7 | |||
| 7ae190c397 | |||
| b9a7a37ec0 | |||
| f52c8e3912 | |||
| ef52b6a434 | |||
| 34177c462c | |||
| 77d5965638 | |||
| 8a4f91b671 | |||
| b930d5a83b | |||
| 92b904642a | |||
| 724dbf2d0c | |||
| 7ed1828798 | |||
| 12ff34e245 | |||
| a26c09be05 | |||
| f2c2aeff2d | |||
| 3f833b914c | |||
| 75b5701ae7 | |||
| 146b8728c7 | |||
| f032cd818e | |||
| 9244a6be27 | |||
| 4d69204037 | |||
| 479206f6ff | |||
| d4c97b77a5 | |||
| 6b68f4e53b | |||
| 7ec5b06656 | |||
| 445cebbdaa | |||
| ac326d2f3b | |||
| cf4a318f80 | |||
| d4c1b75664 | |||
| 9076a56953 | |||
| 315184aeee | |||
| d76f66dde9 | |||
| 4f3f057884 | |||
| c020af7119 | |||
| 8a2366b231 | |||
| 298f767799 | |||
| c711a66af2 | |||
| 4abc65705c | |||
| 69a30a1c2f | |||
| 0d4f86ce4b | |||
| da586c3430 | |||
| 1c70d75ec0 | |||
| 326d894b83 | |||
| f16220e6a9 | |||
| b60f49c799 | |||
| 70c64c1a46 | |||
| 9b27aac9ba | |||
| 14bc58d411 | |||
| 3ebaafd6e5 | |||
| 215692747d | |||
| d8feb56f5d | |||
| f4d8da26f5 | |||
| 51c761454a | |||
| 3836cfd7e6 | |||
| 89d6849793 | |||
| c4269c100d | |||
| b2e3ce3b2b | |||
| 9a14f39663 | |||
| b41ee5a874 | |||
| 79c8c1dba4 | |||
| 6907f59129 | |||
| 2413b939a7 | |||
| e2dd0ea71e | |||
| 8ef0022d29 | |||
| 8fe9be5d8c | |||
| 9f64c0e6b7 | |||
| 1859dfe70d | |||
| 78fdca9618 | |||
| db9b5fc35c | |||
| 62c50f8579 | |||
| bb576411ca | |||
| be5ceecd4d | |||
| a7ad3d051a | |||
| b847c863d9 | |||
| d857dbc1c3 | |||
| 0e62d79714 | |||
| 86b331477a | |||
| 1cad7ef6fe | |||
| f4493074ae | |||
| a204aa1838 | |||
| b3a55ad382 | |||
| 74edbb3c5f | |||
| 381070ab03 | |||
| a2e32e1603 | |||
| 4d5dd30513 | |||
| 380a4235ff | |||
| 0efd6699e2 | |||
| e8a2e5e491 | |||
| 89a4886523 | |||
| 2f48f37d29 | |||
| 372bd6bd34 | |||
| 28f2414b0d | |||
| 9b3939b8f5 | |||
| ecb80afb03 | |||
| f0a346c4ff | |||
| 823ea10f96 | |||
| c57aac2fb1 | |||
| a57365af9c | |||
| 8a5ebf7f29 | |||
| f1a1f86ede | |||
| 31c6df4382 | |||
| 69beb9a8af | |||
| d66683e160 | |||
| e4335c36db | |||
| 66c8048d55 | |||
| db0f3b9159 | |||
| 4a4d9b02df | |||
| 86d1a59ede | |||
| 4dbb62e0c0 | |||
| 05ffd0842e | |||
| 345b5ba60d | |||
| 9be1b6a45e | |||
| aecd299b7a | |||
| f02d236f78 | |||
| 731fa029cd | |||
| cc1eb9113b | |||
| e3a3eacf9e | |||
| 15152a0a44 | |||
| 0681430f0f | |||
| e3db7108a8 | |||
| 2750460adc | |||
| 23e1dc24f3 | |||
| 377da1a0e2 | |||
| 8b33bf0124 | |||
| ce9d5ce529 | |||
| 9401569e39 | |||
| 696b50fff2 | |||
| 85bf673124 | |||
| 3849917982 | |||
| ae4d27ee4e | |||
| b70af87f04 | |||
| ba9c840c99 | |||
| d90cb507f3 | |||
| 853bb906ba | |||
| 8f99b22439 | |||
| b608d7cad3 | |||
| 60b6fc1004 | |||
| 7dfca8bbb1 | |||
| bf54a837aa | |||
| 8ed47badec | |||
| dab8b4662a | |||
| 6317557cfe | |||
| ef5a26d701 | |||
| 293d2ce08e | |||
| 4cbacc2c88 | |||
| c7b1aaeed4 | |||
| 8a57655b50 | |||
| fa3ce02ba1 | |||
| 344c50611d | |||
| c9666935af | |||
| 7cf3b7fabd | |||
| f81b4b1a1b | |||
| 79eebc83aa | |||
| 989f2ccd47 | |||
| daea824d68 | |||
| e21c0ffc23 | |||
| 41fd8ea177 | |||
| e8a51e3f44 | |||
| fa62c456eb | |||
| cca01e1519 | |||
| 293d56acaa | |||
| b0bbcb5647 | |||
| d86dca38ec | |||
| ac594757cb | |||
| fcdca8b2ba | |||
| 0927364827 | |||
| 7d5bb42327 | |||
| c807105f75 | |||
| 5a60645dc7 | |||
| 64622defdd | |||
| 2fe9f46996 | |||
| 9228be2bd2 | |||
| 5c33b48580 | |||
| 993f282295 | |||
| 6df6296812 | |||
| 668ce6df14 | |||
| 87e70ea390 | |||
| 60d12f2e35 | |||
| 7330a604c7 | |||
| def6f22e27 | |||
| 7567dcd370 | |||
| a26f30774b | |||
| b24126e9a9 | |||
| c9609a1f0d | |||
| 37841afffe | |||
| 81b65eaec6 | |||
| 8c2eb9802e | |||
| 6920a2a59c | |||
| b6e33658e3 | |||
| ed22c4f3bc | |||
| 8d5e99f086 | |||
| bd52a0145e | |||
| 3c58497b82 | |||
| f48f0e399d | |||
| 68b8dfa13b | |||
| b0e97aec74 | |||
| c13722179f | |||
| 7e7b0ef002 | |||
| 7b2ce0378b | |||
| 42693210f1 | |||
| 6e1cef3394 | |||
| cad6cf5134 | |||
| d71004a3a2 | |||
| 00db7acb37 | |||
| dcd981ac12 | |||
| 97aa751b03 | |||
| 67b71d5027 | |||
| 1e89d31bf8 | |||
| 33f23cb8df | |||
| e17732128a | |||
| 0e6b0d5c48 | |||
| 2659a6411d | |||
| 91e546cc58 | |||
| 6872a4ee5f | |||
| 3417898861 | |||
| e8c36b7a7a | |||
| d099661cd4 | |||
| 466c30cf6e | |||
| b0aeae8288 | |||
| a655cd9a38 | |||
| 401e26306e | |||
| a5762bd531 | |||
| 6a1a294942 | |||
| 5b78424ea3 | |||
| 01f35fac14 | |||
| 5466503ec1 | |||
| 2e177ee4bc | |||
| 13d6383c9a | |||
| 250aa125bb | |||
| 6e7cd09c2f | |||
| af2146d651 | |||
| 5f73b9b758 | |||
| d62c52b985 | |||
| 9ba5cf85e0 | |||
| 9e6f284ae6 | |||
| 3c8c7ad245 | |||
| acccc0148b | |||
| 1a91392796 | |||
| 19f417f6c3 | |||
| e58aa8db4a | |||
| 47578048b9 | |||
| a045329951 | |||
| bb82c7ba82 | |||
| 79dc9d16be | |||
| 803efadffc | |||
| f6ee732c66 | |||
| 90b6a3282f | |||
| f9109b1c40 | |||
| 66adefcbf6 | |||
| c01c3954af | |||
| c48ca9308f | |||
| f77192322f | |||
| 73b318a63f | |||
| fe4acc87a0 | |||
| db3f7a489c | |||
| aff7b7bd00 | |||
| f213d5dd64 | |||
| 8489b65737 | |||
| 8d96b8a10a | |||
| af007d91ee | |||
| d60572c8dd | |||
| bd9abfe3db | |||
| 1d3301fc3d | |||
| 52742e6f05 | |||
| f9cecaf2f1 | |||
| d3e5a45ac7 | |||
| e80947d967 | |||
| 5bd068b7ad | |||
| 7f1908567b | |||
| 1043fa2dff | |||
| 900022293b | |||
| 36244d8f41 | |||
| 5838338e84 | |||
| f90d3476c6 | |||
| 0bd255acd7 | |||
| b8b2eacad4 | |||
| 638a8adc7b | |||
| 3af559d414 | |||
| ca31757ba3 | |||
| d609b3a37b | |||
| 09b4e87bf9 | |||
| c9b34a7861 | |||
| 32c0a71736 | |||
| 2f49a4fbbc | |||
| 5ce30e94ed | |||
| b1995508c1 | |||
| 4b593df481 | |||
| fe219370ad | |||
| 2076251d51 | |||
| de41196269 | |||
| 99feca8c8e | |||
| e78860178a | |||
| a5566c36e8 | |||
| 87290838c9 | |||
| 20ad9953df | |||
| d3e7c0e206 | |||
| a20d27df81 | |||
| 374e173f11 | |||
| 01cb839f5c | |||
| 0c2153fd8a | |||
| 633e1ee493 | |||
| 8921708582 | |||
| 52f979d9a1 | |||
| 87cba17acf | |||
| 239a789ebd | |||
| 8cc503ed77 | |||
| 32c4ae7dc3 | |||
| 84d46ef3d5 | |||
| 5c044b8812 | |||
| f6cb1501e4 | |||
| 88e8672ef6 | |||
| 26cce91d9b | |||
| f80e271577 | |||
| 7bae742ae7 | |||
| 5930e65512 | |||
| 28894c72b2 | |||
| d9c201e1a0 | |||
| 27c18c1776 | |||
| ca9825f48e | |||
| 8a08a041f4 | |||
| 843808a9d8 | |||
| b139c82dfc | |||
| 5e57504798 | |||
| c7e53eba46 | |||
| 6bfdfaffe9 | |||
| fa86dd5898 | |||
| f1d9c9af1d | |||
| 99fc498b2f | |||
| e9f89ed558 | |||
| d3dd9635ea | |||
| 7a3631b6ee | |||
| 5e24f43df6 | |||
| d15c13904e | |||
| e217284df4 | |||
| 0f26f875f5 | |||
| e5636d3015 | |||
| 1ccb8ec916 | |||
| 0f5a44ca98 | |||
| aba846b248 | |||
| 264062798b | |||
| 1e7321b854 | |||
| cafd7f019a | |||
| 09ea9739f3 | |||
| 6a3d064a00 | |||
| e1578125e4 | |||
| 88b367e331 | |||
| 5c8e9c9d6e | |||
| b1fcf3d343 | |||
| bd72653e3c | |||
| 81cdbf08e9 | |||
| a2b74a9300 | |||
| d2d26c34ba | |||
| 0ace4d2116 | |||
| 19db0355d3 | |||
| 2e8ee5302f | |||
| 8bfa3f6c5f | |||
| 3271d9e6d1 | |||
| 98c51965c1 | |||
| 84b23dce22 | |||
| 3563c6c420 | |||
| 1e266ae4b0 | |||
| b4d17605c1 | |||
| cf6ffbe73b | |||
| a628b65cfa | |||
| 7f51421503 | |||
| f6a157d14a | |||
| fc4ac66431 | |||
| 94e16c079c | |||
| f8c56dd156 | |||
| d8fcdab45c | |||
| 27fb92f48f | |||
| 5dc53c6b7b | |||
| f0d2d9ae0c | |||
| 7a43fb909b | |||
| 77f814a368 | |||
| 8eaa523a2c | |||
| 01d38e9938 | |||
| 04bfc2247d | |||
| 050ed53908 | |||
| 24243ec058 | |||
| 170ab43ad0 | |||
| f7b1762793 | |||
| f4fb213988 | |||
| d8572e7021 | |||
| 521a96d4ef | |||
| 2bab640cd6 | |||
| ffe67636f7 | |||
| c2f3c09b3b | |||
| 9751ebf3ac | |||
| 9e2c7c7fa3 | |||
| af7471c268 | |||
| eb87e4be97 | |||
| e6a99eac77 | |||
| 1eca074507 | |||
| 56bb24458a | |||
| 538e5a2810 | |||
| c6d9f6a175 | |||
| 116244fbae | |||
| 02c9b15942 | |||
| 656e41c472 | |||
| fc80a68f89 | |||
| b40f8bad2f | |||
| 2a0a625e35 | |||
| 4f510e2ec8 | |||
| 803b4bf64c | |||
| 775db8e809 | |||
| 7585949466 | |||
| 6b344faba7 | |||
| 9609ee0a4f | |||
| 4dfc8f1d79 | |||
| 9143ed3366 | |||
| 472da9a27d | |||
| 4d2892942a | |||
| 831b76108a | |||
| 9eb89d835c | |||
| 90459a1db8 | |||
| ee4cee1a4c | |||
| 6c60a57d31 | |||
| b97b59961e | |||
| 858c53d8c9 | |||
| ae5c32e389 | |||
| 1a9c4ef509 | |||
| 787b30c0c2 | |||
| edfda53d51 | |||
| 26aac52ce0 | |||
| 1f322589be | |||
| eab3ae18fc | |||
| 96ef423773 | |||
| a8d9136e89 | |||
| 1244ef78ac | |||
| 03008bca7e | |||
| 33981a427d | |||
| eea7d42fd1 | |||
| a4fa47e7ea | |||
| d4dd4c07fe | |||
| df58100c31 | |||
| a080d1ec16 | |||
| 321a287501 | |||
| 9ed43273aa | |||
| 6365af1cf6 | |||
| 7044ea9423 | |||
| 54618b81a4 | |||
| 585b98c78c | |||
| b0c7638f9c | |||
| 4fc82e8dc9 | |||
| b978bf3a87 | |||
| dda4dbce59 | |||
| c6a5a391d4 | |||
| ed6e226e64 | |||
| 410cc4e472 | |||
| e3ff4d6046 | |||
| e8e22b7718 | |||
| 445ef592dd | |||
| 3fff3a34f7 | |||
| a6376758d6 | |||
| 8231ca599e | |||
| 80ababd00a | |||
| cab7778f18 | |||
| 950acb9c73 | |||
| d5fedfa4a3 | |||
| fa730d469f | |||
| 9b4c44e5ed | |||
| 1558c8e6b4 | |||
| b259fd9a25 | |||
| 6e18a9b615 | |||
| 3ad5be78b5 | |||
| 9cd5f2f577 | |||
| 668483e068 | |||
| 7da5cf7efd | |||
| 75889b48e3 | |||
| d9571844fc | |||
| 30cdc044f7 | |||
| f4f53da543 | |||
| d8b405fda9 | |||
| 2237ea1c13 | |||
| ad961eab24 | |||
| e92c4dcb0a | |||
| 52a84d9eb8 | |||
| 64a6329f61 | |||
| 86c91b1210 | |||
| 88dd35ee8e | |||
| b47bbe5255 | |||
| 7a258d4168 | |||
| 4eaf16f264 | |||
| 40242aaa8f | |||
| 1ad36c7821 | |||
| ba1d266228 | |||
| 84bf769f6b | |||
| 80546a1195 | |||
| 45dd6a2241 | |||
| 3b563f5893 | |||
| a33d21b7d9 | |||
| b2ee750780 | |||
| e53a867fa4 | |||
| 3c5ecd5859 | |||
| b332877b96 | |||
| 0ac94304fc | |||
| 4e59cc4453 | |||
| 4a6638f689 | |||
| e699a73bf4 | |||
| be19968cb3 | |||
| a2d608daf9 | |||
| 0b2db6dca0 | |||
| d9f6fdc21e | |||
| a6109173a2 | |||
| c522818828 | |||
| 59316ec573 | |||
| 4d4e0c7d3d | |||
| 196b6f3918 | |||
| e747435fcd | |||
| dcdb86c08a | |||
| a396bc7d75 | |||
| c1e4fa8fbf | |||
| 011d1af528 | |||
| 62e3a52588 | |||
| 461594cc72 | |||
| ecfecb994d | |||
| 1a5c004e96 | |||
| 8730f7dd53 | |||
| 0b22495f37 | |||
| 7aa951a2cc | |||
| 2fc29c74ab | |||
| c2a4225d1d | |||
| 31e1d6582c | |||
| ca4f8f38b3 | |||
| a8d101b5c4 | |||
| 1235148f9f | |||
| a734c1f59f | |||
| 917aaad1a2 | |||
| f4f655747d | |||
| b8b21c5d2a | |||
| 1b94c6e4b7 | |||
| 6bfdf6cd1e | |||
| 9908a3f5a1 | |||
| 211d5844d4 | |||
| cd784f2438 | |||
| 45e3b380d2 | |||
| fabf55370a | |||
| c0b6773831 | |||
| 74fefb48d5 | |||
| f138d59dba | |||
| 7252b5889b | |||
| 0af074a894 | |||
| fa8452c1d7 | |||
| 81de2d85a6 | |||
| 09182fa82d | |||
| 4e50a79a26 | |||
| b5820d9add | |||
| a8ec259abf | |||
| a62af9c397 | |||
| ce53b30a7a | |||
| 9416fe3a9c | |||
| b3cbec74d9 | |||
| 718ffbfb63 | |||
| cc00f2763f | |||
| f10451c414 | |||
| 562dc5fdda | |||
| e2dfe8bfca | |||
| a28ee0a933 | |||
| 1fdce070c4 | |||
| 69d788e2af | |||
| 15f2ccbbbd | |||
| 66a988f08e | |||
| b9a6d9cd1e | |||
| 179fc95c04 | |||
| a2182b2420 | |||
| 86726446ab | |||
| 3b3b5b4cc5 | |||
| db68f9fedf | |||
| ea799baf48 | |||
| 5bb9d213fe | |||
| 2c550eefbd | |||
| c34b9b9c97 | |||
| 3ee2c02ec3 | |||
| 59900bd490 | |||
| c40999b0b6 | |||
| 36be64d1da | |||
| 54e296b115 | |||
| 20ed8a7215 | |||
| 504af96b2e | |||
| f1b29e2e69 | |||
| 7c1fb23156 | |||
| 31eb4b15b8 | |||
| 826ea2ba9a | |||
| 83dbd468f9 | |||
| 68696f6aa8 | |||
| b7e97fcc73 | |||
| a836952539 | |||
| ba34f3372d | |||
| d6fd65c9c9 | |||
| ed6df9192e | |||
| 727c9ec658 | |||
| 562a703ffd | |||
| 1bd32f7b63 | |||
| 19c8c196b2 | |||
| 233fd3da0b | |||
| 0f3a1c9382 | |||
| d9fc0fc2ad | |||
| af8e80ec8a | |||
| c5150fe5a9 | |||
| 09eb304cf7 | |||
| 14b9196e8d | |||
| fdefa7ef01 | |||
| 9abd181aee | |||
| 2b7a363f02 | |||
| e85a202ba3 | |||
| 3056105182 | |||
| 7c596baca7 | |||
| ef3df6f086 | |||
| 9e0c47a5bc | |||
| 8e4e1d73bd | |||
| 052fdabdbd | |||
| b336fbda27 | |||
| ae2ed9974a | |||
| 28e9a6e43c | |||
| 1d0a5c8ff5 | |||
| 19623c973c | |||
| c2b7ac3fb7 | |||
| 76b58ae598 | |||
| 6fce318ec5 | |||
| e3455f160a | |||
| 95e5c19295 | |||
| a78af87881 | |||
| 34949d8dcb | |||
| 1589c98c56 | |||
| 68060caee6 | |||
| 4089c20bd1 | |||
| cbc2417b31 | |||
| 40e2eda7ae | |||
| 414c6bd2e7 | |||
| 8732dca153 | |||
| 7c08ef3653 | |||
| e696821ea4 | |||
| cb8e73e2c7 | |||
| d6693a3400 | |||
| 104189c1f4 | |||
| a727be0829 | |||
| 083dad4922 | |||
| 9f60b599b9 | |||
| 1b98048119 | |||
| 74f350d482 | |||
| 042117ea4f | |||
| 7ac2e04a44 | |||
| 6575c6f5ad | |||
| bec90d263d | |||
| 9920530563 | |||
| 63513603e7 | |||
| 41d7faf891 | |||
| ecec5caee8 | |||
| 95a3fb3aad | |||
| 04adc7de38 | |||
| 4854bec6cf | |||
| 8e74a6eb9e | |||
| 7a201b247e | |||
| 437ef94eb2 | |||
| 8e1e849480 | |||
| e790b61e38 | |||
| 551f0b5d7e | |||
| dbd594ed15 | |||
| ab1736ab1f | |||
| 9f39ff6d96 | |||
| 96f56bc4ff | |||
| 5d4c573887 | |||
| f1ad20d929 | |||
| bf522dad40 | |||
| 2273ddbb27 | |||
| 5f70ddb676 | |||
| a8088232b1 | |||
| ff1b96e9f0 | |||
| 7ccb369f67 | |||
| 2eb638be81 | |||
| 2ded7bc2eb | |||
| c799044c2c | |||
| 660d3b9530 | |||
| 0a6a753a7f | |||
| 1c7166a8d4 | |||
| 71989c5d39 | |||
| 5066b1258c | |||
| 9c221df743 | |||
| 47fcfc7317 | |||
| ffeeed9b32 | |||
| f943a78cbe | |||
| 0e2b6268f0 | |||
| 8e0b21b0b2 | |||
| 45864cc86e | |||
| ef8197d3af | |||
| 686bbac879 | |||
| 9ee705e74a | |||
| a453501cdc | |||
| af4a1292af | |||
| a5c3aabca8 | |||
| e0d92ff281 | |||
| 03abe79e77 | |||
| b17d944267 | |||
| 7aecee0977 | |||
| 9988588aed | |||
| a7bd7637b4 | |||
| dea80d1f30 | |||
| 60eaa2e72d | |||
| 3364157a4b | |||
| 7d728003ae | |||
| d1451e4f0e | |||
| 0bc4168200 | |||
| 6c6f7c851b | |||
| 4bba5a6f44 | |||
| 4404eb3b01 | |||
| a65d282818 | |||
| 8aee86e196 | |||
| afb3efd947 | |||
| 4987fdbaef | |||
| 8f83745255 | |||
| 2f6b6e9241 | |||
| 577a9f5805 | |||
| 7f871f939b | |||
| 73da033354 | |||
| b94129bc1c | |||
| e8c5ac5251 | |||
| de4add7e1e | |||
| 617ef2a336 | |||
| a55eff0fab | |||
| a081748db4 | |||
| d0afc97d3e | |||
| 4f7e719598 | |||
| ad2f4cff93 | |||
| 8bd763d2da | |||
| ea40ec3c8f | |||
| 20f2564695 | |||
| cc01353321 | |||
| 9cf078114f | |||
| 0542e675b9 | |||
| 3cae7304e5 | |||
| 59194f400e | |||
| 7577a51e48 | |||
| cd735125df | |||
| c6ce18c221 | |||
| 4b8a063ad3 | |||
| 545fa9f30f | |||
| 73de424b0b | |||
| 9bfb8bdbe3 | |||
| 154965a441 | |||
| 4b5fbbed17 | |||
| a2d6e38bd9 | |||
| 4ac48edb9b | |||
| 9f9743cb88 | |||
| 255e7cc375 | |||
| 1c63d8955d | |||
| b74a216ad1 | |||
| 41a5673659 | |||
| 56e1965f4f | |||
| d1e3c0f2ec | |||
| 7b8c690ecf | |||
| f800bf46f6 | |||
| fdcabcb3f1 | |||
| 28b7f29fbc | |||
| 7575a38529 | |||
| ca57f3dd0d | |||
| c819e5cadd | |||
| 872964f140 | |||
| 28a1d6e3c9 | |||
| fc1e2380e4 | |||
| eada4f02cc | |||
| 70cf311253 | |||
| b0f625ebf3 | |||
| 9c9c50d8ec | |||
| e2f5df2d6f | |||
| 3ca50b0dd3 | |||
| 1ecce737cc | |||
| f882530904 | |||
| 6a800f3825 | |||
| fb6c31f207 | |||
| 3d5bd70fea | |||
| c32580cea0 | |||
| 88178d9b78 | |||
| 5553359aa4 | |||
| 503fc99f88 | |||
| ae21a6519b | |||
| cfc90a8c60 | |||
| a3572566d3 | |||
| c8f324143a | |||
| bf4846358f | |||
| e3c1819c36 | |||
| fd95bf5153 | |||
| 7342c508e7 | |||
| d41d24ce4f | |||
| 37e936ab77 | |||
| d8b289ae95 | |||
| 635b51757a | |||
| b7b0aa01a5 | |||
| 837a9c5c12 | |||
| fe0bcf738c | |||
| 3d18158bc8 | |||
| 1e35f5f18e | |||
| c3c9612c1c | |||
| e5da5f70ef | |||
| 864a2b3414 | |||
| 4eec1cbcee | |||
| d8f605d675 | |||
| b3cac2f0e8 | |||
| 930eaf9ec8 | |||
| b3bef28cc0 | |||
| 444014a57e | |||
| 982a81c41f | |||
| fd9e9c6404 | |||
| e8e6e54b7d | |||
| 67faedb211 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
README $Id$
|
||||
README $Id$
|
||||
------
|
||||
|
||||
QUICK INSTALL
|
||||
|
||||
+225
-12
@@ -11,10 +11,8 @@ require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
@@ -22,6 +20,13 @@ $auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
// get currently installed and enabled auth plugins
|
||||
$authsavailable = get_list_of_plugins('auth');
|
||||
|
||||
//revert auth_plugins_enabled
|
||||
if (isset($CFG->auth_plugins_enabled)) {
|
||||
set_config('auth', $CFG->auth_plugins_enabled);
|
||||
delete_records('config', 'name', 'auth_plugins_enabled');
|
||||
unset($CFG->auth_plugins_enabled);
|
||||
}
|
||||
|
||||
get_enabled_auth_plugins(true); // fix the list of enabled auths
|
||||
if (empty($CFG->auth)) {
|
||||
$authsenabled = array();
|
||||
@@ -29,18 +34,44 @@ if (empty($CFG->auth)) {
|
||||
$authsenabled = explode(',', $CFG->auth);
|
||||
}
|
||||
|
||||
if (!empty($auth) and !exists_auth_plugin($auth)) {
|
||||
print_error('pluginnotinstalled', 'auth', $url, $auth);
|
||||
if (!isset($CFG->registerauth)) {
|
||||
set_config('registerauth', '');
|
||||
}
|
||||
|
||||
if (!isset($CFG->auth_instructions)) {
|
||||
set_config('auth_instructions', '');
|
||||
}
|
||||
|
||||
if (!empty($auth) and !exists_auth_plugin($auth)) {
|
||||
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// process actions
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
$status = '';
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'save':
|
||||
if (data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// save settings
|
||||
set_config('guestloginbutton', required_param('guestloginbutton', PARAM_BOOL));
|
||||
set_config('alternateloginurl', stripslashes(trim(required_param('alternateloginurl', PARAM_RAW))));
|
||||
set_config('registerauth', required_param('register', PARAM_SAFEDIR));
|
||||
set_config('auth_instructions', stripslashes(trim(required_param('auth_instructions', PARAM_RAW))));
|
||||
|
||||
// enable registerauth in $CFG->auth if needed
|
||||
if (!empty($CFG->registerauth) and !in_array($CFG->registerauth, $authsenabled)) {
|
||||
$authsenabled[] = $CFG->registerauth;
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
$status = get_string('changessaved');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
// remove from enabled list
|
||||
$key = array_search($auth, $authsenabled);
|
||||
@@ -67,7 +98,7 @@ switch ($action) {
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth plugin is valid
|
||||
if ($key === false) {
|
||||
print_error('pluginnotenabled', 'auth', $url, $auth);
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
}
|
||||
// move down the list
|
||||
if ($key < (count($authsenabled) - 1)) {
|
||||
@@ -82,7 +113,7 @@ switch ($action) {
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth is valid
|
||||
if ($key === false) {
|
||||
print_error('pluginnotenabled', 'auth', $url, $auth);
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
}
|
||||
// move up the list
|
||||
if ($key >= 1) {
|
||||
@@ -97,6 +128,188 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
redirect ($returnurl);
|
||||
// display strings
|
||||
$txt = get_strings(array('authenticationplugins', 'users', 'administration',
|
||||
'settings', 'edit', 'name', 'enable', 'disable',
|
||||
'up', 'down', 'none'));
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
|
||||
// construct the display array, with enabled auth plugins at the top, in order
|
||||
$displayauths = array();
|
||||
$registrationauths = array();
|
||||
$registrationauths[''] = $txt->disable;
|
||||
foreach ($authsenabled as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($authsavailable as $auth) {
|
||||
if (array_key_exists($auth, $displayauths)) {
|
||||
continue; //already in the list
|
||||
}
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
// build the display table
|
||||
$table = new flexible_table('auth_admin_table');
|
||||
$table->define_columns(array('name', 'enable', 'order', 'settings'));
|
||||
$table->define_headers(array($txt->name, $txt->enable, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("{$CFG->wwwroot}/{$CFG->admin}/auth.php");
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
//add always enabled plugins first
|
||||
$displayname = "<span>".$displayauths['manual']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=manual\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
$displayname = "<span>".$displayauths['nologin']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=nologin\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
|
||||
|
||||
// iterate through auth plugins and add to the display table
|
||||
$updowncount = 1;
|
||||
$authcount = count($authsenabled);
|
||||
$url = "auth.php?sesskey=" . sesskey();
|
||||
foreach ($displayauths as $auth => $name) {
|
||||
if ($auth == 'manual' or $auth == 'nologin') {
|
||||
continue;
|
||||
}
|
||||
// hide/show link
|
||||
if (in_array($auth, $authsenabled)) {
|
||||
$hideshow = "<a href=\"$url&action=disable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"disable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=disable&auth=$auth\"><input type=\"checkbox\" checked /></a>";
|
||||
$enabled = true;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$url&action=enable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"enable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=enable&auth=$auth\"><input type=\"checkbox\" /></a>";
|
||||
$enabled = false;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
// up/down link (only if auth is enabled)
|
||||
$updown = '';
|
||||
if ($enabled) {
|
||||
if ($updowncount > 1) {
|
||||
$updown .= "<a href=\"$url&action=up&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount < $authcount) {
|
||||
$updown .= "<a href=\"$url&action=down&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
|
||||
}
|
||||
++ $updowncount;
|
||||
}
|
||||
|
||||
// settings link
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=$auth\">{$txt->settings}</a>";
|
||||
|
||||
// add a row to the table
|
||||
$table->add_data(array($displayname, $hideshow, $updown, $settings));
|
||||
}
|
||||
|
||||
// output form
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
//print stus messages
|
||||
if ($status !== '') {
|
||||
notify($status, 'notifysuccess');
|
||||
}
|
||||
|
||||
print_simple_box(get_string('configauthenticationplugins', 'admin'), 'center', '700');
|
||||
|
||||
$table->print_html();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$guestoptions = array();
|
||||
$guestoptions[0] = get_string("hide");
|
||||
$guestoptions[1] = get_string("show");
|
||||
|
||||
echo '<hr />';
|
||||
|
||||
echo '<form '.$CFG->frametarget.' id="adminsettings" method="post" action="auth.php">';
|
||||
echo '<div class="settingsform">';
|
||||
print_heading(get_string('auth_common_settings', 'auth'));
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
echo '<fieldset>';
|
||||
##echo '<table cellspacing="0" cellpadding="5" border="0" style="margin-left:auto;margin-right:auto">';
|
||||
|
||||
// User self registration
|
||||
echo '<div class="form-item" id="admin-register">';
|
||||
echo '<label for = "menuregister">' . get_string("selfregistration", "auth");
|
||||
echo '<span class="form-shortname">registerauth</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($registrationauths, "register", $CFG->registerauth, "");
|
||||
echo '<div class="description">' . get_string("selfregistration_help", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
// Login as guest button enabled
|
||||
echo '<div class="form-item" id="admin-guestloginbutton">';
|
||||
echo '<label for = "menuguestloginbutton">' . get_string("guestloginbutton", "auth");
|
||||
echo '<span class="form-shortname">guestloginbutton</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($guestoptions, "guestloginbutton", $CFG->guestloginbutton, "");
|
||||
echo '<div class="description">' . get_string("showguestlogin", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
/// An alternate url for the login form. It means we can use login forms that are integrated
|
||||
/// into non-moodle pages
|
||||
echo '<div class="form-item" id="admin-alternateloginurl">';
|
||||
echo '<label for = "alternateloginurl">' . get_string("alternateloginurl", "auth");
|
||||
echo '<span class="form-shortname">alternateloginurl</span>';
|
||||
echo '</label>';
|
||||
echo '<input type="text" size="60" name="alternateloginurl" id="alternateloginurl" value="'.$CFG->alternateloginurl."\" />\n";
|
||||
echo '<div class="description">' . get_string("alternatelogin", "auth", htmlspecialchars($CFG->wwwroot.'/login/index.php')) . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
/// Instructions about login/password
|
||||
/// to be showed to users
|
||||
echo '<div class="form-item" id="admin-auth_instructions">';
|
||||
echo '<label for = "auth_instructions">' . get_string("instructions", "auth");
|
||||
echo '<span class="form-shortname">auth_instructions</span>';
|
||||
echo '</label>';
|
||||
echo '<textarea cols="30" rows="4" name="auth_instructions" id="auth_instructions">'.s($CFG->auth_instructions)."</textarea>\n";
|
||||
echo '<div class="description">' . get_string("authinstructions", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+22
-18
@@ -6,19 +6,19 @@
|
||||
require_once '../config.php';
|
||||
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;
|
||||
|
||||
admin_externalpage_setup('authsetting'.$auth);
|
||||
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$err = array();
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
|
||||
|
||||
// save configuration changes
|
||||
if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$frm = stripslashes_recursive($frm);
|
||||
|
||||
$authplugin->validate_form($frm, $err);
|
||||
@@ -38,7 +38,7 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect($returnurl);
|
||||
redirect("auth.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
@@ -50,16 +50,21 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
$frm = get_config("auth/$auth");
|
||||
}
|
||||
|
||||
$user_fields = $authplugin->userfields;
|
||||
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = $authplugin->get_title();
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Get the auth descriptions (from core or own auth lang files)
|
||||
$authdescription = $authplugin->get_description();
|
||||
$authdescription = get_string("auth_{$auth}description", "auth");
|
||||
if ($authdescription == "[[auth_{$auth}description]]") {
|
||||
$authdescription = get_string("auth_{$auth}description", "auth_{$auth}");
|
||||
}
|
||||
|
||||
// output configuration form
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
// choose an authentication method
|
||||
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
|
||||
@@ -80,7 +85,7 @@ echo '<p style="text-align: center"><input type="submit" value="' . get_string("
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
@@ -136,11 +141,10 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
|
||||
$fieldname = get_string('language');
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} else {
|
||||
$fieldname = get_string($fieldname);
|
||||
}
|
||||
}
|
||||
|
||||
if ($retrieveopts) {
|
||||
$varname = 'field_map_' . $field;
|
||||
|
||||
|
||||
+11
-6
@@ -4,16 +4,16 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('manageblocks', $adminroot);
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
|
||||
if(!$blockrecord = blocks_get_record($blockid)) {
|
||||
if(($blockrecord = blocks_get_record($blockid)) === false) {
|
||||
error('This block does not exist');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('blocksetting'.$blockrecord->name);
|
||||
|
||||
$block = block_instance($blockrecord->name);
|
||||
if($block === false) {
|
||||
error('Problem in instantiating block object');
|
||||
@@ -31,7 +31,7 @@
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if(!$block->has_config()) {
|
||||
error('This block does not support global configuration');
|
||||
@@ -50,7 +50,12 @@
|
||||
$strmanageblocks = get_string('manageblocks');
|
||||
$strblockname = $block->get_title();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
// $CFG->pagepath is used to generate the body and id attributes for the body tag
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'block/' . $block->name() . '/config';
|
||||
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading($strblockname);
|
||||
|
||||
@@ -65,6 +70,6 @@
|
||||
echo '</p>';
|
||||
$block->config_print();
|
||||
echo '</form>';
|
||||
print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+32
-36
@@ -8,7 +8,8 @@
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
require_once($CFG->libdir.'/ddllib.php');
|
||||
|
||||
admin_externalpage_setup('manageblocks');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('manageblocks', $adminroot);
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$hide = optional_param('hide', 0, PARAM_INT);
|
||||
@@ -29,6 +30,10 @@
|
||||
$strmultiple = get_string('blockmultiple', 'admin');
|
||||
$strshowblockcourse = get_string('showblockcourse');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) && confirm_sesskey()) {
|
||||
@@ -36,7 +41,6 @@
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($show) && confirm_sesskey() ) {
|
||||
@@ -44,7 +48,6 @@
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '1', 'id', $block->id); // Show block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($multiple) && confirm_sesskey()) {
|
||||
@@ -53,12 +56,9 @@
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
update_record('block', $block);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($delete) && confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
if (!$block = blocks_get_record($delete)) {
|
||||
error("Block doesn't exist!");
|
||||
@@ -76,7 +76,7 @@
|
||||
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
|
||||
'blocks.php?delete='.$block->id.'&confirm=1&sesskey='.$USER->sesskey,
|
||||
'blocks.php');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
} else {
|
||||
@@ -100,24 +100,34 @@
|
||||
notify("Error occurred while deleting the $strblockname record from blocks table");
|
||||
}
|
||||
|
||||
drop_plugin_tables($block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false); // old obsoleted table names
|
||||
drop_plugin_tables('block_'.$block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false);
|
||||
|
||||
// Then the tables themselves
|
||||
if ($tables = $db->Metatables()) {
|
||||
$prefix = $CFG->prefix.$block->name;
|
||||
$prefix2 = $CFG->prefix.'block_'.$block->name;
|
||||
foreach ($tables as $table) {
|
||||
if (strpos($table, $prefix) === 0 || strpos($table, $prefix2) === 0) {
|
||||
/// If the match has been due to the 1st condition, debug to developers
|
||||
if (strpos($table, $prefix) === 0) {
|
||||
debugging('This block has some wrongly named tables. See Moodle Docs coding guidelines (and MDL-6786)', DEBUG_DEVELOPER);
|
||||
}
|
||||
/// Strip prefix from $table
|
||||
$table = preg_replace("/^{$CFG->prefix}/", '', $table);
|
||||
$xmldb_table = new XMLDBTable($table);
|
||||
if (!drop_table($xmldb_table, true, false)) {
|
||||
notify("ERROR: while trying to drop table $table");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Delete the capabilities that were defined by this block
|
||||
capabilities_cleanup('block/'.$block->name);
|
||||
|
||||
// remove entent handlers and dequeue pending events
|
||||
events_uninstall('block/'.$block->name);
|
||||
|
||||
$a->block = $strblockname;
|
||||
$a->directory = $CFG->dirroot.'/blocks/'.$block->name;
|
||||
notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
/// Main display starts here
|
||||
|
||||
/// Get and sort the existing blocks
|
||||
@@ -162,35 +172,21 @@
|
||||
foreach ($blockbyname as $blockname => $blockid) {
|
||||
|
||||
$blockobject = $blockobjects[$blockid];
|
||||
$block = $blocks[$blockid];
|
||||
|
||||
$delete = '<a href="blocks.php?delete='.$blockid.'&sesskey='.$USER->sesskey.'">'.$strdelete.'</a>';
|
||||
|
||||
$settings = ''; // By default, no configuration
|
||||
if ($blockobject->has_config()) {
|
||||
if (file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
|
||||
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
|
||||
} else {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
if($blockobject->has_config()) {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
|
||||
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
|
||||
// and it should not show up on course search page
|
||||
|
||||
$totalcount = count_records('block_instance', 'blockid', $blockid);
|
||||
|
||||
$count = count_records_sql('SELECT COUNT(*)
|
||||
FROM '.$CFG->prefix.'block_instance
|
||||
WHERE blockid = '.$blockid.' AND
|
||||
pagetype = \'course-view\'');
|
||||
|
||||
$count = count_records('block_instance', 'blockid', $blockid);
|
||||
if ($count>0) {
|
||||
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
}
|
||||
else {
|
||||
$blocklist = "$totalcount";
|
||||
$blocklist = "$count";
|
||||
}
|
||||
$class = ''; // Nothing fancy, by default
|
||||
|
||||
@@ -250,6 +246,6 @@
|
||||
$table->print_html();
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+66
-187
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?PHP // $Id$
|
||||
|
||||
/// This script looks through all the module directories for cron.php files
|
||||
/// and runs them. These files can contain cleanup functions, email functions
|
||||
@@ -10,7 +10,7 @@
|
||||
///
|
||||
/// eg wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
|
||||
/// or php /web/moodle/admin/cron.php
|
||||
set_time_limit(0);
|
||||
|
||||
$starttime = microtime();
|
||||
|
||||
/// The following is a hack necessary to allow this script to work well
|
||||
@@ -32,16 +32,6 @@
|
||||
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/gradelib.php');
|
||||
|
||||
/// Extra debugging (set in config.php)
|
||||
if (!empty($CFG->showcronsql)) {
|
||||
$db->debug = true;
|
||||
}
|
||||
if (!empty($CFG->showcrondebugging)) {
|
||||
$CFG->debug = DEBUG_DEVELOPER;
|
||||
$CFG->displaydebug = true;
|
||||
}
|
||||
|
||||
/// extra safety
|
||||
@session_write_close();
|
||||
@@ -100,8 +90,7 @@
|
||||
/// Run all cron jobs for each module
|
||||
|
||||
mtrace("Starting activity modules");
|
||||
get_mailer('buffer');
|
||||
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1 ")) {
|
||||
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
foreach ($mods as $mod) {
|
||||
$libfile = "$CFG->dirroot/mod/$mod->name/lib.php";
|
||||
if (file_exists($libfile)) {
|
||||
@@ -109,7 +98,6 @@
|
||||
$cron_function = $mod->name."_cron";
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing module function $cron_function ...", '');
|
||||
$pre_dbqueries = null;
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(1);
|
||||
@@ -130,11 +118,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
get_mailer('close');
|
||||
mtrace("Finished activity modules");
|
||||
|
||||
mtrace("Starting blocks");
|
||||
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1")) {
|
||||
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
// we will need the base class.
|
||||
require_once($CFG->dirroot.'/blocks/moodleblock.class.php');
|
||||
foreach ($blocks as $block) {
|
||||
@@ -160,33 +147,6 @@
|
||||
}
|
||||
mtrace('Finished blocks');
|
||||
|
||||
mtrace('Starting admin reports');
|
||||
// Admin reports do not have a database table that lists them. Instead a
|
||||
// report includes cron.php with function report_reportname_cron() if it wishes
|
||||
// to be cronned. It is up to cron.php to handle e.g. if it only needs to
|
||||
// actually do anything occasionally.
|
||||
$reports = get_list_of_plugins($CFG->admin.'/report');
|
||||
foreach($reports as $report) {
|
||||
$cronfile = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php';
|
||||
if (file_exists($cronfile)) {
|
||||
require_once($cronfile);
|
||||
$cronfunction = 'report_'.$report.'_cron';
|
||||
mtrace('Processing cron function for '.$report.'...', '');
|
||||
$pre_dbqueries = null;
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(true);
|
||||
}
|
||||
$cronfunction();
|
||||
if (isset($pre_dbqueries)) {
|
||||
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
|
||||
mtrace("... used " . round(microtime(true) - $pre_time, 2) . " seconds");
|
||||
}
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
mtrace('Finished admin reports');
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages(true);
|
||||
@@ -207,6 +167,7 @@
|
||||
AND ra.timeend < '$timenow'
|
||||
AND c.enrolperiod > 0
|
||||
");
|
||||
mtrace($rs_enrol->RecordCount().' to delete');
|
||||
while ($oldenrolment = rs_fetch_next_record($rs_enrol)) {
|
||||
role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid);
|
||||
$somefound = true;
|
||||
@@ -219,11 +180,6 @@
|
||||
}
|
||||
|
||||
|
||||
mtrace('Starting main gradebook job ...');
|
||||
grade_cron();
|
||||
mtrace('done.');
|
||||
|
||||
|
||||
/// Run all core cron jobs, but not every time since they aren't too important.
|
||||
/// These don't have a timer to reduce load, so we'll use a random number
|
||||
/// to randomly choose the percentage of times we should run these jobs.
|
||||
@@ -237,107 +193,73 @@
|
||||
/// Unenrol users who haven't logged in for $CFG->longtimenosee
|
||||
|
||||
if ($CFG->longtimenosee) { // value in days
|
||||
$cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24);
|
||||
$rs = get_recordset_sql ("SELECT id, userid, courseid
|
||||
FROM {$CFG->prefix}user_lastaccess
|
||||
WHERE courseid != ".SITEID."
|
||||
AND timeaccess < $cuttime ");
|
||||
while ($assign = rs_fetch_next_record($rs)) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (role_unassign(0, $assign->userid, 0, $context->id)) {
|
||||
mtrace("Deleted assignment for user $assign->userid from course $assign->courseid");
|
||||
$longtime = $timenow - ($CFG->longtimenosee * 3600 * 24);
|
||||
if ($assigns = get_users_longtimenosee($longtime)) {
|
||||
foreach ($assigns as $assign) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (role_unassign(0, $assign->id, 0, $context->id)) {
|
||||
mtrace("Deleted assignment for user $assign->id from course $assign->courseid");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
/// Execute the same query again, looking for remaining records and deleting them
|
||||
/// if the user hasn't moodle/course:view in the CONTEXT_COURSE context (orphan records)
|
||||
$rs = get_recordset_sql ("SELECT id, userid, courseid
|
||||
FROM {$CFG->prefix}user_lastaccess
|
||||
WHERE courseid != ".SITEID."
|
||||
AND timeaccess < $cuttime ");
|
||||
while ($assign = rs_fetch_next_record($rs)) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (!has_capability('moodle/course:view', $context, $assign->userid)) {
|
||||
delete_records('user_lastaccess', 'userid', $assign->userid, 'courseid', $assign->courseid);
|
||||
mtrace("Deleted orphan user_lastaccess for user $assign->userid from course $assign->courseid");
|
||||
}
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
|
||||
/// Delete users who haven't confirmed within required period
|
||||
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
$rs = get_recordset_sql ("SELECT id, firstname, lastname
|
||||
FROM {$CFG->prefix}user
|
||||
WHERE confirmed = 0
|
||||
AND firstaccess > 0
|
||||
AND firstaccess < $cuttime");
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
if (!empty($CFG->deleteincompleteusers)) {
|
||||
$cuttime = $timenow - ($CFG->deleteincompleteusers * 3600);
|
||||
$rs = get_recordset_sql ("SELECT id, username
|
||||
FROM {$CFG->prefix}user
|
||||
WHERE confirmed = 1
|
||||
AND lastaccess > 0
|
||||
AND lastaccess < $cuttime
|
||||
AND deleted = 0
|
||||
AND (lastname = '' OR firstname = '' OR email = '')");
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (delete_user($user)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
/// Delete old logs to save space (this might need a timer to slow it down...)
|
||||
|
||||
|
||||
if (!empty($CFG->loglifetime)) { // value in days
|
||||
$loglifetime = $timenow - ($CFG->loglifetime * 3600 * 24);
|
||||
if (delete_records_select("log", "time < '$loglifetime'")) {
|
||||
mtrace("Deleted old log records");
|
||||
}
|
||||
delete_records_select("log", "time < '$loglifetime'");
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
/// Delete old cached texts
|
||||
|
||||
if (!empty($CFG->cachetext)) { // Defined in config.php
|
||||
$cachelifetime = time() - $CFG->cachetext - 60; // Add an extra minute to allow for really heavy sites
|
||||
if (delete_records_select('cache_text', "timemodified < '$cachelifetime'")) {
|
||||
mtrace("Deleted old cache_text records");
|
||||
}
|
||||
delete_records_select('cache_text', "timemodified < '$cachelifetime'");
|
||||
}
|
||||
flush();
|
||||
|
||||
if (!empty($CFG->notifyloginfailures)) {
|
||||
notify_login_failures();
|
||||
mtrace('Notified login failured');
|
||||
}
|
||||
flush();
|
||||
|
||||
sync_metacourses();
|
||||
mtrace('Synchronised metacourses');
|
||||
|
||||
//
|
||||
// generate new password emails for users
|
||||
@@ -363,24 +285,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
tag_cron();
|
||||
mtrace ('Executed tag cron');
|
||||
}
|
||||
|
||||
// Accesslib stuff
|
||||
cleanup_contexts();
|
||||
mtrace ('Cleaned up contexts');
|
||||
gc_cache_flags();
|
||||
mtrace ('Cleaned cache flags');
|
||||
// If you suspect that the context paths are somehow corrupt
|
||||
// replace the line below with: build_context_path(true);
|
||||
build_context_path();
|
||||
mtrace ('Built context paths');
|
||||
|
||||
mtrace("Finished clean-up tasks...");
|
||||
|
||||
} // End of occasional clean-up tasks
|
||||
|
||||
@@ -458,75 +362,50 @@
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour*60*60 + $CFG->statsruntimestartminute*60;
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
// process configured number of days as max (defaulting to 31)
|
||||
$maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
|
||||
if (stats_cron_daily($maxdays)) {
|
||||
if (stats_cron_weekly()) {
|
||||
if (stats_cron_monthly()) {
|
||||
stats_clean_old();
|
||||
}
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
$clobber = true;
|
||||
if (!empty($CFG->statsmaxruntime)) {
|
||||
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour just to make sure (it could take that long to break out of the loop)
|
||||
}
|
||||
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily')) {
|
||||
// first run, set another lock. we'll check for this in subsequent runs to set the timeout to later for the normal lock.
|
||||
set_cron_lock('statsfirstrunlock',true,$time,true);
|
||||
$firsttime = true;
|
||||
}
|
||||
$time = 60*60*2; // this time set to 2.. (overridden by $CFG)
|
||||
if (!empty($CFG->statsmaxruntime)) {
|
||||
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour to make sure (it could take that long to break out of the loop)
|
||||
}
|
||||
if ($config = get_record('config','name','statsfirstrunlock')) {
|
||||
if (!empty($config->value)) {
|
||||
$clobber = false; // if we're on the first run, just don't clobber it.
|
||||
}
|
||||
}
|
||||
@set_time_limit(0);
|
||||
} else {
|
||||
mtrace('Next stats run after:'. userdate($timetocheck));
|
||||
}
|
||||
}
|
||||
|
||||
// run gradebook import/export/report cron
|
||||
if ($gradeimports = get_list_of_plugins('grade/import')) {
|
||||
foreach ($gradeimports as $gradeimport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
|
||||
$cron_function = 'grade_import_'.$gradeimport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook import function $cron_function ...", '');
|
||||
$cron_function;
|
||||
if (set_cron_lock('statsrunning',true,$time, $clobber)) {
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
$return = stats_cron_daily();
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
stats_cron_weekly();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gradeexports = get_list_of_plugins('grade/export')) {
|
||||
foreach ($gradeexports as $gradeexport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
|
||||
$cron_function = 'grade_export_'.$gradeexport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook export function $cron_function ...", '');
|
||||
$cron_function;
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
$return = $return && stats_cron_monthly();
|
||||
}
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
stats_clean_old();
|
||||
}
|
||||
set_cron_lock('statsrunning',false);
|
||||
if (!empty($firsttime)) {
|
||||
set_cron_lock('statsfirstrunlock',false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gradereports = get_list_of_plugins('grade/report')) {
|
||||
foreach ($gradereports as $gradereport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
|
||||
$cron_function = 'grade_report_'.$gradereport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook report function $cron_function ...", '');
|
||||
$cron_function;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run any customized cronjobs, if any
|
||||
// looking for functions in lib/local/cron.php
|
||||
if (file_exists($CFG->dirroot.'/local/cron.php')) {
|
||||
mtrace('Processing customized cron script ...', '');
|
||||
include_once($CFG->dirroot.'/local/cron.php');
|
||||
mtrace('done.');
|
||||
}
|
||||
|
||||
|
||||
//Unset session variables and destroy it
|
||||
@session_unset();
|
||||
@session_destroy();
|
||||
@@ -536,7 +415,7 @@
|
||||
$difftime = microtime_diff($starttime, microtime());
|
||||
mtrace("Execution took ".$difftime." seconds");
|
||||
|
||||
/// finish the IE hack
|
||||
/// finishe the IE hack
|
||||
if (check_browser_version('MSIE')) {
|
||||
echo "</xmp>";
|
||||
}
|
||||
|
||||
@@ -12,17 +12,15 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
$strdatabaseperformance = get_string("databaseperformance");
|
||||
$stradministration = get_string("administration");
|
||||
$site = get_site();
|
||||
|
||||
$navigation = build_navigation(array(
|
||||
array('name'=>$stradministration, 'link'=>'index.php', 'type'=>'misc'),
|
||||
array('name'=>$strdatabaseperformance, 'link'=>null, 'type'=>'misc')));
|
||||
if (!empty($topframe)) {
|
||||
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname", $navigation);
|
||||
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
|
||||
"<a $CFG->frametarget href=\"index.php\">$stradministration</a> -> Database performance");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -5,26 +5,26 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('purgemoodledata');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('purgemoodledata', $adminroot);
|
||||
|
||||
require_login();
|
||||
|
||||
$sure = optional_param('sure', 0, PARAM_BOOL);
|
||||
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
$deletedir = $CFG->dataroot; // The directory to delete!
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading('Purge moodledata');
|
||||
|
||||
if (empty($sure)) {
|
||||
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
|
||||
notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?',
|
||||
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
|
||||
notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?',
|
||||
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
echo '<h1 align="center">Done!</h1>';
|
||||
print_continue($CFG->wwwroot);
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
while ($file = readdir($dir)) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
|
||||
+8
-45
@@ -5,25 +5,21 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
|
||||
$savesettings = optional_param('savesettings', 0, PARAM_BOOL);
|
||||
|
||||
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
|
||||
$CFG->pagepath = 'enrol';
|
||||
|
||||
admin_externalpage_setup('enrolment');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('enrolment', $adminroot);
|
||||
|
||||
if (!isset($CFG->sendcoursewelcomemessage)) {
|
||||
set_config('sendcoursewelcomemessage', 1);
|
||||
}
|
||||
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
|
||||
/// Save settings
|
||||
|
||||
if ($frm = data_submitted() and !$savesettings) {
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if (empty($frm->enable)) {
|
||||
$frm->enable = array();
|
||||
@@ -39,19 +35,13 @@
|
||||
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
|
||||
set_config('enrol', $frm->default);
|
||||
redirect("enrol.php", get_string("changessaved"), 1);
|
||||
|
||||
} else if ($frm = data_submitted() and $savesettings) {
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
set_config('sendcoursewelcomemessage', required_param('sendcoursewelcomemessage', PARAM_BOOL));
|
||||
}
|
||||
|
||||
/// Print the form
|
||||
|
||||
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
$options = array();
|
||||
@@ -112,33 +102,6 @@
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
echo '<hr />';
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
$yesnooptions = array(0=>get_string('no'), 1=>get_string('yes'));
|
||||
|
||||
echo '<form '.$CFG->frametarget.' id="adminsettings" method="post" action="enrol.php">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
print_heading(get_string('commonsettings', 'admin'));
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="savesettings" value="1" />';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="form-item clearfix" id="admin-sendcoursewelcomemessage">';
|
||||
|
||||
echo '<div class="form-label"><label for = "menusendcoursewelcomemessage">' . get_string('sendcoursewelcomemessage', 'admin');
|
||||
echo '<span class="form-shortname">sendcoursewelcomemessage</span>';
|
||||
echo '</label></div>';
|
||||
echo '<div class="form-setting"><div class="form-checkbox defaultsnext">';
|
||||
choose_from_menu($yesnooptions, 'sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, '');
|
||||
echo '</div><div class="form-defaultinfo">'.get_string('defaultsettinginfo', 'admin', get_string('yes')).'</div></div>';
|
||||
echo '<div class="form-description">' . get_string('configsendcoursewelcomemessage', 'admin') . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -5,7 +5,8 @@
|
||||
require_once("../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('enrolment');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('enrolment', $adminroot);
|
||||
|
||||
$enrol = required_param('enrol', PARAM_ALPHA);
|
||||
$CFG->pagepath = 'enrol/' . $enrol;
|
||||
@@ -19,7 +20,7 @@
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if ($enrolment->process_config($frm)) {
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
@@ -41,7 +42,7 @@
|
||||
}
|
||||
asort($options);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
|
||||
echo "<div>";
|
||||
@@ -65,7 +66,7 @@
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
exit;
|
||||
?>
|
||||
|
||||
+10
-9
@@ -7,7 +7,7 @@
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@@ -34,7 +34,8 @@
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
admin_externalpage_setup('environment');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('environment', $adminroot);
|
||||
|
||||
/// Parameters
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
@@ -52,7 +53,7 @@
|
||||
$strmisc = get_string('miscellaneous');
|
||||
|
||||
/// Print the header stuff
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
/// Print the component download link
|
||||
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
|
||||
@@ -65,10 +66,10 @@
|
||||
if ($cd = new component_installer('http://download.moodle.org',
|
||||
'environment',
|
||||
'environment.zip')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/environment/environment.zip';
|
||||
$a->dest= $CFG->dataroot.'/';
|
||||
@@ -77,10 +78,10 @@
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
|
||||
}
|
||||
break;
|
||||
case COMPONENT_UPTODATE:
|
||||
case UPTODATE:
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
|
||||
break;
|
||||
case COMPONENT_INSTALLED:
|
||||
case INSTALLED:
|
||||
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
|
||||
break;
|
||||
}
|
||||
@@ -132,5 +133,5 @@
|
||||
$status = check_moodle_environment($version, $environment_results);
|
||||
|
||||
/// Print footer
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
+6
-46
@@ -117,16 +117,6 @@
|
||||
<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">
|
||||
@@ -177,16 +167,6 @@
|
||||
<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">
|
||||
@@ -200,11 +180,6 @@
|
||||
<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">
|
||||
@@ -225,9 +200,8 @@
|
||||
<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.4" level="required">
|
||||
<PHP version="5.2.0" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
@@ -240,9 +214,9 @@
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
@@ -255,26 +229,12 @@
|
||||
<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="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="globalswarning" />
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
|
||||
+22
-14
@@ -6,15 +6,21 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$filterfull = required_param('filter', PARAM_PATH);
|
||||
$forcereset = optional_param('reset', 0, PARAM_BOOL);
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('managefilters', $adminroot);
|
||||
|
||||
$filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
|
||||
// get parameters
|
||||
$param = new Object;
|
||||
|
||||
admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
|
||||
$param->filter = required_param('filter', PARAM_PATH);
|
||||
$param->submit = optional_param('submit', 0, PARAM_BOOL);
|
||||
$param->reset = optional_param('reset', 0, PARAM_BOOL);
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
|
||||
$filtername = substr($param->filter, strpos( $param->filter, '/' )+1 ) ;
|
||||
|
||||
// $CFG->pagepath is used to generate the body and id attributes for the body tag
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'filter/' . $filtername . '/config';
|
||||
|
||||
// get translated strings for use on page
|
||||
$txt = new Object;
|
||||
@@ -27,7 +33,12 @@
|
||||
//======================
|
||||
|
||||
// if reset pressed let filter config page handle it
|
||||
if ($config = data_submitted() and !$forcereset) {
|
||||
$forcereset = false;
|
||||
if (!empty($param->reset)) {
|
||||
$forcereset = true;
|
||||
}
|
||||
else
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
// check session key
|
||||
if (!confirm_sesskey()) {
|
||||
@@ -51,10 +62,7 @@
|
||||
set_config($name, stripslashes($value));
|
||||
}
|
||||
}
|
||||
|
||||
reset_text_filters_cache();
|
||||
|
||||
redirect($returnurl);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -63,7 +71,7 @@
|
||||
//==============================
|
||||
|
||||
$filtername = ucfirst($filtername);
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading( $filtername );
|
||||
|
||||
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
|
||||
@@ -72,11 +80,11 @@
|
||||
print_simple_box_start("center",'');
|
||||
|
||||
?>
|
||||
<form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
|
||||
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
|
||||
<div style="text-align: center">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
|
||||
<?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
|
||||
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
|
||||
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
|
||||
@@ -86,5 +94,5 @@
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
+216
-41
@@ -1,73 +1,136 @@
|
||||
<?php // $Id$
|
||||
// filters.php
|
||||
// Edit list of available text filters
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$filterpath = optional_param('filterpath', '', PARAM_PATH);
|
||||
// defines
|
||||
define('FILTER_TABLE','filter_administration_table');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('managefilters', $adminroot);
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
|
||||
// get values from page
|
||||
$params = new object();
|
||||
$params->action = optional_param('action', '', PARAM_ACTION);
|
||||
$params->filterpath = optional_param('filterpath', '', PARAM_PATH);
|
||||
$params->cachetext = optional_param('cachetext', 0, PARAM_INT);
|
||||
$params->filterall = optional_param('filterall', 0, PARAM_BOOL);
|
||||
$params->filteruploadedfiles = optional_param('filteruploadedfiles', 0, PARAM_INT);
|
||||
$params->filtermatchoneperpage = optional_param('filtermatchoneperpage', 0, PARAM_BOOL);
|
||||
$params->filtermatchonepertext = optional_param('filtermatchonepertext', 0, PARAM_BOOL);
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
// some basic information
|
||||
$url = 'filters.php';
|
||||
$myurl = "$url?sesskey=" . sesskey();
|
||||
$img = "$CFG->pixpath/t";
|
||||
|
||||
// get a list of installed filters
|
||||
// get translated strings for use on page
|
||||
$txt = new object();
|
||||
$txt->managefilters = get_string('managefilters');
|
||||
$txt->administration = get_string('administration');
|
||||
$txt->configuration = get_string('configuration');
|
||||
$txt->name = get_string('name');
|
||||
$txt->hide = get_string('hide');
|
||||
$txt->show = get_string('show');
|
||||
$txt->hideshow = "$txt->hide/$txt->show";
|
||||
$txt->settings = get_string('settings');
|
||||
$txt->up = get_string('up');
|
||||
$txt->down = get_string('down');
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
$txt->cachetext = get_string('cachetext', 'admin');
|
||||
$txt->configcachetext = get_string('configcachetext', 'admin');
|
||||
$txt->filteruploadedfiles = get_string('filteruploadedfiles','admin');
|
||||
$txt->configfilteruploadedfiles = get_string('configfilteruploadedfiles','admin');
|
||||
$txt->filterall = get_string('filterall','admin');
|
||||
$txt->filtermatchoneperpage = get_string('filtermatchoneperpage','admin');
|
||||
$txt->filtermatchonepertext = get_string('filtermatchonepertext','admin');
|
||||
$txt->configfilterall = get_string('configfilterall','admin');
|
||||
$txt->configfiltermatchoneperpage = get_string('configfiltermatchoneperpage','admin');
|
||||
$txt->configfiltermatchonepertext = get_string('configfiltermatchonepertext','admin');
|
||||
$txt->cachecontrols = get_string('cachecontrols');
|
||||
$txt->yes = get_string('yes');
|
||||
$txt->no = get_string('no');
|
||||
$txt->none = get_string('none');
|
||||
$txt->allfiles = get_string('allfiles');
|
||||
$txt->htmlfilesonly = get_string('htmlfilesonly');
|
||||
|
||||
// get a list of possible filters (and translate name if possible)
|
||||
// note filters can be in the dedicated filters area OR in their
|
||||
// associated modules
|
||||
$installedfilters = array();
|
||||
$filtersettings = array();
|
||||
$filterlocations = array('mod','filter');
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$plugins = get_list_of_plugins($filterlocation);
|
||||
foreach ($plugins as $plugin) {
|
||||
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
|
||||
$settingspath = "$CFG->dirroot/$filterlocation/$plugin/filterconfig.html";
|
||||
if (is_readable($pluginpath)) {
|
||||
$installedfilters["$filterlocation/$plugin"] = "$filterlocation/$plugin";
|
||||
$name = trim(get_string("filtername", $plugin));
|
||||
if (empty($name) or ($name == '[[filtername]]')) {
|
||||
$name = ucfirst($plugin);
|
||||
}
|
||||
$installedfilters["$filterlocation/$plugin"] = $name;
|
||||
if (is_readable($settingspath)) {
|
||||
$filtersettings[] = "$filterlocation/$plugin";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get all the currently selected filters
|
||||
if (!empty($CFG->textfilters)) {
|
||||
$activefilters = explode(',', $CFG->textfilters);
|
||||
$oldactivefilters = explode(',', $CFG->textfilters);
|
||||
$oldactivefilters = array_unique($oldactivefilters);
|
||||
} else {
|
||||
$activefilters = array();
|
||||
$oldactivefilters = array();
|
||||
}
|
||||
|
||||
// take this opportunity to clean up filters
|
||||
$activefilters = array();
|
||||
foreach ($oldactivefilters as $oldactivefilter) {
|
||||
if (!empty($oldactivefilter) and array_key_exists($oldactivefilter, $installedfilters)) {
|
||||
$activefilters[] = $oldactivefilter;
|
||||
}
|
||||
}
|
||||
|
||||
//======================
|
||||
// Process Actions
|
||||
//======================
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'hide':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
if ($params->action=="") {
|
||||
// store cleaned active filers in db
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
} elseif (($params->action=="hide") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
break;
|
||||
// ignore it - doubleclick??
|
||||
} else {
|
||||
// just delete it
|
||||
unset($activefilters[$key]);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
// just delete it
|
||||
unset($activefilters[$key]);
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
} elseif (($params->action=="show") and confirm_sesskey()) {
|
||||
// check filterpath is valid
|
||||
if (!array_key_exists($filterpath, $installedfilters)) {
|
||||
error("Filter $filterpath is not currently installed", $url);
|
||||
} elseif (array_search($filterpath,$activefilters)) {
|
||||
if (!array_key_exists($params->filterpath, $installedfilters)) {
|
||||
error("Filter $params->filterpath is not currently installed", $url);
|
||||
} elseif (array_search($params->filterpath,$activefilters)) {
|
||||
// filterpath is already active - doubleclick??
|
||||
} else {
|
||||
// add it to installed filters
|
||||
$activefilters[] = $filterpath;
|
||||
$activefilters[] = $params->filterpath;
|
||||
$activefilters = array_unique($activefilters);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
} elseif (($params->action=="down") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
} elseif ($key>=(count($activefilters)-1)) {
|
||||
// cannot be moved any further down - doubleclick??
|
||||
} else {
|
||||
@@ -75,14 +138,13 @@
|
||||
$fsave = $activefilters[$key];
|
||||
$activefilters[$key] = $activefilters[$key+1];
|
||||
$activefilters[$key+1] = $fsave;
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'up':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
} elseif (($params->action=="up") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
} elseif ($key<1) {
|
||||
//cannot be moved any further up - doubleclick??
|
||||
} else {
|
||||
@@ -90,13 +152,126 @@
|
||||
$fsave = $activefilters[$key];
|
||||
$activefilters[$key] = $activefilters[$key-1];
|
||||
$activefilters[$key-1] = $fsave;
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
break;
|
||||
} elseif (($params->action=="config") and confirm_sesskey()) {
|
||||
set_config('cachetext', $params->cachetext);
|
||||
set_config('filteruploadedfiles', $params->filteruploadedfiles);
|
||||
set_config('filterall', $params->filterall);
|
||||
set_config('filtermatchoneperpage', $params->filtermatchoneperpage);
|
||||
set_config('filtermatchonepertext', $params->filtermatchonepertext);
|
||||
}
|
||||
|
||||
// save, reset cache and return
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
reset_text_filters_cache();
|
||||
redirect($returnurl);
|
||||
//======================
|
||||
// Build Display Objects
|
||||
//======================
|
||||
|
||||
// construct the display array with installed filters
|
||||
// at the top in the right order
|
||||
$displayfilters = array();
|
||||
foreach ($activefilters as $activefilter) {
|
||||
$name = $installedfilters[$activefilter];
|
||||
$displayfilters[$activefilter] = $name;
|
||||
}
|
||||
foreach ($installedfilters as $key => $filter) {
|
||||
if (!array_key_exists($key, $displayfilters)) {
|
||||
$displayfilters[$key] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
// construct the flexible table ready to display
|
||||
$table = new flexible_table(FILTER_TABLE);
|
||||
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
|
||||
$table->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
$table->set_attribute('id', 'filters');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
// iterate through filters adding to display table
|
||||
$updowncount = 1;
|
||||
$activefilterscount = count($activefilters);
|
||||
foreach ($displayfilters as $path => $name) {
|
||||
$upath = urlencode($path);
|
||||
// get hide/show link
|
||||
if (in_array($path, $activefilters)) {
|
||||
$hideshow = "<a href=\"$myurl&action=hide&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"$txt->hide\" /></a>";
|
||||
$hidden = false;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$myurl&action=show&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"$txt->show\" /></a>";
|
||||
$hidden = true;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
// get up/down link (only if not hidden)
|
||||
$updown = '';
|
||||
if (!$hidden) {
|
||||
if ($updowncount>1) {
|
||||
$updown .= "<a href=\"$myurl&action=up&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/up.gif\" alt=\"$txt->up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount<$activefilterscount) {
|
||||
$updown .= "<a href=\"$myurl&action=down&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/down.gif\" alt=\"$txt->down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" alt=\"\" />";
|
||||
}
|
||||
++$updowncount;
|
||||
}
|
||||
|
||||
// settings link (if defined)
|
||||
$settings = '';
|
||||
if (in_array($path, $filtersettings)) {
|
||||
$settings = "<a href=\"filter.php?filter=" . urlencode($path) . "\">";
|
||||
$settings .= "{$txt->settings}</a>";
|
||||
}
|
||||
|
||||
// write data into the table object
|
||||
$table->add_data(array($displayname, $hideshow, $updown, $settings));
|
||||
}
|
||||
|
||||
// build options list for cache lifetime
|
||||
$seconds = array(604800,86400,43200,10800,7200,3600,2700,1800,900,600,540,480,420,360,300,240,180,120,60,30,0);
|
||||
unset($lifetimeoptions);
|
||||
foreach ($seconds as $second) {
|
||||
if ($second>=86400) {
|
||||
$options[$second] = get_string('numdays','',$second/86400);
|
||||
}
|
||||
elseif ($second>=3600) {
|
||||
$options[$second] = get_string('numhours','',$second/3600);
|
||||
}
|
||||
elseif ($second>=60) {
|
||||
$options[$second] = get_string('numminutes','',$second/60);
|
||||
}
|
||||
elseif ($second>=1) {
|
||||
$options[$second] = get_string('numseconds','',$second);
|
||||
}
|
||||
else {
|
||||
$options[$second] = get_string('no');
|
||||
}
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Display logic
|
||||
//==============================
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading_with_help($txt->managefilters, 'filters');
|
||||
|
||||
// print the table of all the filters
|
||||
$table->print_html();
|
||||
|
||||
// cache control table has been removed
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+6
-295
@@ -13,8 +13,8 @@
|
||||
}
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('healthcenter');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('healthcenter', $adminroot);
|
||||
|
||||
define('SEVERITY_NOTICE', 'notice');
|
||||
define('SEVERITY_ANNOYANCE', 'annoyance');
|
||||
@@ -24,11 +24,11 @@
|
||||
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
$site = get_site();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
echo <<<STYLES
|
||||
<style type="text/css">
|
||||
@@ -100,7 +100,7 @@ STYLES;
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
function health_find_problems() {
|
||||
@@ -525,300 +525,11 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
return 'Error counter was cleared.';
|
||||
} else {
|
||||
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>';
|
||||
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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_000015 extends problem_base {
|
||||
function title() {
|
||||
return 'Question categories should belong to a valid context';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
return record_exists_sql("
|
||||
SELECT qc.*, (SELECT COUNT(1) FROM {$CFG->prefix}question q WHERE q.category = qc.id) AS numquestions
|
||||
FROM {$CFG->prefix}question_categories qc
|
||||
LEFT JOIN {$CFG->prefix}context con ON qc.contextid = con.id
|
||||
WHERE con.id IS NULL");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
global $CFG;
|
||||
$problemcategories = get_records_sql("
|
||||
SELECT qc.id, qc.name, qc.contextid, (SELECT COUNT(1) FROM {$CFG->prefix}question q WHERE q.category = qc.id) AS numquestions
|
||||
FROM {$CFG->prefix}question_categories qc
|
||||
LEFT JOIN {$CFG->prefix}context con ON qc.contextid = con.id
|
||||
WHERE con.id IS NULL
|
||||
ORDER BY numquestions DESC, qc.name");
|
||||
$table = '<table><thead><tr><th>Cat id</th><th>Category name</th>' .
|
||||
"<th>Context id</th><th>Num Questions</th></tr></thead><tbody>\n";
|
||||
if ($problemcategories) {
|
||||
foreach ($problemcategories as $cat) {
|
||||
$table .= "<tr><td>$cat->id</td><td>" . s($cat->name) . "</td><td>" .
|
||||
$cat->contextid ."</td><td>$cat->numquestions</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$table .= '</tbody></table>';
|
||||
return '<p>All question categories are linked to a context id, and, ' .
|
||||
'the context they are linked to must exist. The following categories ' .
|
||||
'belong to a non-existant category:</p>' . $table . '<p>Any of these ' .
|
||||
'categories that contain no questions can just be deleted form the database. ' .
|
||||
'Other categories will require more thought.</p>';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return '<p>You can delete the empty categories by executing the following SQL:</p><pre>
|
||||
DELETE FROM ' . $CFG->prefix . 'question_categories qc
|
||||
WHERE
|
||||
NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = qc.id)
|
||||
AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE qc.contextid = con.id)
|
||||
</pre><p>Any remaining categories that contain questions will require more thought. ' .
|
||||
'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000016 extends problem_base {
|
||||
function title() {
|
||||
return 'Question categories should belong to the same context as their parent';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
return record_exists_sql("
|
||||
SELECT parent_qc.id AS parent, child_qc.id AS child, child_qc.contextid
|
||||
FROM {$CFG->prefix}question_categories child_qc
|
||||
JOIN {$CFG->prefix}question_categories parent_qc ON child_qc.parent = parent_qc.id
|
||||
WHERE child_qc.contextid <> parent_qc.contextid");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
global $CFG;
|
||||
$problemcategories = get_records_sql("
|
||||
SELECT
|
||||
parent_qc.id AS parentid, parent_qc.name AS parentname, parent_qc.contextid AS parentcon,
|
||||
child_qc.id AS childid, child_qc.name AS childname, child_qc.contextid AS childcon
|
||||
FROM {$CFG->prefix}question_categories child_qc
|
||||
JOIN {$CFG->prefix}question_categories parent_qc ON child_qc.parent = parent_qc.id
|
||||
WHERE child_qc.contextid <> parent_qc.contextid");
|
||||
$table = '<table><thead><tr><th colspan="3">Child category</th><th colspan="3">Parent category</th></tr><tr>' .
|
||||
'<th>Id</th><th>Name</th><th>Context id</th>' .
|
||||
'<th>Id</th><th>Name</th><th>Context id</th>' .
|
||||
"</tr></thead><tbody>\n";
|
||||
if ($problemcategories) {
|
||||
foreach ($problemcategories as $cat) {
|
||||
$table .= "<tr><td>$cat->childid</td><td>" . s($cat->childname) .
|
||||
"</td><td>$cat->childcon</td><td>$cat->parentid</td><td>" . s($cat->parentname) .
|
||||
"</td><td>$cat->parentcon</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$table .= '</tbody></table>';
|
||||
return '<p>When one question category is the parent of another, then they ' .
|
||||
'should both belong to the same context. This is not true for the following categories:</p>' .
|
||||
$table;
|
||||
}
|
||||
function solution() {
|
||||
return '<p>An automated solution is difficult. It depends whether the ' .
|
||||
'parent or child category is in the wrong pace.' .
|
||||
'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</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() {
|
||||
|
||||
+98
-169
@@ -24,15 +24,13 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
|
||||
require_once($CFG->libdir.'/ddllib.php'); // Install/upgrade related db functions
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Upgrade-related functions
|
||||
|
||||
$id = optional_param('id', '', PARAM_TEXT);
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
||||
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
|
||||
$confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||
|
||||
/// check upgrade status first
|
||||
if ($ignoreupgradewarning and !empty($_SESSION['upgraderunning'])) {
|
||||
@@ -124,7 +122,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $maintables) {
|
||||
/// hide errors from headers in case debug enabled in config.php
|
||||
$origdebug = $CFG->debug;
|
||||
@@ -132,8 +129,7 @@
|
||||
error_reporting($CFG->debug);
|
||||
if (empty($agreelicense)) {
|
||||
$strlicense = get_string('license');
|
||||
$navigation = build_navigation(array(array('name'=>$strlicense, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strlicense, $strlicense, $navigation, "", "", false, " ", " ");
|
||||
print_header($strlicense, $strlicense, $strlicense, "", "", false, " ", " ");
|
||||
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
|
||||
print_heading(get_string('copyrightnotice'));
|
||||
print_box(text_to_html(get_string('gpl')), 'copyrightnotice');
|
||||
@@ -145,8 +141,7 @@
|
||||
}
|
||||
if (empty($confirmrelease)) {
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
|
||||
echo '<form action="index.php"><div>';
|
||||
@@ -160,11 +155,9 @@
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
$strdatabasesetup = get_string("databasesetup");
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
$navigation = build_navigation(array(array('name'=>$strdatabasesetup, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strdatabasesetup, $strdatabasesetup, $navigation,
|
||||
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup,
|
||||
"", upgrade_get_javascript(), false, " ", " ");
|
||||
/// return to original debugging level
|
||||
$CFG->debug = $origdebug;
|
||||
@@ -174,13 +167,13 @@
|
||||
|
||||
/// Both old .sql files and new install.xml are supported
|
||||
/// But we prioritise install.xml (XMLDB) if present
|
||||
|
||||
|
||||
change_db_encoding(); // first try to change db encoding to utf8
|
||||
if (!setup_is_unicodedb()) {
|
||||
// If could not convert successfully, throw error, and prevent installation
|
||||
print_error('unicoderequired', 'admin');
|
||||
print_error('unicoderequired', 'admin');
|
||||
}
|
||||
|
||||
|
||||
$status = false;
|
||||
if (file_exists("$CFG->libdir/db/install.xml")) {
|
||||
$status = install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
||||
@@ -196,31 +189,37 @@
|
||||
/// Continue with the instalation
|
||||
$db->debug = false;
|
||||
if ($status) {
|
||||
|
||||
/// Groups install is now in core above.
|
||||
//ugly hack - install new groups: MDL-9217
|
||||
require("$CFG->dirroot/group/version.php");
|
||||
set_config('group_version', $group_version);
|
||||
//install_group_db();
|
||||
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('statsrolesupgraded',time());
|
||||
|
||||
// install core event handlers
|
||||
events_update_definition();
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
$adminroot = admin_get_root();
|
||||
$adminroot->prune('backups'); // backup settings table not created yet
|
||||
apply_default_settings($adminroot);
|
||||
|
||||
/// This is used to handle any settings that must exist in $CFG but which do not exist in
|
||||
/// admin_get_root()/$ADMIN as admin_setting objects (there are some exceptions).
|
||||
apply_default_exception_settings(array('auth' => 'email',
|
||||
apply_default_exception_settings(array('alternateloginurl' => '',
|
||||
'auth' => 'email',
|
||||
'auth_pop3mailbox' => 'INBOX',
|
||||
'changepassword' => '',
|
||||
'enrol' => 'manual',
|
||||
'enrol_plugins_enabled' => 'manual',
|
||||
'guestloginbutton' => 1,
|
||||
'registerauth' => 'email',
|
||||
'style' => 'default',
|
||||
'template' => 'default',
|
||||
'theme' => 'standardwhite',
|
||||
'filter_multilang_converted' => 1));
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
admin_apply_default_settings(NULL, true);
|
||||
|
||||
notify($strdatabasesuccess, "green");
|
||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||
} else {
|
||||
@@ -262,80 +261,46 @@
|
||||
$CFG->debug = DEBUG_MINIMAL;
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
// logo ut in case we are upgrading from pre 1.9 version in order to prevent
|
||||
// weird session/role problems caused by incorrect data in USER and SESSION
|
||||
if ($CFG->version < 2007101500) {
|
||||
// logout in case we are upgrading from pre 1.7 version - prevention of weird session problems
|
||||
if ($CFG->version < 2006050600) {
|
||||
require_logout();
|
||||
}
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
$navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strdatabasechecking, $stradministration, $navigation,
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
|
||||
print_footer('none');
|
||||
exit;
|
||||
|
||||
} else if (empty($confirmrelease)){
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
|
||||
|
||||
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'),
|
||||
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" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton">';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
print_footer('none');
|
||||
die;
|
||||
} elseif (empty($confirmplugincheck)) {
|
||||
$strplugincheck = get_string('plugincheck');
|
||||
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, " ", " ");
|
||||
print_heading($strplugincheck);
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('pluginchecknotice');
|
||||
print_box_end();
|
||||
print_plugin_tables();
|
||||
echo "<br />";
|
||||
echo '<div class="continuebutton">';
|
||||
print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
|
||||
echo '</div><br />';
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
print_footer('none');
|
||||
die();
|
||||
|
||||
} else {
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strdatabasechecking, $stradministration, $navigation,
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", upgrade_get_javascript(), false, " ", " ");
|
||||
|
||||
/// return to original debugging level
|
||||
@@ -344,7 +309,7 @@
|
||||
upgrade_log_start();
|
||||
|
||||
/// Upgrade current language pack if we can
|
||||
upgrade_language_pack();
|
||||
upgrade_language_pack();
|
||||
|
||||
print_heading($strdatabasechecking);
|
||||
$db->debug=true;
|
||||
@@ -361,18 +326,16 @@
|
||||
/// If successful, continue upgrading roles and setting everything properly
|
||||
if ($status) {
|
||||
if (empty($CFG->rolesactive)) {
|
||||
|
||||
/// Groups upgrade is now in core above.
|
||||
|
||||
// ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
// require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
// MDL-11062, proper group upgrade code is done in lib/db/upgrade.php
|
||||
// install_group_db();
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
} else if (!update_capabilities()) {
|
||||
error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
}
|
||||
// update core events
|
||||
events_update_definition();
|
||||
|
||||
require_once($CFG->libdir.'/statslib.php');
|
||||
if (!stats_upgrade_for_roles_wrapper()) {
|
||||
notify('Couldn\'t upgrade the stats tables to use the new roles system');
|
||||
@@ -389,7 +352,7 @@
|
||||
/// Main upgrade not success
|
||||
} else {
|
||||
notify('Main Upgrade failed! See lib/db/upgrade.php');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
@@ -414,7 +377,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// Groups install/upgrade is now in core above.
|
||||
/// ugly hack - convert to new groups if upgrading from 1.7; must be reworked
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
upgrade_group_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
@@ -444,9 +409,6 @@
|
||||
/// 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");
|
||||
|
||||
@@ -456,20 +418,9 @@
|
||||
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for changes to RPC functions
|
||||
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
||||
require_once($CFG->dirroot.'/admin/mnet/adminlib.php');
|
||||
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Upgrade all plugins for gradebook
|
||||
upgrade_plugins('gradeexport', 'grade/export', "$CFG->wwwroot/$CFG->admin/index.php");
|
||||
upgrade_plugins('gradeimport', 'grade/import', "$CFG->wwwroot/$CFG->admin/index.php");
|
||||
upgrade_plugins('gradereport', 'grade/report', "$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all message output plugins and upgrade if necessary
|
||||
upgrade_plugins('message','message/output',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all admin report plugins and upgrade if necessary
|
||||
upgrade_plugins('report', $CFG->admin.'/report', "$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
|
||||
/// just make sure upgrade logging is properly terminated
|
||||
upgrade_log_finish();
|
||||
@@ -481,10 +432,10 @@
|
||||
// We are about to create the site "course"
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
|
||||
$newsite = new object();
|
||||
$newsite = new Object();
|
||||
$newsite->fullname = "";
|
||||
$newsite->shortname = "";
|
||||
$newsite->summary = NULL;
|
||||
$newsite->summary = "";
|
||||
$newsite->newsitems = 3;
|
||||
$newsite->numsections = 0;
|
||||
$newsite->category = 0;
|
||||
@@ -495,27 +446,21 @@
|
||||
$newsite->students = get_string("defaultcoursestudents");
|
||||
$newsite->timemodified = time();
|
||||
|
||||
if (!$newid = insert_record('course', $newsite)) {
|
||||
if ($newid = insert_record('course', $newsite)) {
|
||||
// Site created, add blocks for it
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
|
||||
$cat = new Object();
|
||||
$cat->name = get_string('miscellaneous');
|
||||
if (insert_record('course_categories', $cat)) {
|
||||
redirect('index.php');
|
||||
} else {
|
||||
error("Serious Error! Could not set up a default course category!");
|
||||
}
|
||||
} else {
|
||||
error("Serious Error! Could not set up the site!");
|
||||
}
|
||||
// make sure course context exists
|
||||
get_context_instance(CONTEXT_COURSE, $newid);
|
||||
|
||||
// Site created, add blocks for it
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
|
||||
$cat = new object();
|
||||
$cat->name = get_string('miscellaneous');
|
||||
$cat->depth = 1;
|
||||
if (!$catid = insert_record('course_categories', $cat)) {
|
||||
error("Serious Error! Could not set up a default course category!");
|
||||
}
|
||||
// make sure category context exists
|
||||
get_context_instance(CONTEXT_COURSECAT, $catid);
|
||||
mark_context_dirty('/'.SYSCONTEXTID);
|
||||
|
||||
redirect('index.php');
|
||||
}
|
||||
|
||||
// initialise default blocks on admin and site page if needed
|
||||
@@ -529,11 +474,9 @@
|
||||
//add admin_tree block to site if not already present
|
||||
if ($admintree = get_record('block', 'name', 'admin_tree')) {
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, SITEID);
|
||||
$pageblocks=blocks_get_by_page($page);
|
||||
blocks_execute_action($page, $pageblocks, 'add', (int)$admintree->id, false, false);
|
||||
blocks_execute_action($page, blocks_get_by_page($page), 'add', (int)$admintree->id, false, false);
|
||||
if ($admintreeinstance = get_record('block_instance', 'pagetype', $page->type, 'pageid', SITEID, 'blockid', $admintree->id)) {
|
||||
$pageblocks=blocks_get_by_page($page); // Needs to be re-got, since has just changed
|
||||
blocks_execute_action($page, $pageblocks, 'moveleft', $admintreeinstance, false, false);
|
||||
blocks_execute_action($page, blocks_get_by_page($page), 'moveleft', $admintreeinstance, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,23 +498,19 @@
|
||||
|
||||
/// Set up the admin user
|
||||
if (empty($CFG->rolesactive)) {
|
||||
build_context_path(); // just in case - should not be needed
|
||||
create_admin_user();
|
||||
}
|
||||
|
||||
/// Check for valid admin user - no guest autologin
|
||||
require_login(0, false);
|
||||
/// Check for valid admin user
|
||||
require_login();
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
require_capability('moodle/site:config', $context);
|
||||
|
||||
/// check that site is properly customized
|
||||
if (empty($site->shortname)) {
|
||||
// probably new installation - lets return to frontpage after this step
|
||||
// remove settings that we want uninitialised
|
||||
unset_config('registerauth');
|
||||
redirect('upgradesettings.php?return=site');
|
||||
if (empty($site->shortname) or empty($site->shortname)) {
|
||||
redirect('settings.php?section=frontpagesettings&return=site');
|
||||
}
|
||||
|
||||
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
||||
@@ -582,25 +521,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// setup critical warnings before printing admin tree block
|
||||
$insecuredataroot = is_dataroot_insecure(true);
|
||||
$register_globals_enabled = ini_get_bool('register_globals');
|
||||
|
||||
$SESSION->admin_critical_warning = ($register_globals_enabled || $insecuredataroot==INSECURE_DATAROOT_ERROR);
|
||||
|
||||
$adminroot =& admin_get_root();
|
||||
|
||||
/// Check if there are any new admin settings which have still yet to be set
|
||||
if (any_new_admin_settings($adminroot)){
|
||||
redirect('upgradesettings.php');
|
||||
}
|
||||
|
||||
/// Everything should now be set up, and the user is an admin
|
||||
|
||||
/// Print default admin page with notifications.
|
||||
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
admin_externalpage_print_header();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('adminnotifications', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
/// Deprecated database! Warning!!
|
||||
if (!empty($CFG->migrated_to_new_db)) {
|
||||
@@ -612,26 +539,12 @@
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
}
|
||||
|
||||
if ($register_globals_enabled) {
|
||||
print_box(get_string('globalswarning', 'admin'), 'generalbox adminerror');
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_box(get_string('globalsquoteswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
|
||||
if (is_dataroot_insecure()) {
|
||||
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
|
||||
print_box(get_string('datarootsecurityerror', 'admin', $CFG->dataroot), 'generalbox adminerror');
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
@@ -653,30 +566,46 @@
|
||||
}
|
||||
|
||||
|
||||
/// Print slightly annoying registration button
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_box_start('generalbox adminwarning');
|
||||
if(!isset($CFG->registered)) {
|
||||
print_string('pleaseregister', 'admin');
|
||||
/// Print slightly annoying registration button every six months ;-)
|
||||
/// You can set the "registered" variable to something far in the future
|
||||
/// if you really want to prevent this. eg 9999999999
|
||||
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_box_start('generalbox adminwarning');
|
||||
print_string('pleaseregister', 'admin');
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
print_box_end();
|
||||
$registrationbuttonshown = true;
|
||||
}
|
||||
else { /* if (isset($CFG->registered) && $CFG->registered < (time() - 3600*24*30*6)) { */
|
||||
print_string('pleaserefreshregistration', 'admin', userdate($CFG->registered));
|
||||
}
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
print_box_end();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// 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" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
||||
'<a href="http://docs.moodle.org/en/Release">'.$CFG->release.'</a> ('.$CFG->version.')<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>';
|
||||
print_box($copyrighttext, 'copyright');
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
if (empty($registrationbuttonshown)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
}
|
||||
|
||||
|
||||
if (optional_param('dbmigrate')) { // ??? Is this actually used?
|
||||
print_box_start();
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/utfdbmigrate.php');
|
||||
db_migrate2utf8();
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+6
-6
@@ -2,16 +2,16 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('toinodb');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('toinodb', $adminroot);
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
|
||||
|
||||
if ($CFG->dbfamily != 'mysql') {
|
||||
@@ -31,13 +31,13 @@
|
||||
}
|
||||
notify('... done.', 'notifysuccess');
|
||||
print_continue('index.php');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
} else {
|
||||
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
|
||||
notice_yesno('Are you sure you want convert all your tables to the InnoDB format?',
|
||||
'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+196
-863
File diff suppressed because it is too large
Load Diff
+9
-11
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
admin_externalpage_setup('langedit');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('langedit', $adminroot);
|
||||
|
||||
//
|
||||
// Some local configuration
|
||||
@@ -31,10 +32,7 @@
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$stredithelpdocs = get_string('edithelpdocs', 'admin');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
notify('NOTICE: This interface is obsolete now and will be removed. You should use
|
||||
improved <a href="lang.php?mode=helpfiles">lang.php</a> interface.');
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$currentlang = current_language();
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
@@ -42,7 +40,7 @@
|
||||
|
||||
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang','',$adminroot);
|
||||
}
|
||||
// Shall I save POSTed data?
|
||||
|
||||
@@ -51,7 +49,7 @@
|
||||
if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey", $adminroot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +61,7 @@
|
||||
// Get all files from /docs directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
error("Could not find English language docs files!");
|
||||
error("Could not find English language docs files!",'',$adminroot);
|
||||
}
|
||||
|
||||
$options = array();
|
||||
@@ -83,7 +81,7 @@
|
||||
// Get all files from /help directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
error("Could not find English language help files!",'',$adminroot);
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
@@ -196,7 +194,7 @@ $langdir/$currentfile")."</font></p>";
|
||||
error_reporting($CFG->debug);
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -246,7 +244,7 @@ function langdoc_preview_url($currentfile) {
|
||||
$currentfile = substr($currentfile, 5);
|
||||
$currentpathexp = explode('/', $currentfile);
|
||||
if (count($currentpathexp) > 1) {
|
||||
$url = '/help.php?module='.implode('/',array_slice($currentpathexp,0,count($currentpathexp)-1)).'&file='.end($currentpathexp);
|
||||
$url = '/help.php?module='.$currentpathexp[0].'&file='.$currentpathexp[1];
|
||||
} else {
|
||||
$url = '/help.php?module=moodle&file='.$currentfile;
|
||||
}
|
||||
|
||||
+217
-257
@@ -6,98 +6,99 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
admin_externalpage_setup('langimport');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('langimport', $adminroot);
|
||||
|
||||
$mode = optional_param('mode', 0, PARAM_INT); //phase
|
||||
$pack = optional_param('pack', array(), PARAM_FILE); //pack to install
|
||||
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
|
||||
$displaylang = $pack;
|
||||
$uninstalllang = optional_param('uninstalllang', '', PARAM_FILE);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$sitelang = optional_param('sitelangconfig', '', PARAM_FILE);
|
||||
|
||||
define('INSTALLATION_OF_SELECTED_LANG', 2);
|
||||
define('CHANGE_SITE_LANG', 3);
|
||||
define('DELETION_OF_SELECTED_LANG', 4);
|
||||
define('UPDATE_ALL_LANG', 5);
|
||||
|
||||
$strlang = get_string('langimport','admin');
|
||||
$strlanguage = get_string('language');
|
||||
$strthislanguage = get_string('thislanguage');
|
||||
$title = $strlang;
|
||||
$strlang = get_string('langimport','admin');
|
||||
|
||||
$strlanguage = get_string("language");
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$title = $strlang;
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
//reset and diagnose lang cache permissions
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
|
||||
notify('Language cache can not be deleted, please check permissions in dataroot.');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
|
||||
$notice_ok = array();
|
||||
$notice_error = array();
|
||||
|
||||
switch ($mode){
|
||||
|
||||
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
|
||||
|
||||
if (confirm_sesskey() and !empty($pack)) {
|
||||
set_time_limit(0);
|
||||
if (confirm_sesskey()) {
|
||||
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
|
||||
@mkdir ($CFG->dataroot.'/lang/');
|
||||
|
||||
if (is_array($pack)) {
|
||||
$packs = $pack;
|
||||
} else {
|
||||
$packs = array($pack);
|
||||
}
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
|
||||
foreach ($packs as $pack) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new object();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', 'langimport.php', $a);
|
||||
} else {
|
||||
print_error($cd->get_error(), 'error', 'langimport.php');
|
||||
}
|
||||
break;
|
||||
case INSTALLED:
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1, $adminroot);
|
||||
break;
|
||||
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
break;
|
||||
case UPTODATE:
|
||||
break;
|
||||
|
||||
case COMPONENT_UPTODATE:
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
notify('Had an unspecified error with the component installer, sorry.');
|
||||
}
|
||||
} else {
|
||||
notify('Had an unspecified error with the component installer, sorry.');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHANGE_SITE_LANG: //change site language
|
||||
|
||||
if (confirm_sesskey()) {
|
||||
$langconfig = get_record('config','name','lang');
|
||||
$langconfig->value = $sitelang;
|
||||
if (!empty($sitelang) && update_record('config',$langconfig)){
|
||||
redirect('langimport.php', get_string('sitelangchanged','admin'));
|
||||
} else {
|
||||
error('Could not update the default site language!');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
|
||||
|
||||
if ($uninstalllang == 'en_utf8') {
|
||||
$notice_error[] = 'en_utf8 can not be uninstalled!';
|
||||
|
||||
} else if (!$confirm && confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
if (!$confirm && confirm_sesskey()) {
|
||||
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
|
||||
'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php?mode=4&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php');
|
||||
print_footer();
|
||||
die;
|
||||
|
||||
} else if (confirm_sesskey()) {
|
||||
if ($uninstalllang == 'en_utf8') {
|
||||
error ('en_utf8 can not be uninstalled!');
|
||||
}
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
|
||||
$rm1 = false;
|
||||
@@ -111,18 +112,18 @@
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
$notice_ok[] = get_string('langpackremoved','admin');
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'), 3, $adminroot);
|
||||
} else { //nothing deleted, possibly due to permission error
|
||||
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
|
||||
error('An error has occurred, language pack is not completely uninstalled, please check file permissions');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
|
||||
set_time_limit(0);
|
||||
|
||||
//0th pull a list from download.moodle.org,
|
||||
//key = langname, value = md5
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
@@ -130,8 +131,8 @@
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
|
||||
if (!$availablelangs = get_remote_list_of_languages()) {
|
||||
print_error('cannotdownloadlanguageupdatelist');
|
||||
if (!$availablelangs = proxy_url($source)) {
|
||||
error ('can not read from course');
|
||||
}
|
||||
|
||||
//and build an associative array
|
||||
@@ -139,12 +140,8 @@
|
||||
$md5array[$alang[0]] = $alang[1];
|
||||
}
|
||||
|
||||
//filtering out non-16 and unofficial packs
|
||||
//filtering out non-16 packs
|
||||
foreach ($alllangs as $clang) {
|
||||
if (!array_key_exists($clang, $md5array)) {
|
||||
$notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
|
||||
continue;
|
||||
}
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$clang;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$clang;
|
||||
|
||||
@@ -166,7 +163,6 @@
|
||||
if ($pack == 'en_utf8') { // no update for en_utf8
|
||||
continue;
|
||||
}
|
||||
|
||||
//1. delete old director(ies)
|
||||
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$pack;
|
||||
@@ -174,40 +170,38 @@
|
||||
$rm1 = false;
|
||||
$rm2 = false;
|
||||
if (file_exists($dest1)) {
|
||||
if (!remove_dir($dest1)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
|
||||
continue;
|
||||
}
|
||||
$rm1 = remove_dir($dest1);
|
||||
}
|
||||
if (file_exists($dest2)) {
|
||||
if (!remove_dir($dest2)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
|
||||
continue;
|
||||
}
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
if (!($rm1 || $rm2)) {
|
||||
error ('could not delete old directory, update failed');
|
||||
}
|
||||
|
||||
//2. copy & unzip into new
|
||||
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', "", $a); // not probable
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
print_error($cd->get_error(), 'error'); // not probable
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
break;
|
||||
case COMPONENT_UPTODATE:
|
||||
case UPTODATE:
|
||||
//Print error string or whatever you want to do
|
||||
break;
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
|
||||
case INSTALLED:
|
||||
notify(get_string('langpackupdated','admin',$pack), 'notifysuccess');
|
||||
$updated = true;
|
||||
//Print/do whatever you want
|
||||
break;
|
||||
@@ -219,178 +213,131 @@
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
$notice_ok[] = get_string('langupdatecomplete','admin');
|
||||
notice(get_string('langupdatecomplete','admin'), 'langimport.php', NULL, $adminroot);
|
||||
} else {
|
||||
$notice_ok[] = get_string('nolangupdateneeded','admin');
|
||||
notice(get_string('nolangupdateneeded','admin'), 'langimport.php', NULL, $adminroot);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: //display choice mode
|
||||
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$remote = 0; //flag for reading from remote or local
|
||||
|
||||
if ($availablelangs = proxy_url($source)) {
|
||||
$remote = 1;
|
||||
} else {
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
/*
|
||||
if ($fp = fopen($source, 'r')){ /// attempt to get the list from Moodle.org.
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
$remote = 1; //can read from download.moodle.org
|
||||
} else { /// fopen failed, we find local copy of list.
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
*/
|
||||
if (!$remote) {
|
||||
print_box_start();
|
||||
print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/');
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
print_box_start();
|
||||
echo '<table summary="">';
|
||||
echo '<tr><td align="center" valign="top">';
|
||||
echo '<form id="uninstallform" action="langimport.php?mode=4" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
$installedlangs = get_list_of_languages(false, true);
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
|
||||
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
|
||||
foreach ($installedlangs as $clang =>$ilang){
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
echo '<form id="updateform" action="langimport.php?mode=5" method="post">';
|
||||
echo '<div>';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
echo '</td><td align="center" valign="top">';
|
||||
//availabe langs table
|
||||
$empty = 1; //something to pring
|
||||
|
||||
/// if this language pack is not already installed, then we allow installation
|
||||
|
||||
echo '<form id="installform" method="post" action="langimport.php?mode=2">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
|
||||
if ($remote) {
|
||||
echo '<select name="pack" id="pack" size="15">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
if (trim($alang[0]) != "en_utf8") {
|
||||
if ($remote){
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
|
||||
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
|
||||
}
|
||||
} else { //print list in local format, and instruction to install
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<br />';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
}
|
||||
|
||||
//close available langs table
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
|
||||
break;
|
||||
|
||||
} //close of main switch
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$installedlangs = get_list_of_languages(true, true);
|
||||
|
||||
$missingparents = array();
|
||||
$oldlang = isset($SESSION->lang) ? $SESSION->lang : null; // override current lang
|
||||
|
||||
foreach($installedlangs as $l=>$unused) {
|
||||
$SESSION->lang = $l;
|
||||
$parent = get_string('parentlanguage');
|
||||
if ($parent == 'en_utf8') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($parent, '[[') !== false) {
|
||||
continue; // no parent
|
||||
}
|
||||
if (!isset($installedlangs[$parent])) {
|
||||
$missingparents[$l] = $parent;
|
||||
}
|
||||
}
|
||||
if (isset($oldlang)) {
|
||||
$SESSION->lang = $oldlang;
|
||||
} else {
|
||||
unset($SESSION->lang);
|
||||
}
|
||||
|
||||
if ($availablelangs = get_remote_list_of_languages()) {
|
||||
$remote = 1;
|
||||
} else {
|
||||
$remote = 0; //flag for reading from remote or local
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
|
||||
if (!$remote) {
|
||||
print_box_start();
|
||||
print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
if ($notice_ok) {
|
||||
$info = implode('<br />', $notice_ok);
|
||||
notify($info, 'notifysuccess');
|
||||
}
|
||||
|
||||
if ($notice_error) {
|
||||
$info = implode('<br />', $notice_error);
|
||||
notify($info, 'notifyproblem');
|
||||
}
|
||||
|
||||
if ($missingparents) {
|
||||
foreach ($missingparents as $l=>$parent) {
|
||||
$a = new object();
|
||||
$a->lang = $installedlangs[$l];
|
||||
$a->parent = $parent;
|
||||
foreach ($availablelangs as $alang) {
|
||||
if ($alang[0] == $parent) {
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
$a->parent = $alang[2].' ('.$shortlang.')';
|
||||
}
|
||||
}
|
||||
$info = get_string('missinglangparent', 'admin', $a);
|
||||
notify($info, 'notifyproblem');
|
||||
}
|
||||
}
|
||||
|
||||
print_box_start();
|
||||
echo '<table summary="">';
|
||||
echo '<tr><td align="center" valign="top">';
|
||||
echo '<form id="uninstallform" action="langimport.php?mode='.DELETION_OF_SELECTED_LANG.'" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
|
||||
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
|
||||
foreach ($installedlangs as $clang =>$ilang){
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($remote) {
|
||||
echo '<form id="updateform" action="langimport.php?mode='.UPDATE_ALL_LANG.'" method="post">';
|
||||
echo '<div>';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
echo '</td><td align="center" valign="top">';
|
||||
//availabe langs table
|
||||
$empty = 1; //something to pring
|
||||
|
||||
/// if this language pack is not already installed, then we allow installation
|
||||
|
||||
echo '<form id="installform" method="post" action="langimport.php?mode='.INSTALLATION_OF_SELECTED_LANG.'">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
|
||||
if ($remote) {
|
||||
echo '<select name="pack[]" id="pack" size="15" multiple="multiple">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
if ($alang[0] == '') {
|
||||
continue;
|
||||
}
|
||||
if (trim($alang[0]) != "en_utf8") {
|
||||
if ($remote) {
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
|
||||
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
|
||||
}
|
||||
} else { //print list in local format, and instruction to install
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<br />';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
}
|
||||
|
||||
//close available langs table
|
||||
echo '</td></tr></table>';
|
||||
print_box_end();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
/**
|
||||
* Returns a list of available language packs from a
|
||||
/* returns a list of available language packs from a
|
||||
* local copy shipped with standard moodle distro
|
||||
* this is for site that can't download components.
|
||||
* this is for site that can't perform fopen
|
||||
* @return array
|
||||
*/
|
||||
function get_local_list_of_languages() {
|
||||
global $CFG;
|
||||
$source = $CFG->dirroot.'/lib/languages.md5';
|
||||
$source = $CFG->wwwroot.'/lib/languages.md5';
|
||||
$availablelangs = array();
|
||||
if ($fp = fopen($source, 'r')) {
|
||||
if ($fp = fopen($source, 'r')){
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
@@ -398,8 +345,7 @@
|
||||
return $availablelangs;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
/* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
* against the md5 of the local language file from last update
|
||||
* @param string $lang
|
||||
* @param string $md5check
|
||||
@@ -414,26 +360,40 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest list of available language packs from
|
||||
* moodle.org
|
||||
* @return array or false if can not download
|
||||
*/
|
||||
function get_remote_list_of_languages() {
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$availablelangs = array();
|
||||
//returns an array of languages, or false if can not read from source
|
||||
//uses a socket if proxy is set as a config variable
|
||||
function proxy_url($url) {
|
||||
global $CFG;
|
||||
|
||||
if ($content = download_file_content($source)) {
|
||||
$alllines = split("\n", $content);
|
||||
foreach($alllines as $line) {
|
||||
if (!empty($line)){
|
||||
$availablelangs[] = split(',', $line);
|
||||
if ($CFG->proxyhost && $CFG->proxyport) {
|
||||
|
||||
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
|
||||
if (!$proxy_fp) {
|
||||
return false; //failed
|
||||
}
|
||||
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
|
||||
|
||||
$headers_done = false;
|
||||
while(!feof($proxy_fp)) {
|
||||
$string = fgets($proxy_fp, 1024);
|
||||
if(!$headers_done){
|
||||
// A new line indicates end of HTTP headers
|
||||
$headers_done = ("\r\n" == $string);
|
||||
} else {
|
||||
$availablelangs[] = split(',', $string);
|
||||
}
|
||||
}
|
||||
return $availablelangs;
|
||||
fclose($proxy_fp);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
} else { //proxy not in use
|
||||
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
} else { /// fopen failed, return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $availablelangs;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/*
|
||||
* Utility to debug mailouts - will save the content of emails to a
|
||||
* logfile instead of sending them out. Use it as a sendmail
|
||||
* "stand-in" when testing mailouts.
|
||||
*
|
||||
* It is not Moodle specific - use it anywhere by setting the php
|
||||
* "sendmail_path" setting to this file with a logfile parameter.
|
||||
*
|
||||
* - Set in php.ini (not settable in config.php):
|
||||
* sendmail_path=/path-to-moodle/admin/mailout-debugger.php');
|
||||
* Or from the commandline
|
||||
* php -d sendmail_path='/path-to-moodle/admin/mailout-debugger.php' /path/to/cron.php
|
||||
*
|
||||
* - Create a file in admin called mailout-debugger.enable
|
||||
* (this is a security check to prevent execution in prod environments)
|
||||
* touch /path/to/moodle/admin/mailout-debugger.enable
|
||||
*
|
||||
* - Mark as executable: chmod ugo+rx mailout-debugger.php
|
||||
*
|
||||
* - Run your admin/cron.php
|
||||
*
|
||||
* - Read /tmp/moodle-mailout.log
|
||||
*
|
||||
*
|
||||
* This script will create logfiles in /tmp/ or in $TMPDIR if set.
|
||||
* On windows, use php -r 'print sys_get_temp_dir()' to see where the file is saved.
|
||||
*/
|
||||
|
||||
// Security check.
|
||||
if (!file_exists(dirname(__FILE__).'/mailout-debugger.enable')) {
|
||||
mdie("Disabled.");
|
||||
}
|
||||
$tmpdir=sys_get_temp_dir(); // default
|
||||
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
mdie("should not be called from web server!");
|
||||
}
|
||||
|
||||
if (isset($_ENV['TMPDIR']) && is_dir($_ENV['TMPDIR'])) {
|
||||
$tmpdir = $_ENV['TMPDIR'];
|
||||
}
|
||||
|
||||
$tmpfile = $tmpdir . '/moodle-mailout.log';
|
||||
$fh = fopen($tmpfile, 'a+', false)
|
||||
or mdie("Error openning $tmpfile on append\n");
|
||||
fwrite($fh, "==== ".strftime("%a %b %e %H:%M:%S %Y", time())." ====\n");
|
||||
fwrite($fh, "==== Commandline: " . implode(' ',$argv) . "\n");
|
||||
|
||||
$stdin = fopen('php://stdin', 'r');
|
||||
|
||||
while ($line = fgets($stdin)) {
|
||||
fwrite($fh, $line);
|
||||
}
|
||||
fwrite($fh, "\n");
|
||||
fclose($fh);
|
||||
fclose($stdin);
|
||||
|
||||
/**
|
||||
* Print an error to STDOUT and exit with a non-zero code. For commandline scripts.
|
||||
* Default errorcode is 1.
|
||||
*
|
||||
* Very useful for perl-like error-handling:
|
||||
*
|
||||
* do_somethting() or mdie("Something went wrong");
|
||||
*
|
||||
* @param string $msg Error message
|
||||
* @param integer $errorcode Error code to emit
|
||||
*
|
||||
*/
|
||||
function mdie($msg='', $errorcode=1) {
|
||||
trigger_error($msg);
|
||||
exit($errorcode);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('maintenancemode');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('maintenancemode', $adminroot);
|
||||
|
||||
//Check folder exists
|
||||
if (! make_upload_directory(SITEID)) { // Site folder
|
||||
@@ -31,7 +32,7 @@
|
||||
|
||||
/// Print the header stuff
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
/// Print the appropriate form
|
||||
|
||||
@@ -65,5 +66,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -13,13 +13,15 @@ $perpage = optional_param('perpage', 30, PARAM_INT);
|
||||
$action = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_setup('ssoaccesscontrol');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_setup('ssoaccesscontrol', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@@ -39,13 +41,13 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
|
||||
// boot if insufficient permission
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
print_error('nomodifyacl','mnet');
|
||||
error(get_string('nomodifyacl','mnet'));
|
||||
}
|
||||
|
||||
// fetch the record in question
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
|
||||
print_error('recordnoexists','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
error(get_string('recordnoexists','mnet'), '/admin/mnet/access_control.php');
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@@ -60,7 +62,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
// require the access parameter, and it must be 'allow' or 'deny'
|
||||
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
|
||||
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
|
||||
print_error('invalidaccessparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
error(get_string('invalidaccessparam', 'mnet') , '/admin/mnet/access_control.php');
|
||||
}
|
||||
|
||||
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
|
||||
@@ -73,7 +75,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
break;
|
||||
|
||||
default:
|
||||
print_error('invalidactionparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
print_error('invalidactionparam', 'mnet', '/admin/mnet/access_control.php');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// check permissions and verify form input
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
print_error('nomodifyacl','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
error(get_string('nomodifyacl','mnet'), '/admin/mnet/access_control.php');
|
||||
}
|
||||
if (empty($form->username)) {
|
||||
$formerror['username'] = get_string('enterausername','mnet');
|
||||
@@ -232,6 +234,6 @@ foreach ($formerror as $error) {
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -72,7 +72,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
if (!file_exists($filename)) return false;
|
||||
|
||||
if (extension_loaded('tokenizer')) {
|
||||
include_once "$CFG->dirroot/$CFG->admin/mnet/MethodTable.php";
|
||||
include_once $CFG->dirroot.'/admin/mnet/MethodTable.php';
|
||||
$functions = (array)MethodTable::create($filename,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => "$CFG->wwwroot/$CFG->admin/mnet/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string('deletehost', 'mnet'), 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$site->shortname: $strmnetsettings", "$site->fullname", $navigation);
|
||||
print_header("$site->shortname: $strmnetsettings", "$site->fullname",
|
||||
'<a href="'.$CFG->wwwroot.'/admin/index.php">'.$stradministration.'</a> -> '.
|
||||
'<a href="'.$CFG->wwwroot.'/admin/mnet/index.php">'.get_string('mnetsettings', 'mnet').'</a> -> Delete host');
|
||||
|
||||
print_heading(get_string('mnetsettings', 'mnet'));
|
||||
?>
|
||||
@@ -49,7 +46,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</center>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
admin_externalpage_setup('mnetenrol');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
@@ -243,6 +244,7 @@
|
||||
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
|
||||
/// Get some language strings
|
||||
|
||||
$strassignusers = get_string('assignusers', 'role');
|
||||
$strpotentialusers = get_string('potentialusers', 'role');
|
||||
$strexistingusers = get_string('existingusers', 'role');
|
||||
$straction = get_string('assignroles', 'role');
|
||||
@@ -253,7 +255,7 @@ $strshowall = get_string('showall');
|
||||
$strparticipants = get_string('participants');
|
||||
$strsearchresults = get_string('searchresults');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box('<strong>' . s($mnet_peer->name) . ' : '
|
||||
. format_string($course->shortname) .' '. format_string($course->fullname)
|
||||
@@ -274,6 +276,6 @@ if (!empty($errors)) {
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_setup('mnetenrol');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
@@ -23,7 +24,7 @@
|
||||
|
||||
/// Print the page
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box('<strong>' . s($host->name) . ' </strong><br />'
|
||||
. get_string("enrolcourses_desc", "mnet"));
|
||||
@@ -37,7 +38,7 @@
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$link = "$CFG->wwwroot/$CFG->admin/mnet/enr_course_enrol.php?"
|
||||
$link = $CFG->wwwroot . '/admin/mnet/enr_course_enrol.php?'
|
||||
. "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}";
|
||||
echo '<tr>'
|
||||
. "<td>$icon</td>"
|
||||
@@ -52,6 +53,6 @@
|
||||
}
|
||||
echo '</table></div>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
require_once(dirname(__FILE__) . "/../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('mnetenrol');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
|
||||
@@ -17,7 +18,7 @@
|
||||
|
||||
/// get language strings
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box(get_string("remoteenrolhosts_desc", "mnet"));
|
||||
|
||||
@@ -37,7 +38,7 @@
|
||||
. '</tr>';
|
||||
$hosts = $enrolment->list_remote_servers();
|
||||
foreach ($hosts as $host) {
|
||||
$coursesurl = "$CFG->wwwroot/$CFG->admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
|
||||
if (empty($coursecount)) {
|
||||
$coursecount = '?';
|
||||
@@ -49,13 +50,13 @@
|
||||
. "<td align=\"center\" >$enrolcount</td>"
|
||||
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
|
||||
// TODO: teach report/log/index.php to show per-host-logs
|
||||
// . '<td align="center" ><a href="$CFG->wwwroot/$CFG->admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . '<td align="center" ><a href="{$CFG->wwwroot}/admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . get_string('logs', 'mnet').'</a> </td>'
|
||||
. '</tr>';
|
||||
}
|
||||
echo '</table>'
|
||||
. '</div>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('net');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('net', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
@@ -15,19 +16,19 @@
|
||||
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
}
|
||||
@@ -89,7 +90,7 @@
|
||||
}
|
||||
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
?>
|
||||
<center>
|
||||
<form method="post" action="index.php">
|
||||
@@ -147,5 +148,5 @@
|
||||
</center>
|
||||
|
||||
<?php
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -5,15 +5,12 @@ $logurl = $CFG->wwwroot.
|
||||
'&date=0'.
|
||||
'&modid=&modaction=0&logformat=showashtml';
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
|
||||
if ($mnet_peer->application->name == 'moodle') {
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
}
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
} else {
|
||||
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
|
||||
}
|
||||
@@ -27,8 +24,6 @@ print_simple_box_start("center", "");
|
||||
<input type="hidden" name="step" value="commit" />
|
||||
<input type="hidden" name="last_connect_time" value="<?php echo $mnet_peer->last_connect_time; ?>" />
|
||||
<input type="hidden" name="id" value="<?php echo isset($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
|
||||
<input type="hidden" name="applicationid" value="<?php echo isset($mnet_peer->applicationid)? $mnet_peer->applicationid : '0' ; ?>" />
|
||||
<input type="hidden" name="applicationname" value="<?php echo isset($mnet_peer->application->name)? $mnet_peer->application->name : '' ; ?>" />
|
||||
<table cellpadding="9" cellspacing="0" width="635">
|
||||
|
||||
<tr>
|
||||
@@ -53,7 +48,7 @@ if (empty($mnet_peer->public_key)) $mnet_peer->public_key = '';
|
||||
|
||||
|
||||
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0) {
|
||||
$key = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application->xmlrpc_server_url);
|
||||
$key = mnet_get_public_key($mnet_peer->wwwroot);
|
||||
$mnet_peer->public_key = clean_param($key, PARAM_PEM);
|
||||
}
|
||||
?>
|
||||
@@ -136,5 +131,5 @@ if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
|
||||
print_tabs(array($tabs), 'mnetdetails');
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
@@ -19,5 +18,5 @@ print_simple_box_start("center", "");
|
||||
</table>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$logurl = $CFG->wwwroot.
|
||||
'/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
|
||||
@@ -9,10 +9,7 @@ $logurl = $CFG->wwwroot.
|
||||
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
|
||||
if ($mnet_peer->id != $CFG->mnet_all_hosts_id && $mnet_peer->application->name == 'moodle') {
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
}
|
||||
if ($mnet_peer->id != $CFG->mnet_all_hosts_id) $tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
print_tabs(array($tabs), 'mnetservices');
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
@@ -99,5 +96,5 @@ print_simple_box_start("center", "");
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('mnetpeers');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetpeers', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
@@ -33,7 +34,6 @@
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strmnetsettings = get_string('mnetsettings', 'mnet');
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetthemes = get_string('mnetthemes', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
$strmneteditservices = get_string('reviewhostservices', 'mnet');
|
||||
@@ -48,14 +48,7 @@
|
||||
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
|
||||
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
|
||||
|
||||
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)) {
|
||||
if (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
$host2service = new stdClass();
|
||||
$host2service->hostid = $_POST['hostid'];
|
||||
$host2service->serviceid = $key;
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
admin_externalpage_print_header();
|
||||
print_heading(get_string('themes'));
|
||||
$original_theme = fullclone($THEME);
|
||||
|
||||
$logurl = $CFG->wwwroot.
|
||||
'/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
|
||||
'%2F1&user='.'0'.
|
||||
'&date=0'.
|
||||
'&modid=&modaction=0&logformat=showashtml';
|
||||
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
|
||||
if ($mnet_peer->id != $CFG->mnet_all_hosts_id) {
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
}
|
||||
print_tabs(array($tabs), 'mnetthemes');
|
||||
|
||||
$themes = get_list_of_plugins("theme");
|
||||
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
|
||||
echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">";
|
||||
|
||||
if (count($report)) {
|
||||
echo '<tr>';
|
||||
echo '<td align="center" colspan="2">';
|
||||
echo '<span class="'.$report[1].'">'.$report[0].'</span>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
if (!$USER->screenreader) {
|
||||
echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
|
||||
echo "<th scope=\"col\">$strinfo</th></tr>";
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
echo '<td align="center"><span class="informationbox">Choose this option to use your site\'s default theme: <strong>'.$CFG->theme.'</strong>.</span></td>';
|
||||
if ($mnet_peer->theme == '') {
|
||||
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
|
||||
} else {
|
||||
echo '<td valign="top">';
|
||||
}
|
||||
echo '<p style="font-size:1.5em;font-style:bold;">Site Theme</p>';
|
||||
$options = null;
|
||||
$options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ';
|
||||
$options['sesskey'] = $sesskey;
|
||||
$options['hostid'] = $mnet_peer->id;
|
||||
print_single_button('mnet_themes.php', $options, $strchoose);
|
||||
echo '</td>';
|
||||
echo "</tr>";
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
|
||||
unset($THEME);
|
||||
|
||||
if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder
|
||||
continue;
|
||||
}
|
||||
|
||||
include($CFG->themedir.'/'.$theme.'/config.php');
|
||||
|
||||
$readme = '';
|
||||
$screenshot = '';
|
||||
$screenshotpath = '';
|
||||
|
||||
if (file_exists($CFG->themedir.'/'.$theme.'/README.html')) {
|
||||
$readme = '<li>'.
|
||||
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
|
||||
} else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
|
||||
$readme = '<li>'.
|
||||
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
|
||||
}
|
||||
if (file_exists("$theme/screenshot.png")) {
|
||||
$screenshotpath = "$theme/screenshot.png";
|
||||
} else if (file_exists("$theme/screenshot.jpg")) {
|
||||
$screenshotpath = "$theme/screenshot.jpg";
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
|
||||
// no point showing this if user is using screen reader
|
||||
if (!$USER->screenreader) {
|
||||
echo "<td align=\"center\">";
|
||||
if ($screenshotpath) {
|
||||
$screenshot = '<li><a href='.$CFG->wwwroot .'/theme/'. $theme.'/screenshot.jpg">'.$strscreenshot.'</a></li>';
|
||||
echo "<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object></td>";
|
||||
} else {
|
||||
echo '<object type="text/html" data="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'" height="200" width="400">'.$theme.'</object></td>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($mnet_peer->theme == $theme) {
|
||||
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
|
||||
} else {
|
||||
echo '<td valign="top">';
|
||||
}
|
||||
|
||||
if (isset($THEME->sheets)) {
|
||||
echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
|
||||
} else {
|
||||
echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
|
||||
}
|
||||
|
||||
if ($screenshot or $readme) {
|
||||
echo '<ul>';
|
||||
if (!$USER->screenreader) {
|
||||
echo '<li><a href="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'">'.$strpreview.'</a></li>';
|
||||
}
|
||||
echo $screenshot.$readme;
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
$options = null;
|
||||
$options['choose'] = $theme;
|
||||
$options['sesskey'] = $sesskey;
|
||||
$options['hostid'] = $mnet_peer->id;
|
||||
print_single_button('mnet_themes.php', $options, $strchoose);
|
||||
echo '</td>';
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$THEME = $original_theme;
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
// Allows the admin to configure services for remote hosts
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
require_login();
|
||||
admin_externalpage_setup('mnetpeers');
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
|
||||
$hostid = required_param('hostid', PARAM_INT);
|
||||
|
||||
$stradministration = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
$strmnetsettings = get_string('mnetsettings', 'mnet');
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetthemes = get_string('mnetthemes', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
|
||||
|
||||
$mnet_peer = new mnet_peer();
|
||||
if (is_int($hostid)) {
|
||||
$mnet_peer->set_id($hostid);
|
||||
}
|
||||
|
||||
$choose = optional_param("choose",'',PARAM_FILE); // set this theme as default
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strthemes = get_string("themes");
|
||||
$strpreview = get_string("preview");
|
||||
$strchoose = get_string("choose");
|
||||
$strinfo = get_string("info");
|
||||
$strtheme = get_string("theme");
|
||||
$strthemesaved = get_string("themesaved");
|
||||
$strscreenshot = get_string("screenshot");
|
||||
$stroldtheme = get_string("oldtheme");
|
||||
$report = array();
|
||||
$unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
|
||||
|
||||
if ($choose) {
|
||||
if (confirm_sesskey()) {
|
||||
if ($choose == $unlikely_name) {
|
||||
$mnet_peer->force_theme = 1;
|
||||
$mnet_peer->updateparams->force_theme = 1;
|
||||
$mnet_peer->theme = '';
|
||||
$mnet_peer->updateparams->theme = '';
|
||||
if ($mnet_peer->commit()) {
|
||||
$report = array(get_string('themesaved'), 'informationbox');
|
||||
} else {
|
||||
$report = array(get_string('themesavederror', 'mnet'), 'errorbox');
|
||||
}
|
||||
} elseif (!is_dir($CFG->themedir .'/'. $choose) || !file_exists($CFG->themedir .'/'. $choose .'/config.php')) {
|
||||
echo 'CHOOSE -'.$choose.' '. $CFG->themedir .'/'. $choose .'/config.php' ;
|
||||
$report = array('This theme is not installed!'.'3', 'errorbox');
|
||||
} else {
|
||||
$mnet_peer->force_theme = 1;
|
||||
$mnet_peer->theme = $choose;
|
||||
$mnet_peer->updateparams->theme = addslashes($choose);
|
||||
if ($mnet_peer->commit()) {
|
||||
$report = array(get_string('themesaved').'1', 'informationbox');
|
||||
} else {
|
||||
$report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
require('./mnet_themes.html');
|
||||
?>
|
||||
+4
-12
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
|
||||
print_box(get_string('mnetdisabled','mnet'));
|
||||
@@ -76,17 +76,9 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0">wwwroot:</td>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2">
|
||||
<select name="applicationid">
|
||||
<?php
|
||||
foreach($applications as $application) {
|
||||
echo ' <option value="'.$application->id.'">'.$application->display_name."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -97,5 +89,5 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
+18
-51
@@ -7,25 +7,26 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('mnetpeers');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetpeers', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nosite', '');
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nocurl', 'mnet');
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
@@ -40,7 +41,6 @@ $hostid = optional_param('hostid', NULL, PARAM_INT);
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
$strmnetthemes = get_string('mnetthemes', 'mnet');
|
||||
|
||||
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
|
||||
|
||||
@@ -50,16 +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')) {
|
||||
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
|
||||
print_error('xmlrpc-missing', 'mnet','peers.php');
|
||||
error(get_string('xmlrpc-missing', 'mnet'),'peers.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -82,43 +77,38 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$temp_wwwroot = clean_param($form->wwwroot, PARAM_URL);
|
||||
if ($temp_wwwroot !== $form->wwwroot) {
|
||||
trigger_error("We now parse the wwwroot with PARAM_URL. Your URL will need to have a valid TLD, etc.");
|
||||
print_error("invalidurl", 'mnet','peers.php');
|
||||
error(get_string("invalidurl", 'mnet'),'peers.php');
|
||||
exit;
|
||||
}
|
||||
unset($temp_wwwroot);
|
||||
$mnet_peer->set_applicationid($form->applicationid);
|
||||
$application = get_field('mnet_application', 'name', 'id', $form->applicationid);
|
||||
$mnet_peer->bootstrap($form->wwwroot, null, $application);
|
||||
$mnet_peer->bootstrap($form->wwwroot);
|
||||
}
|
||||
|
||||
|
||||
if (isset($form->name) && $form->name != $mnet_peer->name) {
|
||||
$form->name = clean_param($form->name, PARAM_NOTAGS);
|
||||
$mnet_peer->set_name($form->name);
|
||||
}
|
||||
|
||||
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
|
||||
$mnet_peer->updateparams->deleted = $form->deleted;
|
||||
$mnet_peer->deleted = $form->deleted;
|
||||
}
|
||||
|
||||
if (isset($form->public_key)) {
|
||||
$form->public_key = clean_param($form->public_key, PARAM_PEM);
|
||||
if (empty($form->public_key)) {
|
||||
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
exit;
|
||||
} else {
|
||||
$oldkey = $mnet_peer->public_key;
|
||||
$mnet_peer->public_key = $form->public_key;
|
||||
$mnet_peer->updateparams->public_key = addslashes($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);
|
||||
$mnet_peer->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 />';
|
||||
}
|
||||
error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
//print_error("invalidpubkey", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id, $errmsg);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +117,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
|
||||
if ('input' == $form->step) {
|
||||
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
|
||||
print_error("hostexists", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id, $mnet_peer->id);
|
||||
error(get_string("hostexists", 'mnet', $mnet_peer->id),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +135,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
} elseif (is_int($hostid)) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
|
||||
$currentkey = mnet_get_public_key($mnet_peer->wwwroot);
|
||||
if($currentkey == $mnet_peer->public_key) unset($currentkey);
|
||||
$form = new stdClass();
|
||||
if ($hostid != $CFG->mnet_all_hosts_id) {
|
||||
@@ -154,31 +144,8 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
include('./mnet_review_allhosts.html');
|
||||
}
|
||||
} else {
|
||||
$hosts = get_records_sql(' SELECT
|
||||
h.id,
|
||||
h.wwwroot,
|
||||
h.ip_address,
|
||||
h.name,
|
||||
h.public_key,
|
||||
h.public_key_expires,
|
||||
h.transport,
|
||||
h.portno,
|
||||
h.last_connect_time,
|
||||
h.last_log_id,
|
||||
h.applicationid,
|
||||
a.name as app_name,
|
||||
a.display_name as app_display_name,
|
||||
a.xmlrpc_server_url
|
||||
FROM
|
||||
'.$CFG->prefix.'mnet_host h,
|
||||
'.$CFG->prefix.'mnet_application a
|
||||
WHERE
|
||||
h.id != \''.$CFG->mnet_localhost_id.'\' AND
|
||||
h.deleted = \'0\' AND
|
||||
h.applicationid=a.id');
|
||||
|
||||
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
|
||||
if (empty($hosts)) $hosts = array();
|
||||
$applications = get_records('mnet_application');
|
||||
include('./peers.html');
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
?>
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
@@ -64,5 +64,5 @@ admin_externalpage_print_header();
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -6,19 +6,20 @@
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('trustedhosts');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('trustedhosts', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
|
||||
+7
-9
@@ -3,6 +3,8 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('managemodules', $adminroot);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
@@ -10,12 +12,11 @@
|
||||
$module = optional_param('module', '', PARAM_SAFEDIR);
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
admin_externalpage_setup('modsetting'.$module);
|
||||
require_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.
|
||||
@@ -27,8 +28,6 @@
|
||||
$moduleconfig($config);
|
||||
}
|
||||
} else {
|
||||
admin_externalpage_setup('managemodules');
|
||||
|
||||
$moduleprefix = '';
|
||||
}
|
||||
|
||||
@@ -44,8 +43,7 @@
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
admin_externalpage_setup('modsetting'.$module);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
@@ -53,7 +51,7 @@
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'mod/' . $module . '/config';
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
@@ -64,6 +62,6 @@
|
||||
include("$CFG->dirroot/mod/$module/config.html");
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+31
-60
@@ -5,12 +5,12 @@
|
||||
require_once('../course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
require_once($CFG->libdir.'/ddllib.php');
|
||||
|
||||
// defines
|
||||
define('MODULE_TABLE','module_administration_table');
|
||||
|
||||
admin_externalpage_setup('managemodules');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('managemodules', $adminroot);
|
||||
|
||||
$show = optional_param('show', '', PARAM_SAFEDIR);
|
||||
$hide = optional_param('hide', '', PARAM_SAFEDIR);
|
||||
@@ -30,6 +30,10 @@
|
||||
$stractivitymodule = get_string("activitymodule");
|
||||
$strshowmodulecourse = get_string('showmodulecourse');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading($stractivities);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
@@ -48,11 +52,10 @@
|
||||
// where we just deleted something
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visibleold=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
@@ -60,22 +63,19 @@
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold',
|
||||
set_field('course_modules', 'visible', '1', 'visibleold',
|
||||
'1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
// clear the course modinfo cache for courses
|
||||
// where we just made something visible
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visible=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
print_heading($stractivities);
|
||||
|
||||
$strmodulename = get_string("modulename", "$delete");
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
|
||||
"modules.php?delete=$delete&confirm=1&sesskey=$USER->sesskey",
|
||||
"modules.php");
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
} else { // Delete everything!!
|
||||
@@ -105,17 +105,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// delete calendar events
|
||||
if (!delete_records("event", "modulename", $delete)) {
|
||||
notify("Error occurred while deleting all $strmodulename records in calendar event table");
|
||||
}
|
||||
|
||||
// clear course.modinfo for courses
|
||||
// that used this module...
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
|
||||
@@ -139,34 +134,20 @@
|
||||
notify("Error occurred while deleting the $strmodulename record from modules table");
|
||||
}
|
||||
|
||||
// And the module configuration records
|
||||
if (!execute_sql("DELETE FROM {$CFG->prefix}config WHERE name LIKE '{$module->name}_%'")) {
|
||||
notify("Error occurred while deleting the $strmodulename records from the config table");
|
||||
}
|
||||
|
||||
// cleanup the gradebook
|
||||
require_once($CFG->libdir.'/gradelib.php');
|
||||
grade_uninstalled_module($module->name);
|
||||
|
||||
// Then the tables themselves
|
||||
drop_plugin_tables($module->name, "$CFG->dirroot/mod/$module->name/db/install.xml", false);
|
||||
|
||||
// Delete the capabilities that were defined by this module
|
||||
capabilities_cleanup('mod/'.$module->name);
|
||||
|
||||
// remove entent handlers and dequeue pending events
|
||||
events_uninstall('mod/'.$module->name);
|
||||
|
||||
// Perform any custom uninstall tasks
|
||||
if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
|
||||
require_once($CFG->dirroot . '/mod/' . $module->name . '/lib.php');
|
||||
$uninstallfunction = $module->name . '_uninstall';
|
||||
if (function_exists($uninstallfunction)) {
|
||||
if (! $uninstallfunction() ) {
|
||||
notify('Encountered a problem running uninstall function for '. $module->name.'!');
|
||||
if ($tables = $db->Metatables()) {
|
||||
$prefix = $CFG->prefix.$module->name;
|
||||
foreach ($tables as $table) {
|
||||
if (strpos($table, $prefix) === 0) {
|
||||
if (!execute_sql("DROP TABLE $table", false)) {
|
||||
notify("ERROR: while trying to drop table $table");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Delete the capabilities that were defined by this module
|
||||
capabilities_cleanup('mod/'.$module->name);
|
||||
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
@@ -174,9 +155,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading($stractivities);
|
||||
|
||||
/// Get and sort the existing modules
|
||||
|
||||
if (!$modules = get_records("modules")) {
|
||||
@@ -191,7 +169,7 @@
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname, SORT_LOCALE_STRING);
|
||||
ksort($modulebyname);
|
||||
|
||||
/// Print the table of all modules
|
||||
// construct the flexible table ready to display
|
||||
@@ -210,9 +188,7 @@
|
||||
|
||||
$delete = "<a href=\"modules.php?delete=$module->name&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
|
||||
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php")) {
|
||||
$settings = "<a href=\"settings.php?section=modsetting$module->name\">$strsettings</a>";
|
||||
} else if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
|
||||
if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
|
||||
$settings = "<a href=\"module.php?module=$module->name\">$strsettings</a>";
|
||||
} else {
|
||||
$settings = "";
|
||||
@@ -242,23 +218,18 @@
|
||||
$class = "";
|
||||
}
|
||||
|
||||
$extra = '';
|
||||
if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) {
|
||||
$extra = ' <span class="notifyproblem">('.get_string('missingfromdisk').')</span>';
|
||||
}
|
||||
|
||||
$table->add_data(array(
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.$extra.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
$settings
|
||||
));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -4,13 +4,17 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('multilangupgrade');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('multilangupgrade', $adminroot);
|
||||
|
||||
$go = optional_param('go', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
###################################################################
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading(get_string('multilangupgrade', 'admin'));
|
||||
|
||||
@@ -19,7 +23,7 @@ $strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
|
||||
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
|
||||
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
|
||||
notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -56,7 +60,7 @@ foreach ($tables as $table) {
|
||||
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
|
||||
// first find candidate records
|
||||
$rs = get_recordset_sql("SELECT id, $column FROM $table WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'");
|
||||
if ($rs) {
|
||||
if ($rs and $rs->RecordCount() > 0) {
|
||||
while (!$rs->EOF) {
|
||||
$text = $rs->fields[$column];
|
||||
$id = $rs->fields['id'];
|
||||
@@ -86,7 +90,6 @@ foreach ($tables as $table) {
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +108,7 @@ notify('...finished', 'notifysuccess');
|
||||
|
||||
print_continue('index.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
|
||||
|
||||
|
||||
+7
-3
@@ -4,12 +4,16 @@ if (!isset($CFG)) {
|
||||
|
||||
require('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('oacleanup', $adminroot);
|
||||
|
||||
admin_externalpage_setup('oacleanup');
|
||||
require_login();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
online_assignment_cleanup(true);
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+33
-27
@@ -15,57 +15,68 @@ define('BLOCK_L_MIN_WIDTH', $lmin);
|
||||
define('BLOCK_L_MAX_WIDTH', $lmax);
|
||||
define('BLOCK_R_MIN_WIDTH', $rmin);
|
||||
define('BLOCK_R_MAX_WIDTH', $rmax);
|
||||
|
||||
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
class page_admin extends page_base {
|
||||
|
||||
var $section;
|
||||
var $pathtosection;
|
||||
var $visiblepathtosection;
|
||||
|
||||
// hack alert!
|
||||
// this function works around the inability to store the section name
|
||||
// in default block, maybe we should "improve" the blocks a bit?
|
||||
function init_extra($section) {
|
||||
function init_extra($section) {
|
||||
global $CFG;
|
||||
|
||||
if($this->full_init_done) {
|
||||
return;
|
||||
}
|
||||
|
||||
$adminroot =& admin_get_root(false, false); //settings not required - only pages
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
// fetch the path parameter
|
||||
$this->section = $section;
|
||||
$current =& $adminroot->locate($section, true);
|
||||
$this->visiblepathtosection = array_reverse($current->visiblepath);
|
||||
|
||||
$this->visiblepathtosection = array();
|
||||
|
||||
// this part is (potentially) processor-intensive... there's gotta be a better way
|
||||
// of handling this
|
||||
if ($this->pathtosection = $adminroot->path($this->section)) {
|
||||
foreach($this->pathtosection as $element) {
|
||||
if ($pointer = $adminroot->locate($element)) {
|
||||
array_push($this->visiblepathtosection, $pointer->visiblename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all done
|
||||
$this->full_init_done = true;
|
||||
}
|
||||
|
||||
|
||||
function blocks_get_default() {
|
||||
return 'admin_tree,admin_bookmarks';
|
||||
}
|
||||
|
||||
// seems reasonable that the only people that can edit blocks on the admin pages
|
||||
// are the admins... but maybe we want a role for this?
|
||||
function user_allowed_editing() {
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
function user_allowed_editing() {
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
}
|
||||
|
||||
// has to be fixed. i know there's a "proper" way to do this
|
||||
function user_is_editing() {
|
||||
function user_is_editing() {
|
||||
global $USER;
|
||||
return $USER->adminediting;
|
||||
}
|
||||
|
||||
function url_get_path() {
|
||||
function url_get_path() {
|
||||
global $CFG;
|
||||
|
||||
$adminroot =& admin_get_root(false, false); //settings not required - only pages
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
$root =& $adminroot->locate($this->section);
|
||||
$root = $adminroot->locate($this->section);
|
||||
if (is_a($root, 'admin_externalpage')) {
|
||||
return $root->url;
|
||||
} else {
|
||||
@@ -77,11 +88,11 @@ class page_admin extends page_base {
|
||||
return array('section' => (isset($this->section) ? $this->section : ''));
|
||||
}
|
||||
|
||||
function blocks_get_positions() {
|
||||
function blocks_get_positions() {
|
||||
return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
|
||||
}
|
||||
|
||||
function blocks_default_position() {
|
||||
function blocks_default_position() {
|
||||
return BLOCK_POS_LEFT;
|
||||
}
|
||||
|
||||
@@ -99,29 +110,24 @@ class page_admin extends page_base {
|
||||
parent::init_quick($data);
|
||||
}
|
||||
|
||||
function print_header($section = '', $focus='') {
|
||||
function print_header($section = '') {
|
||||
global $USER, $CFG, $SITE;
|
||||
|
||||
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
|
||||
// if not, print_header() has to be called with a $section parameter
|
||||
|
||||
// The search page currently doesn't handle block editing
|
||||
// The search page currently doesn't handle block editing
|
||||
if ($this->section != 'search' and $this->user_allowed_editing()) {
|
||||
$buttons = '<div><form '.$CFG->frametarget.' method="get" action="' . $this->url_get_path() . '">'.
|
||||
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
'<input type="hidden" name="section" value="'.$this->section.'" />'.
|
||||
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></div>';
|
||||
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
'<input type="hidden" name="section" value="'.$this->section.'" />'.
|
||||
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></div>';
|
||||
} else {
|
||||
$buttons = ' ';
|
||||
}
|
||||
|
||||
$navlinks = array();
|
||||
foreach ($this->visiblepathtosection as $element) {
|
||||
$navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
|
||||
}
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
|
||||
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname,
|
||||
implode(" -> ",$this->visiblepathtosection),'', '', true, $buttons, '');
|
||||
}
|
||||
|
||||
function get_type() {
|
||||
|
||||
+8
-3
@@ -4,9 +4,14 @@
|
||||
require_once("../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('phpinfo');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('phpinfo', $adminroot);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
echo '<div class="phpinfo">';
|
||||
|
||||
@@ -28,6 +33,6 @@
|
||||
|
||||
echo '</div>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($modid == '0') { // special
|
||||
}
|
||||
else {
|
||||
$modname = get_field("modules","name","id",$modid);
|
||||
include_once('mod/'.$modname.'/lib.php');
|
||||
require_once('mod/'.$modname.'/lib.php');
|
||||
}
|
||||
$function = $modname.'_process_email';
|
||||
|
||||
|
||||
+12
-14
@@ -5,14 +5,14 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if (!$admin = get_admin()) {
|
||||
@@ -33,11 +33,9 @@
|
||||
$stradministration = get_string("administration");
|
||||
$strregistration = get_string("registration");
|
||||
$strregistrationinfo = get_string("registrationinfo");
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
|
||||
|
||||
print_header("$site->shortname: $strregistration", $site->fullname,
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
|
||||
|
||||
print_heading($strregistration);
|
||||
|
||||
@@ -65,12 +63,12 @@
|
||||
echo '<div class="fitemtitle"><label>URL</label></div>';
|
||||
echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
|
||||
echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
@@ -105,7 +103,7 @@
|
||||
unset($options);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
@@ -121,7 +119,7 @@
|
||||
echo '<br />';
|
||||
|
||||
// total number of role assignments
|
||||
$count = count_records('role_assignments');
|
||||
$count = count_records('role_assignments');
|
||||
echo get_string('roleassignments', 'role').": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
|
||||
echo '<br />';
|
||||
@@ -129,13 +127,13 @@
|
||||
// first find all distinct roles with mod/course:update
|
||||
// please change the name and strings to something appropriate to reflect the new data collected
|
||||
$sql = "SELECT COUNT(DISTINCT u.id)
|
||||
FROM {$CFG->prefix}role_capabilities rc,
|
||||
FROM {$CFG->prefix}role_capabilities rc,
|
||||
{$CFG->prefix}role_assignments ra,
|
||||
{$CFG->prefix}user u
|
||||
WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
|
||||
AND rc.roleid = ra.roleid
|
||||
AND u.id = ra.userid";
|
||||
|
||||
|
||||
$count = count_records_sql($sql);
|
||||
echo get_string("teachers").": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
|
||||
@@ -156,7 +154,7 @@
|
||||
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
|
||||
+33
-7
@@ -4,14 +4,18 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('replace');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('replace', $adminroot);
|
||||
|
||||
$search = optional_param('search', '', PARAM_RAW);
|
||||
$replace = optional_param('replace', '', PARAM_RAW);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
###################################################################
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading('Search and replace text throughout the whole database');
|
||||
|
||||
@@ -28,14 +32,36 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
if (!$tables = $db->Metatables() ) { // No tables yet at all.
|
||||
error("no tables");
|
||||
}
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
if (!db_replace($search, $replace)) {
|
||||
error('An error has occured during this process');
|
||||
/// Turn off time limits, sometimes upgrades can be slow.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
while(@ob_end_flush());
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if (in_array($table, array($CFG->prefix.'config'))) { // Don't process these
|
||||
continue;
|
||||
}
|
||||
if ($columns = $db->MetaColumns($table, false)) {
|
||||
foreach ($columns as $column => $data) {
|
||||
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
|
||||
$db->debug = true;
|
||||
execute_sql("UPDATE $table SET $column = REPLACE($column, '$search', '$replace');");
|
||||
$db->debug = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
@@ -47,6 +73,6 @@ notify('...finished');
|
||||
|
||||
print_continue('index.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/backup/lib.php');
|
||||
|
||||
admin_externalpage_setup('reportbackups');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_setup('reportbackups', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
/// Scheduled backups are disabled by the server admin
|
||||
if (!empty($CFG->disablescheduledbackups)) {
|
||||
@@ -133,6 +135,6 @@
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -4,20 +4,23 @@
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('reportcourseoverview');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_setup('reportcourseoverview', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM)); // needed?
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed?
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot);
|
||||
}
|
||||
|
||||
|
||||
$course = get_site();
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
@@ -43,11 +46,11 @@
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
if (empty($timeoptions)) {
|
||||
print_error('nostatstodisplay', "", $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id, $adminroot);
|
||||
}
|
||||
|
||||
echo '<form action="index.php" method="post">'."\n";
|
||||
echo '<div>';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
|
||||
$table->width = '*';
|
||||
$table->align = array('left','left','left','left','left','left');
|
||||
@@ -57,19 +60,17 @@
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
print_table($table);
|
||||
echo '</div>';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
print_heading($reportoptions[$report]);
|
||||
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
if (!empty($param->sql)) {
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby;
|
||||
@@ -83,9 +84,9 @@
|
||||
|
||||
} else {
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo '<div class="graph">(' . get_string("gdneed") .')</div>';
|
||||
echo '<div class="boxaligncenter">(' . get_string("gdneed") .')</div>';
|
||||
} else {
|
||||
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
echo '<div class="boxaligncenter"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
}
|
||||
|
||||
$table = new StdClass;
|
||||
@@ -114,6 +115,6 @@
|
||||
print_table($table);
|
||||
}
|
||||
}
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby;
|
||||
@@ -29,7 +29,7 @@
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
print_error('statsnodata', "", $CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
require_once($CFG->dirroot.'/course/report/log/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('reportlog');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_setup('reportlog', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
|
||||
$course = get_site();
|
||||
@@ -26,6 +28,6 @@
|
||||
print_heading($heading, 'center', 3);
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -4,10 +4,11 @@
|
||||
require_once($CFG->dirroot.'/question/upgrade.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('reportquestion');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportquestion', $adminroot);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading(get_string('adminreport', 'question'));
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading(page_doc_link(get_string('adminreport', 'question')));
|
||||
|
||||
$probstr = '';
|
||||
$contextupgradeversion = 2007081000;
|
||||
@@ -25,7 +26,7 @@
|
||||
.$CFG->prefix.'course as c WHERE qc.course = c.id AND qc.id IN ('.$catlist.')');
|
||||
foreach ($updates as $id => $publish){
|
||||
$categories[$id]->caturl = "$CFG->wwwroot/question/category.php?sesskey=".sesskey().
|
||||
"&edit=$id&courseid=".$categories[$id]->course;
|
||||
"&edit=$id&id=".$categories[$id]->course;
|
||||
if ($categories[$id]->publish){
|
||||
$categories[$id]->changefrom = get_string('published', 'question');
|
||||
$categories[$id]->changeto = get_string('unpublished', 'question');
|
||||
@@ -69,5 +70,5 @@
|
||||
} else {
|
||||
print_box(get_string('noprobs', 'question'), 'boxwidthnarrow boxaligncenter generalbox');
|
||||
}
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
* @package SimpleTestEx
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
/** */
|
||||
require_once(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/moodlelib.php');
|
||||
require_once($CFG->libdir . '/simpletestlib/reporter.php');
|
||||
|
||||
/**
|
||||
@@ -147,9 +146,9 @@ class ExHtmlReporter extends HtmlReporter {
|
||||
$summarydata->exceptions = $this->getExceptionCount();
|
||||
|
||||
if ($summarydata->fails == 0 && $summarydata->exceptions == 0) {
|
||||
$status = "passed";
|
||||
$status = "pass";
|
||||
} else {
|
||||
$status = "failed";
|
||||
$status = "fail";
|
||||
}
|
||||
echo '<div class="unittestsummary ', $status, '">';
|
||||
echo $this->get_string('summary', $summarydata);
|
||||
|
||||
@@ -10,10 +10,8 @@
|
||||
* @package SimpleTestEx
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
/** */
|
||||
require_once(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/simpletestlib/test_case.php');
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
*/
|
||||
|
||||
/** */
|
||||
require_once(dirname(__FILE__).'/../../../config.php');
|
||||
require_once(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/moodlelib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/simpletestlib.php');
|
||||
require_once('ex_simple_test.php');
|
||||
require_once('ex_reporter.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
/* The UNITTEST constant can be checked elsewhere if you need to know
|
||||
* when your code is being run as part of a unit test. */
|
||||
@@ -31,9 +31,10 @@ $showsearch = optional_param('showsearch', false, PARAM_BOOL);
|
||||
$thorough = optional_param('thorough', false, PARAM_BOOL);
|
||||
|
||||
// Print the header.
|
||||
admin_externalpage_setup('reportsimpletest');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportsimpletest', $adminroot);
|
||||
$strtitle = get_string('unittests', $langfile);
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (!is_null($path)) {
|
||||
// Create the group of tests.
|
||||
@@ -105,6 +106,6 @@ echo '</form>';
|
||||
print_simple_box_end();
|
||||
|
||||
// Footer.
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('reportstats');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_setup('reportstats', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
|
||||
$courseid = optional_param('course', SITEID, PARAM_INT);
|
||||
@@ -28,7 +30,7 @@
|
||||
}
|
||||
|
||||
if ($mode == STATS_MODE_RANKED) {
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3);
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3, $adminroot);
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
@@ -44,10 +46,10 @@
|
||||
require_login();
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot);
|
||||
}
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
|
||||
|
||||
@@ -70,6 +72,6 @@
|
||||
|
||||
require_once($CFG->dirroot.'/course/report/stats/report.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
* then he can modify the roles_allow_assign table via this interface.
|
||||
*/
|
||||
require_once('../../config.php');
|
||||
/// check capabilities here
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('defineroles');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('defineroles', $adminroot);
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
@@ -45,12 +47,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// updated allowassigns sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
}
|
||||
/// displaying form here
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$currenttab='allowassign';
|
||||
require_once('managetabs.php');
|
||||
@@ -84,7 +84,7 @@
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
* and be in the roles_allow_override table.
|
||||
*/
|
||||
require_once('../../config.php');
|
||||
/// check capabilities here
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('defineroles');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('defineroles', $adminroot);
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
@@ -43,12 +45,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// updated allowoverride sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
}
|
||||
/// displaying form here
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$currenttab='allowoverride';
|
||||
require_once('managetabs.php');
|
||||
@@ -74,7 +74,7 @@
|
||||
$table->data[] = array_merge(array(format_string($role->name)), $beta);
|
||||
}
|
||||
|
||||
print_simple_box(get_string('configallowoverride2', 'admin'), 'center');
|
||||
print_simple_box(get_string('configallowoverride', 'admin'), 'center');
|
||||
|
||||
echo '<form action="allowoverride.php" method="post">';
|
||||
print_table($table);
|
||||
@@ -82,7 +82,7 @@
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
// returns array
|
||||
function get_box_list($roleid, $arraylist){
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<form id="assignform" method="post" action="">
|
||||
<div style="text-align:center;">
|
||||
<label for="extendperiod"><?php print_string('enrolperiod') ?></label> <?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?>
|
||||
<label for="extendbase"><?php print_string('startingfrom') ?></label> <?php choose_from_menu($basemenu, "extendbase", 3, ""); ?>
|
||||
|
||||
<div>
|
||||
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
|
||||
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
|
||||
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
||||
@@ -46,8 +43,9 @@
|
||||
</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 get_string('remove').' '.$THEME->rarrow; ?>" 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 ' '.$THEME->rarrow.' '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
|
||||
</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
@@ -60,7 +58,7 @@
|
||||
<?php
|
||||
$i=0;
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
|
||||
+61
-144
@@ -6,7 +6,6 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
define("MAX_USERS_PER_PAGE", 5000);
|
||||
define("MAX_USERS_TO_LIST_PER_ROLE", 10);
|
||||
|
||||
$contextid = required_param('contextid',PARAM_INT); // context id
|
||||
$roleid = optional_param('roleid', 0, PARAM_INT); // required role id
|
||||
@@ -16,8 +15,8 @@
|
||||
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
|
||||
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
|
||||
$hidden = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
|
||||
$extendperiod = optional_param('extendperiod', 0, PARAM_INT);
|
||||
$extendbase = optional_param('extendbase', 0, PARAM_INT);
|
||||
$timestart = optional_param('timestart', 0, PARAM_INT);
|
||||
$timeend = optional_param('timened', 0, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
|
||||
|
||||
@@ -45,12 +44,10 @@
|
||||
} else {
|
||||
error('Invalid course id');
|
||||
}
|
||||
|
||||
} else if (!empty($courseid)){ // we need this for user tabs in user context
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Invalid course id');
|
||||
}
|
||||
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
$course = clone($SITE);
|
||||
@@ -58,55 +55,37 @@
|
||||
|
||||
require_login($course);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_COURSE) {
|
||||
require_login($context->instanceid);
|
||||
} else {
|
||||
require_login();
|
||||
}
|
||||
|
||||
require_capability('moodle/role:assign', $context);
|
||||
|
||||
/// needed for tabs.php
|
||||
|
||||
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
$strassignusers = get_string('assignusers', 'role');
|
||||
$strpotentialusers = get_string('potentialusers', 'role');
|
||||
$strexistingusers = get_string('existingusers', 'role');
|
||||
$straction = get_string('assignroles', 'role');
|
||||
$strroletoassign = get_string('roletoassign', 'role');
|
||||
$strcurrentcontext = get_string('currentcontext', 'role');
|
||||
$strsearch = get_string('search');
|
||||
$strshowall = get_string('showall');
|
||||
$strparticipants = get_string('participants');
|
||||
$strsearchresults = get_string('searchresults');
|
||||
|
||||
$unlimitedperiod = get_string('unlimited');
|
||||
$defaultperiod = $course->enrolperiod;
|
||||
for ($i=1; $i<=365; $i++) {
|
||||
$seconds = $i * 86400;
|
||||
$periodmenu[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
|
||||
$timeformat = get_string('strftimedate');
|
||||
$today = time();
|
||||
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
|
||||
|
||||
// MDL-12420, preventing course start date showing up as an option at system context and front page roles.
|
||||
if ($course->startdate > 0) {
|
||||
$basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
|
||||
}
|
||||
if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
|
||||
$basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
|
||||
}
|
||||
if($course->enrollable == 2) {
|
||||
if($course->enrolstartdate > 0) {
|
||||
$basemenu[4] = get_string('courseenrolstartdate') . ' (' . userdate($course->enrolstartdate, $timeformat) . ')';
|
||||
}
|
||||
if($course->enrolenddate > 0) {
|
||||
$basemenu[5] = get_string('courseenrolenddate') . ' (' . userdate($course->enrolenddate, $timeformat) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
/// Make sure this user can assign that role
|
||||
|
||||
if ($roleid) {
|
||||
if (!isset($assignableroles[$roleid])) {
|
||||
if (!user_can_assign($context, $roleid)) {
|
||||
error ('you can not override this role in this context');
|
||||
}
|
||||
}
|
||||
@@ -121,49 +100,46 @@
|
||||
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
/// course header
|
||||
$navlinks = array();
|
||||
if ($courseid != SITEID) {
|
||||
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$fullname", "$fullname", $navigation, "", "", true, " ", navmenu($course));
|
||||
print_header("$fullname", "$fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> ->".$straction,
|
||||
"", "", true, " ", navmenu($course));
|
||||
|
||||
/// site header
|
||||
} else {
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, " ", navmenu($course));
|
||||
print_header("$course->fullname: $fullname", $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> -> $straction", "", "", true, " ", navmenu($course));
|
||||
}
|
||||
|
||||
$showroles = 1;
|
||||
$currenttab = 'assign';
|
||||
include_once($CFG->dirroot.'/user/tabs.php');
|
||||
} else if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
admin_externalpage_setup('assignroles');
|
||||
admin_externalpage_print_header();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('assignroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = 'assign';
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('frontpageroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = 'assign';
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Process incoming role assignment
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
|
||||
|
||||
$timemodified = time();
|
||||
|
||||
foreach ($frm->addselect as $adduser) {
|
||||
if (!$adduser = clean_param($adduser, PARAM_INT)) {
|
||||
continue;
|
||||
@@ -182,34 +158,12 @@
|
||||
}
|
||||
}
|
||||
if ($allow) {
|
||||
switch($extendbase) {
|
||||
case 0:
|
||||
$timestart = $course->startdate;
|
||||
break;
|
||||
case 3:
|
||||
$timestart = $today;
|
||||
break;
|
||||
case 4:
|
||||
$timestart = $course->enrolstartdate;
|
||||
break;
|
||||
case 5:
|
||||
$timestart = $course->enrolenddate;
|
||||
break;
|
||||
}
|
||||
|
||||
if($extendperiod > 0) {
|
||||
$timeend = $timestart + $extendperiod;
|
||||
} else {
|
||||
$timeend = 0;
|
||||
}
|
||||
if (! role_assign($roleid, $adduser, 0, $context->id, $timestart, $timeend, $hidden)) {
|
||||
$errors[] = "Could not add user with id $adduser to this role!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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);
|
||||
@@ -243,34 +197,29 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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) {
|
||||
print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
|
||||
} else {
|
||||
print_heading_with_help(get_string('assignrolesin', 'role', print_context_name($context)), 'assignroles');
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_SYSTEM) {
|
||||
print_box(get_string('globalroleswarning', 'role'));
|
||||
}
|
||||
|
||||
|
||||
if ($roleid) { /// prints a form to swap roles
|
||||
|
||||
/// Get all existing participants in this context.
|
||||
// Why is this not done with get_users???
|
||||
|
||||
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, ra.hidden')) {
|
||||
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, r.hidden')) {
|
||||
$contextusers = array();
|
||||
}
|
||||
|
||||
@@ -286,8 +235,8 @@
|
||||
|
||||
$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
$select .= $selectsql;
|
||||
} else {
|
||||
$selectsql = "";
|
||||
} else {
|
||||
$selectsql = "";
|
||||
}
|
||||
|
||||
if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?)
|
||||
@@ -305,9 +254,9 @@
|
||||
* 3) get_recordset_sql() is more efficient *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
|
||||
|
||||
|
||||
$doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$validroleids = array();
|
||||
@@ -324,7 +273,7 @@
|
||||
|
||||
if ($validroleids) {
|
||||
$roleids = '('.implode(',', $validroleids).')';
|
||||
|
||||
|
||||
$select = " SELECT u.id, u.firstname, u.lastname, u.email";
|
||||
$countselect = "SELECT COUNT(u.id)";
|
||||
$from = " FROM {$CFG->prefix}user u
|
||||
@@ -338,25 +287,25 @@
|
||||
FROM {$CFG->prefix}role_assignments r,
|
||||
{$CFG->prefix}user u
|
||||
WHERE r.contextid = $contextid
|
||||
AND u.id = r.userid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = $roleid
|
||||
$selectsql)";
|
||||
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
}
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
|
||||
$usercount = count_records_sql($countselect . $from . $where) - count($contextusers);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
} else {
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* context level is above or equal course context level *
|
||||
* in this case we pull out all users matching search criteria (if any) *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/// MDL-11111 do not include user already assigned this role in this context as available users
|
||||
/// so that the number of available users is right and we save time looping later
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
@@ -367,15 +316,15 @@
|
||||
FROM '.$CFG->prefix.'role_assignments r,
|
||||
'.$CFG->prefix.'user u
|
||||
WHERE r.contextid = '.$contextid.'
|
||||
AND u.id = r.userid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = '.$roleid.'
|
||||
'.$selectsql.')
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
$usercount = count_records_select('user', $select) - count($contextusers);
|
||||
|
||||
}
|
||||
|
||||
echo '<div class="selector">';
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$assignableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletoassign);
|
||||
@@ -403,34 +352,6 @@
|
||||
sync_metacourse($course);
|
||||
}
|
||||
|
||||
// Get the names of role holders for roles with between 1 and MAX_USERS_TO_LIST_PER_ROLE users,
|
||||
// and so determine whether to show the extra column.
|
||||
$rolehodlercount = array();
|
||||
$rolehodlernames = array();
|
||||
$strmorethanten = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE);
|
||||
$showroleholders = false;
|
||||
foreach ($assignableroles as $roleid => $rolename) {
|
||||
$countusers = count_role_users($roleid, $context);
|
||||
$rolehodlercount[$roleid] = $countusers;
|
||||
$roleusers = '';
|
||||
if (0 < $countusers && $countusers <= MAX_USERS_TO_LIST_PER_ROLE) {
|
||||
$roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname');
|
||||
if (!empty($roleusers)) {
|
||||
$strroleusers = array();
|
||||
foreach ($roleusers as $user) {
|
||||
$strroleusers[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '" >' . fullname($user) . '</a>';
|
||||
}
|
||||
$rolehodlernames[$roleid] = implode('<br />', $strroleusers);
|
||||
$showroleholders = true;
|
||||
}
|
||||
} else if ($countusers > MAX_USERS_TO_LIST_PER_ROLE) {
|
||||
$rolehodlernames[$roleid] = '<a href="'.$baseurl.'&roleid='.$roleid.'">'.$strmorethanten.'</a>';
|
||||
} else {
|
||||
$rolehodlernames[$roleid] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Print overview table
|
||||
$table->tablealign = 'center';
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
@@ -438,24 +359,20 @@
|
||||
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users'));
|
||||
$table->wrap = array('nowrap', '', 'nowrap');
|
||||
$table->align = array('right', 'left', 'center');
|
||||
if ($showroleholders) {
|
||||
$table->head[] = '';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->align[] = 'left';
|
||||
}
|
||||
|
||||
foreach ($assignableroles as $roleid => $rolename) {
|
||||
$countusers = count_role_users($roleid, $context);
|
||||
$description = format_string(get_field('role', 'description', 'id', $roleid));
|
||||
$row = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>',$description, $rolehodlercount[$roleid]);
|
||||
if ($showroleholders) {
|
||||
$row[] = $rolehodlernames[$roleid];
|
||||
}
|
||||
$table->data[] = $row;
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>',$description, $countusers);
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
} else {
|
||||
print_footer($course);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="shortname"><?php print_string('shortname') ?></label></td>
|
||||
<td><?php
|
||||
echo '<input type="text" id="shortname" name="shortname" maxlength="100" size="15" value="'.s($role->shortname).'" />';
|
||||
echo '<input type="text" id="shortname" name="shortname" maxlength="20" size="15" value="'.s($role->shortname).'" />';
|
||||
if (isset($errors["shortname"])) formerr($errors["shortname"]);
|
||||
?>
|
||||
</td>
|
||||
@@ -113,8 +113,7 @@ $contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
// prepare legacy defaults
|
||||
if (!empty($role->legacytype)) {
|
||||
@@ -131,8 +130,7 @@ foreach ($capabilities as $capability) {
|
||||
}
|
||||
|
||||
// prints a breaker if component or name or context level
|
||||
if (component_level_changed($capability, $component, $contextlevel)) {
|
||||
//if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.
|
||||
get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
}
|
||||
|
||||
+61
-44
@@ -3,8 +3,9 @@
|
||||
require_once('../../config.php');
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_setup('defineroles');
|
||||
admin_externalpage_setup('defineroles', $adminroot);
|
||||
|
||||
$roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role
|
||||
$name = optional_param('name', '', PARAM_MULTILANG); // new role name
|
||||
@@ -117,16 +118,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
// added a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
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':
|
||||
@@ -234,17 +229,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
// edited a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
|
||||
|
||||
redirect('manage.php');
|
||||
}
|
||||
|
||||
// edited a role sitewide - with errors, but still...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@@ -253,18 +240,12 @@
|
||||
}
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
if (!delete_role($roleid)) {
|
||||
|
||||
// partially deleted a role sitewide...?
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
error('Could not delete role with ID '.$roleid);
|
||||
}
|
||||
// deleted a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
} else if (confirm_sesskey()){
|
||||
// show confirmation
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$optionsyes = array('action'=>'delete', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
|
||||
$a = new object();
|
||||
$a->id = $roleid;
|
||||
@@ -272,7 +253,7 @@
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
$a->count = (int)count_records('role_assignments', 'roleid', $roleid);
|
||||
notice_yesno(get_string('deleterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -318,7 +299,7 @@
|
||||
//ok - lets duplicate!
|
||||
} else {
|
||||
// show confirmation
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$optionsyes = array('action'=>'duplicate', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
|
||||
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
|
||||
$a = new object();
|
||||
@@ -326,7 +307,7 @@
|
||||
$a->name = $roles[$roleid]->name;
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
notice_yesno(get_string('duplicaterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -349,8 +330,8 @@
|
||||
$suffixshort = "";
|
||||
}
|
||||
$currentfullname = $fullname.$suffixfull;
|
||||
// Limit the size of shortname - database column accepts <= 100 chars
|
||||
$currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)).$suffixshort;
|
||||
// Limit the size of shortname - database column accepts <= 15 chars
|
||||
$currentshortname = substr($shortname, 0, 15 - strlen($suffixshort)).$suffixshort;
|
||||
$coursefull = get_record("role","name",addslashes($currentfullname));
|
||||
$courseshort = get_record("role","shortname",addslashes($currentshortname));
|
||||
$counter++;
|
||||
@@ -360,13 +341,7 @@
|
||||
if ($newrole = create_role($currentfullname, $currentshortname, $description)) {
|
||||
// dupilcate all the capabilities
|
||||
role_cap_duplicate($sourcerole, $newrole);
|
||||
|
||||
// dup'ed a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
}
|
||||
$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;
|
||||
|
||||
@@ -377,18 +352,11 @@
|
||||
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
reset_role_capabilities($roleid);
|
||||
|
||||
// reset a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
$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 {
|
||||
// show confirmation
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$optionsyes = array('action'=>'reset', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
|
||||
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
|
||||
$a = new object();
|
||||
@@ -402,7 +370,7 @@
|
||||
$warning = get_string('resetrolesure', 'role', $a);
|
||||
}
|
||||
notice_yesno($warning, 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -414,7 +382,7 @@
|
||||
|
||||
/// print UI now
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$currenttab = 'manage';
|
||||
include_once('managetabs.php');
|
||||
@@ -567,9 +535,58 @@
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
|
||||
|
||||
/// ================ some internal functions ====================////
|
||||
|
||||
function switch_roles($first, $second) {
|
||||
$status = true;
|
||||
//first find temorary sortorder number
|
||||
$tempsort = count_records('role') + 3;
|
||||
while (get_record('role','sortorder', $tempsort)) {
|
||||
$tempsort += 3;
|
||||
}
|
||||
|
||||
$r1 = new object();
|
||||
$r1->id = $first->id;
|
||||
$r1->sortorder = $tempsort;
|
||||
$r2 = new object();
|
||||
$r2->id = $second->id;
|
||||
$r2->sortorder = $first->sortorder;
|
||||
|
||||
if (!update_record('role', $r1)) {
|
||||
debugging("Can not update role with ID $r1->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
if (!update_record('role', $r2)) {
|
||||
debugging("Can not update role with ID $r2->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
$r1->sortorder = $second->sortorder;
|
||||
if (!update_record('role', $r1)) {
|
||||
debugging("Can not update role with ID $r1->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
// duplicates all the base definitions of a role
|
||||
function role_cap_duplicate($sourcerole, $targetrole) {
|
||||
global $CFG;
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$caps = get_records_sql("SELECT * FROM {$CFG->prefix}role_capabilities
|
||||
WHERE roleid = $sourcerole->id
|
||||
AND contextid = $systemcontext->id");
|
||||
// adding capabilities
|
||||
foreach ($caps as $cap) {
|
||||
unset($cap->id);
|
||||
$cap->roleid = $targetrole;
|
||||
insert_record('role_capabilities', $cap);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
$toprow = array();
|
||||
|
||||
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'));
|
||||
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'),'', true);
|
||||
|
||||
$toprow[] = new tabobject('allowassign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/allowassign.php', get_string('allowassign', 'role'));
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
$strallow = get_string('allow','role');
|
||||
$strprevent = get_string('prevent','role');
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
$strsafewarning = get_string('safeoverridenotice', 'role');
|
||||
?>
|
||||
|
||||
<form id="overrideform" action="override.php" method="post">
|
||||
@@ -31,8 +30,7 @@
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
@@ -42,8 +40,7 @@
|
||||
}
|
||||
|
||||
// prints a breaker if component or name or context level
|
||||
//if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
if (component_level_changed($capability, $component, $contextlevel)) {
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
}
|
||||
|
||||
@@ -68,7 +65,7 @@
|
||||
$isprohibit = 0;
|
||||
}
|
||||
|
||||
$isdisabled = $isprohibit || $capability->locked;
|
||||
$isdisabled = $isprohibit;
|
||||
|
||||
$riskinfo = '<td class="risk managetrust">';
|
||||
$rowclasses = '';
|
||||
@@ -139,17 +136,10 @@
|
||||
<?php echo $riskinfo; ?>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<div class="submit buttons">
|
||||
<input type="submit" value="<?php print_string('savechanges') ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($safeoverridenotice) {
|
||||
echo '<div class="sefeoverridenotice">'.$strsafewarning.'</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
</form>
|
||||
|
||||
+54
-62
@@ -20,9 +20,7 @@
|
||||
error('Can not override base role capabilities');
|
||||
}
|
||||
|
||||
$canoverride = has_capability('moodle/role:override', $context);
|
||||
|
||||
if (!$canoverride and !has_capability('moodle/role:safeoverride', $context)) {
|
||||
if (!has_capability('moodle/role:override', $context)) {
|
||||
error('You do not have permission to change overrides in this context!');
|
||||
}
|
||||
|
||||
@@ -50,20 +48,22 @@
|
||||
}
|
||||
|
||||
/// needed for tabs.php
|
||||
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
$strroletooverride = get_string('roletooverride', 'role');
|
||||
$stroverrideusers = get_string('overrideusers', 'role');
|
||||
$straction = get_string('overrideroles', 'role');
|
||||
$strcurrentrole = get_string('currentrole', 'role');
|
||||
$strcurrentcontext = get_string('currentcontext', 'role');
|
||||
$strparticipants = get_string('participants');
|
||||
|
||||
/// Make sure this user can override that role
|
||||
|
||||
if ($roleid) {
|
||||
if (!isset($overridableroles[$roleid])) {
|
||||
if (!user_can_override($context, $roleid)) {
|
||||
error ('you can not override this role in this context');
|
||||
}
|
||||
}
|
||||
@@ -74,30 +74,7 @@
|
||||
}
|
||||
|
||||
/// get all cababilities
|
||||
$safeoverridenotice = false;
|
||||
if ($roleid) {
|
||||
if ($capabilities = fetch_context_capabilities($context)) {
|
||||
// find out if we need to lock some capabilities
|
||||
foreach ($capabilities as $capname=>$capability) {
|
||||
$capabilities[$capname]->locked = false;
|
||||
if ($canoverride) {
|
||||
//ok no locking at all
|
||||
continue;
|
||||
}
|
||||
//only limited safe overrides - spam only allowed
|
||||
if ((RISK_DATALOSS & (int)$capability->riskbitmask)
|
||||
or (RISK_MANAGETRUST & (int)$capability->riskbitmask)
|
||||
or (RISK_CONFIG & (int)$capability->riskbitmask)
|
||||
or (RISK_XSS & (int)$capability->riskbitmask)
|
||||
or (RISK_PERSONAL & (int)$capability->riskbitmask)) {
|
||||
$capabilities[$capname]->locked = true;
|
||||
$safeoverridenotice = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$capabilities = null;
|
||||
}
|
||||
$capabilities = fetch_context_capabilities($context);
|
||||
|
||||
/// Process incoming role override
|
||||
if ($data = data_submitted() and $roleid and confirm_sesskey()) {
|
||||
@@ -107,10 +84,6 @@
|
||||
'', 'capability, permission, id');
|
||||
|
||||
foreach ($capabilities as $cap) {
|
||||
if ($cap->locked) {
|
||||
//user not allowed to change this cap
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($data->{$cap->name})) {
|
||||
//cap not specified in form
|
||||
@@ -127,20 +100,36 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($localoverrides[$capname])) {
|
||||
// Something exists, so update it
|
||||
assign_capability($capname, $value, $roleid, $context->id, true);
|
||||
if (isset($localoverrides[$capname])) { // Something exists, so update it
|
||||
if ($value == CAP_INHERIT) { // inherit = delete
|
||||
delete_records('role_capabilities', 'roleid', $roleid, 'contextid', $context->id,
|
||||
'capability', $capname);
|
||||
} else {
|
||||
$localoverride = new object();
|
||||
$localoverride->id = $localoverrides[$capname]->id;
|
||||
$localoverride->permission = $value;
|
||||
$localoverride->timemodified = time();
|
||||
$localoverride->modifierid = $USER->id;
|
||||
if (!update_record('role_capabilities', $localoverride)) {
|
||||
error('Could not update a capability!');
|
||||
}
|
||||
}
|
||||
|
||||
} else { // insert a record
|
||||
if ($value != CAP_INHERIT) { // Ignore inherits
|
||||
assign_capability($capname, $value, $roleid, $context->id);
|
||||
$localoverride = new object();
|
||||
$localoverride->capability = $capname;
|
||||
$localoverride->contextid = $context->id;
|
||||
$localoverride->roleid = $roleid;
|
||||
$localoverride->permission = $value;
|
||||
$localoverride->timemodified = time();
|
||||
$localoverride->modifierid = $USER->id;
|
||||
if (!insert_record('role_capabilities', $localoverride)) {
|
||||
error('Could not insert a capability!');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// force accessinfo refresh for users visiting this context...
|
||||
mark_context_dirty($context->path);
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -148,43 +137,42 @@
|
||||
/// Print the header and tabs
|
||||
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
$navlinks = array();
|
||||
|
||||
/// course header
|
||||
if ($course->id != SITEID) {
|
||||
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$fullname", "$fullname", $navigation, "", "", true, " ", navmenu($course));
|
||||
print_header("$fullname", "$fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$course->id\">$fullname</a> -> $straction",
|
||||
"", "", true, " ", navmenu($course));
|
||||
|
||||
/// site header
|
||||
} else {
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, " ", navmenu($course));
|
||||
print_header("$course->fullname: $fullname", $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$course->id\">$fullname</a> -> $straction", "", "", true, " ", navmenu($course));
|
||||
}
|
||||
$showroles = 1;
|
||||
$currenttab = 'override';
|
||||
include_once($CFG->dirroot.'/user/tabs.php');
|
||||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = 'override';
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('frontpageroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = 'override';
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
|
||||
print_heading_with_help(get_string('overrides', 'role'), 'overrides');
|
||||
|
||||
if ($roleid) {
|
||||
/// prints a form to swap roles
|
||||
echo '<div class="selector">';
|
||||
echo $strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$overridableroles = array('0'=>get_string('listallroles', 'role').'...') + $overridableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/override.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride);
|
||||
@@ -208,7 +196,7 @@
|
||||
if (!empty($capabilities)) {
|
||||
// Print the capabilities overrideable in this context
|
||||
print_simple_box_start('center');
|
||||
include('override.html');
|
||||
include_once('override.html');
|
||||
print_simple_box_end();
|
||||
|
||||
} else {
|
||||
@@ -236,6 +224,10 @@
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
} else {
|
||||
print_footer($course);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+58
-94
@@ -7,16 +7,15 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
$navlinks = array();
|
||||
if ($currenttab != 'update') {
|
||||
switch ($context->contextlevel) {
|
||||
|
||||
case CONTEXT_SYSTEM:
|
||||
$stradministration = get_string('administration');
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => '../index.php', 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header($SITE->fullname, "$SITE->fullname", $navigation);
|
||||
print_header($SITE->fullname, "$SITE->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
|
||||
break;
|
||||
|
||||
case CONTEXT_PERSONAL:
|
||||
break;
|
||||
|
||||
case CONTEXT_USER:
|
||||
@@ -28,16 +27,8 @@ if ($currenttab != 'update') {
|
||||
$strcategories = get_string("categories");
|
||||
$strcategory = get_string("category");
|
||||
$strcourses = get_string("courses");
|
||||
|
||||
$navlinks[] = array('name' => $strcategories,
|
||||
'link' => "$CFG->wwwroot/course/index.php",
|
||||
'type' => 'misc');
|
||||
$navlinks[] = array('name' => $category->name,
|
||||
'link' => "$CFG->wwwroot/course/category.php?id=$category->id",
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses", $navigation, "", "", true);
|
||||
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses",
|
||||
"<a href=\"$CFG->wwwroot/course/index.php\">$strcategories</a> -> <a href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a> -> $straction", "", "", true);
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSE:
|
||||
@@ -47,11 +38,9 @@ if ($currenttab != 'update') {
|
||||
$course = get_record('course', 'id', $context->instanceid);
|
||||
|
||||
require_login($course);
|
||||
$navlinks[] = array('name' => get_string('roles'),
|
||||
'link' => "$CFG->wwwroot/admin/roles/assign.php?contextid=$context->id",
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header($streditcoursesettings, $course->fullname, $navigation);
|
||||
|
||||
print_header($streditcoursesettings, $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -75,8 +64,9 @@ if ($currenttab != 'update') {
|
||||
|
||||
require_login($course);
|
||||
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strnav = "<a href=\"$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id\">$instance->name</a> ->";
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strmodulenameplural = get_string("modulenameplural", $module->name);
|
||||
|
||||
if ($module->name == "label") {
|
||||
@@ -85,21 +75,9 @@ if ($currenttab != 'update') {
|
||||
$focuscursor = "form.name";
|
||||
}
|
||||
|
||||
$navlinks[] = array('name' => $strmodulenameplural,
|
||||
'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
|
||||
$navlinks[] = array('name' => $instance->name,
|
||||
'link' => "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id",
|
||||
'type' => 'misc');
|
||||
|
||||
$navlinks[] = array('name' => $streditinga,
|
||||
'link' => "$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey(),
|
||||
'type' => 'misc');
|
||||
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header_simple($streditinga, '', $navigation, $focuscursor, "", false);
|
||||
print_header_simple($streditinga, '',
|
||||
"<a href=\"$CFG->wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural</a> ->
|
||||
$strnav <a href=\"$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga</a> -> $straction", $focuscursor, "", false);
|
||||
|
||||
break;
|
||||
|
||||
@@ -107,7 +85,7 @@ if ($currenttab != 'update') {
|
||||
if ($blockinstance = get_record('block_instance', 'id', $context->instanceid)) {
|
||||
if ($block = get_record('block', 'id', $blockinstance->blockid)) {
|
||||
$blockname = print_context_name($context);
|
||||
|
||||
$navigation = $blockname. ' -> '.$straction;
|
||||
|
||||
switch ($blockinstance->pagetype) {
|
||||
case 'course-view':
|
||||
@@ -115,39 +93,21 @@ if ($currenttab != 'update') {
|
||||
|
||||
require_login($course);
|
||||
|
||||
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
print_header("$straction: $blockname", $course->fullname, $navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'blog-view':
|
||||
$strblogs = get_string('blogs','blog');
|
||||
$navlinks[] = array('name' => $strblogs,
|
||||
'link' => $CFG->wwwroot.'/blog/index.php',
|
||||
'type' => 'misc');
|
||||
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
$navigation = '<a href="'.$CFG->wwwroot.'/blog/index.php">'.
|
||||
$strblogs.'</a> -> '.$navigation;
|
||||
print_header("$straction: $strblogs", $SITE->fullname, $navigation);
|
||||
break;
|
||||
|
||||
case 'tag-index':
|
||||
$strtags = get_string('tags');
|
||||
$navlinks[] = array('name' => $strtags,
|
||||
'link' => $CFG->wwwroot.'/tag/index.php',
|
||||
'type' => 'misc');
|
||||
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $strtags", $SITE->fullname, $navigation);
|
||||
break;
|
||||
|
||||
default:
|
||||
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $blockname", $SITE->fullname, $navigation);
|
||||
break;
|
||||
}
|
||||
@@ -163,41 +123,48 @@ if ($currenttab != 'update') {
|
||||
}
|
||||
|
||||
|
||||
$toprow = array();
|
||||
$inactive = array();
|
||||
$activetwo = array();
|
||||
|
||||
|
||||
if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context
|
||||
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // only show update button if module?
|
||||
|
||||
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('settings'));
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
|
||||
|
||||
}
|
||||
|
||||
if (!empty($assignableroles)) {
|
||||
$toprow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('localroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
|
||||
$context->id, get_string('roles'));
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$toprow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overridepermissions', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
if (!empty($tabsmode)) {
|
||||
|
||||
}
|
||||
if (!empty($assignableroles)) {
|
||||
$secondrow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('assignroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$secondrow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overrideroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
$inactive[] = 'roles';
|
||||
$activetwo = array('roles');
|
||||
$currenttab = $tabsmode;
|
||||
|
||||
} else {
|
||||
$inactive[] = '';
|
||||
$activetwo = array();
|
||||
}
|
||||
|
||||
/// Here other core tabs should go (always calling tabs.php files)
|
||||
/// All the logic to decide what to show must be self-contained in the tabs file
|
||||
/// eg:
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
/// ej.:
|
||||
/// include_once($CFG->dirroot . '/grades/tabs.php');
|
||||
|
||||
/// Finally, we support adding some 'on-the-fly' tabs here
|
||||
@@ -206,7 +173,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
if ($extratabs = explode(',', $CFG->extratabs)) {
|
||||
asort($extratabs);
|
||||
foreach($extratabs as $extratab) {
|
||||
/// Each extra tab must be one $CFG->dirroot relative file
|
||||
/// Each extra tab mus be one $CFG->dirroot relative file
|
||||
if (file_exists($CFG->dirroot . '/' . $extratab)) {
|
||||
include_once($CFG->dirroot . '/' . $extratab);
|
||||
}
|
||||
@@ -214,16 +181,13 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
}
|
||||
}
|
||||
|
||||
$inactive[] = $currenttab;
|
||||
|
||||
$tabs = array($toprow);
|
||||
|
||||
/// If there are any secondrow defined, let's introduce it
|
||||
if (isset($secondrow) && is_array($secondrow) && !empty($secondrow)) {
|
||||
$tabs[] = $secondrow;
|
||||
if (!empty($secondrow)) {
|
||||
$tabs = array($toprow, $secondrow);
|
||||
} else {
|
||||
$tabs = array($toprow);
|
||||
}
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive, $activetwo);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+121
-26
@@ -5,58 +5,153 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$query = trim(stripslashes(optional_param('query', '', PARAM_NOTAGS))); // Search string
|
||||
$query = trim(stripslashes_safe(required_param('query', PARAM_NOTAGS))); // Search string
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings here
|
||||
$adminroot->search = $query; // So we can reference it in search boxes later in this invocation
|
||||
$statusmsg = '';
|
||||
$errormsg = '';
|
||||
$focus = '';
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('search', $adminroot); // now hidden page
|
||||
|
||||
$CFG->adminsearchquery = $query; // So we can reference it in search boxes later in this invocation
|
||||
|
||||
admin_externalpage_setup('search'); // now hidden page
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with changed settings
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$changedsettings = search_settings(admin_get_root(), $query);
|
||||
$errors = '';
|
||||
|
||||
foreach($changedsettings as $changedsetting) {
|
||||
if (!isset($unslashed['s_' . $changedsetting->name])) {
|
||||
$unslashed['s_' . $changedsetting->name] = ''; // needed for checkboxes
|
||||
}
|
||||
$errors .= $changedsetting->write_setting($unslashed['s_' . $changedsetting->name]);
|
||||
}
|
||||
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
} else {
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
// and finally, if we get here, then there are matching settings and we have to print a form
|
||||
// to modify them
|
||||
admin_externalpage_print_header($focus);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
$resultshtml = admin_search_settings_html($query); // case insensitive search only
|
||||
$resultshtml = search_settings_html(admin_get_root(), $query);
|
||||
|
||||
echo '<form action="search.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="query" value="'.s($query).'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<input type="hidden" name="query" value="' . s($query) . '" />';
|
||||
echo '</div>';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
if ($resultshtml != '') {
|
||||
echo $resultshtml;
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
} else {
|
||||
echo get_string('noresults','admin');
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
/**
|
||||
* Find settings using a query.
|
||||
*
|
||||
* @param string &$node The node at which to start searching. Should be $ADMIN for all external calls to this function.
|
||||
* @param string $query The search string.
|
||||
* @return array An array containing admin_setting objects that match $query.
|
||||
*/
|
||||
function search_settings(&$node, $query) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$return = array();
|
||||
$entries = array_keys($node->children);
|
||||
foreach ($entries as $entry) {
|
||||
$return = array_merge($return, search_settings($node->children[$entry], $query));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$return = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if (stristr($setting->name,$query) || stristr($setting->visiblename,$query) || stristr($setting->description,$query)) {
|
||||
$return[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
function search_settings_html(&$node, $query) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($query == ''){
|
||||
return '';
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$entries = array_keys($node->children);
|
||||
$return = '';
|
||||
foreach ($entries as $entry) {
|
||||
$return .= search_settings_html($node->children[$entry], $query);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$foundsettings = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if (stristr($setting->name,$query) || stristr($setting->visiblename,$query) || stristr($setting->description,$query)) {
|
||||
$foundsettings[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
$return = '';
|
||||
if (count($foundsettings) > 0) {
|
||||
$return .= print_heading(get_string('searchresults','admin').' - '. '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $node->name . '">' . $node->visiblename . '</a>', '', 2, 'main', true);
|
||||
$return .= '<fieldset class="adminsettings">' . "\n";
|
||||
foreach ($foundsettings as $foundsetting) {
|
||||
$return .= '<div class="clearer"><!-- --></div>' . "\n";
|
||||
$return .= highlight($query,$foundsetting->output_html());
|
||||
}
|
||||
$return .= '</fieldset>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+110
-79
@@ -5,56 +5,21 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/pagelib.php');
|
||||
|
||||
$section = required_param('section', PARAM_SAFEDIR);
|
||||
$return = optional_param('return','', PARAM_ALPHA);
|
||||
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings
|
||||
$page =& $adminroot->locate($section);
|
||||
|
||||
if (empty($page) or !is_a($page, 'admin_settingpage')) {
|
||||
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
|
||||
die;
|
||||
if ($site = get_site()) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
if (!($page->check_access())) {
|
||||
print_error('accessdenied', 'admin');
|
||||
die;
|
||||
}
|
||||
|
||||
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
$statusmsg = '';
|
||||
$errormsg = '';
|
||||
$focus = '';
|
||||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
|
||||
if (empty($adminroot->errors)) {
|
||||
switch ($return) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
} else {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
}
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
$page =& $adminroot->locate($section);
|
||||
}
|
||||
|
||||
/// very hacky page setup
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
$PAGE = page_create_object(PAGE_ADMIN, 0); // there must be any constant id number
|
||||
$PAGE->init_extra($section);
|
||||
$CFG->pagepath = 'admin/setting/'.$section;
|
||||
|
||||
$section = optional_param('section', '', PARAM_ALPHAEXT);
|
||||
|
||||
$PAGE->init_extra($section); // hack alert!
|
||||
|
||||
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
|
||||
$return = optional_param('return','', PARAM_ALPHA);
|
||||
|
||||
if (!isset($USER->adminediting)) {
|
||||
$USER->adminediting = false;
|
||||
@@ -68,36 +33,87 @@ if ($PAGE->user_allowed_editing()) {
|
||||
}
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
$root = $adminroot->locate($PAGE->section);
|
||||
|
||||
if (!is_a($root, 'admin_settingpage')) {
|
||||
error(get_string('sectionerror', 'admin'));
|
||||
die;
|
||||
}
|
||||
|
||||
if (!($root->check_access())) {
|
||||
error(get_string('accessdenied', 'admin'));
|
||||
die;
|
||||
}
|
||||
|
||||
$CFG->pagepath = 'admin/setting/'.$section;
|
||||
|
||||
|
||||
|
||||
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
$errors = $root->write_settings($unslashed);
|
||||
//force logout if dbsession setting changes
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
}
|
||||
if (empty($errors)) {
|
||||
switch ($return) {
|
||||
case 'site':
|
||||
redirect("$CFG->wwwroot/");
|
||||
case 'admin':
|
||||
redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
default:
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
} else {
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
|
||||
/// print header stuff ------------------------------------------------------------
|
||||
// header must be printed after the redirects and require_logout
|
||||
|
||||
if (empty($SITE->fullname)) {
|
||||
print_header($page->visiblename, $page->visiblename, '', $focus);
|
||||
print_header();
|
||||
print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
|
||||
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
echo '<div class="settingsform">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
|
||||
echo $page->output_html();
|
||||
echo $root->output_html();
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!empty($SITE->fullname)) {
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
@@ -105,56 +121,71 @@ if (empty($SITE->fullname)) {
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
$PAGE->print_header('', $focus);
|
||||
$PAGE->print_header();
|
||||
|
||||
echo '<table id="layout-table"><tr>';
|
||||
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
|
||||
foreach ($lt as $column) {
|
||||
switch ($column) {
|
||||
case 'left':
|
||||
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
print_container_end();
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'middle':
|
||||
echo '<td id="middle-column">';
|
||||
print_container_start();
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
echo '<a name="startofcontent"></a>';
|
||||
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
print_heading($page->visiblename);
|
||||
echo '<div class="settingsform">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
|
||||
echo $page->output_html();
|
||||
echo $root->output_html();
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
print_container_end();
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'right':
|
||||
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
|
||||
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
print_container_end();
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2,94 +2,113 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "appearance" category
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$ADMIN->add('appearance', new admin_category('themes', get_string('themes')));
|
||||
// "themesettings" settingpage
|
||||
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
|
||||
$ADMIN->add('appearance', new admin_category('themes', get_string('themes')));
|
||||
// "themesettings" settingpage
|
||||
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('hideactivitytypenavlink', get_string('hideactivitytypenavlink', 'admin'), get_string('confighideactivitytypenavlink', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('hidefromnone', 'admin'),
|
||||
1 => get_string('hidefromstudents', 'admin'),
|
||||
2 => get_string('hidefromall', 'admin')
|
||||
)));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
# for CALENDAR_TF_12 and CALENDAR_TF_24 ...
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
|
||||
// calendar
|
||||
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
|
||||
$temp->add(new admin_setting_special_adminseesall());
|
||||
//this is hacky because we do not want to include the stuff from calendar/lib.php
|
||||
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'),
|
||||
get_string('explain_site_timeformat', 'calendar'), '0',
|
||||
array('0' => get_string('default', 'calendar'),
|
||||
'%I:%M %p' => get_string('timeformat_12', 'calendar'),
|
||||
'%H:%M' => get_string('timeformat_24', 'calendar'))));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('sunday', 'calendar'),
|
||||
1 => get_string('monday', 'calendar'),
|
||||
2 => get_string('tuesday', 'calendar'),
|
||||
3 => get_string('wednesday', 'calendar'),
|
||||
4 => get_string('thursday', 'calendar'),
|
||||
5 => get_string('friday', 'calendar'),
|
||||
6 => get_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// calendar
|
||||
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
|
||||
$temp->add(new admin_setting_special_adminseesall());
|
||||
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'), get_string('explain_site_timeformat', 'calendar'), '0',
|
||||
array( 0 => get_string('default', 'calendar'),
|
||||
CALENDAR_TF_12 => get_string('timeformat_12', 'calendar'),
|
||||
CALENDAR_TF_24 => get_string('timeformat_24', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('sunday', 'calendar'),
|
||||
1 => get_string('monday', 'calendar'),
|
||||
2 => get_string('tuesday', 'calendar'),
|
||||
3 => get_string('wednesday', 'calendar'),
|
||||
4 => get_string('thursday', 'calendar'),
|
||||
5 => get_string('friday', 'calendar'),
|
||||
6 => get_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "htmleditor" settingpage
|
||||
$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_special_editorfontlist());
|
||||
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
|
||||
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
|
||||
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_editordictionary());
|
||||
}
|
||||
$temp->add(new admin_setting_special_editorhidebuttons());
|
||||
$temp->add(new admin_setting_emoticons());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// "filtersettings" settingpage
|
||||
$temp = new admin_settingpage('filtersettings', get_string('filtersettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
|
||||
86400 => get_string('numdays','',1),
|
||||
43200 => get_string('numhours','',12),
|
||||
10800 => get_string('numhours','',3),
|
||||
7200 => get_string('numhours','',2),
|
||||
3600 => get_string('numhours','',1),
|
||||
2700 => get_string('numminutes','',45),
|
||||
1800 => get_string('numminutes','',30),
|
||||
900 => get_string('numminutes','',15),
|
||||
600 => get_string('numminutes','',10),
|
||||
540 => get_string('numminutes','',9),
|
||||
480 => get_string('numminutes','',8),
|
||||
420 => get_string('numminutes','',7),
|
||||
360 => get_string('numminutes','',6),
|
||||
300 => get_string('numminutes','',5),
|
||||
240 => get_string('numminutes','',4),
|
||||
180 => get_string('numminutes','',3),
|
||||
120 => get_string('numminutes','',2),
|
||||
60 => get_string('numminutes','',1),
|
||||
30 => get_string('numseconds','',30),
|
||||
0 => get_string('no'))));
|
||||
$temp->add(new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
|
||||
'1' => get_string('allfiles'),
|
||||
'2' => get_string('htmlfilesonly'))));
|
||||
$temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "htmlsettings" settingpage
|
||||
$temp = new admin_settingpage('htmlsettings', get_string('htmlsettings', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('formatstringstriptags', get_string('stripalltitletags', 'admin'), get_string('configstripalltitletags', 'admin'), 1));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "documentation" settingpage
|
||||
$temp = new admin_settingpage('documentation', get_string('moodledocs'));
|
||||
$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
|
||||
$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for coursemanager (what roles to display)
|
||||
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
|
||||
$temp->add(new admin_setting_special_coursemanager());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('disablecourseajax', get_string('disablecourseajax', 'admin'), get_string('configdisablecourseajax', 'admin'),
|
||||
isset($CFG->disablecourseajax) ? 1 : empty($CFG->enableajax)));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// "htmleditor" settingpage
|
||||
$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_special_editorfontlist());
|
||||
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
|
||||
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
|
||||
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_editordictionary());
|
||||
}
|
||||
$temp->add(new admin_setting_special_editorhidebuttons());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// link to tag management interface
|
||||
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));
|
||||
// "documentation" settingpage
|
||||
$temp = new admin_settingpage('documentation', get_string('moodledocs'));
|
||||
$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
|
||||
$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for coursemanager (what roles to display)
|
||||
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
|
||||
$temp->add(new admin_setting_special_coursemanager());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$ADMIN->add('appearance', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
|
||||
} // end of speedup
|
||||
?>
|
||||
|
||||
+41
-55
@@ -2,63 +2,49 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "courses" category
|
||||
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:backup', $systemcontext)
|
||||
or has_capability('moodle/category:update', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
|
||||
|
||||
// "courserequests" settingpage
|
||||
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
|
||||
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
$temp->add(new admin_setting_configselect('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1, make_categories_options()));
|
||||
$ADMIN->add('courses', $temp);
|
||||
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
$ADMIN->add('courses', new admin_enrolment_page());
|
||||
|
||||
// "courserequests" settingpage
|
||||
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
|
||||
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
|
||||
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1));
|
||||
$ADMIN->add('courses', $temp);
|
||||
|
||||
// "backups" settingpage
|
||||
if (!empty($CFG->backup_version)) {
|
||||
$bi = array();
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0);
|
||||
$bi[] = new admin_setting_configselect('backup_sche_users', get_string('users'), get_string('backupusershelp'),
|
||||
0, array(0 => get_string('all'), 1 => get_string('course')));
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_blogs', get_string('blogs', 'blog'), get_string('backupblogshelp','blog'), 0);
|
||||
$bi[] = new admin_setting_configselect('backup_sche_keep', get_string('keep'),
|
||||
get_string('backupkeephelp'), 1, array(0 => get_string('all'), 1 => '1',
|
||||
2 => '2',
|
||||
5 => '5',
|
||||
10 => '10',
|
||||
20 => '20',
|
||||
30 => '30',
|
||||
40 => '40',
|
||||
50 => '50',
|
||||
100 => '100',
|
||||
200 => '200',
|
||||
300 => '300',
|
||||
400 => '400',
|
||||
500 => '500'));
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0);
|
||||
$bi[] = new admin_setting_special_backupdays();
|
||||
$bi[] = new admin_setting_configtime('backup_sche_hour', 'backup_sche_minute', get_string('executeat'),
|
||||
get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0));
|
||||
$bi[] = new admin_setting_configdirectory('backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), '');
|
||||
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'), 'moodle/site:backup');
|
||||
foreach ($bi as $backupitem) {
|
||||
$backupitem->plugin = 'backup';
|
||||
$temp->add($backupitem);
|
||||
}
|
||||
$ADMIN->add('courses', $temp);
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
// "backups" settingpage
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'),'moodle/site:backup');
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0));
|
||||
$temp->add(new admin_setting_backupselect('backup_sche_users', get_string('users'), get_string('backupusershelp'), 0, array(0 => get_string('all'),
|
||||
1 => get_string('course'))));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0));
|
||||
$temp->add(new admin_setting_backupselect('backup_sche_keep', get_string('keep'), get_string('backupkeephelp'), 1, array(0 => get_string('all'),
|
||||
1 => '1',
|
||||
2 => '2',
|
||||
5 => '5',
|
||||
10 => '10',
|
||||
20 => '20',
|
||||
30 => '30',
|
||||
40 => '40',
|
||||
50 => '50',
|
||||
100 => '100',
|
||||
200 => '200',
|
||||
300 => '300',
|
||||
400 => '400',
|
||||
500 => '500')));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0));
|
||||
$temp->add(new admin_setting_special_backupdays());
|
||||
$temp->add(new admin_setting_special_backuptime());
|
||||
$temp->add(new admin_setting_special_backupsaveto());
|
||||
$ADMIN->add('courses', $temp);
|
||||
|
||||
?>
|
||||
|
||||
@@ -4,72 +4,42 @@
|
||||
|
||||
if (get_site()) { //do not use during installation
|
||||
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
|
||||
if ($hassiteconfig or has_any_capability(array(
|
||||
'moodle/course:update',
|
||||
'moodle/role:assign',
|
||||
'moodle/site:restore',
|
||||
'moodle/site:backup',
|
||||
'moodle/course:managefiles',
|
||||
'moodle/question:add',
|
||||
'moodle/question:editmine',
|
||||
'moodle/question:editall',
|
||||
'moodle/question:viewmine',
|
||||
'moodle/question:viewall',
|
||||
'moodle/question:movemine',
|
||||
'moodle/question:moveall'), $frontpagecontext)) {
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', NULL)); // no default
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', NULL)); // no default
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
|
||||
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
|
||||
array('0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6',
|
||||
'7' => '7',
|
||||
'8' => '8',
|
||||
'9' => '9',
|
||||
'10' => '10')));
|
||||
$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
|
||||
|
||||
// front page default role
|
||||
$roleoptions = array(0=>get_string('none')); // roles to choose from
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$roleoptions[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', 0, $roleoptions));
|
||||
|
||||
$ADMIN->add('frontpage', $temp);
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontext->id, 'moodle/role:assign', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
|
||||
|
||||
$questioncapabilites = array(
|
||||
'moodle/question:add',
|
||||
'moodle/question:editmine',
|
||||
'moodle/question:editall',
|
||||
'moodle/question:viewmine',
|
||||
'moodle/question:viewall',
|
||||
'moodle/question:movemine',
|
||||
'moodle/question:moveall');
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilites, false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
|
||||
}
|
||||
$frontpagecontextid = $frontpagecontext->id;
|
||||
} else {
|
||||
$frontpagecontext = NULL;
|
||||
$frontpagecontextid = 0;
|
||||
}
|
||||
?>
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
|
||||
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
|
||||
array('0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6',
|
||||
'7' => '7',
|
||||
'8' => '8',
|
||||
'9' => '9',
|
||||
'10' => '10')));
|
||||
$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
|
||||
$ADMIN->add('frontpage', $temp);
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontextid, 'moodle/role:assign', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
|
||||
|
||||
?>
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
// This file defines settingpages and externalpages under the "grades" section
|
||||
|
||||
if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// General settings
|
||||
|
||||
$temp = new admin_settingpage('gradessettings', get_string('generalsettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
require_once $CFG->libdir.'/grade/constants.php';
|
||||
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
|
||||
// enable outcomes checkbox
|
||||
$temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_grade_profilereport());
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
|
||||
get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
|
||||
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
|
||||
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
|
||||
|
||||
$temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', get_string('includescalesinaggregation', 'grades'), get_string('configincludescalesinaggregation', 'grades'), 1));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0));
|
||||
|
||||
// enable publishing in exports/imports
|
||||
$temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
|
||||
get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
|
||||
get_string('configexportdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
|
||||
$temp->add(new admin_setting_special_gradeexport());
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
/// Grade category settings
|
||||
$temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
$temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
|
||||
|
||||
$strnoforce = get_string('noforce', 'grades');
|
||||
|
||||
// Aggregation type
|
||||
$options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
|
||||
GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
|
||||
GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
|
||||
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
|
||||
GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
|
||||
GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
|
||||
GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
|
||||
GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
|
||||
GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
|
||||
$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
|
||||
|
||||
$options = array(0 => get_string('no'), 1 => get_string('yes'));
|
||||
|
||||
$defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
|
||||
get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
|
||||
$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
|
||||
get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
|
||||
get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
|
||||
|
||||
$options = array(0 => get_string('none'));
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
|
||||
$defaults['value'] = 0;
|
||||
$defaults['forced'] = true;
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
|
||||
get_string('keephighhelp', 'grades'), $defaults, $options));
|
||||
$defaults['forced'] = false;
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
|
||||
get_string('droplowhelp', 'grades'), $defaults, $options));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
/// Grade item settings
|
||||
$temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
$temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
|
||||
get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
|
||||
get_string('configdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
|
||||
array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
|
||||
array('iteminfo' => get_string('iteminfo', 'grades'),
|
||||
'idnumber' => get_string('idnumbermod'),
|
||||
'gradetype' => get_string('gradetype', 'grades'),
|
||||
'scaleid' => get_string('scale'),
|
||||
'grademin' => get_string('grademin', 'grades'),
|
||||
'grademax' => get_string('grademax', 'grades'),
|
||||
'gradepass' => get_string('gradepass', 'grades'),
|
||||
'plusfactor' => get_string('plusfactor', 'grades'),
|
||||
'multfactor' => get_string('multfactor', 'grades'),
|
||||
'display' => get_string('gradedisplaytype', 'grades'),
|
||||
'decimals' => get_string('decimalpoints', 'grades'),
|
||||
'hidden' => get_string('hidden', 'grades'),
|
||||
'hiddenuntil' => get_string('hiddenuntil', 'grades'),
|
||||
'locked' => get_string('locked', 'grades'),
|
||||
'locktime' => get_string('locktime', 'grades'),
|
||||
'aggregationcoef' => get_string('aggregationcoef', 'grades'),
|
||||
'parentcategory' => get_string('parentcategory', 'grades'))));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
/// Scales and outcomes
|
||||
|
||||
$scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $scales);
|
||||
$outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $outcomes);
|
||||
$letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
|
||||
$ADMIN->add('grades', $letters);
|
||||
|
||||
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
|
||||
|
||||
// Reports
|
||||
$ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/report') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradereports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
// Imports
|
||||
$ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/import') as $plugin) {
|
||||
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradeimports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Exports
|
||||
$ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/export') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradeexports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
+12
-19
@@ -2,28 +2,21 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "appearance" category
|
||||
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:langeditmaster', $systemcontext)
|
||||
or has_capability('moodle/site:langeditlocal', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
|
||||
// new CFG variable for excel encoding
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
// new CFG variable for excel encoding
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
|
||||
|
||||
$ADMIN->add('language', $temp);
|
||||
$ADMIN->add('language', $temp);
|
||||
|
||||
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php", array('moodle/site:langeditmaster', 'moodle/site:langeditlocal') ));
|
||||
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
|
||||
|
||||
} // end of speedup
|
||||
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php"));
|
||||
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
|
||||
|
||||
?>
|
||||
|
||||
+19
-19
@@ -1,27 +1,27 @@
|
||||
<?php // $Id$
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
// "locations" settingpage
|
||||
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
$options[0] = get_string('choose') .'...';
|
||||
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
|
||||
|
||||
// "locations" settingpage
|
||||
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
$options[0] = get_string('choose') .'...';
|
||||
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
|
||||
$iplookups = array();
|
||||
if ($plugins = get_list_of_plugins('iplookup')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$iplookups[$plugin] = $plugin;
|
||||
}
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('iplookup', get_string('iplookup', 'admin'), get_string('configiplookup', 'admin'), 'hostip', $iplookups));
|
||||
|
||||
$temp->add(new admin_setting_heading('iplookup', get_string('iplookup', 'admin'), get_string('iplookupinfo', 'admin')));
|
||||
$temp->add(new admin_setting_configfile('geoipfile', get_string('geoipfile', 'admin'), get_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
|
||||
$temp->add(new admin_setting_configtext('googlemapkey', get_string('googlemapkey', 'admin'), get_string('configgooglemapkey', 'admin', $CFG->wwwroot), ''));
|
||||
|
||||
$ADMIN->add('location', $temp);
|
||||
$ADMIN->add('location', $temp);
|
||||
|
||||
|
||||
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
|
||||
|
||||
} // end of speedup
|
||||
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
|
||||
|
||||
?>
|
||||
|
||||
+13
-21
@@ -2,29 +2,21 @@
|
||||
|
||||
// * Miscellaneous settings
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
// Experimental settings page
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
// Experimental settings page
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
|
||||
$item = new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0);
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
$temp->add(new admin_setting_configcheckbox('enablegroupings', get_string('enablegroupings', 'admin'), get_string('configenablegroupings', 'admin'), 0));
|
||||
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
// XMLDB editor
|
||||
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
|
||||
// XMLDB editor
|
||||
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
|
||||
|
||||
|
||||
// hidden scripts linked from elsewhere
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
|
||||
|
||||
} // end of speedup
|
||||
// hidden scripts linked from elsewhere
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
|
||||
|
||||
?>
|
||||
|
||||
+9
-15
@@ -2,26 +2,20 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "mnet" category
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/index.php",
|
||||
$ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/index.php',
|
||||
'moodle/site:config'));
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/peers.php",
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/peers.php',
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', get_string('ssoaccesscontrol', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/access_control.php",
|
||||
$CFG->wwwroot . '/admin/mnet/access_control.php',
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('mnetenrol', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/enr_hosts.php",
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('mnetenrol', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/enr_hosts.php',
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/trustedhosts.php",
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/trustedhosts.php',
|
||||
'moodle/site:config'));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
<?php //$Id$
|
||||
|
||||
if ($hassiteconfig) {
|
||||
|
||||
$ADMIN->add('modules', new admin_category('modsettings', get_string('activities')));
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
if ($modules = get_records('modules')) {
|
||||
$modulebyname = array();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$strmodulename = get_string('modulename', $module->name);
|
||||
// Deal with modules which are lacking the language string
|
||||
if ($strmodulename == '[[modulename]]') {
|
||||
$textlib = textlib_get_instance();
|
||||
$strmodulename = $textlib->strtotitle($module->name);
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname);
|
||||
|
||||
foreach ($modulebyname as $strmodulename=>$module) {
|
||||
$modulename = $module->name;
|
||||
if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settingstree.php')) {
|
||||
include($CFG->dirroot.'/mod/'.$modulename.'/settingstree.php');
|
||||
} else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) {
|
||||
// do not show disabled modules in tree, keep only settings link on manage page
|
||||
$settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible);
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/mod/'.$modulename.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('modsettings', $settings);
|
||||
} else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/config.html')) {
|
||||
$ADMIN->add('modsettings', new admin_externalpage('modsetting'.$modulename, $strmodulename, "$CFG->wwwroot/$CFG->admin/module.php?module=$modulename", 'moodle/site:config', !$module->visible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
|
||||
$ADMIN->add('blocksettings', new admin_page_manageblocks());
|
||||
$ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
if (!empty($CFG->blocks_version) and $blocks = get_records('block')) {
|
||||
$blockbyname = array();
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
if(($blockobject = block_instance($block->name)) === false) {
|
||||
// Failed to load
|
||||
continue;
|
||||
}
|
||||
$blockbyname[$blockobject->get_title()] = $block;
|
||||
}
|
||||
ksort($blockbyname);
|
||||
|
||||
foreach ($blockbyname as $strblockname=>$block) {
|
||||
$blockname = $block->name;
|
||||
if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/settings.php')) {
|
||||
$settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible);
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/blocks/'.$blockname.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('blocksettings', $settings);
|
||||
|
||||
} else if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/config_global.html')) {
|
||||
$ADMIN->add('blocksettings', new admin_externalpage('blocksetting'.$blockname, $strblockname, "$CFG->wwwroot/$CFG->admin/block.php?block=$block->id", 'moodle/site:config', !$block->visible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
|
||||
// "filtersettings" settingpage
|
||||
$temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
$items = array();
|
||||
$items[] = new admin_setting_managefilters();
|
||||
$items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), '');
|
||||
$items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
|
||||
86400 => get_string('numdays','',1),
|
||||
43200 => get_string('numhours','',12),
|
||||
10800 => get_string('numhours','',3),
|
||||
7200 => get_string('numhours','',2),
|
||||
3600 => get_string('numhours','',1),
|
||||
2700 => get_string('numminutes','',45),
|
||||
1800 => get_string('numminutes','',30),
|
||||
900 => get_string('numminutes','',15),
|
||||
600 => get_string('numminutes','',10),
|
||||
540 => get_string('numminutes','',9),
|
||||
480 => get_string('numminutes','',8),
|
||||
420 => get_string('numminutes','',7),
|
||||
360 => get_string('numminutes','',6),
|
||||
300 => get_string('numminutes','',5),
|
||||
240 => get_string('numminutes','',4),
|
||||
180 => get_string('numminutes','',3),
|
||||
120 => get_string('numminutes','',2),
|
||||
60 => get_string('numminutes','',1),
|
||||
30 => get_string('numseconds','',30),
|
||||
0 => get_string('no')));
|
||||
$items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
|
||||
'1' => get_string('allfiles'),
|
||||
'2' => get_string('htmlfilesonly')));
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0);
|
||||
foreach ($items as $item) {
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
}
|
||||
}
|
||||
$ADMIN->add('filtersettings', $temp);
|
||||
|
||||
if (empty($CFG->textfilters)) {
|
||||
$activefilters = array();
|
||||
} else {
|
||||
$activefilters = explode(',', $CFG->textfilters);
|
||||
}
|
||||
$filterlocations = array('mod','filter');
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$filters = get_list_of_plugins($filterlocation);
|
||||
|
||||
$filterbyname = array();
|
||||
|
||||
foreach ($filters as $filter) {
|
||||
$strfiltername = get_string('filtername', $filter);
|
||||
// Deal with filters which are lacking the language string
|
||||
if ($strfiltername == '[[filtername]]') {
|
||||
$textlib = textlib_get_instance();
|
||||
$strfiltername = $textlib->strtotitle($filter);
|
||||
}
|
||||
$filterbyname[$strfiltername] = "$filterlocation/$filter";
|
||||
}
|
||||
ksort($filterbyname);
|
||||
|
||||
foreach ($filterbyname as $strfiltername=>$filterfull) {
|
||||
if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
|
||||
$settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
|
||||
if ($ADMIN->fulltree) {
|
||||
include("$CFG->dirroot/$filterfull/filtersettings.php");
|
||||
}
|
||||
$ADMIN->add('filtersettings', $settings);
|
||||
|
||||
} else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
|
||||
$ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
+77
-96
@@ -1,117 +1,98 @@
|
||||
<?php // $Id$
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
// "sitepolicies" settingpage
|
||||
$temp = new admin_settingpage('sitepolicies', get_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
// "sitepolicies" settingpage
|
||||
$temp = new admin_settingpage('sitepolicies', get_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
|
||||
array(60 => get_string('numminutes', '', 1),
|
||||
300 => get_string('numminutes', '', 5),
|
||||
900 => get_string('numminutes', '', 15),
|
||||
1800 => get_string('numminutes', '', 30),
|
||||
2700 => get_string('numminutes', '', 45),
|
||||
3600 => get_string('numminutes', '', 60))));
|
||||
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
|
||||
'firstname lastname', array('language' => get_string('language'),
|
||||
'firstname lastname' => get_string('firstname') . ' + ' . get_string('lastname'),
|
||||
'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
2 => get_string('groupblogs','blog'),
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
|
||||
$max_upload_choices = get_max_upload_sizes();
|
||||
// maxbytes set to 0 will allow the maxium server lmit for uploads
|
||||
$max_upload_choices[0] = get_string('serverlimit', 'admin');
|
||||
$temp->add(new admin_setting_configselect('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
|
||||
$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('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
|
||||
array(60 => get_string('numminutes', '', 1),
|
||||
300 => get_string('numminutes', '', 5),
|
||||
900 => get_string('numminutes', '', 15),
|
||||
1800 => get_string('numminutes', '', 30),
|
||||
2700 => get_string('numminutes', '', 45),
|
||||
3600 => get_string('numminutes', '', 60))));
|
||||
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
|
||||
'firstname lastname', array('language' => get_string('language'),
|
||||
'firstname lastname' => get_string('firstname').' + '.get_string('lastname'),
|
||||
'lastname firstname' => get_string('lastname').' + '.get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
2 => get_string('groupblogs','blog'),
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
$temp->add(new admin_setting_configcheckbox('usetags', get_string('usetags','admin'),get_string('configusetags', 'admin'),'1'));
|
||||
$temp->add(new admin_setting_configcheckbox('keeptagnamecase', get_string('keeptagnamecase','admin'),get_string('configkeeptagnamecase', 'admin'),'1'));
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlength', get_string('minpasswordlength', 'admin'), get_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpassworddigits', get_string('minpassworddigits', 'admin'), get_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlower', get_string('minpasswordlower', 'admin'), get_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordupper', get_string('minpasswordupper', 'admin'), get_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', get_string('minpasswordnonalphanum', 'admin'), get_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', get_string('disableuserimages', 'admin'), get_string('configdisableuserimages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', get_string('emailchangeconfirmation', 'admin'), get_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
$ADMIN->add('security', $temp);
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', get_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', get_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
// "modulesecurity" settingpage
|
||||
$temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses',
|
||||
'all' => 'All courses',
|
||||
'requested' => 'Requested courses')));
|
||||
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
|
||||
if (!$options = get_records("modules")) {
|
||||
$options = array();
|
||||
}
|
||||
$options2 = array();
|
||||
foreach ($options as $option) {
|
||||
$options2[$option->id] = $option->name;
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', get_string('notifications', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('displayloginfailures', get_string('displayloginfailures', 'admin'), get_string('configdisplayloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'admin' => get_string('administrators'),
|
||||
'teacher' => get_string('administratorsandteachers'),
|
||||
'everybody' => get_string('everybody'))));
|
||||
$temp->add(new admin_setting_configselect('notifyloginfailures', get_string('notifyloginfailures', 'admin'), get_string('confignotifyloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'mainadmin' => get_string('administrator'),
|
||||
'alladmins' => get_string('administratorsall'))));
|
||||
// "modulesecurity" settingpage
|
||||
$temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses',
|
||||
'all' => 'All courses',
|
||||
'requested' => 'Requested courses')));
|
||||
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
|
||||
if (!$options = get_records("modules")) {
|
||||
$options = array();
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('notifyloginthreshold', get_string('notifyloginthreshold', 'admin'), get_string('confignotifyloginthreshold', 'admin'), '10', $options));
|
||||
$ADMIN->add('security', $temp);
|
||||
}
|
||||
$options2 = array();
|
||||
foreach ($options as $option) {
|
||||
$options2[$option->id] = $option->name;
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', get_string('notifications', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('displayloginfailures', get_string('displayloginfailures', 'admin'), get_string('configdisplayloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'admin' => get_string('administrators'),
|
||||
'teacher' => get_string('administratorsandteachers'),
|
||||
'everybody' => get_string('everybody'))));
|
||||
$temp->add(new admin_setting_configselect('notifyloginfailures', get_string('notifyloginfailures', 'admin'), get_string('confignotifyloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'mainadmin' => get_string('administrator'),
|
||||
'alladmins' => get_string('administratorsall'))));
|
||||
$options = array();
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('notifyloginthreshold', get_string('notifyloginthreshold', 'admin'), get_string('confignotifyloginthreshold', 'admin'), '10', $options));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configexecutable('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configdirectory('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => get_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
} // end of speedup
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => get_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
?>
|
||||
|
||||
+27
-92
@@ -2,29 +2,27 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "server" category
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
// "systempaths" settingpage
|
||||
$temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
|
||||
$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
|
||||
'1' => get_string('gd1'),
|
||||
'2' => get_string('gd2'))));
|
||||
$temp->add(new admin_setting_configexecutable('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), ''));
|
||||
$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$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_RAW));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
|
||||
$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));
|
||||
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
@@ -52,25 +50,10 @@ $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestma
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // not needed here
|
||||
$options = array();
|
||||
$options['0'] = 'UTF-8';
|
||||
$options['0'] = get_string('none');
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options));
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
|
||||
$options = array('LF'=>'LF', 'CRLF'=>'CRLF');
|
||||
$temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
|
||||
if (isloggedin()) {
|
||||
global $USER;
|
||||
$primaryadminemail = $USER->email;
|
||||
$primaryadminname = fullname($USER, true);
|
||||
|
||||
} else {
|
||||
// no defaults during installation - admin user must be created first
|
||||
$primaryadminemail = NULL;
|
||||
$primaryadminname = NULL;
|
||||
}
|
||||
$temp->add(new admin_setting_configtext('supportname', get_string('supportname', 'admin'), get_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('supportemail', get_string('supportemail', 'admin'), get_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', 'admin'), get_string('configsupportpage', 'admin'), '', PARAM_URL));
|
||||
$ADMIN->add('server', $temp, 100);
|
||||
|
||||
|
||||
@@ -102,10 +85,9 @@ $ADMIN->add('server', $temp);
|
||||
// "debugging" settingpage
|
||||
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
|
||||
$temp->add(new admin_setting_special_debug());
|
||||
$temp->add(new admin_setting_configcheckbox('debugdisplay', get_string('debugdisplay', 'admin'), get_string('configdebugdisplay', 'admin'), ini_get_bool('display_errors')));
|
||||
$temp->add(new admin_setting_configcheckbox('xmlstrictheaders', get_string('xmlstrictheaders', 'admin'), get_string('configxmlstrictheaders', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_debugdisplay());
|
||||
$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('perfdebug', get_string('perfdebug', 'admin'), get_string('configperfdebug', 'admin'), '7', '15', '7'));
|
||||
$temp->add(new admin_setting_special_perfdebug());
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -123,9 +105,7 @@ $temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirs
|
||||
60*60*24*140 => get_string('nummonths','moodle',5),
|
||||
60*60*24*168 => get_string('nummonths','moodle',6),
|
||||
'all' => get_string('all') )));
|
||||
$temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime3', 'admin'), 0, array(0 => get_string('untilcomplete'),
|
||||
60*30 => '10 '.get_string('minutes'),
|
||||
60*30 => '30 '.get_string('minutes'),
|
||||
$temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime', 'admin'), 0, array(0 => get_string('untilcomplete'),
|
||||
60*60 => '1 '.get_string('hour'),
|
||||
60*60*2 => '2 '.get_string('hours'),
|
||||
60*60*3 => '3 '.get_string('hours'),
|
||||
@@ -134,36 +114,17 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsma
|
||||
60*60*6 => '6 '.get_string('hours'),
|
||||
60*60*7 => '7 '.get_string('hours'),
|
||||
60*60*8 => '8 '.get_string('hours') )));
|
||||
$temp->add(new admin_setting_configtext('statsruntimedays', get_string('statsruntimedays', 'admin'), get_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
|
||||
$temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
|
||||
|
||||
$options = array(0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6);
|
||||
$temp->add(new admin_setting_configselect('statscatdepth', get_string('statscatdepth', 'admin'), get_string('configstatscatdepth', 'admin'), 1, $options));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
// "http" settingpage
|
||||
$temp = new admin_settingpage('http', get_string('http', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT));
|
||||
$temp->add(new admin_setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
|
||||
$temp->add(new admin_setting_heading('reverseproxy', get_string('reverseproxy', 'admin'), '', ''));
|
||||
$options = array(
|
||||
0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
|
||||
GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
|
||||
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
|
||||
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
|
||||
$temp->add(new admin_setting_configselect('getremoteaddrconf', get_string('getremoteaddrconf', 'admin'), get_string('configgetremoteaddrconf', 'admin'), 0, $options));
|
||||
$temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
|
||||
$temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
|
||||
$options = array('HTTP'=>'HTTP');
|
||||
if (defined('CURLPROXY_SOCKS5')) {
|
||||
$options['SOCKS5'] = 'SOCKS5';
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('proxytype', get_string('proxytype', 'admin'), get_string('configproxytype','admin'), 'HTTP', $options));
|
||||
$temp->add(new admin_setting_configtext('proxyuser', get_string('proxyuser', 'admin'), get_string('configproxyuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configpasswordunmask('proxypassword', get_string('proxypassword', 'admin'), get_string('configproxypassword', 'admin'), ''));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
$ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
|
||||
@@ -194,15 +155,6 @@ $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),
|
||||
@@ -211,22 +163,7 @@ $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime
|
||||
120 => get_string('numdays', '', 120),
|
||||
90 => get_string('numdays', '', 90),
|
||||
60 => get_string('numdays', '', 60),
|
||||
35 => get_string('numdays', '', 35))));
|
||||
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
|
||||
get_string('configdisablegradehistory', 'grades'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
|
||||
get_string('configgradehistorylifetime', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
|
||||
1000 => get_string('numdays', '', 1000),
|
||||
365 => get_string('numdays', '', 365),
|
||||
180 => get_string('numdays', '', 180),
|
||||
150 => get_string('numdays', '', 150),
|
||||
120 => get_string('numdays', '', 120),
|
||||
90 => get_string('numdays', '', 90),
|
||||
60 => get_string('numdays', '', 60),
|
||||
30 => get_string('numdays', '', 30))));
|
||||
30 => get_string('numdays', '', 30))));
|
||||
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
@@ -238,17 +175,17 @@ $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "
|
||||
|
||||
// "performance" settingpage
|
||||
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
|
||||
$temp->add(new admin_setting_special_selectsetup('cachetype', get_string('cachetype', 'admin'),
|
||||
get_string('configcachetype', 'admin'), '',
|
||||
array( '' => get_string('none'),
|
||||
'internal' => 'internal',
|
||||
'memcached' => 'memcached',
|
||||
$temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
|
||||
get_string('configcachetype', 'admin'), false,
|
||||
array( '' => 'none',
|
||||
'internal' => 'internal',
|
||||
'memcached' => 'memcached',
|
||||
'eaccelerator' => 'eaccelerator')));
|
||||
// NOTE: $CFG->rcache is forced to bool in lib/setup.php
|
||||
$temp->add(new admin_setting_special_selectsetup('rcache', get_string('rcache', 'admin'),
|
||||
get_string('configrcache', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
'1' => get_string('yes'))));
|
||||
$temp->add(new admin_setting_configselect('rcache', get_string('rcache', 'admin'),
|
||||
get_string('configrcache', 'admin'), false,
|
||||
array( '0' => 'false',
|
||||
'1' => 'true')));
|
||||
$temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
|
||||
get_string('configrcachettl', 'admin'), 10));
|
||||
$temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
|
||||
@@ -256,15 +193,13 @@ $temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax',
|
||||
$temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
|
||||
get_string('configmemcachedhosts', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
|
||||
get_string('configmemcachedpconn', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
'1' => get_string('yes'))));
|
||||
get_string('configmemcachedpconn', 'admin'), false,
|
||||
array( '0' => 'false',
|
||||
'1' => 'true')));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
|
||||
$ADMIN->add('server', new admin_externalpage('database', get_string('managedatabase'), "$CFG->wwwroot/$CFG->admin/mysql/frame.php"));
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+8
-24
@@ -5,26 +5,23 @@
|
||||
// since they need to exist *before* settingpages and externalpages
|
||||
// are added to them.
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (get_site()) {
|
||||
$hassiteconfig = has_capability('moodle/site:config', $systemcontext);
|
||||
} else {
|
||||
// installation starts - no permission checks
|
||||
$hassiteconfig = true;
|
||||
}
|
||||
|
||||
$ADMIN->add('root', new admin_externalpage('adminnotifications', get_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
|
||||
|
||||
// hidden upgrade script
|
||||
$ADMIN->add('root', new admin_externalpage('upgradesettings', get_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
|
||||
|
||||
// hidden search script
|
||||
$ADMIN->add('root', new admin_externalpage('search', get_string('search', 'admin'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
|
||||
|
||||
$ADMIN->add('root', new admin_category('users', get_string('users','admin')));
|
||||
$ADMIN->add('root', new admin_category('courses', get_string('courses','admin')));
|
||||
$ADMIN->add('root', new admin_category('grades', get_string('grades')));
|
||||
$ADMIN->add('root', new admin_category('location', get_string('location','admin')));
|
||||
$ADMIN->add('root', new admin_category('language', get_string('language')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('modules', get_string('plugins', 'admin')));
|
||||
$ADMIN->add('modules', new admin_externalpage('managemodules', get_string('activities'), "$CFG->wwwroot/$CFG->admin/modules.php"));
|
||||
$ADMIN->add('modules', new admin_externalpage('manageblocks', get_string('blocks'), "$CFG->wwwroot/$CFG->admin/blocks.php"));
|
||||
$ADMIN->add('modules', new admin_externalpage('managefilters', get_string('managefilters'), "$CFG->wwwroot/$CFG->admin/filters.php"));
|
||||
|
||||
$ADMIN->add('root', new admin_category('security', get_string('security','admin')));
|
||||
$ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin')));
|
||||
@@ -33,23 +30,13 @@ $ADMIN->add('root', new admin_category('server', get_string('server','admin')));
|
||||
$ADMIN->add('root', new admin_category('mnet', get_string('net','mnet')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
|
||||
foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
|
||||
foreach (get_list_of_plugins('admin/report') as $plugin) {
|
||||
/// This snippet is temporary until simpletest can be fixed to use xmldb. See MDL-7377 XXX TODO
|
||||
if ($plugin == 'simpletest' && $CFG->dbfamily != 'mysql' && $CFG->dbfamily != 'postgres') {
|
||||
continue;
|
||||
}
|
||||
/// End of removable snippet
|
||||
$reportname = get_string($plugin, 'report_' . $plugin);
|
||||
if ($reportname[1] == '[') {
|
||||
$reportname = get_string($plugin, 'admin');
|
||||
}
|
||||
// ugly hack for special access control in reports
|
||||
switch($plugin) {
|
||||
case 'backups': $cap = 'moodle/site:backup'; break;
|
||||
case 'simpletest': $cap = 'moodle/site:config'; break;
|
||||
default: $cap = 'moodle/site:viewreports';
|
||||
}
|
||||
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php",$cap));
|
||||
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, get_string($plugin, 'admin'), "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php"));
|
||||
}
|
||||
|
||||
$ADMIN->add('root', new admin_category('misc', get_string('miscellaneous')));
|
||||
@@ -57,7 +44,4 @@ $ADMIN->add('root', new admin_category('misc', get_string('miscellaneous')));
|
||||
// hidden unsupported category
|
||||
$ADMIN->add('root', new admin_category('unsupported', get_string('unsupported', 'admin'), true));
|
||||
|
||||
// hidden search script
|
||||
$ADMIN->add('root', new admin_externalpage('search', get_string('searchresults'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
|
||||
|
||||
?>
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
// This file defines settingpages and externalpages in the "unsupported" hidden category, use wisely!
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php'));
|
||||
|
||||
$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php', 'moodle/site:config', true));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+83
-157
@@ -2,173 +2,99 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "users" category
|
||||
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:uploadusers', $systemcontext)
|
||||
or has_capability('moodle/user:create', $systemcontext)
|
||||
or has_capability('moodle/user:update', $systemcontext)
|
||||
or has_capability('moodle/user:delete', $systemcontext)
|
||||
or has_capability('moodle/role:manage', $systemcontext)
|
||||
or has_capability('moodle/role:assign', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$ADMIN->add('users', new admin_externalpage('userauthentication', get_string('authentication','admin'), "$CFG->wwwroot/$CFG->admin/auth.php"));
|
||||
|
||||
|
||||
$ADMIN->add('users', new admin_category('authsettings', get_string('authentication','admin')));
|
||||
|
||||
$temp = new admin_settingpage('manageauths', get_string('authsettings', 'admin'));
|
||||
$temp->add(new admin_setting_manageauths());
|
||||
$temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), ''));
|
||||
$temp->add(new admin_setting_special_registerauth());
|
||||
$temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'),
|
||||
get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show'))));
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', get_string('alternateloginurl', 'auth'),
|
||||
get_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php')), ''));
|
||||
$temp->add(new admin_setting_configtext('forgottenpasswordurl', get_string('forgottenpasswordurl', 'auth'),
|
||||
get_string('forgottenpassword', 'auth'), ''));
|
||||
$temp->add(new admin_setting_configtextarea('auth_instructions', get_string('instructions', 'auth'),
|
||||
get_string('authinstructions', 'auth'), ''));
|
||||
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('verifychangedemail', get_string('verifychangedemail', 'admin'), get_string('configverifychangedemail', 'admin'), 1));
|
||||
|
||||
$temp->add(new admin_setting_configtext('recaptchapublickey', get_string('recaptchapublickey', 'admin'), get_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('recaptchaprivatekey', get_string('recaptchaprivatekey', 'admin'), get_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS));
|
||||
$ADMIN->add('authsettings', $temp);
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
|
||||
|
||||
if ($auths = get_list_of_plugins('auth')) {
|
||||
$authsenabled = get_enabled_auth_plugins();
|
||||
$authbyname = array();
|
||||
|
||||
foreach ($auths as $auth) {
|
||||
$strauthname = get_string("auth_{$auth}title", "auth");
|
||||
if ($strauthname == "[[auth_{$auth}title]]") {
|
||||
$strauthname = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
$authbyname[$strauthname] = $auth;
|
||||
}
|
||||
ksort($authbyname);
|
||||
|
||||
foreach ($authbyname as $strauthname=>$authname) {
|
||||
if (file_exists($CFG->dirroot.'/auth/'.$authname.'/settings.php')) {
|
||||
// do not show disabled auths in tree, keep only settings link on manage page
|
||||
$settings = new admin_settingpage('authsetting'.$authname, $strauthname, 'moodle/site:config', !in_array($authname, $authsenabled));
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/auth/'.$authname.'/settings.php');
|
||||
}
|
||||
// TODO: finish implementation of common settings - locking, etc.
|
||||
$ADMIN->add('authsettings', $settings);
|
||||
|
||||
} else {
|
||||
$ADMIN->add('authsettings', new admin_externalpage('authsetting'.$authname, $strauthname, "$CFG->wwwroot/$CFG->admin/auth_config.php?auth=$authname", 'moodle/site:config', !in_array($authname, $authsenabled)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// stuff under the "roles" subcategory
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php"));
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $sitecontext->id));
|
||||
|
||||
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
// "userpolicies" settingpage
|
||||
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (!$guestrole = get_guest_role()) {
|
||||
$guestrole->id = 0;
|
||||
}
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
$studentrole = array_shift($studentroles); /// Take the first one
|
||||
} else {
|
||||
$studentrole->id = 0;
|
||||
}
|
||||
if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
|
||||
$userrole = array_shift($userroles); /// Take the first one
|
||||
} else {
|
||||
$userrole->id = 0;
|
||||
}
|
||||
if (empty($CFG->creatornewroleid)) {
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
set_config('creatornewroleid', $teachereditrole->id);
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
set_config('creatornewroleid', 0);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
|
||||
|
||||
// stuff under the "roles" subcategory
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php", 'moodle/role:manage'));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, 'moodle/role:assign'));
|
||||
|
||||
|
||||
// "userpolicies" settingpage
|
||||
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (!$guestrole = get_guest_role()) {
|
||||
$guestrole->id = 0;
|
||||
}
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
$studentrole = array_shift($studentroles); /// Take the first one
|
||||
} else {
|
||||
$studentrole->id = 0;
|
||||
}
|
||||
if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
|
||||
$userrole = array_shift($userroles); /// Take the first one
|
||||
} else {
|
||||
$userrole->id = 0;
|
||||
}
|
||||
if (empty($CFG->creatornewroleid)) {
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
set_config('creatornewroleid', $teachereditrole->id);
|
||||
} else {
|
||||
set_config('creatornewroleid', 0);
|
||||
}
|
||||
}
|
||||
if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
|
||||
$guestroles = array();
|
||||
}
|
||||
// we must not use assignable roles here:
|
||||
// 1/ unsetting roles as assignable for admin might bork the settings!
|
||||
// 2/ default user role should not be assignable anyway
|
||||
$allroles = array();
|
||||
$nonguestroles = array();
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$rolename = strip_tags(format_string($role->name, true));
|
||||
$allroles[$role->id] = $rolename;
|
||||
if (!isset($guestroles[$role->id])) {
|
||||
$nonguestroles[$role->id] = $rolename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
|
||||
$temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
|
||||
get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
|
||||
get_string('configdefaultuserroleid', 'admin'), $userrole->id, $nonguestroles)); // guest role here breaks a lot of stuff
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('nodefaultuserrolelists', get_string('nodefaultuserrolelists', 'admin'), get_string('confignodefaultuserrolelists', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
|
||||
get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
|
||||
get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
|
||||
get_string('confighiddenuserfields', 'admin'), array(),
|
||||
array('description' => get_string('description'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'),
|
||||
'webpage' => get_string('webpage'),
|
||||
'icqnumber' => get_string('icqnumber'),
|
||||
'skypeid' => get_string('skypeid'),
|
||||
'yahooid' => get_string('yahooid'),
|
||||
'aimid' => get_string('aimid'),
|
||||
'msnid' => get_string('msnid'),
|
||||
'lastaccess' => get_string('lastaccess'))));
|
||||
}
|
||||
// we must not use assignable roles here:
|
||||
// 1/ unsetting roles as assignable for admin might bork the settings!
|
||||
// 2/ default user role should not be assignable anyway
|
||||
$allroles = array();
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$allroles[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->add('roles', $temp);
|
||||
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
|
||||
$temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
|
||||
get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
|
||||
get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
|
||||
get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
|
||||
get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
|
||||
|
||||
//$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
|
||||
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
|
||||
get_string('confighiddenuserfields', 'admin'), array(),
|
||||
array('none' => get_string('none'),
|
||||
'description' => get_string('description'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'),
|
||||
'webpage' => get_string('webpage'),
|
||||
'icqnumber' => get_string('icqnumber'),
|
||||
'skypeid' => get_string('skypeid'),
|
||||
'yahooid' => get_string('yahooid'),
|
||||
'aimid' => get_string('aimid'),
|
||||
'msnid' => get_string('msnid'),
|
||||
'lastaccess' => get_string('lastaccess'))));
|
||||
//$temp->add(new admin_setting_special_adminseesall());
|
||||
|
||||
|
||||
$ADMIN->add('roles', $temp);
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+16
-24
@@ -1,5 +1,5 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/my/pagelib.php');
|
||||
require_once($CFG->dirroot.'/lib/pagelib.php');
|
||||
@@ -10,7 +10,7 @@
|
||||
$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
|
||||
'lib' => '/my/pagelib.php',
|
||||
'name' => get_string('mymoodle','admin')),
|
||||
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
|
||||
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
|
||||
'lib' => '/lib/pagelib.php',
|
||||
'name' => get_string('stickyblockscourseview','admin'))
|
||||
// ... more?
|
||||
@@ -23,48 +23,43 @@
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
// first thing to do is print the dropdown menu
|
||||
|
||||
$strtitle = get_string('stickyblocks','admin');
|
||||
$strheading = get_string('adminhelpstickyblocks');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
|
||||
require_once($CFG->dirroot.$pagetypes[$pt]['lib']);
|
||||
|
||||
|
||||
define('ADMIN_STICKYBLOCKS',$pt);
|
||||
|
||||
|
||||
$PAGE = page_create_object($pt, SITEID);
|
||||
$blocks = blocks_setup($PAGE,BLOCKS_PINNED_TRUE);
|
||||
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
|
||||
|
||||
$navlinks = array(array('name' => get_string('administration'),
|
||||
'link' => "$CFG->wwwroot/$CFG->admin/index.php",
|
||||
'type' => 'misc'));
|
||||
$navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header($strtitle,$strtitle,$navigation);
|
||||
|
||||
print_header($strtitle,$strtitle,'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.
|
||||
get_string('administration').'</a> -> '.$strtitle);
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
|
||||
echo '<tr valign="top">';
|
||||
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '<td valign="top" id="middle-column">';
|
||||
print_container_start();
|
||||
|
||||
} else {
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
admin_externalpage_setup('stickyblocks');
|
||||
admin_externalpage_print_header();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('stickyblocks', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,17 +71,14 @@
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
print_footer();
|
||||
} else {
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+2
-2
@@ -6,14 +6,14 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
$strtimezone = get_string("timezone");
|
||||
$strsavechanges = get_string("savechanges");
|
||||
$strusers = get_string("users");
|
||||
$strall = get_string("all");
|
||||
|
||||
print_header($strtimezone, $strtimezone, build_navigation(array(array('name' => $strtimezone, 'link' => null, 'type' => 'misc'))));
|
||||
print_header($strtimezone, $strtimezone, $strtimezone);
|
||||
|
||||
print_heading("");
|
||||
|
||||
|
||||
+24
-22
@@ -6,8 +6,9 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/olson.php');
|
||||
|
||||
admin_externalpage_setup('timezoneimport');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('timezoneimport', $adminroot);
|
||||
|
||||
$ok = optional_param('ok', 0, PARAM_BOOL);
|
||||
|
||||
@@ -16,23 +17,23 @@
|
||||
|
||||
$strimporttimezones = get_string('importtimezones', 'admin');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading($strimporttimezones);
|
||||
|
||||
if (!$ok or !confirm_sesskey()) {
|
||||
$message = '<br /><br />';
|
||||
$message .= $CFG->dataroot.'/temp/olson.txt<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 .= $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 .= '<br />';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
|
||||
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'index.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@
|
||||
|
||||
/// Next, look for a CSV file locally
|
||||
|
||||
$source = $CFG->dataroot.'/temp/timezone.txt';
|
||||
$source = $CFG->dataroot.'/temp/timezones.txt';
|
||||
if (!$importdone and is_readable($source)) {
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -62,22 +63,26 @@
|
||||
}
|
||||
|
||||
/// Otherwise, let's try moodle.org's copy
|
||||
$source = 'http://download.moodle.org/timezone/';
|
||||
if (!$importdone && ($content=download_file_content($source))) {
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezone.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $content);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezone.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
|
||||
$source = 'http://download.moodle.org/timezones/';
|
||||
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
|
||||
fwrite($file, $contents);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezones.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezones.txt');
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezone.txt');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Final resort, use the copy included in Moodle
|
||||
$source = $CFG->dirroot.'/lib/timezone.txt';
|
||||
|
||||
$source = $CFG->dirroot.'/lib/timezones.txt';
|
||||
if (!$importdone and is_readable($source)) { // Distribution file
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -98,9 +103,6 @@
|
||||
|
||||
$timezonelist = array();
|
||||
foreach ($timezones as $timezone) {
|
||||
if (is_array($timezone)) {
|
||||
$timezone = (object)$timezone;
|
||||
}
|
||||
if (isset($timezonelist[$timezone->name])) {
|
||||
$timezonelist[$timezone->name]++;
|
||||
} else {
|
||||
@@ -121,6 +123,6 @@
|
||||
print_continue('index.php');
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('upgradeforumread');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('upgradeforumread', $adminroot);
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if ($CFG->version < 2005042300) {
|
||||
error("This script does not work with this old version of Moodle");
|
||||
}
|
||||
@@ -21,14 +25,14 @@
|
||||
|
||||
$strupgradingdata = get_string('upgradingdata', 'admin');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading($strupgradingdata);
|
||||
|
||||
if (!data_submitted() or empty($confirm) or !confirm_sesskey()) {
|
||||
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
|
||||
notice_yesno(get_string('upgradeforumreadinfo', 'admin'),
|
||||
'upgradeforumread.php', 'index.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -82,7 +86,7 @@
|
||||
/// If its a group discussion, make sure the user is in the group.
|
||||
if ($discussion->groupid) {
|
||||
if (!isset($groups[$discussion->groupid][$user->id])) {
|
||||
$groups[$discussion->groupid][$user->id] = groups_is_member($discussion->groupid, $user->id);
|
||||
$groups[$discussion->groupid][$user->id] = ismember($discussion->groupid, $user->id);
|
||||
}
|
||||
}
|
||||
if (!$discussion->groupid || !empty($groups[$discussion->groupid][$user->id])) {
|
||||
@@ -104,6 +108,6 @@
|
||||
|
||||
print_continue('index.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('upgradelogs');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('upgradelogs', $adminroot);
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if ($CFG->version < 2004013101) {
|
||||
error("This script does not work with this old version of Moodle");
|
||||
}
|
||||
@@ -25,14 +29,14 @@
|
||||
/// Print header
|
||||
|
||||
$strupgradinglogs = get_string("upgradinglogs", "admin");
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading($strupgradinglogs);
|
||||
|
||||
if (!data_submitted() or empty($confirm) or !confirm_sesskey()) {
|
||||
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
|
||||
notice_yesno(get_string('upgradeforumreadinfo', 'admin'),
|
||||
'upgradelogs.php', 'index.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -120,6 +124,6 @@
|
||||
|
||||
print_continue('index.php');
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
+112
-38
@@ -6,67 +6,141 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$return = optional_param('return', '', PARAM_ALPHA);
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('upgradesettings', $adminroot); // now hidden page
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
// a caveat: we're depending on only having one admin access this page at once. why? the following line
|
||||
// (the function call to find_new_settings) must have the EXACT SAME RETURN VALUE both times that this
|
||||
// page is loaded (i.e. both when we're displaying the form and then when we process the form's input).
|
||||
// if the return values don't match, we could potentially lose changes that the admin is making.
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings
|
||||
admin_externalpage_setup('upgradesettings'); // now hidden page
|
||||
$newsettingshtml = output_new_settings_by_page(admin_get_root());
|
||||
|
||||
// first we deal with the case where there are no new settings to be set
|
||||
if ($newsettingshtml == '') {
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
|
||||
die;
|
||||
}
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with new settings
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
$count = admin_write_settings($data);
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
}
|
||||
if ($data = data_submitted()) {
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$newsettings = find_new_settings(admin_get_root());
|
||||
$errors = '';
|
||||
|
||||
$newsettings = admin_output_new_settings_by_page($adminroot);
|
||||
if (isset($newsettings['frontpagesettings'])) {
|
||||
$frontpage = $newsettings['frontpagesettings'];
|
||||
unset($newsettings['frontpagesettings']);
|
||||
array_unshift($newsettings, $frontpage);
|
||||
}
|
||||
$newsettingshtml = implode($newsettings);
|
||||
unset($newsettings);
|
||||
foreach($newsettings as $newsetting) {
|
||||
if (isset($unslashed['s_' . $newsetting->name])) {
|
||||
$errors .= $newsetting->write_setting($unslashed['s_' . $newsetting->name]);
|
||||
} else {
|
||||
$errors .= $newsetting->write_setting($newsetting->defaultsetting);
|
||||
}
|
||||
}
|
||||
|
||||
$focus = '';
|
||||
|
||||
if (empty($adminroot->errors) and $newsettingshtml === '') {
|
||||
// there must be either redirect without message or continue button or else upgrade would be sometimes broken
|
||||
if ($return == 'site') {
|
||||
redirect("$CFG->wwwroot/");
|
||||
if (empty($errors)) {
|
||||
// there must be either redirect without message or continue button or else upgrade would be sometimes broken
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
|
||||
die;
|
||||
} else {
|
||||
error(get_string('errorwithsettings', 'admin') . ' <br />' . $errors);
|
||||
die;
|
||||
}
|
||||
} else {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
}
|
||||
|
||||
// and finally, if we get here, then there are new settings and we have to print a form
|
||||
// to modify them
|
||||
admin_externalpage_print_header($focus);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box(get_string('upgradesettingsintro','admin'), 'generalbox');
|
||||
print_simple_box(get_string('upgradesettingsintro','admin'),'','100%','',5,'generalbox','');
|
||||
|
||||
echo '<form action="upgradesettings.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
echo $newsettingshtml;
|
||||
echo '</fieldset>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($CFG->adminusehtmleditor)) {
|
||||
use_html_editor();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
/**
|
||||
* Find settings that have not been initialized (e.g. during initial install or an upgrade).
|
||||
*
|
||||
* Tests each setting's get_setting() method. If the result is NULL, we consider the setting
|
||||
* to be uninitialized.
|
||||
*
|
||||
* @param string &$node The node at which to start searching. Should be $ADMIN for all external calls to this function.
|
||||
* @return array An array containing admin_setting objects that haven't yet been initialized
|
||||
*/
|
||||
function find_new_settings(&$node) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$return = array();
|
||||
$entries = array_keys($node->children);
|
||||
foreach ($entries as $entry) {
|
||||
$return = array_merge($return, find_new_settings($node->children[$entry]));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$return = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if ($setting->get_setting() === NULL) {
|
||||
$return[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
print_footer();
|
||||
function output_new_settings_by_page(&$node) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$entries = array_keys($node->children);
|
||||
$return = '';
|
||||
foreach ($entries as $entry) {
|
||||
$return .= output_new_settings_by_page($node->children[$entry]);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$newsettings = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if ($setting->get_setting() === NULL) {
|
||||
$newsettings[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
$return = '';
|
||||
if (count($newsettings) > 0) {
|
||||
$return .= print_heading(get_string('upgradesettings','admin').' - '.$node->visiblename, '', 2, 'main', true);
|
||||
$return .= '<fieldset class="adminsettings">' . "\n";
|
||||
foreach ($newsettings as $newsetting) {
|
||||
$return .= '<div class="clearer"><!-- --></div>' . "\n";
|
||||
$return .= $newsetting->output_html();
|
||||
}
|
||||
$return .= '</fieldset>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Copyright (C) 2007 Inaki Arenaza //
|
||||
// //
|
||||
// Based on .../admin/uploaduser.php and .../lib/gdlib.php //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/uploadlib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/gdlib.php');
|
||||
require_once('uploadpicture_form.php');
|
||||
|
||||
define ('PIX_FILE_UPDATED', 0);
|
||||
define ('PIX_FILE_ERROR', 1);
|
||||
define ('PIX_FILE_SKIPPED', 2);
|
||||
|
||||
admin_externalpage_setup('uploadpictures');
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
}
|
||||
|
||||
$strfile = get_string('file');
|
||||
$struser = get_string('user');
|
||||
$strusersupdated = get_string('usersupdated');
|
||||
$struploadpictures = get_string('uploadpictures','admin');
|
||||
|
||||
$userfields = array (
|
||||
0 => 'username',
|
||||
1 => 'idnumber',
|
||||
2 => 'id' );
|
||||
|
||||
$userfield = optional_param('userfield', 0, PARAM_INT);
|
||||
$overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
|
||||
|
||||
/// Print the header
|
||||
admin_externalpage_print_header();
|
||||
print_heading_with_help($struploadpictures, 'uploadpictures');
|
||||
|
||||
$mform = new admin_uploadpicture_form();
|
||||
if ($formdata = $mform->get_data()) {
|
||||
if (!array_key_exists($userfield, $userfields)) {
|
||||
notify(get_string('uploadpicture_baduserfield','admin'));
|
||||
} else {
|
||||
// Large files are likely to take their time and memory. Let PHP know
|
||||
// that we'll take longer, and that the process should be recycled soon
|
||||
// to free up memory.
|
||||
@set_time_limit(0);
|
||||
@raise_memory_limit("192M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
@apache_child_terminate();
|
||||
}
|
||||
|
||||
// Create a unique temporary directory, to process the zip file
|
||||
// contents.
|
||||
$zipdir = my_mktempdir($CFG->dataroot.'/temp/', 'usrpic');
|
||||
|
||||
if (!$mform->save_files($zipdir)) {
|
||||
notify(get_string('uploadpicture_cannotmovezip','admin'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
$dstfile = $zipdir.'/'.$mform->get_new_filename();
|
||||
if(!unzip_file($dstfile, $zipdir, false)) {
|
||||
notify(get_string('uploadpicture_cannotunzip','admin'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
// We don't need the zip file any longer, so delete it to make
|
||||
// it easier to process the rest of the files inside the directory.
|
||||
@unlink($dstfile);
|
||||
|
||||
$results = array ('errors' => 0,'updated' => 0);
|
||||
|
||||
process_directory($zipdir, $userfields[$userfield], $overwritepicture, $results);
|
||||
|
||||
// Finally remove the temporary directory with all the user images and print some stats.
|
||||
remove_dir($zipdir);
|
||||
notify(get_string('usersupdated', 'admin') . ": " . $results['updated']);
|
||||
notify(get_string('errors', 'admin') . ": " . $results['errors']);
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$mform->display();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
|
||||
// ----------- Internal functions ----------------
|
||||
|
||||
/**
|
||||
* Create a unique temporary directory with a given prefix name,
|
||||
* inside a given directory, with given permissions. Return the
|
||||
* full path to the newly created temp directory.
|
||||
*
|
||||
* @param string $dir where to create the temp directory.
|
||||
* @param string $prefix prefix for the temp directory name (default '')
|
||||
* @param string $mode permissions for the temp directory (default 700)
|
||||
*
|
||||
* @return string The full path to the temp directory.
|
||||
*/
|
||||
function my_mktempdir($dir, $prefix='', $mode=0700) {
|
||||
if (substr($dir, -1) != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
do {
|
||||
$path = $dir.$prefix.mt_rand(0, 9999999);
|
||||
} while (!mkdir($path, $mode));
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively process a directory, picking regular files and feeding
|
||||
* them to process_file().
|
||||
*
|
||||
* @param string $dir the full path of the directory to process
|
||||
* @param string $userfield the prefix_user table field to use to
|
||||
* match picture files to users.
|
||||
* @param bool $overwrite overwrite existing picture or not.
|
||||
* @param array $results (by reference) accumulated statistics of
|
||||
* users updated and errors.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function process_directory ($dir, $userfield, $overwrite, &$results) {
|
||||
if(!($handle = opendir($dir))) {
|
||||
notify(get_string('uploadpicture_cannotprocessdir','admin'));
|
||||
return;
|
||||
}
|
||||
|
||||
while (false !== ($item = readdir($handle))) {
|
||||
if ($item != '.' && $item != '..') {
|
||||
if (is_dir($dir.'/'.$item)) {
|
||||
process_directory($dir.'/'.$item, $userfield, $overwrite, $results);
|
||||
} else if (is_file($dir.'/'.$item)) {
|
||||
$result = process_file($dir.'/'.$item, $userfield, $overwrite);
|
||||
switch ($result) {
|
||||
case PIX_FILE_ERROR:
|
||||
$results['errors']++;
|
||||
break;
|
||||
case PIX_FILE_UPDATED:
|
||||
$results['updated']++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Ignore anything else that is not a directory or a file (e.g.,
|
||||
// symbolic links, sockets, pipes, etc.)
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the full path of a file, try to find the user the file
|
||||
* corresponds to and assign him/her this file as his/her picture.
|
||||
* Make extensive checks to make sure we don't open any security holes
|
||||
* and report back any success/error.
|
||||
*
|
||||
* @param string $file the full path of the file to process
|
||||
* @param string $userfield the prefix_user table field to use to
|
||||
* match picture files to users.
|
||||
* @param bool $overwrite overwrite existing picture or not.
|
||||
*
|
||||
* @return integer either PIX_FILE_UPDATED, PIX_FILE_ERROR or
|
||||
* PIX_FILE_SKIPPED
|
||||
*/
|
||||
function process_file ($file, $userfield, $overwrite) {
|
||||
// Add additional checks on the filenames, as they are user
|
||||
// controlled and we don't want to open any security holes.
|
||||
$path_parts = pathinfo(cleardoubleslashes($file));
|
||||
$basename = $path_parts['basename'];
|
||||
$extension = $path_parts['extension'];
|
||||
if ($basename != clean_param($basename, PARAM_CLEANFILE)) {
|
||||
// The original picture file name has invalid characters
|
||||
notify(get_string('uploadpicture_invalidfilename', 'admin',
|
||||
clean_param($basename, PARAM_CLEANHTML)));
|
||||
return PIX_FILE_ERROR;
|
||||
}
|
||||
|
||||
// The picture file name (without extension) must match the
|
||||
// userfield attribute.
|
||||
$uservalue = substr($basename, 0,
|
||||
strlen($basename) -
|
||||
strlen($extension) - 1);
|
||||
|
||||
// userfield names are safe, so don't quote them.
|
||||
if (!($user = get_record('user', $userfield, addslashes($uservalue)))) {
|
||||
$a = new Object();
|
||||
$a->userfield = clean_param($userfield, PARAM_CLEANHTML);
|
||||
$a->uservalue = clean_param($uservalue, PARAM_CLEANHTML);
|
||||
notify(get_string('uploadpicture_usernotfound', 'admin', $a));
|
||||
return PIX_FILE_ERROR;
|
||||
}
|
||||
|
||||
$haspicture = get_field('user', 'picture', 'id', $user->id);
|
||||
if ($haspicture && !$overwrite) {
|
||||
notify(get_string('uploadpicture_userskipped', 'admin', $user->username));
|
||||
return PIX_FILE_SKIPPED;
|
||||
}
|
||||
|
||||
if (my_save_profile_image($user->id, $file)) {
|
||||
set_field('user', 'picture', 1, 'id', $user->id);
|
||||
notify(get_string('uploadpicture_userupdated', 'admin', $user->username));
|
||||
return PIX_FILE_UPDATED;
|
||||
} else {
|
||||
notify(get_string('uploadpicture_cannotsave', 'admin', $user->username));
|
||||
return PIX_FILE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to save the given file (specified by its full path) as the
|
||||
* picture for the user with the given id.
|
||||
*
|
||||
* @param integer $id the internal id of the user to assign the
|
||||
* picture file to.
|
||||
* @param string $originalfile the full path of the picture file.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function my_save_profile_image($id, $originalfile) {
|
||||
$destination = create_profile_image_destination($id, 'user');
|
||||
if ($destination === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return process_profile_image($originalfile, $destination);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php // $Id$
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploadpicture_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
global $userfields;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$this->set_upload_manager(new upload_manager('userpicturesfile', false, false, null, false, 0, true, true, false));
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
$mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');
|
||||
$mform->addRule('userpicturesfile', null, 'required');
|
||||
|
||||
$choices = $userfields;
|
||||
$mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
|
||||
$mform->setType('userfield', PARAM_INT);
|
||||
|
||||
$choices = array( 0 => get_string('no'), 1 => get_string('yes') );
|
||||
$mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
|
||||
$mform->setType('overwritepicture', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadpictures', 'admin'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
+361
-932
File diff suppressed because it is too large
Load Diff
@@ -1,336 +0,0 @@
|
||||
<?php // $Id$
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploaduser_form1 extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$this->set_upload_manager(new upload_manager('userfile', false, false, null, false, 0, true, true, false));
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
$mform->addElement('file', 'userfile', get_string('file'), 'size="40"');
|
||||
$mform->addRule('userfile', null, 'required');
|
||||
|
||||
$choices = csv_import_reader::get_delimiter_list();
|
||||
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'admin'), $choices);
|
||||
if (array_key_exists('cfg', $choices)) {
|
||||
$mform->setDefault('delimiter_name', 'cfg');
|
||||
} else if (get_string('listsep') == ';') {
|
||||
$mform->setDefault('delimiter_name', 'semicolon');
|
||||
} else {
|
||||
$mform->setDefault('delimiter_name', 'comma');
|
||||
}
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$choices = $textlib->get_encodings();
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'admin'), $choices);
|
||||
$mform->setDefault('encoding', 'UTF-8');
|
||||
|
||||
$choices = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
|
||||
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'admin'), $choices);
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadusers'));
|
||||
}
|
||||
}
|
||||
|
||||
class admin_uploaduser_form2 extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
|
||||
//no editors here - we need proper empty fields
|
||||
$CFG->htmleditor = null;
|
||||
|
||||
$mform =& $this->_form;
|
||||
$columns =& $this->_customdata;
|
||||
|
||||
// I am the template user, why should it be the administrator? we have roles now, other ppl may use this script ;-)
|
||||
$templateuser = $USER;
|
||||
|
||||
// upload settings and file
|
||||
$mform->addElement('header', 'settingsheader', get_string('settings'));
|
||||
|
||||
$choices = array(UU_ADDNEW => get_string('uuoptype_addnew', 'admin'),
|
||||
UU_ADDINC => get_string('uuoptype_addinc', 'admin'),
|
||||
UU_ADD_UPDATE => get_string('uuoptype_addupdate', 'admin'),
|
||||
UU_UPDATE => get_string('uuoptype_update', 'admin'));
|
||||
$mform->addElement('select', 'uutype', get_string('uuoptype', 'admin'), $choices);
|
||||
|
||||
$choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
|
||||
$mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'admin'), $choices);
|
||||
$mform->setDefault('uupasswordnew', 0);
|
||||
$mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_UPDATE);
|
||||
|
||||
$choices = array(0 => get_string('nochanges', 'admin'),
|
||||
1 => get_string('uuupdatefromfile', 'admin'),
|
||||
2 => get_string('uuupdateall', 'admin'),
|
||||
3 => get_string('uuupdatemissing', 'admin'));
|
||||
$mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'admin'), $choices);
|
||||
$mform->setDefault('uuupdatetype', 0);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$choices = array(0 => get_string('nochanges', 'admin'), 1 => get_string('update'));
|
||||
$mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'admin'), $choices);
|
||||
$mform->setDefault('uupasswordold', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDINC);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 3);
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'admin'));
|
||||
$mform->setDefault('uuallowrenames', 0);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'admin'));
|
||||
$mform->setDefault('uuallowdeletes', 0);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'admin'));
|
||||
$mform->setDefault('uunoemailduplicates', 0);
|
||||
|
||||
$choices = array(0 => get_string('no'),
|
||||
1 => get_string('uubulknew', 'admin'),
|
||||
2 => get_string('uubulkupdated', 'admin'),
|
||||
3 => get_string('uubulkall', 'admin'));
|
||||
$mform->addElement('select', 'uubulk', get_string('uubulk', 'admin'), $choices);
|
||||
$mform->setDefault('uubulk', 0);
|
||||
|
||||
// roles selection
|
||||
$showroles = false;
|
||||
foreach ($columns as $column) {
|
||||
if (preg_match('/^type\d+$/', $column)) {
|
||||
$showroles = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($showroles) {
|
||||
$mform->addElement('header', 'rolesheader', get_string('roles'));
|
||||
|
||||
$choices = uu_allowed_roles(true);
|
||||
|
||||
$choices[0] = get_string('uucoursedefaultrole', 'admin');
|
||||
$mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'admin'), $choices);
|
||||
$mform->setDefault('uulegacy1', 0);
|
||||
unset($choices[0]);
|
||||
|
||||
$mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'admin'), $choices);
|
||||
if ($editteacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW)) {
|
||||
$editteacherrole = array_shift($editteacherroles); /// Take the first one
|
||||
$mform->setDefault('uulegacy2', $editteacherrole->id);
|
||||
unset($editteacherroles);
|
||||
} else {
|
||||
$mform->setDefault('uulegacy2', $CFG->defaultcourseroleid);
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'admin'), $choices);
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
|
||||
$teacherrole = array_shift($teacherroles); /// Take the first one
|
||||
$mform->setDefault('uulegacy3', $teacherrole->id);
|
||||
unset($teacherroles);
|
||||
} else {
|
||||
$mform->setDefault('uulegacy3', $CFG->defaultcourseroleid);
|
||||
}
|
||||
}
|
||||
|
||||
// default values
|
||||
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
|
||||
|
||||
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
|
||||
$mform->addRule('username', get_string('requiredtemplate', 'admin'), 'required', null, 'client');
|
||||
|
||||
// only enabled and known to work plugins
|
||||
$choices = uu_allowed_auths();
|
||||
$mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $choices);
|
||||
$mform->setDefault('auth', 'manual'); // manual is a sensible backwards compatible default
|
||||
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod','auth')));
|
||||
$mform->setAdvanced('auth');
|
||||
|
||||
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
|
||||
|
||||
$choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
|
||||
$mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
|
||||
$mform->setDefault('maildisplay', 2);
|
||||
|
||||
$choices = array(0 => get_string('emailenable'), 1 => get_string('emaildisable'));
|
||||
$mform->addElement('select', 'emailstop', get_string('emailactive'), $choices);
|
||||
|
||||
$choices = array(0 => get_string('textformat'), 1 => get_string('htmlformat'));
|
||||
$mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
|
||||
$mform->setDefault('mailformat', 1);
|
||||
$mform->setAdvanced('mailformat');
|
||||
|
||||
$choices = array(0 => get_string('emaildigestoff'), 1 => get_string('emaildigestcomplete'), 2 => get_string('emaildigestsubjects'));
|
||||
$mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
|
||||
$mform->setDefault('maildigest', 0);
|
||||
$mform->setAdvanced('maildigest');
|
||||
|
||||
$choices = array(0 => get_string('autosubscribeyes'), 1 => get_string('autosubscribeno'));
|
||||
$mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
|
||||
$mform->setDefault('autosubscribe', 1);
|
||||
|
||||
if ($CFG->htmleditor) {
|
||||
$choices = array(0 => get_string('texteditor'), 1 => get_string('htmleditor'));
|
||||
$mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
|
||||
$mform->setDefault('htmleditor', 1);
|
||||
} else {
|
||||
$mform->addElement('static', 'htmleditor', get_string('textediting'), get_string('texteditor'));
|
||||
}
|
||||
$mform->setAdvanced('htmleditor');
|
||||
|
||||
if (empty($CFG->enableajax)) {
|
||||
$mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
|
||||
} else {
|
||||
$choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
|
||||
$mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
|
||||
$mform->setDefault('ajax', 1);
|
||||
}
|
||||
$mform->setAdvanced('ajax');
|
||||
|
||||
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
|
||||
$mform->setType('city', PARAM_MULTILANG);
|
||||
$mform->setDefault('city', $templateuser->city);
|
||||
|
||||
$mform->addElement('select', 'country', get_string('selectacountry'), get_list_of_countries());
|
||||
$mform->setDefault('country', $templateuser->country);
|
||||
$mform->setAdvanced('country');
|
||||
|
||||
$choices = get_list_of_timezones();
|
||||
$choices['99'] = get_string('serverlocaltime');
|
||||
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
|
||||
$mform->setDefault('timezone', $templateuser->timezone);
|
||||
$mform->setAdvanced('timezone');
|
||||
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
|
||||
$mform->setDefault('lang', $templateuser->lang);
|
||||
$mform->setAdvanced('lang');
|
||||
|
||||
$mform->addElement('htmleditor', 'description', get_string('userdescription'));
|
||||
$mform->setType('description', PARAM_CLEAN);
|
||||
$mform->setHelpButton('description', array('text', get_string('helptext')));
|
||||
$mform->setAdvanced('description');
|
||||
|
||||
$mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
|
||||
$mform->setAdvanced('url');
|
||||
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
|
||||
$mform->setType('idnumber', PARAM_CLEAN);
|
||||
|
||||
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
|
||||
$mform->setType('institution', PARAM_MULTILANG);
|
||||
$mform->setDefault('institution', $templateuser->institution);
|
||||
|
||||
$mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
|
||||
$mform->setType('department', PARAM_MULTILANG);
|
||||
$mform->setDefault('department', $templateuser->department);
|
||||
|
||||
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
|
||||
$mform->setType('phone1', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone1');
|
||||
|
||||
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
|
||||
$mform->setType('phone2', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone2');
|
||||
|
||||
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
|
||||
$mform->setType('address', PARAM_MULTILANG);
|
||||
$mform->setAdvanced('address');
|
||||
|
||||
/// Next the profile defaults
|
||||
profile_definition($mform);
|
||||
|
||||
// hidden fields
|
||||
$mform->addElement('hidden', 'iid');
|
||||
$mform->setType('iid', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'previewrows');
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'readcount');
|
||||
$mform->setType('readcount', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(true, get_string('uploadusers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Form tweaks that depend on current data.
|
||||
*/
|
||||
function definition_after_data() {
|
||||
$mform =& $this->_form;
|
||||
$columns =& $this->_customdata;
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if ($mform->elementExists($column)) {
|
||||
$mform->removeElement($column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Server side validation.
|
||||
*/
|
||||
function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
$columns =& $this->_customdata;
|
||||
$optype = $data['uutype'];
|
||||
|
||||
// detect if password column needed in file
|
||||
if (!in_array('password', $columns)) {
|
||||
switch ($optype) {
|
||||
case UU_UPDATE:
|
||||
if (!empty($data['uupasswordold'])) {
|
||||
$errors['uupasswordold'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
|
||||
case UU_ADD_UPDATE:
|
||||
if (empty($data['uupasswordnew'])) {
|
||||
$errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
if (!empty($data['uupasswordold'])) {
|
||||
$errors['uupasswordold'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
|
||||
case UU_ADDNEW:
|
||||
case UU_ADDINC:
|
||||
if (empty($data['uupasswordnew'])) {
|
||||
$errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// look for other required data
|
||||
if ($optype != UU_UPDATE) {
|
||||
if (!in_array('firstname', $columns)) {
|
||||
$errors['uutype'] = get_string('missingfield', 'error', 'firstname');
|
||||
}
|
||||
|
||||
if (!in_array('lastname', $columns)) {
|
||||
if (isset($errors['uutype'])) {
|
||||
$errors['uutype'] = '';
|
||||
} else {
|
||||
$errors['uutype'] = ' ';
|
||||
}
|
||||
$errors['uutype'] .= get_string('missingfield', 'error', 'lastname');
|
||||
}
|
||||
|
||||
if (!in_array('email', $columns) and empty($data['email'])) {
|
||||
$errors['email'] = get_string('requiredtemplate', 'admin');
|
||||
}
|
||||
|
||||
if (!in_array('city', $columns) and empty($data['city'])) {
|
||||
$errors['city'] = get_string('required');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
?>
|
||||
+152
-35
@@ -2,7 +2,6 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/user/filters/lib.php');
|
||||
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', '', PARAM_ALPHANUM); //md5 confirmation hash
|
||||
@@ -11,14 +10,47 @@
|
||||
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
|
||||
$search = trim(optional_param('search', '', PARAM_RAW));
|
||||
$lastinitial = optional_param('lastinitial', '', PARAM_CLEAN); // only show students with this last initial
|
||||
$firstinitial = optional_param('firstinitial', '', PARAM_CLEAN); // only show students with this first initial
|
||||
$ru = optional_param('ru', '2', PARAM_INT); // show remote users
|
||||
$lu = optional_param('lu', '2', PARAM_INT); // show local users
|
||||
$acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access)
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('editusers', $adminroot);
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
// Let's see if we have *any* mnet users. Just ask for a single record
|
||||
$mnet_users = get_records_select('user', " auth='mnet' AND mnethostid != '{$CFG->mnet_localhost_id}' ", '', '*', '0', '1');
|
||||
if(is_array($mnet_users) && count($mnet_users) > 0) {
|
||||
$mnet_auth_users = true;
|
||||
} else {
|
||||
$mnet_auth_users = false;
|
||||
}
|
||||
|
||||
if($mnet_auth_users) {
|
||||
// Determine which users we are looking at (local, remote, or both). Start with both.
|
||||
if (!isset($_SESSION['admin-user-remoteusers'])) {
|
||||
$_SESSION['admin-user-remoteusers'] = 1;
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
}
|
||||
if ($ru == 0 or $ru == 1) {
|
||||
$_SESSION['admin-user-remoteusers'] = $ru;
|
||||
}
|
||||
if ($lu == 0 or $lu == 1) {
|
||||
$_SESSION['admin-user-localusers'] = $lu;
|
||||
}
|
||||
$remoteusers = $_SESSION['admin-user-remoteusers'];
|
||||
$localusers = $_SESSION['admin-user-localusers'];
|
||||
|
||||
// if neither remote nor local, set to sensible local only
|
||||
if (!$remoteusers and !$localusers) {
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
$localusers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$site = get_site();
|
||||
|
||||
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
|
||||
@@ -28,6 +60,7 @@
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$strdeletecheck = get_string('deletecheck');
|
||||
$strsearch = get_string('search');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
@@ -36,7 +69,7 @@
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record('user', 'id', $confirmuser)) {
|
||||
@@ -63,7 +96,8 @@
|
||||
error("No such user!", '', true);
|
||||
}
|
||||
|
||||
if (is_primary_admin($user->id)) {
|
||||
$primaryadmin = get_admin();
|
||||
if ($user->id == $primaryadmin->id) {
|
||||
error("You are not allowed to delete the primary admin user!", '', true);
|
||||
}
|
||||
|
||||
@@ -72,10 +106,21 @@
|
||||
print_heading(get_string('deleteuser', 'admin'));
|
||||
$optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey());
|
||||
notice_yesno(get_string('deletecheckfull', '', "'$fullname'"), 'user.php', 'user.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
} else if (data_submitted() and !$user->deleted) {
|
||||
if (delete_user($user)) {
|
||||
//following code is also used in auth sync scripts
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time()); // Remember it just in case
|
||||
$updateuser->email = ''; // Clear this field to free it up
|
||||
$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
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
@@ -117,9 +162,6 @@
|
||||
. "' access now set to '$accessctrl'.");
|
||||
}
|
||||
|
||||
// create the user filter form
|
||||
$ufiltering = new user_filtering();
|
||||
|
||||
// Carry on with the user listing
|
||||
|
||||
$columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
|
||||
@@ -143,19 +185,28 @@
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
|
||||
|
||||
}
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir\">".$string[$column]."</a>$columnicon";
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=".urlencode(stripslashes($search))."&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
$extrasql = $ufiltering->get_sql_filter();
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '', $extrasql);
|
||||
|
||||
// tell the query which users we are looking at (local, remote, or both)
|
||||
$remotewhere = '';
|
||||
if($mnet_auth_users && ($localusers XOR $remoteusers)) {
|
||||
if ($localusers) {
|
||||
$remotewhere .= " and mnethostid = {$CFG->mnet_localhost_id} ";
|
||||
} else {
|
||||
$remotewhere .= " and mnethostid <> {$CFG->mnet_localhost_id} ";
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, '', true, "", "", '', '', '', '', '*', $extrasql);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
if ($extrasql !== '') {
|
||||
if ($search or $firstinitial or $lastinitial) {
|
||||
print_heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
$usercount = $usersearchcount;
|
||||
} else {
|
||||
@@ -165,15 +216,65 @@
|
||||
$alphabet = explode(',', get_string('alphabet'));
|
||||
$strall = get_string('all');
|
||||
|
||||
|
||||
/// Bar of first initials
|
||||
|
||||
echo "<p style=\"text-align:center\">";
|
||||
echo get_string("firstname")." : ";
|
||||
if ($firstinitial) {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $firstinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
/// Bar of last initials
|
||||
|
||||
echo get_string("lastname")." : ";
|
||||
if ($lastinitial) {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $lastinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&");
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
|
||||
flush();
|
||||
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
print_heading(get_string('nousersfound'));
|
||||
if ($search !== '') {
|
||||
$match[] = s($search);
|
||||
}
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string('firstname').": $firstinitial"."___";
|
||||
}
|
||||
if ($lastinitial) {
|
||||
$match[] = get_string('lastname').": $lastinitial"."___";
|
||||
}
|
||||
$matchstring = implode(", ", $match);
|
||||
print_heading(get_string('nousersmatching', '', $matchstring));
|
||||
|
||||
$table = NULL;
|
||||
|
||||
@@ -202,18 +303,7 @@
|
||||
|
||||
$mainadmin = get_admin();
|
||||
|
||||
$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->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
@@ -288,9 +378,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
// add filters
|
||||
$ufiltering->display_add();
|
||||
$ufiltering->display_active();
|
||||
if($mnet_auth_users) {
|
||||
echo "<p style=\"text-align:center\">";
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?lu=0">'.get_string('hidelocal','mnet').'</a> | ';
|
||||
} elseif ($localusers == 0) {
|
||||
echo '<a href="?lu=1">'.get_string('showlocal','mnet').'</a> | ';
|
||||
} else {
|
||||
echo get_string('hidelocal','mnet').' | ';
|
||||
}
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?ru=0">'.get_string('hideremote','mnet').'</a>';
|
||||
} elseif ($remoteusers == 0) {
|
||||
echo '<a href="?ru=1">'.get_string('showremote','mnet').'</a>';
|
||||
} else {
|
||||
echo get_string('hideremote','mnet');
|
||||
}
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
|
||||
echo "<form action=\"user.php\" method=\"get\"><fieldset class=\"invisiblefieldset\">";
|
||||
echo "<input type=\"text\" name=\"search\" value=\"".s($search, true)."\" size=\"20\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsearch\" />";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
|
||||
}
|
||||
echo "</fieldset></form>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
@@ -298,13 +413,15 @@
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&");
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once($CFG->dirroot.'/user/filters/lib.php');
|
||||
|
||||
if (!defined('MAX_BULK_USERS')) {
|
||||
define('MAX_BULK_USERS', 2000);
|
||||
}
|
||||
|
||||
function add_selection_all($ufiltering) {
|
||||
global $SESSION;
|
||||
|
||||
$guest = get_guest();
|
||||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
|
||||
|
||||
if ($rs = get_recordset_select('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname')) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (! isset($SESSION->bulk_users[$user->id])) {
|
||||
$SESSION->bulk_users[$user->id] = $user->id;
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
}
|
||||
|
||||
function get_selection_data($ufiltering) {
|
||||
global $SESSION;
|
||||
|
||||
// get the SQL filter
|
||||
$guest = get_guest();
|
||||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
|
||||
|
||||
$total = count_records_select('user', "id<>{$guest->id} AND deleted <> 1");
|
||||
$acount = count_records_select('user', $sqlwhere);
|
||||
$scount = count($SESSION->bulk_users);
|
||||
|
||||
$userlist = array('acount'=>$acount, 'scount'=>$scount, 'ausers'=>false, 'susers'=>false, 'total'=>$total);
|
||||
$userlist['ausers'] = get_records_select_menu('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname', 0, MAX_BULK_USERS);
|
||||
|
||||
if ($scount) {
|
||||
if ($scount < MAX_BULK_USERS) {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
} else {
|
||||
$bulkusers = array_slice($SESSION->bulk_users, 0, MAX_BULK_USERS, true);
|
||||
$in = implode(',', $bulkusers);
|
||||
}
|
||||
$userlist['susers'] = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
}
|
||||
|
||||
return $userlist;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/user/lib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/user/user_bulk_forms.php');
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
|
||||
if (!isset($SESSION->bulk_users)) {
|
||||
$SESSION->bulk_users = array();
|
||||
}
|
||||
// create the user filter form
|
||||
$ufiltering = new user_filtering();
|
||||
|
||||
// array of bulk operations
|
||||
// create the bulk operations form
|
||||
$action_form = new user_bulk_action_form();
|
||||
if ($data = $action_form->get_data(false)) {
|
||||
// check if an action should be performed and do so
|
||||
switch ($data->action) {
|
||||
case 1: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_confirm.php');
|
||||
case 2: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_message.php');
|
||||
case 3: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_delete.php');
|
||||
case 4: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_display.php');
|
||||
case 5: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_download.php');
|
||||
}
|
||||
}
|
||||
|
||||
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
|
||||
|
||||
if ($data = $user_bulk_form->get_data(false)) {
|
||||
if (!empty($data->addall)) {
|
||||
add_selection_all($ufiltering);
|
||||
|
||||
} else if (!empty($data->addsel)) {
|
||||
if (!empty($data->ausers)) {
|
||||
if (in_array(0, $data->ausers)) {
|
||||
add_selection_all($ufiltering);
|
||||
} else {
|
||||
foreach($data->ausers as $userid) {
|
||||
if ($userid == -1) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($SESSION->bulk_users[$userid])) {
|
||||
$SESSION->bulk_users[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!empty($data->removeall)) {
|
||||
$SESSION->bulk_users= array();
|
||||
|
||||
} else if (!empty($data->removesel)) {
|
||||
if (!empty($data->susers)) {
|
||||
if (in_array(0, $data->susers)) {
|
||||
$SESSION->bulk_users= array();
|
||||
} else {
|
||||
foreach($data->susers as $userid) {
|
||||
if ($userid == -1) {
|
||||
continue;
|
||||
}
|
||||
unset($SESSION->bulk_users[$userid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset the form selections
|
||||
unset($_POST);
|
||||
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
|
||||
}
|
||||
// do output
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$ufiltering->display_add();
|
||||
$ufiltering->display_active();
|
||||
|
||||
$user_bulk_form->display();
|
||||
$action_form->display();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php //$Id$
|
||||
/**
|
||||
* script for bulk user delete operations
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
//TODO: add support for large number of users
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)", '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if ($user->confirmed) {
|
||||
continue;
|
||||
}
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
$result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
|
||||
if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
redirect($return, get_string('changessaved'));
|
||||
|
||||
} else {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
$usernames = implode(', ', $userlist);
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
notice_yesno(get_string('confirmcheckfull', '', $usernames), 'user_bulk_confirm.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php //$Id$
|
||||
/**
|
||||
* script for bulk user delete operations
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:delete', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
//TODO: add support for large number of users
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
$primaryadmin = get_admin();
|
||||
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)")) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if ($primaryadmin->id != $user->id and $USER->id != $user->id and delete_user($user)) {
|
||||
unset($SESSION->bulk_users[$user->id]);
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
redirect($return, get_string('changessaved'));
|
||||
|
||||
} else {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
$usernames = implode(', ', $userlist);
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
notice_yesno(get_string('deletecheckfull', '', $usernames), 'user_bulk_delete.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$sort = optional_param('sort', 'fullname', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'asc', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
$users = $SESSION->bulk_users;
|
||||
$usertotal = get_users(false);
|
||||
$usercount = count($users);
|
||||
|
||||
$strnever = get_string('never');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$countries = get_list_of_countries();
|
||||
|
||||
foreach ($users as $key => $id) {
|
||||
$user = get_record('user', 'id', $id, null, null, null, null, 'id, firstname, lastname, username, email, country, lastaccess, city');
|
||||
$user->fullname = fullname($user, true);
|
||||
$user->country = @$countries[$user->country];
|
||||
unset($user->firstname);
|
||||
unset($user->lastname);
|
||||
$users[$key] = $user;
|
||||
}
|
||||
unset($countries);
|
||||
|
||||
// Need to sort by date
|
||||
function sort_compare($a, $b) {
|
||||
global $sort, $dir;
|
||||
if($sort == 'lastaccess') {
|
||||
$rez = $b->lastaccess - $a->lastaccess;
|
||||
} else {
|
||||
$rez = strcasecmp(@$a->$sort, @$b->$sort);
|
||||
}
|
||||
return $dir == 'desc' ? -$rez : $rez;
|
||||
}
|
||||
usort($users, 'sort_compare');
|
||||
|
||||
$table->width = "95%";
|
||||
$columns = array('fullname', /*'username', */'email', 'city', 'country', 'lastaccess');
|
||||
foreach ($columns as $column) {
|
||||
$strtitle = get_string($column);
|
||||
if ($sort != $column) {
|
||||
$columnicon = '';
|
||||
$columndir = 'asc';
|
||||
} else {
|
||||
$columndir = $dir == 'asc' ? 'desc' : 'asc';
|
||||
$columnicon = ' <img src="'.$CFG->pixpath.'/t/'.($dir == 'asc' ? 'down' : 'up' ).'.gif" alt="" />';
|
||||
}
|
||||
$table->head[] = '<a href="user_bulk_display.php?sort='.$column.'&dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon;
|
||||
$table->align[] = 'left';
|
||||
}
|
||||
|
||||
foreach($users as $user) {
|
||||
$table->data[] = array (
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.SITEID.'">'.$user->fullname.'</a>',
|
||||
// $user->username,
|
||||
$user->email,
|
||||
$user->city,
|
||||
$user->country,
|
||||
$user->lastaccess ? format_time(time() - $user->lastaccess) : $strnever
|
||||
);
|
||||
}
|
||||
|
||||
print_heading("$usercount / $usertotal ".get_string('users'));
|
||||
print_table($table);
|
||||
|
||||
print_continue($return);
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -1,182 +0,0 @@
|
||||
<?php //$Id$
|
||||
/**
|
||||
* script for downloading of user lists
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$format = optional_param('format', '', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
if ($format) {
|
||||
$fields = array('id' => 'id',
|
||||
'username' => 'username',
|
||||
'email' => 'email',
|
||||
'firstname' => 'firstname',
|
||||
'lastname' => 'lastname',
|
||||
'idnumber' => 'idnumber',
|
||||
'institution' => 'institution',
|
||||
'department' => 'department',
|
||||
'phone1' => 'phone1',
|
||||
'phone2' => 'phone2',
|
||||
'city' => 'city',
|
||||
'url' => 'url',
|
||||
'icq' => 'icq',
|
||||
'skype' => 'skype',
|
||||
'aim' => 'aim',
|
||||
'yahoo' => 'yahoo',
|
||||
'msn' => 'msn',
|
||||
'country' => 'country');
|
||||
|
||||
if ($extrafields = get_records_select('user_info_field')) {
|
||||
foreach ($extrafields as $n=>$v){
|
||||
$fields['profile_field_'.$v->shortname] = 'profile_field_'.$v->name;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($format) {
|
||||
case 'csv' : user_download_csv($fields);
|
||||
case 'ods' : user_download_ods($fields);
|
||||
case 'xls' : user_download_xls($fields);
|
||||
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading(get_string('download', 'admin'));
|
||||
|
||||
print_box_start();
|
||||
echo '<ul>';
|
||||
echo '<li><a href="user_bulk_download.php?format=csv">'.get_string('downloadtext').'</a></li>';
|
||||
echo '<li><a href="user_bulk_download.php?format=ods">'.get_string('downloadods').'</a></li>';
|
||||
echo '<li><a href="user_bulk_download.php?format=xls">'.get_string('downloadexcel').'</a></li>';
|
||||
echo '</ul>';
|
||||
print_box_end();
|
||||
|
||||
print_continue($return);
|
||||
|
||||
print_footer();
|
||||
|
||||
function user_download_ods($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once("$CFG->libdir/odslib.class.php");
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
|
||||
$filename = clean_filename(get_string('users').'.ods');
|
||||
|
||||
$workbook = new MoodleODSWorkbook('-');
|
||||
$workbook->send($filename);
|
||||
|
||||
$worksheet = array();
|
||||
|
||||
$worksheet[0] =& $workbook->add_worksheet('');
|
||||
$col = 0;
|
||||
foreach ($fields as $fieldname) {
|
||||
$worksheet[0]->write(0, $col, $fieldname);
|
||||
$col++;
|
||||
}
|
||||
|
||||
$row = 1;
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
die;
|
||||
}
|
||||
|
||||
function user_download_xls($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once("$CFG->libdir/excellib.class.php");
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
|
||||
$filename = clean_filename(get_string('users').'.xls');
|
||||
|
||||
$workbook = new MoodleExcelWorkbook('-');
|
||||
$workbook->send($filename);
|
||||
|
||||
$worksheet = array();
|
||||
|
||||
$worksheet[0] =& $workbook->add_worksheet('');
|
||||
$col = 0;
|
||||
foreach ($fields as $fieldname) {
|
||||
$worksheet[0]->write(0, $col, $fieldname);
|
||||
$col++;
|
||||
}
|
||||
|
||||
$row = 1;
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
die;
|
||||
}
|
||||
|
||||
function user_download_csv($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
|
||||
$filename = clean_filename(get_string('users').'.csv');
|
||||
|
||||
header("Content-Type: application/download\n");
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
|
||||
header("Pragma: public");
|
||||
|
||||
$delimiter = get_string('listsep');
|
||||
$encdelim = '&#'.ord($delimiter);
|
||||
|
||||
$row = array();
|
||||
foreach ($fields as $fieldname) {
|
||||
$row[] = str_replace($delimiter, $encdelim, $fieldname);
|
||||
}
|
||||
echo implode($delimiter, $row)."\n";
|
||||
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
$row = array();
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$row[] = str_replace($delimiter, $encdelim, $user->$field);
|
||||
}
|
||||
echo implode($delimiter, $row)."\n";
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user