Compare commits
666 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f12a2ccee5 | |||
| a803edf7db | |||
| d80e3a0b10 | |||
| 1eae64185c | |||
| ac2ce35b6c | |||
| 4e27090284 | |||
| fc3992e57e | |||
| 81f7813e8b | |||
| 941369258b | |||
| c72350373c | |||
| ade1ee0deb | |||
| cd91db1630 | |||
| 872c8cc93f | |||
| 725f4c704c | |||
| 6ec1f89e73 | |||
| 498f8e8f82 | |||
| ea22498866 | |||
| 8d1c6cd682 | |||
| 4f75b1b68a | |||
| 7114adb590 | |||
| e41839dc50 | |||
| 9eff824be8 | |||
| 58e42445d2 | |||
| 536c4f8875 | |||
| 5690a10e32 | |||
| abe8f35a49 | |||
| 354176b5fe | |||
| 1fca73d04c | |||
| 07a7a711fa | |||
| 26337523fa | |||
| 21dcd628bc | |||
| ed31529ce5 | |||
| d3613a1235 | |||
| 247fa07654 | |||
| 72cecd3b85 | |||
| 81af00fbb9 | |||
| f74c520b87 | |||
| a4810441af | |||
| 9c13746dab | |||
| d5d17ef33a | |||
| 1c8ec13811 | |||
| 0492535297 | |||
| e476dc67ea | |||
| f9edb1e4e4 | |||
| 6a06def8a1 | |||
| 48b65cc309 | |||
| ae8701d94d | |||
| c31957babf | |||
| b0efb18b72 | |||
| 18d7110673 | |||
| 3114a292df | |||
| 86462cee30 | |||
| 88a78fa926 | |||
| 6c90434d03 | |||
| 49e6e996df | |||
| 7ca75c035a | |||
| a05c7db850 | |||
| bef711f560 | |||
| 50c68d01cc | |||
| 18129bbfee | |||
| 1a827abb0c | |||
| a85c4eefaf | |||
| 1d8c89c4ad | |||
| e7ee1905ff | |||
| 6feba15b31 | |||
| adb2905dcc | |||
| 597748ddd8 | |||
| 0df80ebf9c | |||
| a8293dd818 | |||
| f39ebcea89 | |||
| b44c702d45 | |||
| e0fb4a8743 | |||
| 839d72b06c | |||
| ae0561140c | |||
| bbf8fb528f | |||
| d1c840e99c | |||
| c8b8b71645 | |||
| 57d6548065 | |||
| f1bd861709 | |||
| 84a36391d5 | |||
| 6131f70069 | |||
| 7706180dbd | |||
| df7ef3a1a4 | |||
| 0d9a6ca147 | |||
| beb6d00f46 | |||
| 9df9473d98 | |||
| ae875f50eb | |||
| bdde7324d7 | |||
| 851942fb7f | |||
| f3f11963d8 | |||
| 187b3f885d | |||
| bb6c0ef2cf | |||
| 284115288b | |||
| f50c83ff30 | |||
| 722e45997d | |||
| 8acf33144a | |||
| 720c94fa06 | |||
| 877129cd0d | |||
| b0e8fede48 | |||
| aa45776dd7 | |||
| c912dab6da | |||
| ada7af846f | |||
| 833b1e0045 | |||
| ff0b80cc36 | |||
| 22d205da7a | |||
| d492819687 | |||
| 97aaaec647 | |||
| 5e6d7b8d6b | |||
| 443a1fee8e | |||
| 303e816601 | |||
| 9fc2409875 | |||
| cbcf18e5b8 | |||
| 931e9d3ec4 | |||
| 94b9899627 | |||
| 66c3b5f155 | |||
| ba3381be5d | |||
| 71588440e9 | |||
| 0393331c13 | |||
| 5f3d54fc4e | |||
| 7c68f9da21 | |||
| 1ab2605768 | |||
| 521601d0ce | |||
| d4680e253a | |||
| 320e91e2f8 | |||
| 0148e8be18 | |||
| b2057b4917 | |||
| 87dc962b44 | |||
| 20875a12e0 | |||
| f8ef9c04db | |||
| ea9b4c707e | |||
| 9c3c1ab56d | |||
| 2c9a36d79c | |||
| 967e19d6a0 | |||
| 4a440d90b6 | |||
| fcfd2e8a45 | |||
| 86ad0ba459 | |||
| 3ceeb19d3c | |||
| 0dd41b1891 | |||
| 5111517c8a | |||
| 876e35b24c | |||
| 79fb7ea7d3 | |||
| a5d3cae9d3 | |||
| 4955e30c0b | |||
| d75724cb1a | |||
| aa51ed515c | |||
| d3397f0604 | |||
| 3f5636b56e | |||
| ed13c57b3b | |||
| 94ad221b27 | |||
| 785c3ff9ac | |||
| d8e091627c | |||
| 4d6e43a1dd | |||
| fcbf9d8a95 | |||
| 2467402841 | |||
| 3c724071a5 | |||
| 6ad59438e1 | |||
| cc5d09ac00 | |||
| d10e856d88 | |||
| 77666b4acf | |||
| 0df6befcd9 | |||
| 42f6931f27 | |||
| f8b1eb504e | |||
| 879761a29f | |||
| 737498e986 | |||
| 9bdb39c797 | |||
| 862d935434 | |||
| 8ab602a484 | |||
| 39ce906768 | |||
| 6b1688b15e | |||
| ee90562005 | |||
| e8da9c41f0 | |||
| a3af58c6f1 | |||
| 5eeebe5b48 | |||
| 2439bedff8 | |||
| 06f5909a8d | |||
| ae4e154ed9 | |||
| 8e6f40259c | |||
| 475419e555 | |||
| 6547c735ca | |||
| d1e867d052 | |||
| daa4c6c53a | |||
| 7632e30c4f | |||
| 400781874e | |||
| be50571e93 | |||
| d25fdffd6e | |||
| 6768c07ed1 | |||
| 4d4dc7bf1d | |||
| 5159864bc6 | |||
| 3a13bda089 | |||
| e246e032da | |||
| fb0454d62c | |||
| 49676c0186 | |||
| 029f59fbd1 | |||
| da7f4c196a | |||
| a2e867b092 | |||
| 82b04884f3 | |||
| 117e675602 | |||
| 055f9be516 | |||
| 6877f88f86 | |||
| 1dfa763a2f | |||
| 54ee7246cc | |||
| 89f9450834 | |||
| afe83312b2 | |||
| a2067bf38d | |||
| 0d4542e24b | |||
| a5c9d2e444 | |||
| 8ea4e65638 | |||
| a6bc0fd2b6 | |||
| 98d2cd7f7a | |||
| 3ff91874a8 | |||
| 84fe017f67 | |||
| 18877525ef | |||
| 94fc397cbb | |||
| 1b8a70860d | |||
| 4aeccc8bf8 | |||
| 12999c3311 | |||
| ebd585bb42 | |||
| 0ef7420b0e | |||
| fe9384833b | |||
| 5d75612163 | |||
| 1a19384b18 | |||
| a0b8e7637d | |||
| a7285f63b4 | |||
| 3d3f891d44 | |||
| bccb50caab | |||
| 18fe8f7b9c | |||
| a9c5278c27 | |||
| 8312d945fb | |||
| aa80e16b12 | |||
| 38ffb6c139 | |||
| 91cf92265e | |||
| 8713ac5fd3 | |||
| 9e5ef14437 | |||
| cd42b2be8d | |||
| 631c9f5c49 | |||
| 6ba41390ef | |||
| 8118207b6f | |||
| f021a9119f | |||
| 857ec70622 | |||
| 52bb51f204 | |||
| f542e41fdd | |||
| 6fd207292f | |||
| f7e75ede04 | |||
| 5d64f72c23 | |||
| 0e36e50b0b | |||
| 0eca93e5be | |||
| 9b231c86ec | |||
| 6c089f4a28 | |||
| fe01ad8ec0 | |||
| f6f3408324 | |||
| d72e36cce7 | |||
| bcdc90679d | |||
| ff3af6786d | |||
| 504c188064 | |||
| 6c9af98401 | |||
| 183eb24d8d | |||
| be80fc7e66 | |||
| bff131f52e | |||
| 00c573bbce | |||
| 257ae54b65 | |||
| bd5ec8cef4 | |||
| 8f476f51bf | |||
| 281295d2b9 | |||
| 1987fb0808 | |||
| 0a8b14d0d7 | |||
| fc0a3140db | |||
| f0a6326181 | |||
| 2004936d44 | |||
| 850d5da191 | |||
| 4b6c7b206b | |||
| 08b8a69610 | |||
| 69ef0b666c | |||
| d77d361e3d | |||
| c4abdd2816 | |||
| 96a8c8e639 | |||
| 9e7f36a948 | |||
| 527f62f6af | |||
| 35ef2c8919 | |||
| e24aa3d6ba | |||
| afece01121 | |||
| 38d6fc273a | |||
| f271e4112e | |||
| b63b26f1aa | |||
| ae65fba742 | |||
| 33096a7bb9 | |||
| 05cdffa828 | |||
| 49a60852e8 | |||
| 309b6caaa5 | |||
| bf44458bd2 | |||
| 14e404f960 | |||
| 24ca59f03e | |||
| 7c589aa751 | |||
| 2904df1380 | |||
| 56f2d43291 | |||
| c4fcff1d13 | |||
| 8c8660ae5c | |||
| 612bbdefad | |||
| 4c404aa348 | |||
| eefe474a0d | |||
| 075d93f958 | |||
| e8ee249670 | |||
| afd99f1f07 | |||
| 7d23ab127f | |||
| 2df5a942f3 | |||
| 6fdfabaf42 | |||
| 2dd4271bcb | |||
| d64cc008d2 | |||
| 6fa83c2add | |||
| 97da7bed2a | |||
| 364a7f4f98 | |||
| 03506f373f | |||
| a3691d7ef1 | |||
| 3be617a985 | |||
| f0c8025bbc | |||
| e5c375e29c | |||
| 9032900612 | |||
| a745c8abee | |||
| db4095092f | |||
| 1de384c32d | |||
| 15bf342ec7 | |||
| db65c8ca8f | |||
| e21607e203 | |||
| aeb85c2797 | |||
| 354c67d262 | |||
| 10f40eec25 | |||
| 14b2880f3b | |||
| be22faa965 | |||
| 16f75b4eba | |||
| 44ad54efea | |||
| 0cb6604857 | |||
| ac1358665d | |||
| add8d12caa | |||
| ee57cdb57d | |||
| 1bdbe3964e | |||
| abbf392ed1 | |||
| 474ade7a7d | |||
| 21de682b37 | |||
| 9df9cacc9c | |||
| d81585ed6a | |||
| 67a8c620b6 | |||
| e06a19af92 | |||
| 34a00a23d5 | |||
| 3ede3c4be6 | |||
| dfcb02766e | |||
| 93bff91055 | |||
| 58ab8bffd3 | |||
| 7cad8ab660 | |||
| 37fb4b6c7f | |||
| b9d7e5f583 | |||
| 5a761ab83a | |||
| 450f580012 | |||
| 26687962c2 | |||
| f4cb414111 | |||
| 0bd80872c5 | |||
| 7152a7833f | |||
| 403b1e85d8 | |||
| 3a23d626f3 | |||
| 08225e2a51 | |||
| 6b533b4584 | |||
| d17e23ee7a | |||
| 2293c3cd02 | |||
| 9011bb8224 | |||
| 1bed04c61b | |||
| 6bd99cf609 | |||
| 5c978acd07 | |||
| 6aba72e06f | |||
| 29a2749da5 | |||
| 96eb0bd743 | |||
| cbb5738c23 | |||
| 061a4b01be | |||
| 3d229827b8 | |||
| ceb2d03736 | |||
| 93e32c5f7f | |||
| 1a13367f78 | |||
| d3d9d95f42 | |||
| ee95c70444 | |||
| ab42d25ac1 | |||
| 3ae9e88793 | |||
| c5244b4f3e | |||
| 7ba9cd4a78 | |||
| be69717a20 | |||
| e66bb1797e | |||
| 4a8da19c12 | |||
| fa34b952f9 | |||
| ef04e681c9 | |||
| c6569182cc | |||
| e04de8e20b | |||
| 5b28f2b17f | |||
| c07d5ff235 | |||
| 62382645cb | |||
| 3a6a84b79b | |||
| 8cfb08638b | |||
| bc65820fd0 | |||
| f45a63ee62 | |||
| 7e56570572 | |||
| 136c064f3a | |||
| 8ccbb75512 | |||
| f9c06a4b94 | |||
| 78bc1f9ce6 | |||
| 022de3941f | |||
| 5133ebb08c | |||
| c98670a5e3 | |||
| bd0dc7fe3d | |||
| df681accd9 | |||
| 282cd5aec2 | |||
| fbf5f5c483 | |||
| 808bdc658a | |||
| 832a20fc17 | |||
| 78c05837f4 | |||
| 9e41616dab | |||
| dbb82a47ca | |||
| 003f4c662a | |||
| c4e8b525de | |||
| 95245d35a6 | |||
| 73c7b457a9 | |||
| e43ed443fe | |||
| 5957e19ae3 | |||
| 56fcf4b1b2 | |||
| ad1db4c380 | |||
| 38b8f21410 | |||
| 525afa8223 | |||
| 1ac8d21f76 | |||
| e76ddb2da6 | |||
| d3bba8da1b | |||
| 08cebb831a | |||
| ec8f711d06 | |||
| dddf8e46ef | |||
| 7b05b2702e | |||
| 40b3f45dec | |||
| 0651a3115b | |||
| 1f579d5052 | |||
| 4048d5cf73 | |||
| 7942f4377a | |||
| 515ae2a180 | |||
| 60ddeb3f09 | |||
| afe0df456f | |||
| cb5f71b27f | |||
| 07c2d960d0 | |||
| f44721b9f7 | |||
| 37b267d4ec | |||
| e55ee4ba01 | |||
| cde5a89a74 | |||
| d86eb86faa | |||
| 24037e0f07 | |||
| f1d31dfee3 | |||
| 2feaf50aa1 | |||
| f0cf5bc1d3 | |||
| 27e661082b | |||
| d6be0ca412 | |||
| a057fabf60 | |||
| e4d75c6f2e | |||
| c9f43908a4 | |||
| 9e13cb7144 | |||
| 402b744fd6 | |||
| ffa16956e6 | |||
| 4aee1d4ecb | |||
| 6a6723a267 | |||
| 44c109eb7e | |||
| 830abccdda | |||
| bc673426bd | |||
| 09d10cdc1a | |||
| 6b98139026 | |||
| be24cfe9c2 | |||
| 6f5d60121b | |||
| 0ea152345f | |||
| 1ebff51139 | |||
| 8809f87505 | |||
| afe91850a8 | |||
| a393ece095 | |||
| 612b2f8c2c | |||
| 7912ecb1b1 | |||
| bc0dc73d24 | |||
| 2dc6c4abe2 | |||
| a18258a969 | |||
| 90165e2d01 | |||
| af0322b9b3 | |||
| 4c86245c5e | |||
| b8ad30bec7 | |||
| c78e0578f7 | |||
| 1de8fe9ea6 | |||
| aebf995894 | |||
| 440f829392 | |||
| fd25cefe34 | |||
| 5452f37f23 | |||
| 34aa9e6818 | |||
| 0f3cf17a4b | |||
| fe3987a324 | |||
| 40af907f97 | |||
| 30ab1999fb | |||
| d3d7ba8f7a | |||
| e4c6b6b470 | |||
| 16aa360aac | |||
| cd3a029451 | |||
| 6d8c1e5e58 | |||
| 1ca801982a | |||
| 3f86d1c681 | |||
| f52c805656 | |||
| 2934dce435 | |||
| 9bb38ad7d2 | |||
| 567c3be0a2 | |||
| 945fec4e6d | |||
| 5db52de0fa | |||
| 28df24fc95 | |||
| 50522dae6e | |||
| 0e432a1d81 | |||
| f9bc559511 | |||
| ab14532e7f | |||
| 79d3cc8589 | |||
| 5198be103b | |||
| b6f293036f | |||
| da336c9649 | |||
| c014235e75 | |||
| 6ace2cf04c | |||
| 688b962ee4 | |||
| 792068fa8d | |||
| 592d0165e9 | |||
| 3f21bfb704 | |||
| dda0672145 | |||
| 563392734f | |||
| c77cf00618 | |||
| 0584008dc4 | |||
| f8eacd07ec | |||
| 13dbf19ec1 | |||
| 541b11c434 | |||
| 45d3c87b30 | |||
| c153af6351 | |||
| 8527371af3 | |||
| 889aaef90e | |||
| ed75557ce9 | |||
| 6b3281b20e | |||
| 2a5d6b8035 | |||
| 86a226f6ca | |||
| 2b47d8926a | |||
| 931ad967da | |||
| 57525b9420 | |||
| 267ecadfe9 | |||
| 9e8a2d77ef | |||
| f0bb791809 | |||
| 435dd405d5 | |||
| f47b53dd0a | |||
| 37168eadd6 | |||
| 96015624c1 | |||
| a1ac8fd963 | |||
| 043fd9c793 | |||
| 72ec0c3baa | |||
| 5a79a02a79 | |||
| 5d0160f8f5 | |||
| d332a153a8 | |||
| c9cebbcdaf | |||
| 02c62cb3d5 | |||
| cbebda6a36 | |||
| 892174bda5 | |||
| 098a9ff379 | |||
| eb2af98aaa | |||
| 7ee7cb758a | |||
| c147575b6c | |||
| 5fd87bf13c | |||
| ce60661535 | |||
| 976b0d2f2f | |||
| 2f06efca9a | |||
| 4db516ba85 | |||
| 65299ae590 | |||
| 5673b0ce58 | |||
| 19466f5699 | |||
| 4646b94ab0 | |||
| f54f4b22a9 | |||
| 0690424663 | |||
| 320ce836d1 | |||
| 673e73d799 | |||
| fd74d39545 | |||
| 8a55979706 | |||
| a2051dc458 | |||
| e1e2d33d8a | |||
| 0b82096d87 | |||
| 81e8e321cc | |||
| 6d6d43d1df | |||
| c59a69dab8 | |||
| 7ff4e151ed | |||
| bbf2de8d3b | |||
| 5c691fc5fc | |||
| e694d551b5 | |||
| e83460ac86 | |||
| 49e1894df3 | |||
| 688df1279e | |||
| c281745c42 | |||
| 361536479a | |||
| 4272fc068c | |||
| 2b00d67a44 | |||
| 5f58a4a398 | |||
| a55cfa4fa1 | |||
| 3fecb85f5b | |||
| f74e0556dd | |||
| de5971270b | |||
| 0f332452fe | |||
| 29ed8ead20 | |||
| 1505b92d40 | |||
| c1a8231dfa | |||
| 0c11a3b0df | |||
| a72cd02f9e | |||
| 9046955f03 | |||
| a93679c79b | |||
| 52d6376cb9 | |||
| 5ce37277d3 | |||
| 5b7a62a269 | |||
| 9312d39243 | |||
| 83bf96e1ee | |||
| a24259df35 | |||
| 11ff786551 | |||
| e347d1c0f9 | |||
| 5f72b90848 | |||
| 6b90b67d7c | |||
| b6e8bdbbad | |||
| c1393f970c | |||
| cc4f01a09a | |||
| 1edcd3e2e0 | |||
| 43d565b15f | |||
| b6b9873174 | |||
| 291a7deb3e | |||
| aab5a32a63 | |||
| 36f9513fc6 | |||
| b412f4ac03 | |||
| d0e9296d42 | |||
| 63e7059c90 | |||
| e352659420 | |||
| ea9f82462a | |||
| df87047314 | |||
| 38302a5459 | |||
| bee7fad9b6 | |||
| 2e291dfa51 | |||
| eb84b02feb | |||
| f01e8f7c24 | |||
| f06680badc | |||
| 5e0289bcde | |||
| d8f4ee51a5 | |||
| edd01f0e5f | |||
| ee8bc9d180 | |||
| 77e95f5bd3 | |||
| 835625bf4c | |||
| 3559450d81 | |||
| d98bdd3592 | |||
| 7a6df50371 | |||
| 74c8a06e3e | |||
| 4b02f546ee | |||
| 754104acb4 | |||
| 7e3d9f3c18 | |||
| f4d0a18a41 | |||
| b53905ab09 | |||
| e31601a7f9 | |||
| 1e2f651f2e | |||
| 1568332295 | |||
| ee1cbb3856 | |||
| 6904fe1e26 | |||
| a15965fc5f | |||
| 79147f355b | |||
| aaa252dbc1 | |||
| 6f82b46490 | |||
| 60a6ca5f38 | |||
| 3dff726aa1 | |||
| 7fa6c5f12b | |||
| 67fbbc6a26 | |||
| 72a2effa06 | |||
| 99d4c223ff | |||
| e0bc9f3bec | |||
| e14a0902ed | |||
| 8a1d2fdf0d | |||
| 4efe1f63ca |
+3
-3
@@ -30,7 +30,7 @@ if (empty($CFG->auth)) {
|
||||
}
|
||||
|
||||
if (!empty($auth) and !exists_auth_plugin($auth)) {
|
||||
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
|
||||
print_error('pluginnotinstalled', 'auth', $url, $auth);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -67,7 +67,7 @@ switch ($action) {
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth plugin is valid
|
||||
if ($key === false) {
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
print_error('pluginnotenabled', 'auth', $url, $auth);
|
||||
}
|
||||
// move down the list
|
||||
if ($key < (count($authsenabled) - 1)) {
|
||||
@@ -82,7 +82,7 @@ switch ($action) {
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth is valid
|
||||
if ($key === false) {
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
print_error('pluginnotenabled', 'auth', $url, $auth);
|
||||
}
|
||||
// move up the list
|
||||
if ($key >= 1) {
|
||||
|
||||
@@ -50,7 +50,8 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
$frm = get_config("auth/$auth");
|
||||
}
|
||||
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
$user_fields = $authplugin->userfields;
|
||||
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = $authplugin->get_title();
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if(!$block->has_config()) {
|
||||
error('This block does not support global configuration');
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($CFG->usetags)){
|
||||
if (!empty($CFG->usetags)) {
|
||||
require_once($CFG->dirroot.'/tag/lib.php');
|
||||
tag_cron();
|
||||
mtrace ('Executed tag cron');
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$strdatabaseperformance = get_string("databaseperformance");
|
||||
$stradministration = get_string("administration");
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
$sure = optional_param('sure', 0, PARAM_BOOL);
|
||||
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$deletedir = $CFG->dataroot; // The directory to delete!
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if (empty($frm->enable)) {
|
||||
$frm->enable = array();
|
||||
@@ -103,4 +103,4 @@
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if ($enrolment->process_config($frm)) {
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
|
||||
@@ -122,6 +122,11 @@
|
||||
<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,6 +182,11 @@
|
||||
<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">
|
||||
@@ -249,6 +259,11 @@
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
$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, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$site = get_site();
|
||||
|
||||
|
||||
+2
-2
@@ -560,7 +560,7 @@
|
||||
/// Check for valid admin user - no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context);
|
||||
|
||||
@@ -653,7 +653,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
'<a href="http://docs.moodle.org/en/Release">'.$CFG->release.'</a> ('.$CFG->version.')<br />'.
|
||||
'<a href="http://docs.moodle.org/en/Release" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
||||
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
||||
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
||||
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
|
||||
|
||||
+23
-20
@@ -14,7 +14,7 @@
|
||||
|
||||
admin_externalpage_setup('langedit');
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button?
|
||||
define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines?
|
||||
@@ -290,7 +290,10 @@
|
||||
$missingcounter++;
|
||||
$totalcounter->missing++;
|
||||
}
|
||||
if (LANG_LINK_MISSING_STRINGS && $missingstring) {
|
||||
if ($translationsdiffer) {
|
||||
$missingcounter++;
|
||||
}
|
||||
if (LANG_LINK_MISSING_STRINGS && ($missingstring || $translationsdiffer)) {
|
||||
$missinglinkstart = "<a href=\"lang.php?mode=compare&currentfile=$filename#missing$missingcounter\">";
|
||||
$missinglinkend = '</a>';
|
||||
} else {
|
||||
@@ -435,7 +438,7 @@
|
||||
|
||||
if (isset($_POST['currentfile'])){ // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
$newstrings = array();
|
||||
@@ -586,12 +589,13 @@
|
||||
$value2 = lang_fix_value_from_file($localstring[$key]);
|
||||
}
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
// Color highlighting:
|
||||
// red #ef6868 - translation missing in both system and local pack
|
||||
// yellow #feff7f - translation missing in system pack but is translated in local
|
||||
// green #AAFFAA - translation present in both system and local but is different
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
$missingprev = '';
|
||||
$cellcolour = '';
|
||||
$usetabindex = false;
|
||||
if (!$value) {
|
||||
// the string is not present in the pack being processed
|
||||
if (!$value2) {
|
||||
$cellcolour = 'class="bothmissing"';
|
||||
$usetabindex = true;
|
||||
@@ -606,22 +610,21 @@
|
||||
'<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall" alt="'.$strnext.'" /></a>';
|
||||
$missingprev = '<a href="#missing'.($missingcounter-1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/up.gif" class="iconsmall" alt="'.$strprev.'" /></a>';
|
||||
} else {
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
$missingprev = '';
|
||||
}
|
||||
} else {
|
||||
if ($value <> $value2 && $value2 <> '') {
|
||||
// the string is translated in the pack being processed
|
||||
if ($value <> $value2 && ($uselocal || $value2 <> '')) {
|
||||
$cellcolour = 'class="localdifferent"';
|
||||
$usetabindex = true;
|
||||
} else {
|
||||
$cellcolour = '';
|
||||
$usetabindex = false;
|
||||
$missingcounter++;
|
||||
if (LANG_DISPLAY_MISSING_LINKS) {
|
||||
$missingtarget = '<a name="missing'.$missingcounter.'"></a>';
|
||||
$missingnext = '<a href="#missing'.($missingcounter+1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall" alt="'.$strnext.'" /></a>';
|
||||
$missingprev = '<a href="#missing'.($missingcounter-1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/up.gif" class="iconsmall" alt="'.$strprev.'" /></a>';
|
||||
}
|
||||
}
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
$missingprev = '';
|
||||
}
|
||||
|
||||
if ($editable) {
|
||||
@@ -707,7 +710,7 @@
|
||||
|
||||
if (isset($_POST['currentfile'])) { // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
|
||||
|
||||
+82
-30
@@ -12,7 +12,7 @@
|
||||
admin_externalpage_setup('langimport');
|
||||
|
||||
$mode = optional_param('mode', 0, PARAM_INT); //phase
|
||||
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
|
||||
$pack = optional_param('pack', array(), PARAM_FILE); //pack to install
|
||||
$displaylang = $pack;
|
||||
$uninstalllang = optional_param('uninstalllang', '', PARAM_FILE);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
@@ -41,36 +41,45 @@
|
||||
|
||||
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
|
||||
|
||||
if (confirm_sesskey()) {
|
||||
if (confirm_sesskey() and !empty($pack)) {
|
||||
set_time_limit(0);
|
||||
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
|
||||
@mkdir ($CFG->dataroot.'/lang/');
|
||||
|
||||
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 COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new object();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a), 'langimport.php');
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'), 'langimport.php');
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
break;
|
||||
|
||||
case COMPONENT_UPTODATE:
|
||||
break;
|
||||
|
||||
}
|
||||
if (is_array($pack)) {
|
||||
$packs = $pack;
|
||||
} else {
|
||||
notify('Had an unspecified error with the component installer, sorry.');
|
||||
$packs = array($pack);
|
||||
}
|
||||
|
||||
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 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 COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
break;
|
||||
|
||||
case COMPONENT_UPTODATE:
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
notify('Had an unspecified error with the component installer, sorry.');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -110,6 +119,7 @@
|
||||
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
|
||||
@@ -188,9 +198,9 @@
|
||||
$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)); // not probable
|
||||
print_error($cd->get_error(), 'error', "", $a); // not probable
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error')); // not probable
|
||||
print_error($cd->get_error(), 'error'); // not probable
|
||||
}
|
||||
break;
|
||||
case COMPONENT_UPTODATE:
|
||||
@@ -222,6 +232,28 @@
|
||||
|
||||
$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 {
|
||||
@@ -245,6 +277,26 @@
|
||||
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">';
|
||||
@@ -287,7 +339,7 @@
|
||||
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">';
|
||||
echo '<select name="pack[]" id="pack" size="15" multiple="multiple">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
|
||||
@@ -19,7 +19,7 @@ admin_externalpage_setup('ssoaccesscontrol');
|
||||
admin_externalpage_print_header();
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@@ -39,13 +39,13 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
|
||||
// boot if insufficient permission
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error(get_string('nomodifyacl','mnet'));
|
||||
print_error('nomodifyacl','mnet');
|
||||
}
|
||||
|
||||
// fetch the record in question
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
|
||||
error(get_string('recordnoexists','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
print_error('recordnoexists','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@@ -60,7 +60,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') {
|
||||
error(get_string('invalidaccessparam', 'mnet') , "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
print_error('invalidaccessparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
|
||||
@@ -84,7 +84,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// check permissions and verify form input
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error(get_string('nomodifyacl','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
print_error('nomodifyacl','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
if (empty($form->username)) {
|
||||
$formerror['username'] = get_string('enterausername','mnet');
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('mnetenrol');
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,17 +15,17 @@ require_capability('moodle/site:config', $context, $USER->id, true, "nopermissio
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
print_error('nosite', '');
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
print_error('nocurl', 'mnet');
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
@@ -59,7 +59,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
|
||||
error(get_string('xmlrpc-missing', 'mnet'),'peers.php');
|
||||
print_error('xmlrpc-missing', 'mnet','peers.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ 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.");
|
||||
error(get_string("invalidurl", 'mnet'),'peers.php');
|
||||
print_error("invalidurl", 'mnet','peers.php');
|
||||
exit;
|
||||
}
|
||||
unset($temp_wwwroot);
|
||||
@@ -103,7 +103,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (isset($form->public_key)) {
|
||||
$form->public_key = clean_param($form->public_key, PARAM_PEM);
|
||||
if (empty($form->public_key)) {
|
||||
error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
exit;
|
||||
} else {
|
||||
$oldkey = $mnet_peer->public_key;
|
||||
@@ -116,6 +116,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +125,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
|
||||
if ('input' == $form->step) {
|
||||
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
|
||||
error(get_string("hostexists", 'mnet', $mnet_peer->id),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
print_error("hostexists", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id, $mnet_peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
$module = optional_param('module', '', PARAM_SAFEDIR);
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
|
||||
+6
-1
@@ -242,8 +242,13 @@
|
||||
$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.'</span>',
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.$extra.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ class page_admin extends page_base {
|
||||
// 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, SITEID));
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
}
|
||||
|
||||
// has to be fixed. i know there's a "proper" way to do this
|
||||
|
||||
+2
-2
@@ -5,14 +5,14 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
if (!$admin = get_admin()) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/// Scheduled backups are disabled by the server admin
|
||||
if (!empty($CFG->disablescheduledbackups)) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed?
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM)); // needed?
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
@@ -43,7 +43,7 @@
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
if (empty($timeoptions)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
print_error('nostatstodisplay', "", $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
echo '<form action="index.php" method="post">'."\n";
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
print_error('statsnodata', "", $CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ require_once('ex_simple_test.php');
|
||||
require_once('ex_reporter.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/* The UNITTEST constant can be checked elsewhere if you need to know
|
||||
* when your code is being run as part of a unit test. */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
admin_externalpage_setup('defineroles');
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
admin_externalpage_setup('defineroles');
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
|
||||
+3
-21
@@ -45,13 +45,11 @@
|
||||
} else {
|
||||
error('Invalid course id');
|
||||
}
|
||||
$coursecontext = $context;
|
||||
|
||||
} else if (!empty($courseid)){ // we need this for user tabs in user context
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Invalid course id');
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
@@ -60,17 +58,12 @@
|
||||
|
||||
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);
|
||||
$assignableroles = get_assignable_roles($context); // Plain role names, may be altered later
|
||||
|
||||
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
|
||||
|
||||
|
||||
/// Get some language strings
|
||||
@@ -165,17 +158,6 @@
|
||||
}
|
||||
|
||||
|
||||
/// Rename some of the role names if needed
|
||||
if (isset($coursecontext)) {
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($assignableroles[$alias->roleid])) {
|
||||
$assignableroles[$alias->roleid] = $alias->name.' ('.$assignableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Process incoming role assignment
|
||||
|
||||
|
||||
@@ -28,13 +28,9 @@
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Bad course ID');
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
} else {
|
||||
$course = clone($SITE);
|
||||
$courseid = SITEID;
|
||||
$coursecontext = $context;
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
@@ -52,8 +48,8 @@
|
||||
}
|
||||
|
||||
/// needed for tabs.php
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
|
||||
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
@@ -155,18 +151,6 @@
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
/// Rename some of the role names if needed
|
||||
if (isset($coursecontext)) {
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($overridableroles[$alias->roleid])) {
|
||||
$overridableroles[$alias->roleid] = $alias->name.' ('.$overridableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
|
||||
|
||||
if ($roleid) {
|
||||
|
||||
+19
-12
@@ -75,8 +75,6 @@ if ($currenttab != 'update') {
|
||||
|
||||
require_login($course);
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // for role names later
|
||||
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strmodulenameplural = get_string("modulenameplural", $module->name);
|
||||
@@ -110,9 +108,6 @@ if ($currenttab != 'update') {
|
||||
if ($block = get_record('block', 'id', $blockinstance->blockid)) {
|
||||
$blockname = print_context_name($context);
|
||||
|
||||
// Prepare the last part of the breadcrumbs first
|
||||
$navlinks[98] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[99] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
|
||||
switch ($blockinstance->pagetype) {
|
||||
case 'course-view':
|
||||
@@ -120,12 +115,8 @@ if ($currenttab != 'update') {
|
||||
|
||||
require_login($course);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$navlinks[0] = array('name' => $course->shortname,
|
||||
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // for role names later
|
||||
}
|
||||
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $blockname", $course->fullname, $navigation);
|
||||
}
|
||||
@@ -133,14 +124,30 @@ if ($currenttab != 'update') {
|
||||
|
||||
case 'blog-view':
|
||||
$strblogs = get_string('blogs','blog');
|
||||
$navlinks[0] = array('name' => $strblogs,
|
||||
$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);
|
||||
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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,12 +16,12 @@ $adminroot =& admin_get_root(); // need all settings
|
||||
$page =& $adminroot->locate($section);
|
||||
|
||||
if (empty($page) or !is_a($page, 'admin_settingpage')) {
|
||||
error(get_string('sectionerror', 'admin'), "$CFG->wwwroot/$CFG->admin/");
|
||||
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
|
||||
die;
|
||||
}
|
||||
|
||||
if (!($page->check_access())) {
|
||||
error(get_string('accessdenied', 'admin'));
|
||||
print_error('accessdenied', 'admin');
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ if ($hassiteconfig
|
||||
$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',
|
||||
|
||||
@@ -24,10 +24,12 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
|
||||
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0, PARAM_INT));
|
||||
$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, PARAM_INT));
|
||||
$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,
|
||||
|
||||
@@ -20,7 +20,9 @@ if ($hassiteconfig) {
|
||||
|
||||
foreach ($modulebyname as $strmodulename=>$module) {
|
||||
$modulename = $module->name;
|
||||
if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) {
|
||||
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) {
|
||||
|
||||
@@ -145,7 +145,7 @@ $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_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
|
||||
$temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
|
||||
$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));
|
||||
|
||||
@@ -25,7 +25,9 @@ if ($hassiteconfig
|
||||
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_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);
|
||||
|
||||
|
||||
@@ -106,13 +108,21 @@ if ($hassiteconfig
|
||||
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) {
|
||||
$allroles[$role->id] = strip_tags(format_string($role->name, true));
|
||||
$rolename = strip_tags(format_string($role->name, true));
|
||||
$allroles[$role->id] = $rolename;
|
||||
if (!isset($guestroles[$role->id])) {
|
||||
$nonguestroles[$role->id] = $rolename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +131,7 @@ if ($hassiteconfig
|
||||
$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));
|
||||
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));
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
// first thing to do is print the dropdown menu
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$strtimezone = get_string("timezone");
|
||||
$strsavechanges = get_string("savechanges");
|
||||
|
||||
@@ -32,7 +32,7 @@ admin_externalpage_setup('uploadpictures', $adminroot);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
|
||||
@@ -66,9 +66,13 @@ $returnurl = $CFG->wwwroot.'/'.$CFG->admin.'/uploaduser.php';
|
||||
$bulknurl = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
// array of all valid fields for validation
|
||||
$STD_FIELDS = array('firstname', 'lastname', 'username', 'email', 'city', 'country', 'lang', 'auth', 'timezone', 'mailformat', 'maildisplay', 'maildigest', 'htmleditor',
|
||||
'ajax', 'autosubscribe', 'mnethostid', 'institution', 'department', 'idnumber', 'icq', 'phone1', 'phone2', 'address', 'url', 'description',
|
||||
'oldusername', 'emailstop', 'deleted', 'password');
|
||||
$STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email',
|
||||
'city', 'country', 'lang', 'auth', 'timezone', 'mailformat',
|
||||
'maildisplay', 'maildigest', 'htmleditor', 'ajax', 'autosubscribe',
|
||||
'mnethostid', 'institution', 'department', 'idnumber', 'skype',
|
||||
'msn', 'aim', 'yahoo', 'icq', 'phone1', 'phone2', 'address',
|
||||
'url', 'description', 'oldusername', 'emailstop', 'deleted',
|
||||
'password');
|
||||
|
||||
$PRF_FIELDS = array();
|
||||
|
||||
@@ -94,7 +98,7 @@ if (empty($iid)) {
|
||||
if ($readcount === false) {
|
||||
error($cir->get_error(), $returnurl);
|
||||
} else if ($readcount == 0) {
|
||||
error(get_string('csvemptyfile', 'error'), $returnurl);
|
||||
print_error('csvemptyfile', 'error', $returnurl);
|
||||
}
|
||||
// continue to form2
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
$mform->setType('phone1', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone1');
|
||||
|
||||
$mform->addElement('text', 'phone2', get_string('phone'), 'maxlength="20" size="25"');
|
||||
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
|
||||
$mform->setType('phone2', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone2');
|
||||
|
||||
|
||||
@@ -17,16 +17,31 @@ if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
|
||||
if ($format) {
|
||||
$fields = array('id' => 'id',
|
||||
'username' => get_string('username'),
|
||||
'email' => get_string('email'),
|
||||
'firstname' => get_string('firstname'),
|
||||
'lastname' => get_string('lastname'),
|
||||
'idnumber' => get_string('idnumber'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'));
|
||||
'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);
|
||||
@@ -56,6 +71,7 @@ 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');
|
||||
|
||||
@@ -77,6 +93,7 @@ function user_download_ods($fields) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
@@ -92,6 +109,7 @@ 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');
|
||||
|
||||
@@ -113,6 +131,7 @@ function user_download_xls($fields) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
@@ -126,6 +145,8 @@ function user_download_xls($fields) {
|
||||
|
||||
function user_download_csv($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
|
||||
$filename = clean_filename(get_string('users').'.csv');
|
||||
|
||||
@@ -149,6 +170,7 @@ function user_download_csv($fields) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
profile_load_data($user);
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$row[] = str_replace($delimiter, $encdelim, $user->$field);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/// Body of the script, based on action, we delegate the work
|
||||
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
// hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS
|
||||
//
|
||||
if (!$_SERVER['REQUEST_URI']) {
|
||||
if (!isset($_SERVER['REQUEST_URI'])) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -487,11 +487,8 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
* @return array
|
||||
*/
|
||||
function ldap_attributes () {
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
"idnumber", "lang" );
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
foreach ($this->userfields as $field) {
|
||||
if (!empty($this->config->{"field_map_$field"})) {
|
||||
$moodleattributes[$field] = $this->config->{"field_map_$field"};
|
||||
if (preg_match('/,/',$moodleattributes[$field])) {
|
||||
@@ -698,7 +695,7 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
// find users in DB that aren't in ldap -- to be removed!
|
||||
// this is still not as scalable (but how often do we mass delete?)
|
||||
if (!empty($this->config->removeuser)) {
|
||||
$sql = "SELECT u.id, u.username, u.email
|
||||
$sql = "SELECT u.id, u.username, u.email, u.auth
|
||||
FROM {$CFG->prefix}user u
|
||||
LEFT JOIN $temptable e ON u.username = e.username
|
||||
WHERE u.auth='cas'
|
||||
|
||||
@@ -134,7 +134,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
|
||||
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
|
||||
|
||||
@@ -722,7 +722,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="attrcreators_key"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
|
||||
<td align="right"><label for="attrcreators"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
@@ -742,7 +742,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="groupecreators_key"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
|
||||
<td align="right"><label for="groupecreators"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
@@ -825,4 +825,4 @@ print_auth_lock_options('cas', $user_fields, $help, true, true);
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
+3
-6
@@ -132,11 +132,8 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
* @return array
|
||||
*/
|
||||
function db_attributes() {
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
"idnumber", "lang" );
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
foreach ($this->userfields as $field) {
|
||||
if (!empty($this->config->{"field_map_$field"})) {
|
||||
$moodleattributes[$field] = $this->config->{"field_map_$field"};
|
||||
}
|
||||
@@ -241,11 +238,11 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
// find obsolete users
|
||||
if (count($userlist)) {
|
||||
$sql = "SELECT u.id, u.username, u.email
|
||||
$sql = "SELECT u.id, u.username, u.email, u.auth
|
||||
FROM {$CFG->prefix}user u
|
||||
WHERE u.auth='db' AND u.deleted=0 AND u.username NOT IN ($quoteduserlist)";
|
||||
} else {
|
||||
$sql = "SELECT u.id, u.username, u.email
|
||||
$sql = "SELECT u.id, u.username, u.email, u.auth
|
||||
FROM {$CFG->prefix}user u
|
||||
WHERE u.auth='db' AND u.deleted=0";
|
||||
}
|
||||
|
||||
@@ -197,8 +197,24 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
* Processes and stores configuration data for this authentication plugin.
|
||||
*/
|
||||
function process_config($config) {
|
||||
// set to defaults if undefined
|
||||
if (!isset($config->recaptcha)) {
|
||||
$config->recaptcha = false;
|
||||
}
|
||||
|
||||
// save settings
|
||||
set_config('recaptcha', $config->recaptcha, 'auth/email');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.
|
||||
* @abstract Implement in child classes
|
||||
* @return bool
|
||||
*/
|
||||
function is_captcha_enabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+19
-1
@@ -1,7 +1,25 @@
|
||||
<!-- No config needed -->
|
||||
<div style="text-align: center"><?php print_string('none'); ?></div>
|
||||
<?php
|
||||
// set to defaults if undefined
|
||||
if (!isset($config->recaptcha)) {
|
||||
$config->recaptcha = false;
|
||||
}
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
?>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h2 class="main"><?php print_string('auth_emailsettings', 'auth') ?> </h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><label for="menurecaptcha"><?php print_string('auth_emailrecaptcha_key', 'auth') ?></label></td>
|
||||
<td><?php choose_from_menu($yesno, 'recaptcha', $config->recaptcha, ''); ?></td>
|
||||
<td><?php print_string('auth_emailrecaptcha', 'auth') ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('email', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
+2
-5
@@ -643,7 +643,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
// find users in DB that aren't in ldap -- to be removed!
|
||||
// this is still not as scalable (but how often do we mass delete?)
|
||||
if (!empty($this->config->removeuser)) {
|
||||
$sql = "SELECT u.id, u.username, u.email
|
||||
$sql = "SELECT u.id, u.username, u.email, u.auth
|
||||
FROM {$CFG->prefix}user u
|
||||
LEFT JOIN $temptable e ON u.username = e.username
|
||||
WHERE u.auth='ldap'
|
||||
@@ -1647,11 +1647,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
*/
|
||||
|
||||
function ldap_attributes () {
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
"idnumber", "lang" );
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
foreach ($this->userfields as $field) {
|
||||
if (!empty($this->config->{"field_map_$field"})) {
|
||||
$moodleattributes[$field] = $this->config->{"field_map_$field"};
|
||||
if (preg_match('/,/',$moodleattributes[$field])) {
|
||||
|
||||
@@ -450,7 +450,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="ntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key','auth') ?></label></td>
|
||||
<td align="right"><label for="menuntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled, '0');
|
||||
@@ -462,7 +462,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key','auth') ?></label></td>
|
||||
<td><input name="ntlmsso_subnet" id="ntlmsso_subnet" type="text" size="30" value="<?php p($config->ntlmsso_subnet) ?>"
|
||||
<td><input name="ntlmsso_subnet" id="ntlmsso_subnet" type="text" size="30" value="<?php p($config->ntlmsso_subnet) ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ntlmsso_subnet','auth') ?>
|
||||
|
||||
+12
-12
@@ -171,16 +171,16 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
// check remote login permissions
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM, SITEID))
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM))
|
||||
or is_mnet_remote_user($USER)
|
||||
or $USER->username == 'guest'
|
||||
or empty($USER->id)) {
|
||||
error(get_string('notpermittedtojump', 'mnet'));
|
||||
print_error('notpermittedtojump', 'mnet');
|
||||
}
|
||||
|
||||
// check for SSO publish permission first
|
||||
if ($this->has_service($mnethostid, 'sso_sp') == false) {
|
||||
error(get_string('hostnotconfiguredforsso', 'mnet'));
|
||||
print_error('hostnotconfiguredforsso', 'mnet');
|
||||
}
|
||||
|
||||
// set RPC timeout to 30 seconds if not configured
|
||||
@@ -209,7 +209,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
} else {
|
||||
$mnet_session->useragent = sha1($_SERVER['HTTP_USER_AGENT']);
|
||||
@@ -218,7 +218,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (false == update_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// verify the remote host is configured locally before attempting RPC call
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot)) {
|
||||
error(get_string('notpermittedtoland', 'mnet'));
|
||||
print_error('notpermittedtoland', 'mnet');
|
||||
}
|
||||
|
||||
// get the originating (ID provider) host info
|
||||
@@ -268,7 +268,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
|
||||
if($code == 702) {
|
||||
$site = get_site();
|
||||
print_error('mnet_session_prohibited','mnet', $remotewwwroot, format_string($site->fullname));
|
||||
print_error('mnet_session_prohibited', 'mnet', $remotewwwroot, format_string($site->fullname));
|
||||
exit;
|
||||
}
|
||||
$message .= "ERROR $code:<br/>$errormessage<br/>";
|
||||
@@ -291,15 +291,15 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
// TODO: refactor into a separate function
|
||||
if (empty($localuser) || ! $localuser->id) {
|
||||
if (empty($this->config->auto_add_remote_users)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
print_error('nolocaluser', 'mnet');
|
||||
}
|
||||
$remoteuser->mnethostid = $remotehost->id;
|
||||
if (! insert_record('user', addslashes_object($remoteuser))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
$firsttime = true;
|
||||
if (! $localuser = get_record('user', 'username', addslashes($remoteuser->username), 'mnethostid', $remotehost->id)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
print_error('nolocaluser', 'mnet');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
} else {
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
@@ -1124,7 +1124,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_request->add_param($username);
|
||||
$mnet_request->add_param($useragent);
|
||||
if ($mnet_request->send($mnet_peer) === false) {
|
||||
debugging("Server side error has occured on host $mnethostid: " .
|
||||
debugging("Server side error has occured on host $mnetsession->mnethostid: " .
|
||||
join("\n", $mnet_request->error));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
|
||||
|
||||
require_login();
|
||||
|
||||
if (!is_enabled_auth('mnet')) {
|
||||
error('mnet is disabled');
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
// Check whether we have got all the essential attributes
|
||||
if ( empty($_SERVER[$this->config->user_attribute]) ) {
|
||||
error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')"));
|
||||
print_error( 'shib_not_all_attributes_error', 'auth' , '', "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')");
|
||||
}
|
||||
|
||||
$attrmap = $this->get_attributes();
|
||||
@@ -123,12 +123,8 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
function get_attributes() {
|
||||
$configarray = (array) $this->config;
|
||||
|
||||
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
||||
"department", "address", "city", "country", "description",
|
||||
"idnumber", "lang", "guid");
|
||||
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
foreach ($this->userfields as $field) {
|
||||
if (isset($configarray["field_map_$field"])) {
|
||||
$moodleattributes[$field] = $configarray["field_map_$field"];
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<tr valign="top">
|
||||
<td align="right">Identity Providers:</td>
|
||||
<td>
|
||||
<textarea name="organization_selection" rows="10" cols="30" style="overflow: auto;" wrap="off"
|
||||
<textarea name="organization_selection" rows="10" cols="30" style="overflow: auto; white-space: nowrap;"
|
||||
><?php
|
||||
if (!isset($config->organization_selection)){
|
||||
echo 'urn:mace:organization1:providerID, Example Organization 1
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
// Check whether Shibboleth is configured properly
|
||||
if (empty($pluginconfig->user_attribute)) {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
print_error('shib_not_set_up_error', 'auth');
|
||||
}
|
||||
|
||||
/// If we can find the Shibboleth attribute, save it in session and return to main login page
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
/// Go to my-moodle page instead of homepage if mymoodleredirect enabled
|
||||
if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->mymoodleredirect) and !isguest()) {
|
||||
if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) and !empty($CFG->mymoodleredirect) and !isguest()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/';
|
||||
}
|
||||
@@ -88,9 +88,9 @@
|
||||
// If we can find any (user independent) Shibboleth attributes but no user
|
||||
// attributes we probably didn't receive any user attributes
|
||||
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])) {
|
||||
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
|
||||
print_error('shib_no_attributes_error', 'auth' , '', '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\'');
|
||||
} else {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
print_error('shib_not_set_up_error', 'auth');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@
|
||||
}
|
||||
} else {
|
||||
require_login();
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
}
|
||||
|
||||
//Print header
|
||||
if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $strcoursebackup, 'link' => 'backup.php', 'type' => 'misc');
|
||||
$navlinks[] = array('name' => "$course->fullname ($course->shortname)", 'link' => null, 'type' => 'misc');
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
|
||||
//user info, user_files, logs and exercises, workshop and messages & blogs backups. A Warning is showed to
|
||||
//inform the user.
|
||||
// TODO: Move this logic to one function to be shared by any (manual, scheduled) backup
|
||||
if ($backupprefs->backup_users == 2) {
|
||||
@@ -114,6 +114,7 @@
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
$backupprefs->backup_blogs = 0;
|
||||
$backupprefs->backuproleassignments = array();
|
||||
|
||||
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
|
||||
@@ -195,7 +196,7 @@
|
||||
$user_options[2] = get_string("includenoneusers");
|
||||
echo $user_options[$backupprefs->backup_users].'</b>';
|
||||
//Print info
|
||||
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages);
|
||||
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages, $backupprefs->backup_blogs);
|
||||
print_table($table);
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+60
-43
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@
|
||||
$backup_site_files = optional_param('backup_site_files',1);
|
||||
$backup_gradebook_history = optional_param('backup_gradebook_history', 0, PARAM_INT);
|
||||
$backup_messages = optional_param('backup_messages',1);
|
||||
$backup_blogs = optional_param('backup_blogs',1);
|
||||
|
||||
if ($count == 0) {
|
||||
notice("No backupable modules are installed!");
|
||||
@@ -124,7 +125,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Print option to select/deselect everything with 1 click.
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\">";
|
||||
echo '<b>'.get_string("include").":</b>";
|
||||
echo '<b>'.get_string("include")."</b>";
|
||||
echo "</td><td>";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', true);\">". get_string("all")."</a>/";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', false);\">". get_string("none")."</a>";
|
||||
@@ -142,8 +143,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$modname = $mod->name;
|
||||
$modbackup = $modname."_backup_mods";
|
||||
//If exists the lib & function
|
||||
$var = "exists_".$modname;
|
||||
if (isset($$var) && $$var) {
|
||||
$var = 'exists_'.$modname;
|
||||
$exvar = 'exists_one_'.$modname;
|
||||
if (!empty($$var) and !empty($$exvar)) {
|
||||
//Print the full tr
|
||||
echo "<tr class=\"r".$currentrow."\">";
|
||||
echo " <td align=\"right\"> ";
|
||||
@@ -166,29 +168,25 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
// if we have the backup_one_mod function, loop here.
|
||||
$var = 'exists_one_'.$modname;
|
||||
if (!empty($$var)) {
|
||||
echo '<tr><td></td><td colspan="3"><table class="backup-form-instances">';
|
||||
$instances = get_all_instances_in_course($modname, $course, NULL, true);
|
||||
foreach ($instances as $instance) {
|
||||
echo '<tr><td>';
|
||||
$var = 'backup_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
print_checkbox($var,$$var,$$var,$instance->name,$instance->name,'this.form.elements[\'backup_'.$modname.'\'].checked=1;');
|
||||
echo '</td><td align="right"> ';
|
||||
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
if (empty($to)) {
|
||||
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'backup_user_info_'.$modname.'\'].checked=1;');
|
||||
} else {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td></td><td colspan="3"><table class="backup-form-instances">';
|
||||
$instances = get_all_instances_in_course($modname, $course, NULL, true);
|
||||
$var = $exvar;
|
||||
foreach ($instances as $instance) {
|
||||
echo '<tr><td>';
|
||||
$var = 'backup_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
print_checkbox($var,$$var,$$var,$instance->name,$instance->name,'this.form.elements[\'backup_'.$modname.'\'].checked=1;');
|
||||
echo '</td><td align="right"> ';
|
||||
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
if (empty($to)) {
|
||||
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'backup_user_info_'.$modname.'\'].checked=1;');
|
||||
} else {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
}
|
||||
echo '</table></td></tr>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
echo '</table></td></tr>';
|
||||
}
|
||||
}
|
||||
//Line
|
||||
@@ -198,7 +196,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the Metacourse tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("metacourse").":";
|
||||
echo '<label for="menubackup_metacourse">'.get_string ("metacourse").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$meta_options[0] = get_string("no");
|
||||
$meta_options[1] = get_string("yes");
|
||||
@@ -213,7 +211,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the Users tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string("users").":";
|
||||
echo '<label for="menubackup_users">'.get_string ("users").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$user_options[0] = get_string("all");
|
||||
$user_options[1] = get_string("course");
|
||||
@@ -229,7 +227,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the Logs tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string("logs").":";
|
||||
echo '<label for="menubackup_logs">'.get_string ("logs").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$log_options[0] = get_string("no");
|
||||
$log_options[1] = get_string("yes");
|
||||
@@ -244,7 +242,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the User Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("userfiles").":";
|
||||
echo '<label for="menubackup_user_files">'.get_string ("userfiles").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$user_file_options[0] = get_string("no");
|
||||
$user_file_options[1] = get_string("yes");
|
||||
@@ -254,10 +252,11 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
else {
|
||||
$hidden_options .= '<input type="hidden" name="backup_user_files" value="0" />';
|
||||
}
|
||||
|
||||
//Now print the Course Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("coursefiles").":";
|
||||
echo '<label for="menubackup_course_files">'.get_string ("coursefiles").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$course_file_options[0] = get_string("no");
|
||||
$course_file_options[1] = get_string("yes");
|
||||
@@ -269,7 +268,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the site Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("sitefilesused").":";
|
||||
echo '<label for="menubackup_site_files">'.get_string ("sitefilesused").'</label>';
|
||||
helpbutton('sitefilesused', get_string('sitefilesused'));
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$course_file_options[0] = get_string("no");
|
||||
@@ -279,20 +278,24 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
}
|
||||
|
||||
// do you want grade histories to be backed up?
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ('gradebookhistories', 'grades').":";
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$gradebook_history_options[0] = get_string("no");
|
||||
$gradebook_history_options[1] = get_string("yes");
|
||||
choose_from_menu($gradebook_history_options, "backup_gradebook_history", $backup_gradebook_history, "");
|
||||
echo "</td></tr>";
|
||||
if (empty($CFG->disablegradehistory)) {
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menubackup_gradebook_history">'.get_string ('gradebookhistories', 'grades').'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$gradebook_history_options[0] = get_string("no");
|
||||
$gradebook_history_options[1] = get_string("yes");
|
||||
choose_from_menu($gradebook_history_options, "backup_gradebook_history", $backup_gradebook_history, "");
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
$hidden_options .= '<input type="hidden" name="backup_gradebook_history" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to) && $course->id == SITEID) {
|
||||
//If we are in a SITEID backup print the Messages tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ('messages','message').":";
|
||||
echo '<label for="menubackup_messages">'.get_string ('messages', 'message').'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$mess_options[0] = get_string("no");
|
||||
$mess_options[1] = get_string("yes");
|
||||
@@ -302,6 +305,21 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
else {
|
||||
$hidden_options .= '<input type="hidden" name="backup_messages" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to) && $course->id == SITEID && !empty($CFG->bloglevel)) {
|
||||
//If we are in a SITEID backup and blogs are enabled print the Blogs tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ('blogs','blog').":";
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$blog_options[0] = get_string("no");
|
||||
$blog_options[1] = get_string("yes");
|
||||
choose_from_menu($blog_options, "backup_blogs", $backup_blogs, "");
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
$hidden_options .= '<input type="hidden" name="backup_blogs" value="0" />';
|
||||
}
|
||||
}
|
||||
|
||||
//Now print a place to select which role assignments to back up.
|
||||
@@ -311,7 +329,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" valign=\"top\" colspan=\"2\"><b>";
|
||||
echo get_string("backuproleassignments").":";
|
||||
echo get_string("backuproleassignments");
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$roles = get_records('role', '', '', 'sortorder');
|
||||
foreach ($roles as $role) {
|
||||
@@ -333,12 +351,11 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
|
||||
?>
|
||||
</table>
|
||||
<div style="text-align:center;margin-left:auto;margin-right:auto">
|
||||
<?php
|
||||
/// Print captured hidden options, now that we have closed the table
|
||||
echo $hidden_options;
|
||||
?>
|
||||
|
||||
<div style="text-align:center;margin-left:auto;margin-right:auto">
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="to" value="<?php p($to) ?>" />
|
||||
<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code); ?>" />
|
||||
|
||||
@@ -340,6 +340,9 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
if (!isset($backup_config->backup_sche_messages)) {
|
||||
$backup_config->backup_sche_messages = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_blogs)) {
|
||||
$backup_config->backup_sche_blogs = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_active)) {
|
||||
$backup_config->backup_sche_active = 0;
|
||||
}
|
||||
@@ -437,6 +440,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$preferences->backup_course_files = $backup_config->backup_sche_coursefiles;
|
||||
$preferences->backup_site_files = $backup_config->backup_sche_sitefiles;
|
||||
$preferences->backup_messages = $backup_config->backup_sche_messages;
|
||||
$preferences->backup_blogs = $backup_config->backup_sche_blogs;
|
||||
$preferences->backup_course = $course->id;
|
||||
$preferences->backup_destination = $backup_config->backup_sche_destination;
|
||||
$preferences->backup_keep = $backup_config->backup_sche_keep;
|
||||
@@ -507,7 +511,13 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
} else {
|
||||
$include_message_users = false;
|
||||
}
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$include_message_users);
|
||||
//Decide about include users with blogs, based on SITEID
|
||||
if ($preferences->backup_blogs && $preferences->backup_course == SITEID) {
|
||||
$include_blog_users = true;
|
||||
} else {
|
||||
$include_blog_users = false;
|
||||
}
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$include_message_users, $include_blog_users);
|
||||
}
|
||||
|
||||
//Now calculate the logs
|
||||
@@ -623,9 +633,14 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
//doing a SITE backup, let's do it
|
||||
if ($status && $preferences->backup_messages && $preferences->backup_course == SITEID) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," messages");
|
||||
if (!$status = backup_messages($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up messages");
|
||||
}
|
||||
$status = backup_messages($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//If we have selected to backup blogs and we are
|
||||
//doing a SITE backup, let's do it
|
||||
if ($status && $preferences->backup_blogs && $preferences->backup_course == SITEID) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," blogs");
|
||||
$status = backup_blogs($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//If we have selected to backup quizzes, backup categories and
|
||||
|
||||
+318
-144
@@ -12,9 +12,11 @@
|
||||
* @param int $backup_unique_code setting specifying what users to export (0=all, 1=needed, 2=none)
|
||||
* @param int $backup_messages flag (true/false) defining if messages must be
|
||||
* considered to extract needed users
|
||||
* @param int $backup_blogs flag (true/false) defining if blogs must be
|
||||
* considered to extract needed users
|
||||
* @return array one array (key, value) sumarizing the result of the function (number of users)
|
||||
*/
|
||||
function user_check_backup($courseid,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
function user_check_backup($courseid,$backup_unique_code,$backup_users,$backup_messages,$backup_blogs) {
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$count_users = 0;
|
||||
@@ -25,8 +27,9 @@
|
||||
|
||||
} else if ($backup_users == 1) { /// Needed users
|
||||
|
||||
/// Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($courseid, $backup_messages);
|
||||
/// Calculate needed users (calling every xxxx_get_participants function + scales users
|
||||
/// + messages users + blogs users)
|
||||
$needed_users = backup_get_needed_users($courseid, $backup_messages, $backup_blogs);
|
||||
|
||||
/// Calculate enrolled users (having course:view cap)
|
||||
$enrolled_users = backup_get_enrolled_users($courseid);
|
||||
@@ -83,11 +86,13 @@
|
||||
//Returns every needed user (participant) in a course
|
||||
//It uses the xxxx_get_participants() function
|
||||
//plus users needed to backup scales.
|
||||
//Also it search for users having messages and
|
||||
//users having blogs
|
||||
//WARNING: It returns only NEEDED users, not every
|
||||
// every student and teacher in the course, so it
|
||||
//must be merged with backup_get_enrrolled_users !!
|
||||
|
||||
function backup_get_needed_users ($courseid, $includemessages=false) {
|
||||
function backup_get_needed_users ($courseid, $includemessages=false, $includeblogs=false) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
@@ -150,6 +155,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Now, add blog users if necessary
|
||||
if ($includeblogs) {
|
||||
include_once("$CFG->dirroot/blog/lib.php");
|
||||
//Get users
|
||||
$blogusers = blog_get_participants();
|
||||
//Add blog users to results
|
||||
if ($blogusers) {
|
||||
foreach ($blogusers as $bloguser) {
|
||||
//If id != 0
|
||||
if ($bloguser->id !=0) {
|
||||
$result[$bloguser->id]->id = $bloguser->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@@ -585,18 +606,30 @@
|
||||
} else {
|
||||
fwrite ($bf,full_tag("COURSEFILES",3,false,"false"));
|
||||
}
|
||||
//The course files
|
||||
//The site files
|
||||
if ($preferences->backup_site_files == 1) {
|
||||
fwrite ($bf,full_tag("SITEFILES",3,false,"true"));
|
||||
} else {
|
||||
fwrite ($bf,full_tag("SITEFILES",3,false,"false"));
|
||||
}
|
||||
//The gradebook histories
|
||||
if ($preferences->backup_gradebook_history == 1) {
|
||||
fwrite ($bf,full_tag("GRADEBOOKHISTORIES",3,false,"true"));
|
||||
} else {
|
||||
fwrite ($bf,full_tag("GRADEBOOKHISTORIES",3,false,"false"));
|
||||
}
|
||||
//The messages in backup
|
||||
if ($preferences->backup_messages == 1 && $preferences->backup_course == SITEID) {
|
||||
fwrite ($bf,full_tag("MESSAGES",3,false,"true"));
|
||||
} else {
|
||||
fwrite ($bf,full_tag("MESSAGES",3,false,"false"));
|
||||
}
|
||||
//The blogs in backup
|
||||
if ($preferences->backup_blogs == 1 && $preferences->backup_course == SITEID) {
|
||||
fwrite ($bf,full_tag("BLOGS",3,false,"true"));
|
||||
} else {
|
||||
fwrite ($bf,full_tag("BLOGS",3,false,"false"));
|
||||
}
|
||||
//The mode of writing the block data
|
||||
fwrite ($bf,full_tag('BLOCKFORMAT',3,false,'instances'));
|
||||
fwrite ($bf,end_tag("DETAILS",2,true));
|
||||
@@ -608,13 +641,19 @@
|
||||
fwrite ($bf, start_tag('ROLES', 1, true));
|
||||
$roles = backup_fetch_roles($preferences);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $preferences->backup_course);
|
||||
|
||||
foreach ($roles as $role) {
|
||||
fwrite ($bf,start_tag('ROLE',2,true));
|
||||
fwrite ($bf,full_tag('ID', 3, false, $role->id));
|
||||
fwrite ($bf,full_tag('NAME',3,false,$role->name));
|
||||
fwrite ($bf,full_tag('SHORTNAME',3,false,$role->shortname));
|
||||
/// Calculate $role name in course
|
||||
$nameincourse = role_get_name($role, $coursecontext);
|
||||
if ($nameincourse != $role->name) {
|
||||
fwrite ($bf,full_tag('NAMEINCOURSE', 3, false, $nameincourse));
|
||||
}
|
||||
// find and write all default capabilities
|
||||
fwrite ($bf,start_tag('CAPABILITIES',3,true));
|
||||
// pull out all default (site context) capabilities
|
||||
@@ -624,6 +663,7 @@
|
||||
fwrite ($bf,full_tag('NAME', 5, false, $capability));
|
||||
fwrite ($bf,full_tag('PERMISSION', 5, false, $value));
|
||||
// use this to pull out the other info (timemodified and modifierid)
|
||||
|
||||
$cap = get_record_sql("SELECT *
|
||||
FROM {$CFG->prefix}role_capabilities
|
||||
WHERE capability = '$capability'
|
||||
@@ -910,6 +950,92 @@
|
||||
|
||||
}
|
||||
|
||||
//Print blogs info (post table, module=blog, course=0)
|
||||
function backup_blogs($bf, $preferences) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
/// Check we have something to backup
|
||||
$siteblogs = count_records('post', 'module', 'blog', 'courseid', 0);
|
||||
|
||||
if ($siteblogs) {
|
||||
$counter = 0;
|
||||
/// blogs open tag
|
||||
fwrite ($bf, start_tag("BLOGS",2,true));
|
||||
|
||||
if ($siteblogs) {
|
||||
$rs_blogs = get_recordset_sql("SELECT * from {$CFG->prefix}post
|
||||
WHERE module = 'blog'
|
||||
AND courseid = 0");
|
||||
/// Iterate over every blog
|
||||
while ($blog = rs_fetch_next_record($rs_blogs)) {
|
||||
/// start blog
|
||||
fwrite($bf, start_tag("BLOG",3,true));
|
||||
/// blog body
|
||||
fwrite ($bf,full_tag("ID",4,false,$blog->id));
|
||||
fwrite ($bf,full_tag("MODULE",4,false,$blog->module));
|
||||
fwrite ($bf,full_tag("USERID",4,false,$blog->userid));
|
||||
fwrite ($bf,full_tag("COURSEID",4,false,$blog->courseid));
|
||||
fwrite ($bf,full_tag("GROUPID",4,false,$blog->groupid));
|
||||
fwrite ($bf,full_tag("MODULEID",4,false,$blog->moduleid));
|
||||
fwrite ($bf,full_tag("COURSEMODULEID",4,false,$blog->coursemoduleid));
|
||||
fwrite ($bf,full_tag("SUBJECT",4,false,$blog->subject));
|
||||
fwrite ($bf,full_tag("SUMMARY",4,false,$blog->summary));
|
||||
fwrite ($bf,full_tag("CONTENT",4,false,$blog->content));
|
||||
fwrite ($bf,full_tag("UNIQUEHASH",4,false,$blog->uniquehash));
|
||||
fwrite ($bf,full_tag("RATING",4,false,$blog->rating));
|
||||
fwrite ($bf,full_tag("FORMAT",4,false,$blog->format));
|
||||
fwrite ($bf,full_tag("ATTACHMENT",4,false,$blog->attachment));
|
||||
fwrite ($bf,full_tag("PUBLISHSTATE",4,false,$blog->publishstate));
|
||||
fwrite ($bf,full_tag("LASTMODIFIED",4,false,$blog->lastmodified));
|
||||
fwrite ($bf,full_tag("CREATED",4,false,$blog->created));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",4,false,$blog->usermodified));
|
||||
|
||||
/// Blog tags
|
||||
/// Check if we have blog tags to backup
|
||||
if (!empty($CFG->usetags)) {
|
||||
if ($tags = tag_get_tags('post', $blog->id)) { //This return them ordered by default
|
||||
/// Start BLOG_TAGS tag
|
||||
fwrite ($bf,start_tag("BLOG_TAGS",4,true));
|
||||
/// Write blog tags fields
|
||||
foreach ($tags as $tag) {
|
||||
fwrite ($bf,start_tag("BLOG_TAG",5,true));
|
||||
fwrite ($bf,full_tag("NAME",6,false,$tag->name));
|
||||
fwrite ($bf,full_tag("RAWNAME",6,false,$tag->rawname));
|
||||
fwrite ($bf,end_tag("BLOG_TAG",5,true));
|
||||
}
|
||||
/// End BLOG_TAGS tag
|
||||
fwrite ($bf,end_tag("BLOG_TAGS",4,true));
|
||||
}
|
||||
}
|
||||
|
||||
/// Blog comments
|
||||
/// TODO: Blog comments go here (2.0)
|
||||
|
||||
/// end blog
|
||||
fwrite($bf, end_tag("BLOG",3,true));
|
||||
|
||||
/// Do some output
|
||||
$counter++;
|
||||
if ($counter % 20 == 0) {
|
||||
echo ".";
|
||||
if ($counter % 400 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
rs_close($rs_blogs);
|
||||
}
|
||||
/// blogs close tag
|
||||
$status = fwrite($bf, end_tag("BLOGS",2,true));
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Prints course's blocks info (table block_instance)
|
||||
function backup_course_blocks ($bf,$preferences) {
|
||||
|
||||
@@ -923,27 +1049,31 @@
|
||||
$pages = array();
|
||||
$pages[] = page_create_object(PAGE_COURSE_VIEW, $preferences->backup_course);
|
||||
|
||||
// Let's see if we have to backup blocks from modules
|
||||
$modulerecords = get_records_sql('SELECT name, id FROM '.$CFG->prefix.'modules');
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
// get course structure
|
||||
$course = get_record('course', 'id', $preferences->backup_course);
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
|
||||
foreach($preferences->mods as $module) {
|
||||
if(!$module->backup) {
|
||||
continue;
|
||||
}
|
||||
foreach($preferences->mods as $module) {
|
||||
if (!$module->backup) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cmods = get_records_select('course_modules', 'course = '.$preferences->backup_course.' AND module = '.$modulerecords[$module->name]->id);
|
||||
if(empty($cmods)) {
|
||||
continue;
|
||||
}
|
||||
if (empty($modinfo->instances[$module->name])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pagetypes = page_import_types('mod/'.$module->name.'/');
|
||||
if(empty($pagetypes)) {
|
||||
continue;
|
||||
}
|
||||
$pagetypes = page_import_types('mod/'.$module->name.'/');
|
||||
if (empty($pagetypes)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($pagetypes as $pagetype) {
|
||||
foreach($cmods as $cmod) {
|
||||
$pages[] = page_create_object($pagetype, $cmod->instance);
|
||||
foreach($pagetypes as $pagetype) {
|
||||
foreach($modinfo->instances[$module->name] as $cm) {
|
||||
if (!empty($module->instances[$cm->instance]->backup)) {
|
||||
$pages[] = page_create_object($pagetype, $cm->instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -951,7 +1081,7 @@
|
||||
//Blocks open tag
|
||||
fwrite ($bf,start_tag('BLOCKS',2,true));
|
||||
|
||||
while($page = array_pop($pages)) {
|
||||
foreach($pages as $page) {
|
||||
if ($instances = blocks_get_by_page($page)) {
|
||||
//Iterate over every block
|
||||
foreach ($instances as $position) {
|
||||
@@ -961,26 +1091,32 @@
|
||||
if(empty($blocks[$instance->blockid]->name)) {
|
||||
continue;
|
||||
}
|
||||
$blockname = $blocks[$instance->blockid]->name;
|
||||
|
||||
//Give the block a chance to process any links in configdata.
|
||||
if (!isset($blocks[$instance->blockid]->blockobject)) {
|
||||
$blocks[$instance->blockid]->blockobject = block_instance($blocks[$instance->blockid]->name);
|
||||
if (!$blockobj = block_instance($blockname, $instance)) {
|
||||
// Invalid block
|
||||
continue;
|
||||
}
|
||||
$config = unserialize(base64_decode($instance->configdata));
|
||||
$blocks[$instance->blockid]->blockobject->backup_encode_absolute_links_in_config($config);
|
||||
$instance->configdata = base64_encode(serialize($config));
|
||||
|
||||
// encode absolute links in block config
|
||||
$instance->configdata = $blockobj->get_backup_encoded_config();
|
||||
|
||||
//Begin Block
|
||||
fwrite ($bf,start_tag('BLOCK',3,true));
|
||||
fwrite ($bf,full_tag('ID', 4, false,$instance->id));
|
||||
fwrite ($bf,full_tag('NAME',4,false,$blocks[$instance->blockid]->name));
|
||||
fwrite ($bf,full_tag('NAME',4,false,$blockname));
|
||||
fwrite ($bf,full_tag('PAGEID',4,false,$instance->pageid));
|
||||
fwrite ($bf,full_tag('PAGETYPE',4,false,$instance->pagetype));
|
||||
fwrite ($bf,full_tag('POSITION',4,false,$instance->position));
|
||||
fwrite ($bf,full_tag('WEIGHT',4,false,$instance->weight));
|
||||
fwrite ($bf,full_tag('VISIBLE',4,false,$instance->visible));
|
||||
fwrite ($bf,full_tag('CONFIGDATA',4,false,$instance->configdata));
|
||||
|
||||
// Write instance data if needed
|
||||
if ($blockobj->backuprestore_instancedata_used()) {
|
||||
fwrite ($bf,start_tag('INSTANCEDATA',4,true));
|
||||
$status = $blockobj->instance_backup($bf, $preferences);
|
||||
fwrite ($bf,end_tag('INSTANCEDATA',4,true));
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
@@ -1087,8 +1223,18 @@
|
||||
|
||||
if ($selected) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $tok);
|
||||
//Gets course_module data from db
|
||||
$course_module = get_records ("course_modules","id",$tok);
|
||||
//Gets course_module data from db - verify activity exists and is enabled!
|
||||
$sql = "SELECT cm.*
|
||||
FROM {$CFG->prefix}course_modules cm
|
||||
JOIN {$CFG->prefix}modules m ON m.id = cm.module
|
||||
JOIN {$CFG->prefix}$moduletype a ON a.id = cm.instance
|
||||
WHERE m.visible = 1 AND cm.id = $tok";
|
||||
if (!$course_module = get_record_sql($sql)) {
|
||||
// cm exists but activity instance missing - probably caused by double clicking
|
||||
$tok = strtok(",");
|
||||
continue;
|
||||
}
|
||||
|
||||
//If it's the first, pring MODS tag
|
||||
if ($first_record) {
|
||||
fwrite ($bf,start_tag("MODS",4,true));
|
||||
@@ -1097,8 +1243,8 @@
|
||||
// if we're doing selected instances, check that too.
|
||||
if (is_array($preferences->mods[$moduletype]->instances)
|
||||
&& count($preferences->mods[$moduletype]->instances)
|
||||
&& (!array_key_exists($course_module[$tok]->instance,$preferences->mods[$moduletype]->instances)
|
||||
|| empty($preferences->mods[$moduletype]->instances[$course_module[$tok]->instance]->backup))) {
|
||||
&& (!array_key_exists($course_module->instance,$preferences->mods[$moduletype]->instances)
|
||||
|| empty($preferences->mods[$moduletype]->instances[$course_module->instance]->backup))) {
|
||||
$tok = strtok(",");
|
||||
continue;
|
||||
}
|
||||
@@ -1111,14 +1257,15 @@
|
||||
//Save neccesary info to backup_ids
|
||||
fwrite ($bf,full_tag("ID",6,false,$tok));
|
||||
fwrite ($bf,full_tag("TYPE",6,false,$moduletype));
|
||||
fwrite ($bf,full_tag("INSTANCE",6,false,$course_module[$tok]->instance));
|
||||
fwrite ($bf,full_tag("ADDED",6,false,$course_module[$tok]->added));
|
||||
fwrite ($bf,full_tag("SCORE",6,false,$course_module[$tok]->score));
|
||||
fwrite ($bf,full_tag("INDENT",6,false,$course_module[$tok]->indent));
|
||||
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module[$tok]->visible));
|
||||
fwrite ($bf,full_tag("GROUPMODE",6,false,$course_module[$tok]->groupmode));
|
||||
fwrite ($bf,full_tag("GROUPINGID",6,false,$course_module[$tok]->groupingid));
|
||||
fwrite ($bf,full_tag("GROUPMEMBERSONLY",6,false,$course_module[$tok]->groupmembersonly));
|
||||
fwrite ($bf,full_tag("INSTANCE",6,false,$course_module->instance));
|
||||
fwrite ($bf,full_tag("ADDED",6,false,$course_module->added));
|
||||
fwrite ($bf,full_tag("SCORE",6,false,$course_module->score));
|
||||
fwrite ($bf,full_tag("INDENT",6,false,$course_module->indent));
|
||||
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module->visible));
|
||||
fwrite ($bf,full_tag("GROUPMODE",6,false,$course_module->groupmode));
|
||||
fwrite ($bf,full_tag("GROUPINGID",6,false,$course_module->groupingid));
|
||||
fwrite ($bf,full_tag("GROUPMEMBERSONLY",6,false,$course_module->groupmembersonly));
|
||||
fwrite ($bf,full_tag("IDNUMBER",6,false,$course_module->idnumber));
|
||||
// get all the role_capabilities overrides in this mod
|
||||
write_role_overrides_xml($bf, $context, 6);
|
||||
/// write role_assign code here
|
||||
@@ -1401,54 +1548,54 @@
|
||||
}
|
||||
|
||||
//Backup gradebook info
|
||||
function backup_gradebook_info($bf,$preferences) {
|
||||
|
||||
function backup_gradebook_info($bf, $preferences) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/gradelib.php');
|
||||
|
||||
//first make sure items are properly sorted and everything is ok
|
||||
grade_category::fetch_course_tree($preferences->backup_course, true);
|
||||
grade_regrade_final_grades($preferences->backup_course);
|
||||
|
||||
$status = true;
|
||||
|
||||
// see if ALL grade items of type mod of this course are being backed up
|
||||
// if not, we do not need to backup grade category and associated grade items/grades
|
||||
$backupall = true;
|
||||
|
||||
if ($grade_items = get_records_sql("SELECT * FROM {$CFG->prefix}grade_items
|
||||
WHERE courseid = $preferences->backup_course
|
||||
AND itemtype != 'course'
|
||||
ORDER BY sortorder ASC")) {
|
||||
if ($grade_items = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}grade_items
|
||||
WHERE courseid = $preferences->backup_course
|
||||
AND itemtype = 'mod'")) {
|
||||
foreach ($grade_items as $grade_item) {
|
||||
|
||||
// do not restore if this grade_item is a mod, and
|
||||
if ($grade_item->itemtype == 'mod') {
|
||||
|
||||
// get module information
|
||||
// if no user data selected, we skip this grade_item
|
||||
if (!backup_userdata_selected($preferences,$grade_item->itemmodule,$grade_item->iteminstance)) {
|
||||
//print_object($grade_item);
|
||||
$backupall = false;
|
||||
break;
|
||||
}
|
||||
// get module information
|
||||
// if no user data selected, we do not backup categories
|
||||
if (!backup_userdata_selected($preferences,$grade_item->itemmodule,$grade_item->iteminstance)) {
|
||||
$backupall = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($grade_items); //free memory
|
||||
}
|
||||
|
||||
//Gradebook header
|
||||
fwrite ($bf,start_tag("GRADEBOOK",2,true));
|
||||
|
||||
$status = backup_gradebook_outcomes_info($bf, $preferences);
|
||||
$status = backup_gradebook_grade_letters_info($bf,$preferences);
|
||||
|
||||
// Now backup grade_item (inside grade_category)
|
||||
if ($backupall) {
|
||||
$status = backup_gradebook_category_info($bf,$preferences);
|
||||
}
|
||||
|
||||
$status = backup_gradebook_item_info($bf,$preferences, $backupall);
|
||||
$status = backup_gradebook_grade_letters_info($bf,$preferences);
|
||||
$status = backup_gradebook_outcomes_info($bf, $preferences);
|
||||
$status = backup_gradebook_outcomes_courses_info($bf, $preferences);
|
||||
|
||||
// backup gradebook histories
|
||||
if ($preferences->backup_gradebook_history) {
|
||||
$status = backup_gradebook_categories_history_info($bf, $preferences);
|
||||
$status = backup_gradebook_grades_history_info($bf, $preferences);
|
||||
$status = backup_gradebook_items_history_info($bf, $preferences);
|
||||
$status = backup_gradebook_outcomes_history($bf, $preferences);
|
||||
$status = backup_gradebook_categories_history_info($bf, $preferences);
|
||||
$status = backup_gradebook_items_history_info($bf, $preferences);
|
||||
$status = backup_gradebook_grades_history_info($bf, $preferences);
|
||||
}
|
||||
|
||||
//Gradebook footer
|
||||
@@ -1456,17 +1603,20 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
function backup_gradebook_category_info($bf,$preferences) {
|
||||
function backup_gradebook_category_info($bf, $preferences) {
|
||||
global $CFG;
|
||||
$status = true;
|
||||
|
||||
// getting grade categories, but make sure parents come before children
|
||||
// because when we do restore, we need to recover the parents first
|
||||
// we do this by getting the lowest depth first
|
||||
$grade_categories = get_records_sql("SELECT * FROM {$CFG->prefix}grade_categories
|
||||
WHERE courseid = $preferences->backup_course
|
||||
AND depth > 1
|
||||
ORDER BY depth ASC");
|
||||
// get grade categories in proper order - specified in category grade items
|
||||
$course_item = grade_item::fetch_course_item($preferences->backup_course);
|
||||
$grade_categories = get_records_sql("SELECT gc.*, gi.sortorder
|
||||
FROM {$CFG->prefix}grade_categories gc
|
||||
JOIN {$CFG->prefix}grade_items gi
|
||||
ON (gi.iteminstance = gc.id)
|
||||
WHERE gc.courseid = $preferences->backup_course
|
||||
AND (gi.itemtype='course' OR gi.itemtype='category')
|
||||
ORDER BY gi.sortorder ASC");
|
||||
|
||||
if ($grade_categories) {
|
||||
//Begin grade_categories tag
|
||||
fwrite ($bf,start_tag("GRADE_CATEGORIES",3,true));
|
||||
@@ -1500,33 +1650,32 @@
|
||||
}
|
||||
|
||||
//Backup gradebook_item (called from backup_gradebook_info
|
||||
function backup_gradebook_item_info($bf,$preferences, $backupall) {
|
||||
|
||||
function backup_gradebook_item_info($bf, $preferences, $backupall) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/gradelib.php');
|
||||
|
||||
$status = true;
|
||||
// get all the grade_items, ordered by sort order since upon restoring, it is not always
|
||||
// possible to use the same sort order. We could at least preserve the sortorder by restoring
|
||||
// grade_items in the original sortorder
|
||||
if ($grade_items = get_records_sql("SELECT * FROM {$CFG->prefix}grade_items
|
||||
WHERE courseid = $preferences->backup_course
|
||||
ORDER BY sortorder ASC")) {
|
||||
if ($grade_items = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}grade_items
|
||||
WHERE courseid = $preferences->backup_course
|
||||
ORDER BY sortorder ASC")) {
|
||||
|
||||
//Begin grade_items tag
|
||||
fwrite ($bf,start_tag("GRADE_ITEMS",3,true));
|
||||
//Iterate for each item
|
||||
foreach ($grade_items as $grade_item) {
|
||||
//Iterate over each item
|
||||
foreach ($grade_items as $item) {
|
||||
// Instantiate a grade_item object, to access its methods
|
||||
$grade_item = grade_object::fetch_helper('grade_items', 'grade_item', $grade_item);
|
||||
$grade_item = new grade_item($item, false);
|
||||
|
||||
// do not restore if this grade_item is a mod, and
|
||||
if ($grade_item->itemtype == 'mod') {
|
||||
// this still needs to be included, though grades can be ignored
|
||||
|
||||
//MDL-12463 - exclude grade_items of instances not chosen for backup
|
||||
if (empty($preferences->mods[$grade_item->itemmodule]->instances[$grade_item->iteminstance]->backup)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if ($grade_item->itemtype == 'category') {
|
||||
// if not all grade items are being backed up
|
||||
// we ignore this type of grade_item and grades associated
|
||||
@@ -1591,28 +1740,23 @@
|
||||
global $CFG;
|
||||
$status = true;
|
||||
|
||||
// getting grade categories, but make sure parents come before children
|
||||
// because when we do restore, we need to recover the parents first
|
||||
// we do this by getting the lowest depth first
|
||||
$context = get_context_instance(CONTEXT_COURSE, $preferences->backup_course);
|
||||
$grade_letters = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}grade_letters
|
||||
WHERE contextid = $context->id");
|
||||
FROM {$CFG->prefix}grade_letters
|
||||
WHERE contextid = $context->id");
|
||||
if ($grade_letters) {
|
||||
//Begin grade_categories tag
|
||||
//Begin grade_l tag
|
||||
fwrite ($bf,start_tag("GRADE_LETTERS",3,true));
|
||||
//Iterate for each category
|
||||
//Iterate for each letter
|
||||
foreach ($grade_letters as $grade_letter) {
|
||||
//Begin grade_category
|
||||
//Begin grade_letter
|
||||
fwrite ($bf,start_tag("GRADE_LETTER",4,true));
|
||||
//Output individual fields
|
||||
fwrite ($bf,full_tag("ID",5,false,$grade_letter->id));
|
||||
|
||||
// not keeping path and depth because they can be derived
|
||||
fwrite ($bf,full_tag("LOWERBOUNDARY",5,false,$grade_letter->lowerboundary));
|
||||
fwrite ($bf,full_tag("LETTER",5,false,$grade_letter->letter));
|
||||
|
||||
//End grade_category
|
||||
//End grade_letter
|
||||
fwrite ($bf,end_tag("GRADE_LETTER",4,true));
|
||||
}
|
||||
//End grade_categories tag
|
||||
@@ -1622,16 +1766,16 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
function backup_gradebook_outcomes_info($bf,$preferences) {
|
||||
function backup_gradebook_outcomes_info($bf, $preferences) {
|
||||
|
||||
global $CFG;
|
||||
$status = true;
|
||||
// only back up courses already in the grade_outcomes_courses table
|
||||
$grade_outcomes = get_records_sql('SELECT go.*
|
||||
FROM '.$CFG->prefix.'grade_outcomes_courses goc,
|
||||
'.$CFG->prefix.'grade_outcomes go
|
||||
WHERE goc.courseid = '.$preferences->backup_course.'
|
||||
AND goc.outcomeid = go.id');
|
||||
$grade_outcomes = get_records_sql("SELECT go.*
|
||||
FROM {$CFG->prefix}grade_outcomes go
|
||||
JOIN {$CFG->prefix}grade_outcomes_courses goc
|
||||
ON (goc.outcomeid = go.id)
|
||||
WHERE goc.courseid = $preferences->backup_course");
|
||||
|
||||
if (!empty($grade_outcomes)) {
|
||||
//Begin grade_outcomes tag
|
||||
@@ -1661,35 +1805,6 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
// outcomes assigned to this course
|
||||
function backup_gradebook_outcomes_courses_info($bf,$preferences) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
// get all global outcomes (used in this course)
|
||||
// and course specific outcomes
|
||||
// we don't need to backup all the outcomes in this case
|
||||
if ($outcomes_courses = get_records('grade_outcomes_courses', 'courseid', $preferences->backup_course)) {
|
||||
//Begin grade_outcomes tag
|
||||
fwrite ($bf,start_tag("GRADE_OUTCOMES_COURSES",3,true));
|
||||
//Iterate for each outcome
|
||||
foreach ($outcomes_courses as $outcomes_course) {
|
||||
//Begin grade_outcome
|
||||
fwrite ($bf,start_tag("GRADE_OUTCOMES_COURSE",4,true));
|
||||
//Output individual fields
|
||||
fwrite ($bf,full_tag("ID",5,false,$outcomes_course->id));
|
||||
fwrite ($bf,full_tag("OUTCOMEID",5,false,$outcomes_course->outcomeid));
|
||||
|
||||
//End grade_outcome
|
||||
fwrite ($bf,end_tag("GRADE_OUTCOMES_COURSE",4,true));
|
||||
}
|
||||
//End grade_outcomes tag
|
||||
$status = fwrite ($bf,end_tag("GRADE_OUTCOMES_COURSES",3,true));
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
function backup_gradebook_grades_info($bf,$preferences, $itemid) {
|
||||
|
||||
global $CFG;
|
||||
@@ -1770,10 +1885,11 @@
|
||||
$status = true;
|
||||
|
||||
// find all grade categories history
|
||||
if ($chs = get_records_sql("SELECT ggh.* FROM {$CFG->prefix}grade_grades_history ggh,
|
||||
{$CFG->prefix}grade_items gi
|
||||
WHERE gi.courseid = $preferences->backup_course
|
||||
AND ggh.itemid = gi.id")) {
|
||||
if ($chs = get_records_sql("SELECT ggh.*
|
||||
FROM {$CFG->prefix}grade_grades_history ggh
|
||||
JOIN {$CFG->prefix}grade_items gi
|
||||
ON gi.id = ggh.itemid
|
||||
WHERE gi.courseid = $preferences->backup_course")) {
|
||||
fwrite ($bf,start_tag("GRADE_GRADES_HISTORIES",5,true));
|
||||
foreach ($chs as $ch) {
|
||||
/// Grades are only sent to backup if the user is one target user
|
||||
@@ -1846,8 +1962,8 @@
|
||||
fwrite ($bf,full_tag("PLUSFACTOR",7,false,$ch->plusfactor));
|
||||
fwrite ($bf,full_tag("AGGREGATIONCOEF",7,false,$ch->aggregationcoef));
|
||||
fwrite ($bf,full_tag("SORTORDER",7,false,$ch->sortorder));
|
||||
fwrite ($bf,full_tag("DISPLAY",7,false,$ch->display));
|
||||
fwrite ($bf,full_tag("DECIMALS",7,false,$ch->decimals));
|
||||
//fwrite ($bf,full_tag("DISPLAY",7,false,$ch->display));
|
||||
//fwrite ($bf,full_tag("DECIMALS",7,false,$ch->decimals));
|
||||
fwrite ($bf,full_tag("HIDDEN",7,false,$ch->hidden));
|
||||
fwrite ($bf,full_tag("LOCKED",7,false,$ch->locked));
|
||||
fwrite ($bf,full_tag("LOCKTIME",7,false,$ch->locktime));
|
||||
@@ -1898,8 +2014,8 @@
|
||||
|
||||
//Get scales (common and course scales)
|
||||
$scales = get_records_sql("SELECT id, courseid, userid, name, scale, description, timemodified
|
||||
FROM {$CFG->prefix}scale
|
||||
WHERE courseid = '0' or courseid = $preferences->backup_course");
|
||||
FROM {$CFG->prefix}scale
|
||||
WHERE courseid = 0 OR courseid = $preferences->backup_course");
|
||||
|
||||
//Copy only used scales to $backupscales. They will be in backup (unused no). See Bug 1223.
|
||||
$backupscales = array();
|
||||
@@ -2036,8 +2152,13 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get groups_members
|
||||
$groups_members = get_records("groups_members","groupid",$groupid);
|
||||
//Get groups_members that are being included in backup
|
||||
$groups_members = get_records_sql("SELECT gm.*
|
||||
FROM {$CFG->prefix}groups_members gm,
|
||||
{$CFG->prefix}backup_ids bi
|
||||
WHERE gm.groupid = $groupid
|
||||
AND bi.backup_code = $preferences->backup_unique_code
|
||||
AND bi.table_name = 'user'");
|
||||
|
||||
//Pring groups_members header
|
||||
if ($groups_members) {
|
||||
@@ -2161,7 +2282,13 @@
|
||||
if (function_exists($onemodbackup)) {
|
||||
foreach ($preferences->mods[$module]->instances as $instance => $object) {
|
||||
if (!empty($object->backup)) {
|
||||
$status = $onemodbackup($bf,$preferences,$instance);
|
||||
$statusm = $onemodbackup($bf,$preferences,$instance);
|
||||
if (!$statusm) {
|
||||
if (!defined('BACKUP_SILENTLY')) {
|
||||
notify('backup of '.$module.'-'.$object->name.' failed.');
|
||||
}
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2193,6 +2320,16 @@
|
||||
|
||||
global $CFG,$preferences;
|
||||
|
||||
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
|
||||
/// heavy interlinking. Just a few cpu cycles saved.
|
||||
if ($content === NULL) {
|
||||
return NULL;
|
||||
} else if ($content === '') {
|
||||
return '';
|
||||
} else if (is_numeric($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Use one static variable to cache all the require_once calls that,
|
||||
//under PHP5 seems to increase load too much, and we are requiring
|
||||
//them here thousands of times (one per content). MDL-8700.
|
||||
@@ -2236,6 +2373,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
// For each block, call its encode_content_links method.
|
||||
// This encodes forexample links to blocks/something/viewphp?id=666
|
||||
// that are stored in other activities.
|
||||
static $blockobjects = null;
|
||||
if (!isset($blockobjects)) {
|
||||
$blockobjects = array();
|
||||
if ($blocks = get_records('block', 'visible', 1)) {
|
||||
foreach ($blocks as $block) {
|
||||
if ($blockobject = block_instance($block->name)) {
|
||||
$blockobjects[] = $blockobject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($blockobjects as $blockobject) {
|
||||
$result = $blockobject->encode_content_links($result,$mypreferences);
|
||||
}
|
||||
|
||||
if ($result != $content) {
|
||||
debugging('<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />');
|
||||
}
|
||||
@@ -2579,6 +2735,7 @@
|
||||
$preferences->backup_gradebook_history = optional_param('backup_gradebook_history', 1, PARAM_INT);
|
||||
$preferences->backup_site_files = optional_param('backup_site_files',1,PARAM_INT);
|
||||
$preferences->backup_messages = optional_param('backup_messages',1,PARAM_INT);
|
||||
$preferences->backup_blogs = optional_param('backup_blogs',1,PARAM_INT);
|
||||
$preferences->backup_course = $course->id;
|
||||
$preferences->backup_name = required_param('backup_name',PARAM_FILE);
|
||||
$preferences->backup_unique_code = required_param('backup_unique_code');
|
||||
@@ -2761,7 +2918,7 @@
|
||||
$status = backup_delete_old_data();
|
||||
if (!$status) {
|
||||
if (!defined('BACKUP_SILENTLY')) {
|
||||
error ("An error occurred deleting old backup data");
|
||||
notify ("An error occurred deleting old backup data");
|
||||
}
|
||||
else {
|
||||
$errorstr = "An error occurred deleting old backup data";
|
||||
@@ -2896,6 +3053,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
//If we have selected to backup blogs and we are
|
||||
//doing a SITE backup, let's do it
|
||||
if ($status && $preferences->backup_blogs && $preferences->backup_course == SITEID) {
|
||||
if (!defined('BACKUP_SILENTLY')) {
|
||||
echo "<li>".get_string("writingblogsinfo").'</li>';
|
||||
}
|
||||
if (!$status = backup_blogs($backup_file,$preferences)) {
|
||||
if (!defined('BACKUP_SILENTLY')) {
|
||||
notify("An error occurred while backing up blogs");
|
||||
}
|
||||
else {
|
||||
$errorstr = "An error occurred while backing up blogs";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If we have selected to backup quizzes or other modules that use questions
|
||||
//we've already added ids of categories and questions to backup to backup_ids table
|
||||
if ($status) {
|
||||
|
||||
+16
-7
@@ -527,11 +527,16 @@
|
||||
}
|
||||
} else {
|
||||
//Only if status (record exists)
|
||||
if ($status) {
|
||||
////First strip slashes
|
||||
$temp = stripslashes($status->info);
|
||||
//Now unserialize
|
||||
$status->info = unserialize($temp);
|
||||
if (!empty($status->info)) {
|
||||
if ($status->info === 'needed') {
|
||||
// TODO: ugly hack - fix before 1.9.1
|
||||
debugging('Incorrect string "needed" in $status->info, please fix the code (table:'.$table.'; old_id:'.$old_id.').', DEBUG_DEVELOPER);
|
||||
} else {
|
||||
////First strip slashes
|
||||
$temp = stripslashes($status->info);
|
||||
//Now unserialize
|
||||
$status->info = unserialize($temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,12 +545,15 @@
|
||||
|
||||
//This function is used to add slashes (and decode from UTF-8 if needed)
|
||||
//It's used intensivelly when restoring modules and saving them in db
|
||||
function backup_todb ($data) {
|
||||
function backup_todb ($data, $addslashes=true) {
|
||||
// MDL-10770
|
||||
if ($data === '$@NULL@$') {
|
||||
return null;
|
||||
} else {
|
||||
return restore_decode_absolute_links(addslashes($data));
|
||||
if ($addslashes) {
|
||||
$data = addslashes($data);
|
||||
}
|
||||
return restore_decode_absolute_links($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,6 +847,7 @@
|
||||
$preferences->backup_course_files = (isset($prefs['backup_course_files']) ? $prefs['backup_course_files'] : 0);
|
||||
$preferences->backup_site_files = (isset($prefs['backup_site_files']) ? $prefs['backup_site_files'] : 0);
|
||||
$preferences->backup_messages = (isset($prefs['backup_messages']) ? $prefs['backup_messages'] : 0);
|
||||
$preferences->backup_gradebook_history = (isset($prefs['backup_gradebook_history']) ? $prefs['backup_gradebook_history'] : 0);
|
||||
$preferences->backup_course = $course->id;
|
||||
backup_add_static_preferences($preferences);
|
||||
return $preferences;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
//Print header
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
|
||||
+25
-26
@@ -72,31 +72,35 @@
|
||||
}
|
||||
foreach ($instances as $instance) {
|
||||
$var = 'restore_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
$$var = optional_param($var,0,PARAM_INT);
|
||||
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
$$var = optional_param($var,0,PARAM_INT);
|
||||
}
|
||||
}
|
||||
}
|
||||
//restoreto
|
||||
$restore_restoreto = required_param('restore_restoreto');
|
||||
$restore_restoreto = required_param('restore_restoreto', PARAM_INT);
|
||||
//restore_metacourse
|
||||
$restore_metacourse = required_param('restore_metacourse');
|
||||
$restore_metacourse = required_param('restore_metacourse', PARAM_INT);
|
||||
//restore_users
|
||||
$restore_users = required_param('restore_users');
|
||||
$restore_users = required_param('restore_users', PARAM_INT);
|
||||
|
||||
$restore_groups = required_param('restore_groups', PARAM_INT);
|
||||
//restore_logs
|
||||
$restore_logs = required_param('restore_logs');
|
||||
$restore_logs = required_param('restore_logs', PARAM_INT);
|
||||
//restore_user_files
|
||||
$restore_user_files = required_param('restore_user_files');
|
||||
$restore_user_files = required_param('restore_user_files', PARAM_INT);
|
||||
//restore_course_files
|
||||
$restore_course_files = required_param('restore_course_files');
|
||||
$restore_course_files = required_param('restore_course_files', PARAM_INT);
|
||||
//restore_site_files
|
||||
$restore_site_files = required_param('restore_site_files');
|
||||
$restore_site_files = required_param('restore_site_files', PARAM_INT);
|
||||
//restore_gradebook_history
|
||||
$restore_gradebook_history = required_param('restore_gradebook_history');
|
||||
$restore_gradebook_history = required_param('restore_gradebook_history', PARAM_INT);
|
||||
//restore_messages
|
||||
$restore_messages = required_param('restore_messages');
|
||||
|
||||
$restore_messages = required_param('restore_messages', PARAM_INT);
|
||||
//restore_blogs
|
||||
$restore_blogs = required_param('restore_blogs', PARAM_INT);
|
||||
|
||||
//Check we've selected a course to restore to
|
||||
$course_id = optional_param('course_id', 0, PARAM_INT);
|
||||
|
||||
@@ -126,11 +130,13 @@
|
||||
$restore->restoreto=$restore_restoreto;
|
||||
$restore->metacourse=$restore_metacourse;
|
||||
$restore->users=$restore_users;
|
||||
$restore->groups=$restore_groups;
|
||||
$restore->logs=$restore_logs;
|
||||
$restore->user_files=$restore_user_files;
|
||||
$restore->course_files=$restore_course_files;
|
||||
$restore->site_files=$restore_site_files;
|
||||
$restore->messages=$restore_messages;
|
||||
$restore->blogs=$restore_blogs;
|
||||
$restore->restore_gradebook_history=$restore_gradebook_history;
|
||||
$restore->course_id=$course_id;
|
||||
//add new vars to restore object
|
||||
@@ -170,10 +176,7 @@
|
||||
}
|
||||
|
||||
// pass in the course category param
|
||||
$cat_id = optional_param('restore_restorecatto', 0, PARAM_INT);
|
||||
if ($cat_id) {
|
||||
$restore->restore_restorecatto = $cat_id;
|
||||
}
|
||||
$restore->restore_restorecatto = optional_param('restore_restorecatto', 0, PARAM_INT);
|
||||
|
||||
//We have the object with data, put it in the session
|
||||
$SESSION->restore = $restore;
|
||||
@@ -189,7 +192,7 @@
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -200,7 +203,7 @@
|
||||
}
|
||||
|
||||
//Depending the selected restoreto:
|
||||
// If user is a teacher (and not creator):
|
||||
// If user is a teacher (and not creator) or we are restoring from within SITEID:
|
||||
// 0-Current course, deleting: Put $restore->course_id and $restore->deleting (true), create the restore object
|
||||
// 1-Current course, adding: Put $restore->course_id and $restore->deleting (false), create the restore object
|
||||
// If the uses is a creator:
|
||||
@@ -210,12 +213,9 @@
|
||||
// put $restore->course_id and $restore->deleting (false), create the restore object.
|
||||
// 2-New course: Create the restore object and launch the execute.
|
||||
|
||||
//If the user is a teacher and not a creator
|
||||
//If the user is a teacher and not a creator or we are restoring from within SITEID
|
||||
|
||||
|
||||
//if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
|
||||
if (!user_can_create_courses()) {
|
||||
if (!user_can_create_courses() || $id == SITEID) {
|
||||
$restore->course_id = $id;
|
||||
if ($restore->restoreto == 0) {
|
||||
$restore->deleting = true;
|
||||
@@ -225,7 +225,6 @@
|
||||
}
|
||||
|
||||
//If the user is a creator (or admin)
|
||||
//if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (user_can_create_courses()) {
|
||||
//Set restore->deleting as needed
|
||||
if ($restore->restoreto == 0) {
|
||||
@@ -287,8 +286,8 @@
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
//If we have selected user files or messages, then users must be restored too
|
||||
if ($restore->user_files || $restore->messages) {
|
||||
//If we have selected user files or messages or blogs, then users must be restored too
|
||||
if ($restore->user_files || $restore->messages || $restore->blogs) {
|
||||
$changed = 1;
|
||||
}
|
||||
if ($changed) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+148
-65
@@ -29,7 +29,7 @@
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,14 @@
|
||||
$restore_users = 1;
|
||||
}
|
||||
|
||||
if (!isset($restore_groups)) {
|
||||
if (empty($CFG->enablegroupings)) {
|
||||
$restore_groups = RESTORE_GROUPS_ONLY;
|
||||
} else {
|
||||
$restore_groups = RESTORE_GROUPS_GROUPINGS;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($restore_logs)) {
|
||||
$restore_logs = 1;
|
||||
}
|
||||
@@ -95,7 +103,11 @@
|
||||
|
||||
if (!isset($restore_messages)) {
|
||||
$restore_messages = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($restore_blogs)) {
|
||||
$restore_blogs = 1;
|
||||
}
|
||||
|
||||
if (!isset($restore_restoreto)) {
|
||||
if (!user_can_create_courses()) {
|
||||
@@ -177,14 +189,15 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\"><b>";
|
||||
echo get_string("restoreto").":</b>";
|
||||
echo '<label for="menurestore_restoreto">'.get_string ('restoreto').'</label>';
|
||||
echo "</b>";
|
||||
echo "</td><td colspan=\"3\">";
|
||||
|
||||
|
||||
// permission should have been checked already
|
||||
|
||||
/**
|
||||
* if user has manageactivities in any course, we show
|
||||
* if user has manageactivities in any course and we are not restoring from within SITEID
|
||||
* existingcoursedeleting
|
||||
* existingcourseadding
|
||||
* else we show
|
||||
@@ -200,14 +213,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
} else {
|
||||
$accessinfo = get_user_access_sitewide($USER->id);
|
||||
}
|
||||
|
||||
|
||||
$mycourses = get_user_courses_bycap($USER->id, 'moodle/site:restore', $accessinfo, true);
|
||||
// if the user can manage 2 or more courses,
|
||||
// or if the only course the user can manage is not the current course
|
||||
|
||||
// if the user can manage 2 or more courses and we are not restoring from within SITEID,
|
||||
// we show options for existing courses
|
||||
|
||||
if (count($mycourses) > 1) {
|
||||
// if user can manage more than 1 course, or if user can restore to a single different course
|
||||
|
||||
if (count($mycourses) > 1 && $id != SITEID) {
|
||||
$restore_restoreto_options[0] = get_string("existingcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("existingcourseadding");
|
||||
// else if the user can write to current course
|
||||
@@ -221,6 +233,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
}
|
||||
|
||||
/// Acummulator for hidden options and proper XHTML output
|
||||
$hidden_options = '';
|
||||
|
||||
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
|
||||
echo "</td></tr>";
|
||||
if (user_can_create_courses()) { //display these fields conditionally
|
||||
@@ -228,46 +243,53 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
// find the list of cates user can edit
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string('category');
|
||||
echo " :</td>";
|
||||
echo '<label for="menurestore_restorecatto">'.get_string ('category').'</label>';
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
choose_from_menu(get_creatable_categories(), "restore_restorecatto", $course_header->category->id, "");
|
||||
// Category selection isn't alowed if restoring from within SITEID course
|
||||
if ($id != SITEID) {
|
||||
make_categories_list($categories, $parents);
|
||||
choose_from_menu($categories, "restore_restorecatto", $course_header->category->id, "");
|
||||
} else {
|
||||
print_string('notavailable');
|
||||
echo '<input type="hidden" name="restore_restorecatto" id="menurestore_restorecatto" value="0" />';
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("shortname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"100\" size=\"20\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
echo '<label for="shortnamefield">'.get_string ('shortname').'</label>';
|
||||
echo "</td>";
|
||||
echo "<td><input type=\"text\" id=\"shortnamefield\" name=\"shortname\" maxlength=\"100\" size=\"20\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
helpbutton("courseshortname", get_string("shortname")) ;
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("fullname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"$form1->fullname\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
echo '<label for="fullnamefield">'.get_string ('fullname').'</label>';
|
||||
echo "</td>";
|
||||
echo "<td><input type=\"text\" id=\"fullnamefield\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"$form1->fullname\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
helpbutton("coursefullname", get_string("fullname")) ;
|
||||
if (isset($err["fullname"])) formerr($err["fullname"]);
|
||||
echo"</td></tr>";
|
||||
echo "<tr valign=\"top\"> ";
|
||||
echo "<td align=\"right\"> ";
|
||||
print_string("startdate");
|
||||
echo ":</td><td>";
|
||||
echo "</td><td>";
|
||||
/// Show the roll dates option only if the backup course has a start date
|
||||
/// (some formats like main page, social..., haven't it and rolling dates
|
||||
/// from 0 produces crazy dates. MDL-10125
|
||||
if ($form1->startdate) {
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
} else {
|
||||
print_string('notavailable');
|
||||
echo '<input type="hidden" name="startyear" value="0" />';
|
||||
echo '<input type="hidden" name="startmonth" value="0" />';
|
||||
echo '<input type="hidden" name="startday" value="0" />';
|
||||
}
|
||||
helpbutton("coursestartdate", get_string("startdate"));
|
||||
echo "</td></tr>";
|
||||
}
|
||||
//Line
|
||||
@@ -277,7 +299,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Print option to select/deselect everything with 1 click.
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\">";
|
||||
echo '<b>'.get_string("include").":</b>";
|
||||
echo '<b>'.get_string("include")."</b>";
|
||||
echo "</td><td>";
|
||||
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'restore_', true);\">".
|
||||
get_string("all")."</a>/";
|
||||
@@ -378,25 +400,27 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the Metacourse tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string("metacourse").":";
|
||||
echo '<label for="menurestore_metacourse">'.get_string ("metacourse").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
//If metacourse are in the backup file, show menu, else fixed to no
|
||||
if ($info->backup_metacourse == "true") {
|
||||
$metacourse_options = array();
|
||||
$metacourse_options[0] = get_string("no");
|
||||
$metacourse_options[1] = get_string("yes");
|
||||
choose_from_menu($metacourse_options, "restore_metacourse", $restore_metacourse, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" name=\"restore_metacourse\" value=\"0\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_metacourse\" name=\"restore_metacourse\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
//Now print the Users tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string("users").":";
|
||||
echo '<label for="menurestore_users">'.get_string ("users").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
//If some user is present in the backup file
|
||||
if ($info->backup_users == "all" or $info->backup_users == "course") {
|
||||
$user_options = array();
|
||||
//If all users are in the backup file
|
||||
if ($info->backup_users == "all") {
|
||||
$user_options[0] = get_string("all");
|
||||
@@ -406,58 +430,85 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
choose_from_menu($user_options, "restore_users", $restore_users, "");
|
||||
} else {
|
||||
echo get_string("none");
|
||||
echo "<input type=\"hidden\" name=\"restore_users\" value=\"2\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_users\" name=\"restore_users\" value=\"2\" />";
|
||||
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
//Now print the Groups tr (assume there is no $info->backup_groups)
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
$helplink = helpbutton('grouprestore', get_string('groups'), '', true, false, '', true);
|
||||
if (empty($CFG->enablegroupings)) {
|
||||
echo '<label for="menurestore_groups">'.get_string ("groups").'</label>'.$helplink;
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$group_options[RESTORE_GROUPS_NONE] = get_string('no');
|
||||
$group_options[RESTORE_GROUPS_ONLY] = get_string('yes');
|
||||
} else {
|
||||
echo '<label for="menurestore_groups">'.get_string ('groupsgroupings', 'group').'</label>'.$helplink;
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$group_options[RESTORE_GROUPS_NONE] = get_string('none');
|
||||
$group_options[RESTORE_GROUPS_ONLY] = get_string('groupsonly', 'group');
|
||||
$group_options[RESTORE_GROUPINGS_ONLY] = get_string('groupingsonly', 'group');
|
||||
$group_options[RESTORE_GROUPS_GROUPINGS] = get_string('groupsgroupings', 'group'); //all.
|
||||
|
||||
} /*else {
|
||||
echo get_string('none');
|
||||
echo "<input type=\"hidden\" name=\"restore_groups\" value=\"2\" />";
|
||||
}*/
|
||||
choose_from_menu($group_options, 'restore_groups', $restore_groups, '');
|
||||
echo "</td></tr>";
|
||||
|
||||
//Now print the Logs tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string("logs").":";
|
||||
echo '<label for="menurestore_logs">'.get_string ("logs").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
//If logs are in the backup file, show menu, else fixed to no
|
||||
if ($info->backup_logs == "true") {
|
||||
$log_options = array();
|
||||
$log_options[0] = get_string("no");
|
||||
$log_options[1] = get_string("yes");
|
||||
choose_from_menu($log_options, "restore_logs", $restore_logs, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" name=\"restore_logs\" value=\"0\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_logs\" name=\"restore_logs\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
//Now print the User Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("userfiles").":";
|
||||
echo '<label for="menurestore_user_files">'.get_string ("userfiles").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
//If user files are in the backup file, show menu, else fixed to no
|
||||
if ($info->backup_user_files == "true") {
|
||||
$user_file_options = array();
|
||||
$user_file_options[0] = get_string("no");
|
||||
$user_file_options[1] = get_string("yes");
|
||||
choose_from_menu($user_file_options, "restore_user_files", $restore_user_files, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" name=\"restore_user_files\" value=\"0\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_user_files\" name=\"restore_user_files\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
//Now print the Course Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("coursefiles").":";
|
||||
echo '<label for="menurestore_course_files">'.get_string ("coursefiles").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"$backup_unique_code\" />";
|
||||
echo "<input type=\"hidden\" name=\"file\" value=\"$file\" />";
|
||||
//If course files are in the backup file, show menu, else fixed to no
|
||||
if ($info->backup_course_files == "true") {
|
||||
$course_file_options = array();
|
||||
$course_file_options[0] = get_string("no");
|
||||
$course_file_options[1] = get_string("yes");
|
||||
choose_from_menu($course_file_options, "restore_course_files", $restore_course_files, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" name=\"restore_course_files\" value=\"0\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_course_files\" name=\"restore_course_files\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
@@ -465,54 +516,81 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//Now print the Site Files tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ("sitefiles").":";
|
||||
echo '<label for="menurestore_site_files">'.get_string ("sitefiles").'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
//If site files are in the backup file, show menu, else fixed to no
|
||||
if (isset($info->backup_site_files) && $info->backup_site_files == "true") {
|
||||
$site_file_options = array();
|
||||
$site_file_options[0] = get_string("no");
|
||||
$site_file_options[1] = get_string("yes");
|
||||
choose_from_menu($site_file_options, "restore_site_files", $restore_site_files, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" name=\"restore_site_files\" value=\"0\" />";
|
||||
echo "<input type=\"hidden\" id=\"menurestore_site_files\" name=\"restore_site_files\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
// do you want grade histories to be restored?
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo get_string ('gradebookhistories', 'grades').":";
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$gradebook_history_options[0] = get_string("no");
|
||||
$gradebook_history_options[1] = get_string("yes");
|
||||
choose_from_menu($gradebook_history_options, "restore_gradebook_history", $restore_gradebook_history, "");
|
||||
echo "</td></tr>";
|
||||
|
||||
//Now print the Messages tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
if (empty($CFG->disablegradehistory)) {
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menurestore_gradebook_history">'.get_string ('gradebookhistories', 'grades').'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
if (isset($info->gradebook_histories) && $info->gradebook_histories == "true") {
|
||||
$gradebook_history_options = array();
|
||||
$gradebook_history_options[0] = get_string("no");
|
||||
$gradebook_history_options[1] = get_string("yes");
|
||||
choose_from_menu($gradebook_history_options, "restore_gradebook_history", $restore_gradebook_history, "");
|
||||
} else {
|
||||
echo get_string("no");
|
||||
echo "<input type=\"hidden\" id=\"menurestore_gradebook_history\" name=\"restore_gradebook_history\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
$hidden_options .= '<input type="hidden" name="restore_gradebook_history" value="0" />';
|
||||
}
|
||||
|
||||
//This tr is slighty different. Everything becomes hidden if
|
||||
//we haven't messages is the backup, to avoid confusions to users.
|
||||
//If messages are in the backup file, show menu, else fixed to no and show nothing
|
||||
if ($info->backup_messages == "true") {
|
||||
echo get_string ('messages','message').":";
|
||||
//Also, messaging must be enabled in the destination site
|
||||
if (isset($info->backup_messages) && $info->backup_messages == "true" && !empty($CFG->messaging)) {
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menurestore_messages">'.get_string ('messages', 'message').'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$message_options = array();
|
||||
$message_options[0] = get_string("no");
|
||||
$message_options[1] = get_string("yes");
|
||||
choose_from_menu($message_options, "restore_messages", $restore_messages, "");
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
echo " </b></td><td colspan=\"2\">";
|
||||
echo "<input type=\"hidden\" name=\"restore_messages\" value=\"0\" />";
|
||||
$hidden_options .= '<input type="hidden" name="restore_messages" value="0" />';
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
|
||||
//This tr is slighty different. Everything becomes hidden if
|
||||
//we haven't blogs is the backup, to avoid confusions to users.
|
||||
//If blogs are in the backup file, show menu, else fixed to no and show nothing
|
||||
//Also, blogs must be enabled in the destination site
|
||||
if (isset($info->backup_blogs) && $info->backup_blogs == "true" && !empty($CFG->bloglevel)) {
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
echo '<label for="menurestore_blogs">'.get_string ('blogs', 'blog').'</label>';
|
||||
echo "</b></td><td colspan=\"2\">";
|
||||
$blog_options = array();
|
||||
$blog_options[0] = get_string("no");
|
||||
$blog_options[1] = get_string("yes");
|
||||
choose_from_menu($blog_options, "restore_blogs", $restore_blogs, "");
|
||||
echo "</td></tr>";
|
||||
} else {
|
||||
$hidden_options .= '<input type="hidden" name="restore_blogs" value="0" />';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<hr/>
|
||||
<hr />
|
||||
<?php
|
||||
|
||||
print_heading(get_string('rolemappings'));
|
||||
@@ -521,8 +599,8 @@ $xml_file = $CFG->dataroot."/temp/backup/".$backup_unique_code."/moodle.xml";
|
||||
$info = restore_read_xml_info($xml_file);
|
||||
|
||||
// fix for MDL-9068, front page course is just a normal course
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "shortname");
|
||||
$siterolesnamearray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "name");
|
||||
$siterolesarray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "shortname", ROLENAME_ORIGINAL);
|
||||
$siterolesnamearray = get_assignable_roles (get_context_instance(CONTEXT_COURSE, $course->id), "name", ROLENAME_ORIGINAL);
|
||||
$allroles = get_records('role');
|
||||
|
||||
echo ('<table width="100%" class="restore-form-instances">');
|
||||
@@ -533,24 +611,25 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
|
||||
/// Editting teacher
|
||||
echo ('<tr><td align="right">');
|
||||
print_string('defaultcourseteacher');
|
||||
echo '<label for="menudefaultteacheredit">'.get_string ('defaultcourseteacher').'</label>';
|
||||
echo ('</td><td algin="left">');
|
||||
|
||||
// get the first teacheredit legacy
|
||||
$roles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$roles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$editteacher = array_shift($roles);
|
||||
$editteacher = reset($roles);
|
||||
choose_from_menu ($siterolesarray, "defaultteacheredit", $editteacher->id, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
|
||||
/// Non-editting teacher
|
||||
echo ('<tr><td align="right">');
|
||||
echo '<label for="menudefaultteacher">'.get_string ('noneditingteacher').'</label>';
|
||||
print_string('noneditingteacher');
|
||||
echo ('</td><td algin="left">');
|
||||
|
||||
// get the first teacheredit legacy
|
||||
$roles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$teacher = array_shift($roles);
|
||||
$roles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
$teacher = reset($roles);
|
||||
|
||||
choose_from_menu ($siterolesarray, "defaultteacher", $teacher->id, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
@@ -558,11 +637,11 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
|
||||
/// Student
|
||||
echo ('<tr><td align="right">');
|
||||
print_string('defaultcoursestudent');
|
||||
echo '<label for="menudefaultstudent">'.get_string ('defaultcoursestudent').'</label>';
|
||||
echo ('</td><td algin="left">');
|
||||
|
||||
// get the first teacheredit legacy
|
||||
$roles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$roles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
$studentrole = array_shift($roles);
|
||||
|
||||
choose_from_menu ($siterolesarray, "defaultstudent", $studentrole->id, 'new role', '', '0');
|
||||
@@ -582,7 +661,7 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
$mappableroles = $siteroleschoicearray;
|
||||
|
||||
echo ('<tr><td align="right">');
|
||||
echo $role->name." (".($role->shortname).")";
|
||||
echo '<label for="menuroles_'.$roleid.'">'.$role->name." (".($role->shortname).")".'</label>';
|
||||
echo ('</td><td align="left">');
|
||||
|
||||
/// first, we see if any exact role definition is found
|
||||
@@ -616,6 +695,10 @@ echo ('</table>'); // end of role mappings table
|
||||
?>
|
||||
<br />
|
||||
<div style="text-align:center">
|
||||
<?php
|
||||
/// Print captured hidden options, now that we have closed the table
|
||||
echo $hidden_options;
|
||||
?>
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="launch" value="check" />
|
||||
<input type="hidden" name="fromform" value="1" />
|
||||
@@ -701,4 +784,4 @@ function restore_is_samerole($testroleid, $rolefromxml) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+1560
-945
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
/// database (backup_version) to determine whether upgrades should
|
||||
/// be performed (see db/backup_*.php)
|
||||
|
||||
$backup_version = 2007122700; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_version = 2008030300; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_release = '1.9'; // User-friendly version number
|
||||
|
||||
?>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_activity_modules extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('activities');
|
||||
$this->version = 2006011300;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_admin extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('administration');
|
||||
$this->version = 2004081200;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
@@ -213,31 +213,9 @@ class block_admin extends block_list {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Should the following two be in this block?
|
||||
|
||||
|
||||
/// View own activity report
|
||||
// if ($course->showreports) {
|
||||
// $this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&user='.$USER->id.'">'.get_string('activityreport').'</a>';
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" alt="" />';
|
||||
// }
|
||||
|
||||
|
||||
/// Edit your own profile
|
||||
|
||||
// $fullname = fullname($USER, has_capability('moodle/site:viewfullnames', $context));
|
||||
// $editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
// if (empty($USER->description)) {
|
||||
// //Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
// $text = get_string('profile').' '.get_string('missingdescription');
|
||||
// $this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
|
||||
// } else {
|
||||
// $this->content->items[]= $editmyprofile;
|
||||
// }
|
||||
// $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
|
||||
/// Link to the user own profile
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$course->id.'">'.get_string('profile').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class block_admin_bookmarks extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('adminbookmarks');
|
||||
$this->version = 2006090300;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
|
||||
@@ -12,7 +12,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
|
||||
$bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
|
||||
|
||||
if (in_array($section, $bookmarks)) {
|
||||
error(get_string('bookmarkalreadyexists','admin'));
|
||||
print_error('bookmarkalreadyexists','admin');
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
|
||||
set_user_preference('admin_bookmarks', $bookmarks);
|
||||
|
||||
} else {
|
||||
error(get_string('invalidsection','admin'));
|
||||
print_error('invalidsection','admin');
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
|
||||
}
|
||||
|
||||
} else {
|
||||
error(get_string('invalidsection','admin'));
|
||||
print_error('invalidsection','admin');
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
|
||||
$key = array_search($section, $bookmarks);
|
||||
|
||||
if ($key === false) {
|
||||
error(get_string('nonexistentbookmark','admin'));
|
||||
print_error('nonexistentbookmark','admin');
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -38,12 +38,12 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
|
||||
|
||||
}
|
||||
|
||||
error(get_string('nobookmarksforuser','admin'));
|
||||
print_error('nobookmarksforuser','admin');
|
||||
die;
|
||||
|
||||
} else {
|
||||
error(get_string('invalidsection', 'admin'));
|
||||
print_error('invalidsection', 'admin');
|
||||
die;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -12,7 +12,7 @@ class block_admin_tree extends block_base {
|
||||
function init() {
|
||||
global $PAGE;
|
||||
$this->title = get_string('administrationsite');
|
||||
$this->version = 2006090300;
|
||||
$this->version = 2007101509;
|
||||
$this->currentdepth = 0;
|
||||
$this->divcounter = 1;
|
||||
$this->tempcontent = '';
|
||||
@@ -22,8 +22,11 @@ class block_admin_tree extends block_base {
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
//TODO: add 'my' only if user has role assigned in system or any course category context
|
||||
return array('site' => true, 'admin' => true, 'my' => true);
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
return array('site' => true, 'admin' => true, 'my' => true);
|
||||
} else {
|
||||
return array('site' => true, 'admin' => true);
|
||||
}
|
||||
}
|
||||
|
||||
function preferred_width() {
|
||||
|
||||
@@ -7,7 +7,7 @@ class block_blog_menu extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('blockmenutitle', 'blog');
|
||||
$this->content_type = BLOCK_TYPE_TEXT;
|
||||
$this->version = 2004112000;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
@@ -51,7 +51,7 @@ class block_blog_menu extends block_base {
|
||||
$addentrylink = '';
|
||||
$coursearg = '';
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
if ($COURSE->id != SITEID) {
|
||||
|
||||
@@ -121,4 +121,4 @@ class block_blog_menu extends block_base {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -8,7 +8,7 @@ require_once($CFG->dirroot .'/blog/lib.php');
|
||||
|
||||
class block_blog_tags extends block_base {
|
||||
function init() {
|
||||
$this->version = 2006032000;
|
||||
$this->version = 2007101509;
|
||||
$this->title = get_string('blocktagstitle', 'blog');
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class block_blog_tags extends block_base {
|
||||
$sql .= 'AND p.id = ti.itemid ';
|
||||
|
||||
// admins should be able to read all tags
|
||||
if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') ';
|
||||
}
|
||||
$sql .= "AND ti.timemodified > {$timewithin} ";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_calendar_month extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('calendar', 'calendar');
|
||||
$this->version = 2004081200;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function preferred_width() {
|
||||
@@ -32,11 +32,14 @@ class block_calendar_month extends block_base {
|
||||
// It definitely needs SOME comment here!
|
||||
$courseshown = $COURSE->id;
|
||||
|
||||
if($courseshown == SITEID) {
|
||||
if ($courseshown == SITEID) {
|
||||
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
|
||||
// the list of courses it will be grabbing events from.
|
||||
$filtercourse = NULL;
|
||||
$groupeventsfrom = NULL;
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
calendar_set_referring_course(0);
|
||||
|
||||
} else {
|
||||
// Forcibly filter events to include only those from the particular course we are in.
|
||||
$filtercourse = array($courseshown => $COURSE);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_calendar_upcoming extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('upcomingevents', 'calendar');
|
||||
$this->version = 2004052600;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
@@ -44,6 +44,8 @@ class block_calendar_upcoming extends block_base {
|
||||
// the list of courses it will be grabbing events from.
|
||||
$filtercourse = NULL;
|
||||
$groupeventsfrom = NULL;
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
calendar_set_referring_course(0);
|
||||
} else {
|
||||
// Forcibly filter events to include only those from the particular course we are in.
|
||||
$filtercourse = array($courseshown => $COURSE);
|
||||
|
||||
@@ -5,7 +5,7 @@ include_once($CFG->dirroot . '/course/lib.php');
|
||||
class block_course_list extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('courses');
|
||||
$this->version = 2004111600;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function has_config() {
|
||||
@@ -25,7 +25,7 @@ class block_course_list extends block_list {
|
||||
$this->content->footer = '';
|
||||
|
||||
$icon = "<img src=\"$CFG->pixpath/i/course.gif\"".
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
" class=\"icon\" alt=\"".get_string("coursecategory")."\" />";
|
||||
|
||||
$adminseesall = true;
|
||||
if (isset($CFG->block_course_list_adminview)) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_course_summary extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('pagedescription', 'block_course_summary');
|
||||
$this->version = 2004052600;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
|
||||
@@ -8,7 +8,7 @@ class block_glossary_random extends block_base {
|
||||
function init() {
|
||||
|
||||
$this->title = get_string('blockname','block_glossary_random');
|
||||
$this->version = 2005040500;
|
||||
$this->version = 2007101509;
|
||||
|
||||
}
|
||||
|
||||
@@ -226,5 +226,17 @@ class block_glossary_random extends block_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executed after block instance has been created, we use it to recode
|
||||
* the glossary config setting to point to the new (restored) one
|
||||
*/
|
||||
function after_restore($restore) {
|
||||
/// We need to transform the glossary->id from the original one to the restored one
|
||||
if ($rec = backup_getid($restore->backup_unique_code, 'glossary', $this->config->glossary)) {
|
||||
$this->config->glossary = $rec->new_id;
|
||||
$this->instance_config_commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -4,7 +4,7 @@ class block_html extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('html', 'block_html');
|
||||
$this->version = 2004123000;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
@@ -12,7 +12,7 @@ class block_html extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
$this->title = isset($this->config->title) ? $this->config->title : get_string('newhtmlblock', 'block_html');
|
||||
$this->title = isset($this->config->title) ? format_string($this->config->title) : format_string(get_string('newhtmlblock', 'block_html'));
|
||||
}
|
||||
|
||||
function instance_allow_multiple() {
|
||||
@@ -36,14 +36,55 @@ class block_html extends block_base {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
function backup_encode_absolute_links_in_config(&$config) {
|
||||
$config->text = backup_encode_absolute_links($config->text);
|
||||
/**
|
||||
* Will be called before an instance of this block is backed up, so that any links in
|
||||
* any links in any HTML fields on config can be encoded.
|
||||
* @return string
|
||||
*/
|
||||
function get_backup_encoded_config() {
|
||||
/// Prevent clone for non configured block instance. Delegate to parent as fallback.
|
||||
if (empty($this->config)) {
|
||||
return parent::get_backup_encoded_config();
|
||||
}
|
||||
$data = clone($this->config);
|
||||
$data->text = backup_encode_absolute_links($data->text);
|
||||
return base64_encode(serialize($data));
|
||||
}
|
||||
|
||||
function restore_decode_absolute_links_in_config(&$config) {
|
||||
$oldtext = $config->text;
|
||||
$config->text = restore_decode_absolute_links($oldtext);
|
||||
return $config->text != $oldtext;
|
||||
/**
|
||||
* This function makes all the necessary calls to {@link restore_decode_content_links_worker()}
|
||||
* function in order to decode contents of this block from the backup
|
||||
* format to destination site/course in order to mantain inter-activities
|
||||
* working in the backup/restore process.
|
||||
*
|
||||
* This is called from {@link restore_decode_content_links()} function in the restore process.
|
||||
*
|
||||
* NOTE: There is no block instance when this method is called.
|
||||
*
|
||||
* @param object $restore Standard restore object
|
||||
* @return boolean
|
||||
**/
|
||||
function decode_content_links_caller($restore) {
|
||||
global $CFG;
|
||||
|
||||
if ($restored_blocks = get_records_select("backup_ids","table_name = 'block_instance' AND backup_code = $restore->backup_unique_code AND new_id > 0", "", "new_id")) {
|
||||
$restored_blocks = implode(',', array_keys($restored_blocks));
|
||||
$sql = "SELECT bi.*
|
||||
FROM {$CFG->prefix}block_instance bi
|
||||
JOIN {$CFG->prefix}block b ON b.id = bi.blockid
|
||||
WHERE b.name = 'html' AND bi.id IN ($restored_blocks)";
|
||||
|
||||
if ($instances = get_records_sql($sql)) {
|
||||
foreach ($instances as $instance) {
|
||||
$blockobject = block_instance('html', $instance);
|
||||
$blockobject->config->text = restore_decode_absolute_links($blockobject->config->text);
|
||||
$blockobject->config->text = restore_decode_content_links_worker($blockobject->config->text, $restore);
|
||||
$blockobject->instance_config_commit($blockobject->pinned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,7 @@ class block_loancalc extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('loancalc','block_loancalc');
|
||||
$this->content_type = BLOCK_TYPE_TEXT;
|
||||
$this->version = 2005022100;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
@@ -150,8 +150,6 @@ function comp(v) { // general entry point for all cases
|
||||
} // function comp
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<h1></h1>
|
||||
<form method="post" id="vbankform" action="">
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_login extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('login');
|
||||
$this->version = 2006102700; //TODO
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
|
||||
@@ -4,11 +4,11 @@ class block_mentees extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('blockname', 'block_mentees');
|
||||
$this->version = 2007030900;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('all' => true, 'my' =>false, 'tag' => false);
|
||||
return array('all' => true, 'tag' => false);
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
@@ -49,4 +49,4 @@ class block_mentees extends block_base {
|
||||
return $this->content;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_messages extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('messages','message');
|
||||
$this->version = 2004122800;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_mnet_hosts extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('mnet_hosts','block_mnet_hosts') ;
|
||||
$this->version = 2006112100;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function has_config() {
|
||||
|
||||
@@ -130,25 +130,102 @@ class block_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called before an instance of this block is backed up, so that any links in
|
||||
* any links in any HTML fields on config can be encoded. For example, for the HTML block
|
||||
* we need to do $config->text = backup_encode_absolute_links($config->text);.
|
||||
* Enable custom instance data section in backup and restore.
|
||||
*
|
||||
* If return true, then {@link instance_backup()} and
|
||||
* {@link instance_restore()} will be called during
|
||||
* backup/restore routines.
|
||||
*
|
||||
* @param object $config the config field for an insance of this class.
|
||||
*/
|
||||
function backup_encode_absolute_links_in_config(&$config) {
|
||||
* @return boolean
|
||||
**/
|
||||
function backuprestore_instancedata_used() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo the effect of backup_encode_absolute_links_in_config. For exmaple, in the
|
||||
* HTML block we need to do $config->text = restore_decode_absolute_links($config->text);
|
||||
* Allows the block class to have a backup routine. Handy
|
||||
* when the block has its own tables that have foreign keys to
|
||||
* other tables (example: user table).
|
||||
*
|
||||
* Note: at the time of writing this comment, the indent level
|
||||
* for the {@link full_tag()} should start at 5.
|
||||
*
|
||||
* @param object $config the config field for an insance of this class.
|
||||
* @return boolean return true if something has changed, so the database can be updated,
|
||||
* false if not, for efficiency reasons.
|
||||
* @param resource $bf Backup File
|
||||
* @param object $preferences Backup preferences
|
||||
* @return boolean
|
||||
**/
|
||||
function instance_backup($bf, $preferences) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the block class to restore its backup routine.
|
||||
*
|
||||
* Should not return false if data is empty
|
||||
* because old backups would not contain block instance backup data.
|
||||
*
|
||||
* @param object $restore Standard restore object
|
||||
* @param object $data Object from backup_getid for this block instance
|
||||
* @return boolean
|
||||
**/
|
||||
function instance_restore($restore, $data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called before an instance of this block is backed up, so that any links in
|
||||
* in config can be encoded. For example config->text, for the HTML block
|
||||
* @return string
|
||||
*/
|
||||
function restore_decode_absolute_links_in_config(&$config) {
|
||||
return false;
|
||||
function get_backup_encoded_config() {
|
||||
return base64_encode(serialize($this->config));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the content encoded to support interactivities linking. This function is
|
||||
* called automatically from the backup procedure by {@link backup_encode_absolute_links()}.
|
||||
*
|
||||
* NOTE: There is no block instance when this method is called.
|
||||
*
|
||||
* @param string $content Content to be encoded
|
||||
* @param object $restore Restore preferences object
|
||||
* @return string The encoded content
|
||||
**/
|
||||
function encode_content_links($content, $restore) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function makes all the necessary calls to {@link restore_decode_content_links_worker()}
|
||||
* function in order to decode contents of this block from the backup
|
||||
* format to destination site/course in order to mantain inter-activities
|
||||
* working in the backup/restore process.
|
||||
*
|
||||
* This is called from {@link restore_decode_content_links()} function in the restore process.
|
||||
*
|
||||
* NOTE: There is no block instance when this method is called.
|
||||
*
|
||||
* @param object $restore Standard restore object
|
||||
* @return boolean
|
||||
**/
|
||||
function decode_content_links_caller($restore) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return content decoded to support interactivities linking.
|
||||
* This is called automatically from
|
||||
* {@link restore_decode_content_links_worker()} function
|
||||
* in the restore process.
|
||||
*
|
||||
* NOTE: There is no block instance when this method is called.
|
||||
*
|
||||
* @param string $content Content to be dencoded
|
||||
* @param object $restore Restore preferences object
|
||||
* @return string The dencoded content
|
||||
**/
|
||||
function decode_content_links($content, $restore) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_news_items extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('latestnews');
|
||||
$this->version = 2005030800;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class block_online_users extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('blockname','block_online_users');
|
||||
$this->version = 2006030100;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function has_config() {return true;}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_participants extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('people');
|
||||
$this->version = 2004052600;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
@@ -10,7 +10,7 @@ define('B_QUIZRESULTS_GRADE_FORMAT_ABS', 3);
|
||||
class block_quiz_results extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('formaltitle', 'block_quiz_results');
|
||||
$this->version = 2005082300;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class block_recent_activity extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('recentactivity');
|
||||
$this->version = 2004042900;
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('feedstitle', 'block_rss_client');
|
||||
$this->version = 2007080101;
|
||||
$this->version = 2007101509;
|
||||
$this->cron = 300; /// Set min time between cron executions to 300 secs (5 mins)
|
||||
}
|
||||
|
||||
@@ -330,6 +330,9 @@
|
||||
mtrace(' ' . $rec->url . ' ', '');
|
||||
/// Fetch the rss feed, using standard magpie caching
|
||||
/// so feeds will be renewed only if cache has expired
|
||||
// sometimes the cron times out on moodle.org during fetching,
|
||||
// there is a 5s limit in magpie which should work, but does not sometimes :-(
|
||||
@set_time_limit(60);
|
||||
if ($rss = fetch_rss($rec->url)) {
|
||||
mtrace ('ok');
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
|
||||
// Ensure that the logged in user is not using the guest account
|
||||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
print_error('noguestpost', 'forum', $referrer);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ if (!empty($id)) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
}
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ if ($act == 'updfeed') {
|
||||
error(get_string('noguestpost', 'forum').
|
||||
' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
$referrer);
|
||||
//print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +226,7 @@ if ($act == 'updfeed') {
|
||||
error(get_string('noguestpost', 'forum').
|
||||
' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
$referrer);
|
||||
//print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
|
||||
}
|
||||
|
||||
$file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user