Compare commits
1082 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99312493b6 | |||
| 0f4aa108d9 | |||
| 8e6e45aa1a | |||
| 040ea6d217 | |||
| 2e47bfb16b | |||
| 3702d88a6e | |||
| 185441df1a | |||
| 1394c591c6 | |||
| 278b82afec | |||
| 5842492ff6 | |||
| c335b24901 | |||
| 3e70580216 | |||
| ae3071a0df | |||
| d778032a9e | |||
| 9d88867d0f | |||
| 49d4be8ba5 | |||
| 7ca341ae94 | |||
| b16206af1c | |||
| 741859448b | |||
| fd6024c0be | |||
| 9037920594 | |||
| 203968ccae | |||
| 9eb290680b | |||
| 1510c6c913 | |||
| faed109b67 | |||
| a0a264068f | |||
| 8db9017fd8 | |||
| 96b4500a91 | |||
| 2fbc9fcb8b | |||
| f9085923a2 | |||
| c612c32231 | |||
| f8d1a60893 | |||
| 947c93bc0a | |||
| f63a256c87 | |||
| cdfbc956fc | |||
| 9922fbf9d6 | |||
| 31df961fd2 | |||
| 288b5b4028 | |||
| e94ed1ae6e | |||
| 57be0ec8f7 | |||
| 1b7d1827de | |||
| b10c986edc | |||
| 18dd81c215 | |||
| 2468aba863 | |||
| c4826181c8 | |||
| 54ad70b035 | |||
| 66feb0092d | |||
| c852b07683 | |||
| 133e54629f | |||
| 7d9881cdea | |||
| 95ae6fbf1f | |||
| 169d90353f | |||
| dd6f51b926 | |||
| 8dea9afdee | |||
| 91b1bf8572 | |||
| 948cff69a6 | |||
| 1f1df4b191 | |||
| df226eb12d | |||
| 88d8fff6d7 | |||
| afd64674a5 | |||
| 26eee29f1e | |||
| 3c6767e8ad | |||
| 5bdab31478 | |||
| e883fe1ab2 | |||
| fa6947c2cd | |||
| 8536a9fbc6 | |||
| 19a7b0aaff | |||
| d3b10b9746 | |||
| 38aa918f2f | |||
| 3a9ad62295 | |||
| efd1898dc0 | |||
| 719faf3548 | |||
| e155f2040b | |||
| ec8d4ea9cd | |||
| 0425032153 | |||
| d00f6bbccf | |||
| 2e43c17e57 | |||
| 8d7c19f5d1 | |||
| e99f828c35 | |||
| 5d65584d34 | |||
| 92cb423293 | |||
| 7c3f0706a0 | |||
| 9ebd5c666d | |||
| df5be4fb9c | |||
| 75b281a8a1 | |||
| dc01248261 | |||
| e4aad71ea4 | |||
| 79d00fd3af | |||
| 9456e28c08 | |||
| 7649ed1209 | |||
| 87042d5731 | |||
| efcbd12a39 | |||
| 8efcefe411 | |||
| 751f367170 | |||
| 528029df3f | |||
| b6a671d653 | |||
| d8a7a8f691 | |||
| 09e3e4efb6 | |||
| e7d53ba351 | |||
| 558d74308f | |||
| 1ba41a5caf | |||
| 41cc574f95 | |||
| 5a7aef9c1c | |||
| 152f2f68ce | |||
| 7f761c27eb | |||
| 0ce6c76982 | |||
| 6219090e2c | |||
| a0ea30a741 | |||
| a40cd98d67 | |||
| d84e26d2c4 | |||
| c8d51449f7 | |||
| b2fb1d4096 | |||
| 2459ecc419 | |||
| 48441521aa | |||
| 2101eddc89 | |||
| 33cc11661b | |||
| 7e507929e6 | |||
| e671b92a2a | |||
| 53f5364123 | |||
| 5b2f502112 | |||
| 34126fd8f1 | |||
| fed8004f56 | |||
| 74a2040332 | |||
| 9a5d3d9d3d | |||
| cda98581a5 | |||
| 5e75f98c71 | |||
| 2dc20107b9 | |||
| cd6323f517 | |||
| cee5f24cc3 | |||
| a2e587548e | |||
| 56e5cb78a8 | |||
| 5a3951e035 | |||
| bc1982446c | |||
| eb3deee548 | |||
| 262bc9a40b | |||
| b8d8a34565 | |||
| a29910300d | |||
| d79dfb8586 | |||
| 30f5739a46 | |||
| 1e51f8fa07 | |||
| 3211d8b265 | |||
| c9ab907641 | |||
| c095ae4364 | |||
| c9534efc10 | |||
| 7edb720ac8 | |||
| 244cb43dff | |||
| 2b72207cc3 | |||
| a9aecc7b14 | |||
| c814ba2c1e | |||
| 8823667015 | |||
| 6ffb4d547c | |||
| 3434f2553a | |||
| 1877680610 | |||
| 8fc5a75c11 | |||
| eda7a6b347 | |||
| 5d4b57cb07 | |||
| 502e8e4c30 | |||
| 93f56c2a9d | |||
| 98e8766b5b | |||
| 5d5f22570f | |||
| 88540a03e6 | |||
| 7a222aa46e | |||
| 0dbc56ee8b | |||
| 7c3bf2a16b | |||
| c0d26d69f8 | |||
| d33c47e381 | |||
| 75d6eaaf31 | |||
| 6c5baec1b5 | |||
| fdc6e017b5 | |||
| c7d80b3a25 | |||
| 2979aead19 | |||
| 68e9ee7163 | |||
| 7b462b46f0 | |||
| 8297db894e | |||
| 4babe7c31f | |||
| 000f9787f6 | |||
| 020fe631c3 | |||
| 970166d4ac | |||
| df6447ef65 | |||
| 203b990fb0 | |||
| ab6bd700d8 | |||
| e629e57a2b | |||
| a8cd1b57da | |||
| 89d98b923b | |||
| de13f5b6fd | |||
| 098a26f514 | |||
| 802f6e34d7 | |||
| d0494b6ec0 | |||
| f8faba784a | |||
| a3534169ae | |||
| c447099bda | |||
| 14c5382464 | |||
| e70e08fa8e | |||
| 2328428fe1 | |||
| 123dcabe68 | |||
| 1c1b5fc676 | |||
| 89f02fd6b2 | |||
| 3efca70fda | |||
| 24ab562c73 | |||
| 3dcb2cda36 | |||
| e3d41efc04 | |||
| 1b3fa338bb | |||
| 5a01c73780 | |||
| ba33284ca1 | |||
| 5a661304aa | |||
| f653c544e9 | |||
| 52d3a9e351 | |||
| b94db131e5 | |||
| 7cc7b0c033 | |||
| 81c049d9c2 | |||
| d119a6f42f | |||
| f032a4bebd | |||
| 8b45b8e0a6 | |||
| 27b1710b01 | |||
| 98928f94e9 | |||
| 0ee8a5280e | |||
| 4855134e63 | |||
| 96be763dc5 | |||
| 8a8d3515d3 | |||
| b59914d977 | |||
| 4dc48514e5 | |||
| ac470e064e | |||
| 4b3f2d3739 | |||
| b8ca891023 | |||
| 70acd53078 | |||
| f1cac46f00 | |||
| 990ae1bb9d | |||
| 904eea079b | |||
| 676174682e | |||
| 870c9c02b3 | |||
| 7356223a7d | |||
| 9deccd7a44 | |||
| 5580a59ba7 | |||
| 7bf7c697d3 | |||
| c539258b52 | |||
| 0c9945f5c6 | |||
| 74ec307700 | |||
| f4687e66e7 | |||
| b4ed6f7392 | |||
| 54d9b6d847 | |||
| 83941d0192 | |||
| 9109202550 | |||
| 669b80b1e2 | |||
| 49f5a957cd | |||
| c35b90ebed | |||
| 68f67bbe75 | |||
| 099d1c8f62 | |||
| e599ca7241 | |||
| 19226c30b5 | |||
| ccd33d6b19 | |||
| 4de6676739 | |||
| ae817db2f8 | |||
| e93291d5ee | |||
| cfe0874655 | |||
| 75ed3a0add | |||
| 6b3eca01f2 | |||
| 51f90f8839 | |||
| 99797689e6 | |||
| 841dca3991 | |||
| 28fb4d1027 | |||
| e54510d166 | |||
| 72cd33b6f4 | |||
| c10708e9ce | |||
| ef1da4973c | |||
| bd4c23edf3 | |||
| 8354fc630f | |||
| 737b745890 | |||
| abd67b8e7f | |||
| b70a71f3eb | |||
| 673b34647a | |||
| 1539445279 | |||
| 9346aeddae | |||
| fba5ee935b | |||
| 2edb5cbdc4 | |||
| b3ed7949fb | |||
| 4100f63ab4 | |||
| 06553cdb82 | |||
| 34a90b1d22 | |||
| 598100a16b | |||
| 514dc2d92a | |||
| beca85894e | |||
| 022acf5df4 | |||
| 7d39e1b828 | |||
| 300185b2e4 | |||
| 20dce6a07d | |||
| d630b81286 | |||
| a59b768dee | |||
| 338f490b98 | |||
| 37bff835b0 | |||
| d0a2161941 | |||
| 757bc06941 | |||
| a20f71c7ef | |||
| 8a60457e13 | |||
| 90dc0f3071 | |||
| 7cdb6ee4a9 | |||
| 5a8100234f | |||
| 1c6f3513d9 | |||
| fcfe44d8b4 | |||
| 28f18faa37 | |||
| 8e4a35943c | |||
| 18284d3f65 | |||
| 45ee48d990 | |||
| abae4967bc | |||
| 6417390ca5 | |||
| 32db125642 | |||
| 13b78aa854 | |||
| 877c237cf5 | |||
| 8ed5c68a7f | |||
| 54b9c5feb0 | |||
| 03c03e08cc | |||
| 3dc3b31e77 | |||
| 51f2cdd803 | |||
| b12c6f2b1c | |||
| 2c15845dfb | |||
| f4b987c7a4 | |||
| 61bfc7eaa1 | |||
| f6a9b4c9b8 | |||
| cd268329ef | |||
| 32b0172953 | |||
| 56d0ff42c0 | |||
| fc137768fd | |||
| 5220582ed7 | |||
| 0b3cc31c2e | |||
| e1cd6c73e5 | |||
| 82df9925b8 | |||
| bbe0467bff | |||
| 58c8f24909 | |||
| a5c1df9bcf | |||
| b2744afe61 | |||
| 6d969cd512 | |||
| 03c358e331 | |||
| 0db058ef58 | |||
| 1bc0bbb4ef | |||
| 32932231fd | |||
| 9cdfe34923 | |||
| 36c04a1bdb | |||
| 73fcfef178 | |||
| f52a0de1c5 | |||
| ea9af5b1a2 | |||
| 1ac5aabb2f | |||
| ee7a11dc62 | |||
| ca6f03263d | |||
| 77a53d26bb | |||
| 414b66be32 | |||
| b5558e5742 | |||
| 9dbb215cf6 | |||
| 0a85b6161b | |||
| eb34ba19a9 | |||
| 8a48b86836 | |||
| 0196475e23 | |||
| 8245849ef9 | |||
| 0b5a4199d0 | |||
| 3dd157d0ee | |||
| 51528c6d6e | |||
| d07ae54371 | |||
| 4f497b2c4e | |||
| 482221882b | |||
| fab9a8452a | |||
| 0c7d5e2966 | |||
| 50ab9935c0 | |||
| 1e81a1295e | |||
| 200f64d220 | |||
| 1b1bd5929b | |||
| e489cc2f8d | |||
| 827100874d | |||
| 160684c811 | |||
| afbb79e1c6 | |||
| 1cd4d9dffe | |||
| f548abb84c | |||
| 1f44541d17 | |||
| 1cefec56ed | |||
| aeae7ec39d | |||
| 471e1be772 | |||
| 3e5d5d5741 | |||
| f1deee8860 | |||
| c08b2ecf09 | |||
| fae700ba1c | |||
| 7b8cd330a3 | |||
| 5645145115 | |||
| ad91f3744e | |||
| 7bf21a5064 | |||
| 3b37251a8a | |||
| 80d7317a79 | |||
| 47d75826be | |||
| 8478d321ec | |||
| 9e9511ca48 | |||
| 451761a403 | |||
| f5a587ce76 | |||
| ffb13064dc | |||
| d359ac1491 | |||
| 7521250967 | |||
| 0b0f2f864b | |||
| ed0acd0904 | |||
| b3f877de05 | |||
| 552254834b | |||
| 894722ed9c | |||
| dcc09c507e | |||
| da76b7ee70 | |||
| 3a041e458c | |||
| 134f59345f | |||
| 1769403fbd | |||
| eb923b5cc1 | |||
| 8e9fca4fff | |||
| bcc37dd0c1 | |||
| 58e84d7044 | |||
| c58364c3d3 | |||
| f6a54f01e3 | |||
| 678530de2b | |||
| ca6e796485 | |||
| 5d6dccfa8e | |||
| e941d7248b | |||
| fec02d75b9 | |||
| ab7005bfa4 | |||
| 2dd8e071a8 | |||
| e041eb354e | |||
| d6358f2d18 | |||
| 6ba9ac7e71 | |||
| 5e1cef5b04 | |||
| 5789b52a35 | |||
| eab947dabd | |||
| 2b2cdcd504 | |||
| d4833f2103 | |||
| f285e9514a | |||
| fc05711af3 | |||
| 603042b740 | |||
| 386aed2335 | |||
| 4e48f83df8 | |||
| 7b57c10fb9 | |||
| 1ea523a8b1 | |||
| 34d1510980 | |||
| db6988d87f | |||
| c5edbc12e8 | |||
| fa9e2d8b58 | |||
| 57aafd33f7 | |||
| c9ff03bdf4 | |||
| e967dcc1a7 | |||
| 15fbde6aee | |||
| 50b474966c | |||
| eeb28d3ff4 | |||
| 0f4452fcd0 | |||
| 343c223111 | |||
| 726f2a45dc | |||
| 6f23f8985a | |||
| 752569765e | |||
| 0570c31a3b | |||
| d1bbb75333 | |||
| 9822b38f10 | |||
| dc2ea6fb26 | |||
| 941f70858d | |||
| 3b0dc8cd12 | |||
| 5358318b6f | |||
| e88bc4a2c1 | |||
| 4970ebb19c | |||
| a6ec1e9dd0 | |||
| e0033fb83c | |||
| c5fbfafa62 | |||
| 5e0da4b5ee | |||
| 4b952ed3ff | |||
| c28f197deb | |||
| b63b4c2c19 | |||
| 1994116184 | |||
| d2d4b56c83 | |||
| 439e93b27f | |||
| 5234b78232 | |||
| cc701ed021 | |||
| 06ff2489ae | |||
| aac7fcb6fe | |||
| 9f34d8341a | |||
| 921899fc20 | |||
| f3768c4094 | |||
| 24ec59cd3c | |||
| 47b0cf06a3 | |||
| 7a3fa1280f | |||
| 2628f0bc16 | |||
| 070a606c68 | |||
| 8ef593442b | |||
| 83a66c9f3b | |||
| f312622c4e | |||
| 5fa1dcdb43 | |||
| f2c0c26767 | |||
| f96fdd4505 | |||
| 4e36e57bcb | |||
| dc99997eac | |||
| 32a6bb301e | |||
| b1062ec362 | |||
| 14a6c97e6c | |||
| a78a688961 | |||
| 661b8d9dec | |||
| 909abddce3 | |||
| 5678d4e4fa | |||
| ee9568e574 | |||
| 60b5a1e50a | |||
| 44f2b37760 | |||
| c3b4148b48 | |||
| 8569a0b96f | |||
| 1b14f9daf5 | |||
| 0d2521b4d3 | |||
| 29a8cc034b | |||
| 5862de1d22 | |||
| 2022d08058 | |||
| e3d945e86a | |||
| b3225d1a2f | |||
| d029c122af | |||
| eb1bf09594 | |||
| 6fdadd110b | |||
| b57ddf7b1d | |||
| 3c7d829b22 | |||
| 4a1db8bd3d | |||
| ed548587ab | |||
| dbd1755a42 | |||
| 09d1d1ac2e | |||
| 90f3a22a0b | |||
| 753775479c | |||
| c47b3a935b | |||
| 2eff9d1367 | |||
| 1437b25532 | |||
| 4e39b6ff35 | |||
| 01c48affff | |||
| d6949b0238 | |||
| f60ecf6045 | |||
| f0af72d2f9 | |||
| 9f51b7c925 | |||
| 4ad794c524 | |||
| 4aec47adba | |||
| f38de13d68 | |||
| e6096b71e5 | |||
| 8a789e52cc | |||
| bbb0032181 | |||
| 3751aaf098 | |||
| 75e27a12be | |||
| c19977a6f5 | |||
| 3d6d2b8153 | |||
| 7f4ea06814 | |||
| 3dda8f3cf3 | |||
| d78ec260b2 | |||
| 0572e4291d | |||
| 8bc1d327c2 | |||
| e0f57f0d56 | |||
| 6886503616 | |||
| bc93860e9f | |||
| 1ffd2c0ac6 | |||
| e1be60d66c | |||
| 727031451d | |||
| 947d3349ab | |||
| 2bb9c62bf8 | |||
| b65f805a91 | |||
| 4bc522672d | |||
| 1bb56f97c5 | |||
| a11b2d8e72 | |||
| 5a1920568c | |||
| dd85612a17 | |||
| 7e2aced51d | |||
| fe6e5f35b5 | |||
| de3499d458 | |||
| 26b131922b | |||
| f67882c305 | |||
| eed1c7ca5b | |||
| 34a2acfc72 | |||
| bb0aa83341 | |||
| dfae0ffa1b | |||
| c194ca1c70 | |||
| 90b52b9486 | |||
| b0e29954ae | |||
| ebd7bc06ce | |||
| 167a831615 | |||
| efedb70895 | |||
| 3f9fd1987c | |||
| 048373691e | |||
| baa0b3ceae | |||
| e289bd8030 | |||
| 509f876de8 | |||
| 6e21779482 | |||
| b65a82e1a4 | |||
| f6fc4e1891 | |||
| a4bc586138 | |||
| f0bcc27f90 | |||
| 75bbcfb74f | |||
| 014c522eb8 | |||
| f99f716464 | |||
| b1b4cdb7d8 | |||
| dda3fc5779 | |||
| 4e557706d3 | |||
| 0556edaf60 | |||
| 231e409849 | |||
| e7c9105d26 | |||
| 8323fb4279 | |||
| 28e95b14e2 | |||
| df4847fc1b | |||
| e0e0c00e94 | |||
| e19f5f4ce5 | |||
| f5f696be2a | |||
| 36d38823c0 | |||
| fadd42e097 | |||
| 23ae278546 | |||
| f86c86269e | |||
| 89eccbccb2 | |||
| 5d88d553ef | |||
| caba817fe7 | |||
| 419b95d2ad | |||
| 61bb817fd2 | |||
| a186848393 | |||
| 66738744f5 | |||
| 961ffe486f | |||
| 04bb266b3f | |||
| d672ecf8e8 | |||
| 4f4f20e7fb | |||
| b424feb1cd | |||
| 78ed8710e6 | |||
| 5ff601c49e | |||
| 186b0a1537 | |||
| f99ed7c86d | |||
| bdbb8f02b2 | |||
| 0c08447833 | |||
| c6b4a16884 | |||
| f5446711d2 | |||
| 919352d80a | |||
| 57c9510f1b | |||
| edf9554096 | |||
| 874833bf64 | |||
| aac5f17176 | |||
| 725685f9fb | |||
| cfbd464c72 | |||
| 1a730605aa | |||
| f33f60f78e | |||
| 2b33092aba | |||
| b874e680dc | |||
| aa604cfa06 | |||
| af8288c0e6 | |||
| 0920afeddc | |||
| 1ad377cf12 | |||
| e9ba213148 | |||
| 3fc8fbccd6 | |||
| eebb9e840d | |||
| d7ced1eca3 | |||
| cbcae60bb4 | |||
| cf71b80e65 | |||
| dc1a8255ba | |||
| 0b58276ad0 | |||
| 5d27c224dd | |||
| 015edfa92e | |||
| c0b9b34aea | |||
| c54982c11b | |||
| 1714e789f4 | |||
| 91d44be7b0 | |||
| edd33b96b3 | |||
| df63d62031 | |||
| ae066f4cae | |||
| fc1981bb71 | |||
| 3404e92ced | |||
| e2e41efc2a | |||
| 0e92e35575 | |||
| eb2a551ce4 | |||
| 82cb40f813 | |||
| dbc6368462 | |||
| f4afcf7efa | |||
| 05c7e459ac | |||
| 7608d5ccab | |||
| c798b55df4 | |||
| 5a9528b959 | |||
| 45d99c3807 | |||
| d26e72d1b2 | |||
| 2baa6afc82 | |||
| 0fcad934b6 | |||
| 9bee6187e4 | |||
| 4764cb3ee8 | |||
| f2614f737b | |||
| b7f2b64f2f | |||
| 3b53ec29f8 | |||
| 0498a4d517 | |||
| 7d0ffb0fe6 | |||
| d3564a90ad | |||
| d3ad764373 | |||
| 8a9febcdb0 | |||
| 0a78a5c67d | |||
| 16ce3928cc | |||
| 08c28a96f7 | |||
| 1ba840fdbb | |||
| cfca081765 | |||
| f6297ede8e | |||
| 50a79cfecc | |||
| 133f457cdc | |||
| 8f56f9d9a3 | |||
| 1c632b934d | |||
| 12b7c16ffc | |||
| 3580ad8ee1 | |||
| 5c6a0bad7b | |||
| 697463d868 | |||
| 8d20f40cb9 | |||
| 347f90e704 | |||
| b533156097 | |||
| 22bf0fd32c | |||
| 2c4f2d4004 | |||
| a2ed173893 | |||
| ec6b89399a | |||
| e2d52b4b88 | |||
| c8733890c3 | |||
| 5d72dbbe9d | |||
| b214c00f01 | |||
| c223acda18 | |||
| 41fe0508eb | |||
| 6673f18b1c | |||
| 97bc9f4934 | |||
| 07893c5239 | |||
| 4bedc06d42 | |||
| 93d8244508 | |||
| 77b7083885 | |||
| a9fce7695e | |||
| bf4c59aa42 | |||
| 6255297f0b | |||
| 6164fc9080 | |||
| a0d692e925 | |||
| 1bc5e06312 | |||
| eb6591ca8b | |||
| f005a30c52 | |||
| 73083f1705 | |||
| 2712b7f2dc | |||
| b9e6a03e3e | |||
| cd93c36de6 | |||
| 69e5b55d03 | |||
| e0a8a35867 | |||
| a34487e2e5 | |||
| bc1d20eea9 | |||
| 7efe75fcc4 | |||
| 1f7790ffe5 | |||
| c15b5c3c96 | |||
| 03648520cc | |||
| ea6f1fd569 | |||
| d6c42bb205 | |||
| e3128055a2 | |||
| 52c72b0079 | |||
| e5d17c3450 | |||
| ee0875740d | |||
| ec5a8430eb | |||
| 3fdb68a838 | |||
| 1ebce948ec | |||
| 8841cecde3 | |||
| aa4be76082 | |||
| af191f3be2 | |||
| 4cd5906993 | |||
| 907e4a312d | |||
| 8eda8b6521 | |||
| 16c5052e79 | |||
| c6144706fb | |||
| 8ab04045ff | |||
| a280860c4e | |||
| 5c8faf4728 | |||
| 9b71941eba | |||
| 45e27a011b | |||
| 53f6ee19bd | |||
| 42e28aa6ca | |||
| 0d8b628813 | |||
| 3f22efa141 | |||
| 2142a30406 | |||
| 1d671e8e4a | |||
| 211a42594f | |||
| 041396c760 | |||
| dadcf5cc42 | |||
| 0337694a7d | |||
| a936d39aed | |||
| f5c39e0b23 | |||
| 53aab8ffd4 | |||
| bc8f835f0d | |||
| b05c975e30 | |||
| 908a8949b3 | |||
| dc4495783d | |||
| 75ca3e0d01 | |||
| 49b5de5ae4 | |||
| 9725881e50 | |||
| 3b817c7251 | |||
| acb9bb129a | |||
| 480e735763 | |||
| 6b94ff60e6 | |||
| 6214b779ff | |||
| 9ce40f4de1 | |||
| c72a4079b1 | |||
| 8f5b6a9308 | |||
| 1138529ffa | |||
| 80289b2543 | |||
| 71f9356394 | |||
| dd48dfc480 | |||
| 95dfead3b1 | |||
| 22c22fe17c | |||
| 6e4dbffd0a | |||
| 6339452c3e | |||
| ffeb631f28 | |||
| a44ce185fa | |||
| 1c5d61d928 | |||
| b766a48f3f | |||
| eac3f48ca7 | |||
| 581ca3d354 | |||
| 6ac9c77179 | |||
| 31682b1276 | |||
| daf3c36c51 | |||
| 0ab95f8bf6 | |||
| 295ce0c81e | |||
| dda4bbbf25 | |||
| eee45d7fe6 | |||
| 838e92f788 | |||
| a904349624 | |||
| bfbe9c52c1 | |||
| 2e5815427b | |||
| 1c2d58cc99 | |||
| ebecdf8d14 | |||
| 82cb7fe78c | |||
| 9b2aa32147 | |||
| 196684087f | |||
| d86d8f5a99 | |||
| 4514f4bf4b | |||
| 4bcf2c2122 | |||
| ed4fd6c492 | |||
| 809651502d | |||
| ab717a9c26 | |||
| 9ffa6198f3 | |||
| 62ec0b2bd4 | |||
| c6b2e4fce9 | |||
| 82ad3312a7 | |||
| ca2af27934 | |||
| 19ec0f2df2 | |||
| 4adbf6cf72 | |||
| 91cee36fe6 | |||
| 0c93bd7340 | |||
| 4be4e29a3b | |||
| 8cd6f2b347 | |||
| 87aa917219 | |||
| 1221d87de8 | |||
| caa413ece1 | |||
| 4fb68891b0 | |||
| acd404e309 | |||
| 1f31378d11 | |||
| 273c8bf204 | |||
| db8a7ac9d1 | |||
| ef9b262c7c | |||
| 5ce8c064dd | |||
| 37c023fb5c | |||
| 2ac86cbd24 | |||
| 5573a51843 | |||
| f4f534c675 | |||
| aa34400457 | |||
| 8ebd0d9f4d | |||
| 1880a55e53 | |||
| 4fadd52878 | |||
| 87b9156edb | |||
| 39bf0df228 | |||
| 27a78fcd2d | |||
| 45debd50c5 | |||
| a4f3137661 | |||
| 1002d7e22a | |||
| 587813b713 | |||
| c21899e0dd | |||
| bcfbd8cbdf | |||
| 304182d210 | |||
| f4c0f3d062 | |||
| a871e630b2 | |||
| 5ceecdaaff | |||
| 964b1bb8c5 | |||
| 5aada1957d | |||
| 6e0c3e4e4d | |||
| 1e6eb9da35 | |||
| 960192ec0e | |||
| 66f8778519 | |||
| da30f2babd | |||
| 9ff3b4ab32 | |||
| f97583af41 | |||
| dfb723b481 | |||
| f40f3604c7 | |||
| 6483b3b16c | |||
| a3daa6c40d | |||
| bb9950d1cc | |||
| 4fb30fc90b | |||
| 50ae935fd6 | |||
| 3fcf436c16 | |||
| aa86e60148 | |||
| 529c18df40 | |||
| 88f3ed390f | |||
| 5008d3951f | |||
| 247879d0f3 | |||
| 3708bfc599 | |||
| 59d1acce89 | |||
| e95c8bc282 | |||
| c7ff87ee13 | |||
| 520b973c8d | |||
| f76a2d832d | |||
| 18e1b648b9 | |||
| b30533ad22 | |||
| 8e797520d7 | |||
| b552ea3586 | |||
| bc898bed7b | |||
| 13f4d81384 | |||
| 12fa8f82fc | |||
| cf5bb676dc | |||
| 02e7dadc05 | |||
| 439d39348d | |||
| 69860d5d10 | |||
| 84345a1d0d | |||
| 41617e6525 | |||
| 864fbeda4b | |||
| 748d925acb | |||
| f352ff4b83 | |||
| 3dc450db90 | |||
| 11bf8a95e2 | |||
| 6a219918c2 | |||
| 6f6506058f | |||
| cccd285acf | |||
| 14f42baf18 | |||
| 0dc4f14a26 | |||
| 3dbdd5caa3 | |||
| 38048ab4eb | |||
| 2329052916 | |||
| d715f651f4 | |||
| 597abe1a2c | |||
| 9a1dd76cfa | |||
| 488fec2e70 | |||
| ece92348bf | |||
| cf3ccea5e5 | |||
| ee87411fa9 | |||
| b8f8058211 | |||
| 29b30932c9 | |||
| 02bfbf0518 | |||
| 9d46c8fbbf | |||
| b77a1c30bd | |||
| 49240e1503 | |||
| 7ea370a056 | |||
| 323871cbf3 | |||
| d7fd82a2ca | |||
| 6794ccb2b3 | |||
| 392e59c88e | |||
| fdfe84df84 | |||
| dc751c555e | |||
| ef9e26dd33 | |||
| 28b9086750 | |||
| 85b70ad4f6 | |||
| 1110888aee | |||
| 43a8efaadc | |||
| 71ad20a5ca | |||
| ca133f6ec3 | |||
| c69e712116 | |||
| ce52f7c68c | |||
| 1aca4eeaf0 | |||
| 3e57e4b578 | |||
| d10350ce83 | |||
| e0fdaa9de0 | |||
| 2da97a4f23 | |||
| 5097b7269b | |||
| f88c5b545d | |||
| be8963b70c | |||
| 9bea47311f | |||
| be76a35ac3 | |||
| eceb6476e1 | |||
| b0cd3f5453 | |||
| 24c07163d0 | |||
| b95233e1e1 | |||
| ba1b4cd1ef | |||
| 21e00abf42 | |||
| 9c257d8057 | |||
| d0b9615cff | |||
| fcbae39803 | |||
| 25e5ce9a5f | |||
| 611e9f2a67 | |||
| 7936d32cf6 | |||
| bc8f1674e9 | |||
| 5d29fd70a3 | |||
| 6c8a956d90 | |||
| 1aee1e5a27 | |||
| 5e8255d651 | |||
| 6f8489e13d | |||
| b19909d9ae | |||
| 9084681497 | |||
| 305726a6a2 | |||
| 62f3bee984 | |||
| 0183e41239 | |||
| 3b5d49f20c | |||
| bdf5dce110 | |||
| c278e8bc8f | |||
| ed200fd420 | |||
| 44a718e930 | |||
| 5e4098df22 | |||
| 300ade82c4 | |||
| 275b342ce2 | |||
| 84d7815107 | |||
| cd1aa3bb76 | |||
| 4b70ac02cd | |||
| 2ad92ce59b | |||
| bdf0b64635 | |||
| fba486beb4 | |||
| 40bb4f3941 | |||
| f5084fcf1f | |||
| 75f97e398e | |||
| 450eb77b78 | |||
| 4caf41a177 | |||
| d9a1a6f021 | |||
| 880ae97916 | |||
| d10fd935b9 | |||
| d205581b9e | |||
| e3c424e08c | |||
| fa21044e08 | |||
| 5b696e30cc | |||
| 5c03a7d201 | |||
| 55c59f5050 | |||
| c9c54db3d8 | |||
| 826b485ce1 | |||
| bbbba10d73 | |||
| 493ac92129 | |||
| 084712eadc | |||
| 22f3e58605 | |||
| dc6ef09c49 | |||
| 3f9156bf56 | |||
| 52dce7612b | |||
| 552ae418de | |||
| 4db3f36034 | |||
| 9259bf1c0e | |||
| 9407c07c61 | |||
| 0b6c589f21 | |||
| 9da6b30269 | |||
| 5046d2353b | |||
| 81f99d24f7 | |||
| a80094eff3 | |||
| f4921fb310 | |||
| 6c709360f5 | |||
| 8969caa059 | |||
| 226c671af7 | |||
| ca8c7dbc52 | |||
| 1239139dd3 | |||
| fc1bdd6e88 | |||
| b207f15ca2 | |||
| 9dd4a457c8 | |||
| ea86a3aa8d | |||
| e33fc5a3ee | |||
| 1cbf76c5fb | |||
| 06d11b581a | |||
| c519c19ab8 | |||
| 357d918295 | |||
| 173e8c5dfb | |||
| 50e7e04949 | |||
| e1e9407acb | |||
| 3f7cc1f861 | |||
| 6a51d6a786 | |||
| 8c36f3b9a9 | |||
| 2da68b0b32 | |||
| 55005a51ce | |||
| c92d8dd677 | |||
| e1e7d03480 | |||
| 7ee50b87b8 | |||
| 687ce1c4e0 | |||
| 3db1ddedd3 | |||
| fc2df8c889 | |||
| 60a66a2bef | |||
| f7d555d577 | |||
| 974762e6f5 | |||
| ab5642fe19 | |||
| b1b45674dd | |||
| dee89d7ecc | |||
| 32caf9d6d9 | |||
| 91c6c3dc85 | |||
| 331ecbe5b6 | |||
| 46a4dde38c | |||
| 9b7d5f1aa8 | |||
| 706ea2faf3 | |||
| f8128f42a9 | |||
| 234e96d185 | |||
| 01b1fab671 | |||
| 61d29b99d8 | |||
| 8054e9aaad | |||
| ee4848432c | |||
| d3d4f4936e | |||
| d799be5424 | |||
| f24e0da312 | |||
| a8fbb9b4cd | |||
| cfc673c112 | |||
| 6dfe1cc67c | |||
| e796e306f8 | |||
| a7adb64678 | |||
| bfd12c4dd5 | |||
| 8eede3f475 | |||
| 9267fe2f43 | |||
| 1c09e6fe0c | |||
| 62fc4a966f | |||
| 7ba648a011 | |||
| 19798dc28d | |||
| 08f5787e35 | |||
| 5b99950ef1 | |||
| 21cd4715de | |||
| 9a9446e5b4 |
+16
-4
@@ -140,9 +140,15 @@ $registrationauths = array();
|
||||
$registrationauths[''] = $txt->disable;
|
||||
foreach ($authsenabled as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,9 +157,15 @@ foreach ($authsavailable as $auth) {
|
||||
continue; //already in the list
|
||||
}
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-9
@@ -9,6 +9,7 @@ require_once $CFG->libdir.'/adminlib.php';
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
$auth = required_param('auth', PARAM_SAFEDIR);
|
||||
$CFG->pagepath = 'auth/' . $auth;
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$err = array();
|
||||
|
||||
@@ -50,13 +51,18 @@ if ($frm = data_submitted()) {
|
||||
$frm = get_config("auth/$auth");
|
||||
}
|
||||
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
$modules = get_list_of_plugins('auth');
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = get_string("auth_{$module}title", 'auth');
|
||||
}
|
||||
asort($options);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Get the auth descriptions (from core or own auth lang files)
|
||||
$authdescription = get_string("auth_{$auth}description", "auth");
|
||||
if ($authdescription == "[[auth_{$auth}description]]") {
|
||||
$authdescription = get_string("auth_{$auth}description", "auth_{$auth}");
|
||||
}
|
||||
|
||||
// output configuration form
|
||||
admin_externalpage_print_header($adminroot);
|
||||
@@ -69,9 +75,9 @@ echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
|
||||
|
||||
// auth plugin description
|
||||
print_simple_box_start('center', '80%');
|
||||
print_heading($options[$auth]);
|
||||
print_simple_box_start('center', '60%', '', 5, 'informationbox');
|
||||
print_string("auth_{$auth}description", 'auth');
|
||||
print_heading($authtitle);
|
||||
print_simple_box_start('center', '80%', '', 5, 'informationbox');
|
||||
echo $authdescription;
|
||||
print_simple_box_end();
|
||||
echo "<hr />\n";
|
||||
$authplugin->config_form($frm, $err, $user_fields);
|
||||
|
||||
+8
-3
@@ -54,7 +54,7 @@
|
||||
if (!$block = blocks_get_record($multiple)) {
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
$block->multiple = intval(!$block->multiple);
|
||||
update_record('block', $block);
|
||||
}
|
||||
|
||||
@@ -179,8 +179,13 @@
|
||||
if($blockobject->has_config()) {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
|
||||
$count = count_records('block_instance', 'blockid', $blockid);
|
||||
|
||||
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
|
||||
// and it should not show up on course search page
|
||||
$count = count_records_sql('SELECT COUNT(*)
|
||||
FROM '.$CFG->prefix.'block_instance
|
||||
WHERE blockid = '.$blockid.' AND
|
||||
pagetype = \'course-view\'');
|
||||
if ($count>0) {
|
||||
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
|
||||
+33
-8
@@ -98,11 +98,21 @@
|
||||
$cron_function = $mod->name."_cron";
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing module function $cron_function ...", '');
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(1);
|
||||
}
|
||||
if ($cron_function()) {
|
||||
if (! set_field("modules", "lastcron", $timenow, "id", $mod->id)) {
|
||||
mtrace("Error: could not update timestamp for $mod->fullname");
|
||||
}
|
||||
}
|
||||
if (isset($pre_dbqueries)) {
|
||||
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
|
||||
mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
|
||||
}
|
||||
/// Reset possible changes by modules to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace("done.");
|
||||
}
|
||||
}
|
||||
@@ -127,6 +137,8 @@
|
||||
mtrace('Error: could not update timestamp for '.$block->name);
|
||||
}
|
||||
}
|
||||
/// Reset possible changes by blocks to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
@@ -142,13 +154,26 @@
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
$timenow = time();
|
||||
if ($oldenrolments = get_records_select('role_assignments', "timeend > 0 AND timeend < '$timenow'")) {
|
||||
mtrace(count($oldenrolments).' to delete');
|
||||
foreach ($oldenrolments as $oldenrolment) {
|
||||
if (role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid)) {
|
||||
mtrace("Deleted expired role assignment $oldenrolment->roleid for user $oldenrolment->userid from context $oldenrolment->contextid");
|
||||
}
|
||||
}
|
||||
$somefound = false;
|
||||
// The preferred way saves memory, dmllib.php
|
||||
// find courses where limited enrolment is enabled
|
||||
global $CFG;
|
||||
$rs_enrol = get_recordset_sql("SELECT ra.roleid, ra.userid, ra.contextid
|
||||
FROM {$CFG->prefix}course c
|
||||
INNER JOIN {$CFG->prefix}context cx ON cx.instanceid = c.id
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.contextid = cx.id
|
||||
WHERE cx.contextlevel = '".CONTEXT_COURSE."'
|
||||
AND ra.timeend > 0
|
||||
AND ra.timeend < '$timenow'
|
||||
AND c.enrolperiod > 0
|
||||
");
|
||||
mtrace($rs_enrol->RecordCount().' to delete');
|
||||
while ($oldenrolment = rs_fetch_next_record($rs_enrol)) {
|
||||
role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid);
|
||||
$somefound = true;
|
||||
}
|
||||
rs_close($rs_enrol);
|
||||
if($somefound) {
|
||||
mtrace('Done');
|
||||
} else {
|
||||
mtrace('none found');
|
||||
@@ -339,7 +364,7 @@
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
$timetocheck = strtotime("today $CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
|
||||
@@ -117,6 +117,141 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required">
|
||||
<RESTRICT function="restrict_php50_version" message="php50restricted" />
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_random_check" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_OK message="questioncwqpfsok" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0" requires="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.0" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="qtyperqpwillberemovedanyway" />
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+20
-22
@@ -190,8 +190,9 @@
|
||||
$db->debug = false;
|
||||
if ($status) {
|
||||
//ugly hack - install new groups: MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
require("$CFG->dirroot/group/version.php");
|
||||
set_config('group_version', $group_version);
|
||||
//install_group_db();
|
||||
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
@@ -281,11 +282,16 @@
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
@@ -325,9 +331,10 @@
|
||||
/// If successful, continue upgrading roles and setting everything properly
|
||||
if ($status) {
|
||||
if (empty($CFG->rolesactive)) {
|
||||
//ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
// ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
// require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
// MDL-11062, proper group upgrade code is done in lib/db/upgrade.php
|
||||
// install_group_db();
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
@@ -407,6 +414,9 @@
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check all auth plugins and upgrade if necessary
|
||||
upgrade_plugins('auth','auth',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all course formats and upgrade if necessary
|
||||
upgrade_plugins('format','course/format',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
@@ -488,19 +498,7 @@
|
||||
|
||||
/// Check if the guest user exists. If not, create one.
|
||||
if (! record_exists("user", "username", "guest")) {
|
||||
$guest->auth = "manual";
|
||||
$guest->username = "guest";
|
||||
$guest->password = md5("guest");
|
||||
$guest->firstname = addslashes(get_string("guestuser"));
|
||||
$guest->lastname = " ";
|
||||
$guest->email = "root@localhost";
|
||||
$guest->description = addslashes(get_string("guestuserinfo"));
|
||||
$guest->mnethostid = $CFG->mnet_localhost_id;
|
||||
$guest->confirmed = 1;
|
||||
$guest->lang = $CFG->lang;
|
||||
$guest->timemodified= time();
|
||||
|
||||
if (! $guest->id = insert_record("user", $guest)) {
|
||||
if (! $guest = create_guest_record()) {
|
||||
notify("Could not create guest user record !!!");
|
||||
}
|
||||
}
|
||||
@@ -549,8 +547,8 @@
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_box(get_string('globalsquoteswarning', 'admin'), 'generalbox adminwarning');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_box(get_string('globalswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
@@ -592,7 +590,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>';
|
||||
|
||||
@@ -583,6 +583,9 @@ function lang_fix_value_before_save($value='') {
|
||||
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
}
|
||||
if (ini_get_bool('magic_quotes_sybase')) { // Unescape escaped sybase quotes
|
||||
$value = str_replace("''", "'", $value);
|
||||
}
|
||||
$value = str_replace("'", "\\'", $value); // Add slashes for '
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="← '.get_string('install','admin').'" />';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
@@ -29,7 +29,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
$docname = 'rpclib.php';
|
||||
$relname = '/mod/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
if (file_exists($filename)) include_once $filename;
|
||||
$mnet_publishes = $parentname.'_mnet_publishes';
|
||||
if (function_exists($mnet_publishes)) {
|
||||
(array)$publishes = $mnet_publishes();
|
||||
@@ -38,7 +38,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
// auth or enrol
|
||||
$relname = '/'.$type.'/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
if (file_exists($filename)) include_once $filename;
|
||||
$class = $type.($type=='enrol'? 'ment':'').'_plugin_'.$parentname;
|
||||
if (class_exists($class)) {
|
||||
$object = new $class();
|
||||
|
||||
@@ -46,7 +46,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/// If data submitted, process and store
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (!empty($form->submit) && $form->submit == get_string('savechanges')) {
|
||||
if (in_array($form->mode, array("off", "strict", "promiscuous"))) {
|
||||
if (in_array($form->mode, array("off", "strict", "dangerous"))) {
|
||||
if (set_config('mnet_dispatcher_mode', $form->mode)) {
|
||||
redirect('index.php', get_string('changessaved'));
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,14 @@
|
||||
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
|
||||
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
|
||||
|
||||
if (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
if ($publish != 1 && $subscribe != 1) {
|
||||
if (false == $host2service) {
|
||||
// We don't have or need a record - do nothing!
|
||||
} else {
|
||||
// We don't need the record - delete it
|
||||
delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
|
||||
}
|
||||
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
$host2service = new stdClass();
|
||||
$host2service->hostid = $_POST['hostid'];
|
||||
$host2service->serviceid = $key;
|
||||
|
||||
@@ -76,7 +76,7 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c0">wwwroot:</td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
|
||||
@@ -50,6 +50,11 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (!empty($form->wwwroot)) {
|
||||
// ensure we remove trailing slashes
|
||||
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
|
||||
|
||||
// ensure the wwwroot starts with a http or https prefix
|
||||
if (strtolower(substr($form->wwwroot, 0, 4)) != 'http') {
|
||||
$form->wwwroot = 'http://'.$form->wwwroot;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
// if the config.html contains a hidden form field giving
|
||||
// the module name then the form does not have to prefix all
|
||||
// its variable names, we will do it here.
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
|
||||
+36
-19
@@ -34,29 +34,45 @@
|
||||
|
||||
print_heading($stractivities);
|
||||
|
||||
$coursesaffected = false;
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $hide)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
set_field('course_modules', 'visibleold', '1', 'visible' ,'1', 'module', $module->id); // Remember the previous visible state so we can toggle this back if the module is unhidden.
|
||||
set_field('course_modules', 'visibleold', '0', 'visible' ,'0', 'module', $module->id);
|
||||
set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
// Remember the visibility status in visibleold
|
||||
// and hide...
|
||||
$sql = "UPDATE {$CFG->prefix}course_modules
|
||||
SET visibleold=visible,
|
||||
visible=0
|
||||
WHERE module={$module->id}";
|
||||
execute_sql($sql, false);
|
||||
// clear the course modinfo cache for courses
|
||||
// where we just deleted something
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visibleold=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $show)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold', '1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold',
|
||||
'1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
// clear the course modinfo cache for courses
|
||||
// where we just made something visible
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visible=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
@@ -89,6 +105,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// clear course.modinfo for courses
|
||||
// that used this module...
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
SET modinfo=''
|
||||
WHERE id IN (SELECT DISTINCT course
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
|
||||
// Now delete all the course module records
|
||||
if (!delete_records("course_modules", "module", $module->id)) {
|
||||
notify("Error occurred while deleting all $strmodulename records in course_modules table");
|
||||
@@ -124,20 +149,12 @@
|
||||
// Delete the capabilities that were defined by this module
|
||||
capabilities_cleanup('mod/'.$module->name);
|
||||
|
||||
// rebuild_course_cache(); // Because things have changed
|
||||
$coursesaffected = true;
|
||||
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
notice(get_string("moduledeletefiles", "", $a), "modules.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($coursesaffected) {
|
||||
rebuild_course_cache(); // Because things have changed
|
||||
}
|
||||
|
||||
|
||||
/// Get and sort the existing modules
|
||||
|
||||
if (!$modules = get_records("modules")) {
|
||||
|
||||
@@ -42,7 +42,7 @@ while(@ob_end_flush());
|
||||
|
||||
echo '<strong>Progress:</strong>';
|
||||
$i = 0;
|
||||
$skiptables = array($CFG->prefix.'config');//, $CFG->prefix.'sessions2');
|
||||
$skiptables = array($CFG->prefix.'config', $CFG->prefix.'user_students', $CFG->prefix.'user_teachers');//, $CFG->prefix.'sessions2');
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if (($CFG->prefix && strpos($table, $CFG->prefix) !== 0)
|
||||
@@ -63,12 +63,8 @@ foreach ($tables as $table) {
|
||||
if ($rs and $rs->RecordCount() > 0) {
|
||||
while (!$rs->EOF) {
|
||||
$text = $rs->fields[$column];
|
||||
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
|
||||
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
|
||||
if ($newtext != $text) {
|
||||
$newtext = addslashes($newtext);
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=".$rs->fields['id'], false);
|
||||
}
|
||||
$id = $rs->fields['id'];
|
||||
|
||||
if ($i % 600 == 0) {
|
||||
echo '<br />';
|
||||
}
|
||||
@@ -77,6 +73,22 @@ foreach ($tables as $table) {
|
||||
}
|
||||
$i++;
|
||||
$rs->MoveNext();
|
||||
|
||||
if (empty($text) or is_numeric($text)) {
|
||||
continue; // nothing to do
|
||||
}
|
||||
|
||||
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
|
||||
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
|
||||
|
||||
if (is_null($newtext)) {
|
||||
continue; // regex error
|
||||
}
|
||||
|
||||
if ($newtext != $text) {
|
||||
$newtext = addslashes($newtext);
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($modid == '0') { // special
|
||||
}
|
||||
else {
|
||||
$modname = get_field("modules","name","id",$modid);
|
||||
require_once('mod/'.$modname.'/lib.php');
|
||||
include_once('mod/'.$modname.'/lib.php');
|
||||
}
|
||||
$function = $modname.'_process_email';
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php // $Id$
|
||||
// index.php - scheduled backup logs
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/backup/lib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_setup('reportbackups', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
/// Scheduled backups are disabled by the server admin
|
||||
if (!empty($CFG->disablescheduledbackups)) {
|
||||
print_error('scheduledbackupsdisabled', '', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Scheduled backups aren't active by the site admin
|
||||
$backup_config = backup_get_config();
|
||||
if (empty($backup_config->backup_sche_active)) {
|
||||
notify(get_string('scheduledbackupsinactive'));
|
||||
}
|
||||
|
||||
/// Get needed strings
|
||||
$backuploglaststatus = get_string("backuploglaststatus");
|
||||
$backuplogdetailed = get_string("backuplogdetailed");
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strbackup = get_string("backup");
|
||||
$strbackupdetails = get_string("backupdetails");
|
||||
$strlogs = get_string("logs");
|
||||
$strftimedatetime = get_string("strftimerecent");
|
||||
$strftimetime = get_string("strftimetime").":%S";
|
||||
$strerror = get_string("error");
|
||||
$strok = get_string("ok");
|
||||
$strunfinished = get_string("unfinished");
|
||||
$strskipped = get_string("skipped");
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
$strnext = get_string("next");
|
||||
|
||||
/// Decide when to show last execution logs or detailed logs
|
||||
/// Lastlog view
|
||||
if (!$courseid) {
|
||||
print_heading($backuploglaststatus);
|
||||
print_simple_box_start('center');
|
||||
/// Now, get every record from backup_courses
|
||||
$courses = get_records("backup_courses");
|
||||
|
||||
if (!$courses) {
|
||||
notify(get_string('nologsfound'));
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
//Print table header
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
|
||||
foreach ($courses as $course) {
|
||||
/// Get the course shortname
|
||||
$coursename = get_field ("course","fullname","id",$course->courseid);
|
||||
if ($coursename) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"index.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
|
||||
if ($course->laststatus == 1) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
|
||||
} else if ($course->laststatus == 2) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
|
||||
} else if ($course->laststatus == 3) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
|
||||
} else {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
|
||||
}
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
/// Detailed View !!
|
||||
} else {
|
||||
print_heading($backuplogdetailed);
|
||||
|
||||
$coursename = get_field("course","fullname","id","$courseid");
|
||||
print_heading("$strcourse: $coursename");
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
/// First, me get all the distinct backups for that course in backup_log
|
||||
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid'
|
||||
ORDER BY laststarttime DESC");
|
||||
|
||||
/// Iterate over backup executions
|
||||
if (!$executions) {
|
||||
notify(get_string('nologsfound'));
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
foreach($executions as $execution) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
|
||||
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
$logs = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid' AND
|
||||
laststarttime = '$execution->laststarttime'
|
||||
ORDER BY id");
|
||||
if ($logs) {
|
||||
foreach ($logs as $log) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
|
||||
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
|
||||
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" "," ",$log->info)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
stats_check_uptodate();
|
||||
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/question/upgrade.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportquestion', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading(page_doc_link(get_string('adminreport', 'question')));
|
||||
|
||||
$probstr = '';
|
||||
$contextupgradeversion = 2007081000;
|
||||
if ($CFG->version < $contextupgradeversion){
|
||||
///cwrqpfs issue
|
||||
$probstr = print_heading(get_string('cwrqpfs', 'question'), '', 3, 'main', true);
|
||||
|
||||
if ($updates = question_cwqpfs_to_update()){
|
||||
|
||||
$probstr .=get_string('cwrqpfsinfo', 'question');
|
||||
$probstr .= '<ul>';
|
||||
$catlist = join(array_keys($updates), ',');
|
||||
//get info about cateogries and no of questions used outside category's course
|
||||
$categories = get_records_sql('SELECT qc.*, c.fullname as coursename FROM '.$CFG->prefix.'question_categories as qc, '
|
||||
.$CFG->prefix.'course as c WHERE qc.course = c.id AND qc.id IN ('.$catlist.')');
|
||||
foreach ($updates as $id => $publish){
|
||||
$categories[$id]->caturl = "$CFG->wwwroot/question/category.php?sesskey=".sesskey().
|
||||
"&edit=$id&id=".$categories[$id]->course;
|
||||
if ($categories[$id]->publish){
|
||||
$categories[$id]->changefrom = get_string('published', 'question');
|
||||
$categories[$id]->changeto = get_string('unpublished', 'question');
|
||||
} else {
|
||||
$categories[$id]->changefrom = get_string('unpublished', 'question');
|
||||
$categories[$id]->changeto = get_string('published', 'question');
|
||||
}
|
||||
$probstr .= '<li>'.get_string('changepublishstatuscat', 'question', $categories[$id]);
|
||||
if ($questions = get_records_sql('SELECT q.*, qui.id as quizid, qui.name as quizname, cm.id as cmid, '
|
||||
.'qui.course, c.fullname as coursename FROM '.$CFG->prefix.'question q, '
|
||||
.$CFG->prefix.'quiz_question_instances qqi, '
|
||||
.$CFG->prefix.'quiz qui, '
|
||||
.$CFG->prefix.'course_modules cm, '
|
||||
.$CFG->prefix.'modules m, '
|
||||
.$CFG->prefix.'course c '
|
||||
.'WHERE (q.category = '.$id.' AND qqi.question = q.id '
|
||||
.'AND qqi.quiz = qui.id '
|
||||
.'AND qui.course = c.id '
|
||||
.'AND cm.instance = qui.id '
|
||||
.'AND cm.module = m.id '
|
||||
.'AND m.name = \'quiz\''
|
||||
.'AND ('.$categories[$id]->course.' <> qui.course)) ORDER BY qui.id ASC')){
|
||||
|
||||
$probstr .= '<ul>';
|
||||
foreach ($questions as $question){
|
||||
$question->quizurl = "$CFG->wwwroot/mod/quiz/edit.php?cmid=".$question->cmid;
|
||||
$question->qurl = "$CFG->wwwroot/question/question.php?cmid={$question->cmid}&id={$question->id}&returnurl=".urlencode($FULLME);
|
||||
$probstr .= '<li>'.get_string('questionaffected', 'question', $question).'</li>';
|
||||
}
|
||||
$probstr .= '</ul>';
|
||||
}
|
||||
$probstr .= '</li>';
|
||||
}
|
||||
$probstr .= '</ul>';
|
||||
} else {
|
||||
$probstr .=('<p>'.get_string('cwrqpfsnoprob', 'question').'</p>');
|
||||
}
|
||||
}
|
||||
if ($probstr) {
|
||||
print_box($probstr);
|
||||
} else {
|
||||
print_box(get_string('noprobs', 'question'), 'boxwidthnarrow boxaligncenter generalbox');
|
||||
}
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
+7
-11
@@ -58,13 +58,11 @@
|
||||
<?php
|
||||
$i=0;
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
@@ -74,11 +72,9 @@
|
||||
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
|
||||
} else {
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($contextusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+98
-8
@@ -163,7 +163,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@@ -197,11 +199,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($showall) {
|
||||
$searchtext = '';
|
||||
$previoussearch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
@@ -233,16 +240,99 @@
|
||||
$LIKE = sql_ilike();
|
||||
$FULLNAME = sql_fullname();
|
||||
|
||||
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
$select .= $selectsql;
|
||||
} else {
|
||||
$selectsql = "";
|
||||
}
|
||||
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
WHERE '.$select.'
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?)
|
||||
|
||||
/// In the .html file below we loop through these results and exclude any in $contextusers
|
||||
/************************************************************************
|
||||
* *
|
||||
* context level is above or equal course context level *
|
||||
* in this case we pull out all users matching search criteria (if any) *
|
||||
* *
|
||||
* MDL-11324 *
|
||||
* a mini get_users_by_capability() call here, this is done instead of *
|
||||
* get_users_by_capability() because *
|
||||
* 1) get_users_by_capability() does not deal with searching by name *
|
||||
* 2) exceptions array can be potentially large for large courses *
|
||||
* 3) get_recordset_sql() is more efficient *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
|
||||
|
||||
$doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$validroleids = array();
|
||||
foreach ($possibleroles as $possiblerole) {
|
||||
if (isset($doanythingroles[$possiblerole->id])) { // We don't want these included
|
||||
continue;
|
||||
}
|
||||
if ($caps = role_context_capabilities($possiblerole->id, $context, 'moodle/course:view')) { // resolved list
|
||||
if (isset($caps['moodle/course:view']) && $caps['moodle/course:view'] > 0) { // resolved capability > 0
|
||||
$validroleids[] = $possiblerole->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($validroleids) {
|
||||
$roleids = '('.implode(',', $validroleids).')';
|
||||
|
||||
$select = " SELECT u.id, u.firstname, u.lastname, u.email";
|
||||
$countselect = "SELECT COUNT(u.id)";
|
||||
$from = " FROM {$CFG->prefix}user u
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
INNER JOIN {$CFG->prefix}role r ON r.id = ra.roleid";
|
||||
$where = " WHERE ra.contextid ".get_related_contexts_string($context)."
|
||||
AND u.deleted = 0
|
||||
AND ra.roleid in $roleids";
|
||||
$excsql = " AND u.id NOT IN (
|
||||
SELECT u.id
|
||||
FROM {$CFG->prefix}role_assignments r,
|
||||
{$CFG->prefix}user u
|
||||
WHERE r.contextid = $contextid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = $roleid
|
||||
$selectsql)";
|
||||
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
}
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* context level is above or equal course context level *
|
||||
* in this case we pull out all users matching search criteria (if any) *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/// MDL-11111 do not include user already assigned this role in this context as available users
|
||||
/// so that the number of available users is right and we save time looping later
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
WHERE '.$select.'
|
||||
AND id NOT IN (
|
||||
SELECT u.id
|
||||
FROM '.$CFG->prefix.'role_assignments r,
|
||||
'.$CFG->prefix.'user u
|
||||
WHERE r.contextid = '.$contextid.'
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = '.$roleid.'
|
||||
'.$selectsql.')
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
|
||||
}
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
|
||||
@@ -113,7 +113,8 @@ $contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
// prepare legacy defaults
|
||||
if (!empty($role->legacytype)) {
|
||||
|
||||
@@ -119,9 +119,12 @@
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$rolename = get_field('role', 'name', 'id', $newroleid);
|
||||
add_to_log(SITEID, 'role', 'add', 'admin/roles/manage.php?action=add', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
@@ -228,10 +231,11 @@
|
||||
unassign_capability($lcap, $roleid);
|
||||
}
|
||||
}
|
||||
|
||||
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@@ -342,6 +346,8 @@
|
||||
// dupilcate all the capabilities
|
||||
role_cap_duplicate($sourcerole, $newrole);
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $newrole);
|
||||
add_to_log(SITEID, 'role', 'duplicate', 'admin/roles/manage.php?roleid='.$newrole.'&action=duplicate', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
@@ -352,6 +358,8 @@
|
||||
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
reset_role_capabilities($roleid);
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log(SITEID, 'role', 'reset', 'admin/roles/manage.php?roleid='.$roleid.'&action=reset', $rolename, '', $USER->id);
|
||||
redirect('manage.php?action=view&roleid='.$roleid);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
redirect($baseurl);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// This file defines settingpages and externalpages under the "courses" category
|
||||
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on'));
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
|
||||
|
||||
@@ -17,7 +17,7 @@ $ADMIN->add('courses', $temp);
|
||||
|
||||
|
||||
// "backups" settingpage
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'));
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'),'moodle/site:backup');
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0));
|
||||
|
||||
@@ -5,7 +5,6 @@ $temp = new admin_settingpage('locationsettings', get_string('locationsettings',
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (!empty($pt)) {
|
||||
echo '</td>';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
if (!$ok or !confirm_sesskey()) {
|
||||
$message = '<br /><br />';
|
||||
$message .= $CFG->dataroot.'/temp/olson.txt<br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezones.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezones/">http://download.moodle.org/timezones/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezones.txt">'.$CFG->dirroot.'/lib/timezones.txt</a><br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezone.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezone/">http://download.moodle.org/timezone/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezone.txt">'.$CFG->dirroot.'/lib/timezone.txt</a><br />';
|
||||
$message .= '<br />';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
/// Next, look for a CSV file locally
|
||||
|
||||
$source = $CFG->dataroot.'/temp/timezones.txt';
|
||||
$source = $CFG->dataroot.'/temp/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) {
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -64,17 +64,17 @@
|
||||
|
||||
/// Otherwise, let's try moodle.org's copy
|
||||
|
||||
$source = 'http://download.moodle.org/timezones/';
|
||||
$source = 'http://download.moodle.org/timezone/';
|
||||
if (!$importdone and ini_get('allow_url_fopen')) {
|
||||
if (is_readable($source) && $contents = file_get_contents($source)) { // Grab whole page
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezones.txt', 'w')) { // Make local copy
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezone.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $contents);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezones.txt', 'timezone')) { // Parse it
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezone.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezones.txt');
|
||||
unlink($CFG->dataroot.'/temp/timezone.txt');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
/// Final resort, use the copy included in Moodle
|
||||
|
||||
$source = $CFG->dirroot.'/lib/timezones.txt';
|
||||
$source = $CFG->dirroot.'/lib/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) { // Distribution file
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('upgradesettings', $adminroot); // now hidden page
|
||||
|
||||
|
||||
@@ -104,8 +104,6 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
"maildisplay" => 1,
|
||||
"htmleditor" => 1,
|
||||
"autosubscribe" => 1,
|
||||
"idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"course1" => 1,
|
||||
"course2" => 1,
|
||||
"course3" => 1,
|
||||
@@ -421,4 +419,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+4
-3
@@ -118,8 +118,9 @@
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
// not sure if this is needed. unenrol_student($user->id); // From all courses
|
||||
delete_records('role_assignments', 'userid', $user->id); // unassign all roles
|
||||
// Removing a user may have more requirements than just removing their role assignments.
|
||||
// Use 'role_unassign' to make sure that all necessary actions occur.
|
||||
role_unassign(0, $user->id);
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
} else {
|
||||
@@ -202,7 +203,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere, false);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// This class will compare all the indexes found in the XMLDB definitions
|
||||
/// with the phisical DB implementation, reporting about all the missing
|
||||
/// indexes to be created to be 100% ok.
|
||||
|
||||
class check_indexes extends XMLDBAction {
|
||||
|
||||
/**
|
||||
* Init method, every subclass will have its own
|
||||
*/
|
||||
function init() {
|
||||
parent::init();
|
||||
|
||||
/// Set own core attributes
|
||||
|
||||
/// Set own custom attributes
|
||||
|
||||
/// Get needed strings
|
||||
$this->loadStrings(array(
|
||||
'confirmcheckindexes' => 'xmldb',
|
||||
'ok' => '',
|
||||
'missing' => 'xmldb',
|
||||
'table' => 'xmldb',
|
||||
'key' => 'xmldb',
|
||||
'index' => 'xmldb',
|
||||
'searchresults' => 'xmldb',
|
||||
'missingindexes' => 'xmldb',
|
||||
'completelogbelow' => 'xmldb',
|
||||
'nomissingindexesfound' => 'xmldb',
|
||||
'yesmissingindexesfound' => 'xmldb',
|
||||
'yes' => '',
|
||||
'no' => '',
|
||||
'back' => 'xmldb'
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke method, every class will have its own
|
||||
* returns true/false on completion, setting both
|
||||
* errormsg and output as necessary
|
||||
*/
|
||||
function invoke() {
|
||||
parent::invoke();
|
||||
|
||||
$result = true;
|
||||
|
||||
/// Set own core attributes
|
||||
$this->does_generate = ACTION_GENERATE_HTML;
|
||||
|
||||
/// These are always here
|
||||
global $CFG, $XMLDB;
|
||||
|
||||
/// And we nedd some ddl suff
|
||||
require_once ($CFG->libdir . '/ddllib.php');
|
||||
|
||||
/// Here we'll acummulate all the missing indexes found
|
||||
$missing_indexes = array();
|
||||
|
||||
/// Do the job, setting $result as needed
|
||||
|
||||
/// Get the confirmed to decide what to do
|
||||
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmcheckindexes'] . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=check_indexes&confirmed=yes" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=main_view" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= '</table>';
|
||||
|
||||
$this->output = $o;
|
||||
} else {
|
||||
/// The back to edit table button
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b .= '<a href="index.php">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
|
||||
/// Iterate over $XMLDB->dbdirs, loading their XML data to memory
|
||||
if ($XMLDB->dbdirs) {
|
||||
$dbdirs =& $XMLDB->dbdirs;
|
||||
$o='<ul>';
|
||||
foreach ($dbdirs as $dbdir) {
|
||||
/// Only if the directory exists
|
||||
if (!$dbdir->path_exists) {
|
||||
continue;
|
||||
}
|
||||
/// Load the XML file
|
||||
$xmldb_file = new XMLDBFile($dbdir->path . '/install.xml');
|
||||
/// Load the needed XMLDB generator
|
||||
$classname = 'XMLDB' . $CFG->dbtype;
|
||||
$generator = new $classname();
|
||||
$generator->setPrefix($CFG->prefix);
|
||||
|
||||
/// Only if the file exists
|
||||
if (!$xmldb_file->fileExists()) {
|
||||
continue;
|
||||
}
|
||||
/// Load the XML contents to structure
|
||||
$loaded = $xmldb_file->loadXMLStructure();
|
||||
if (!$loaded || !$xmldb_file->isLoaded()) {
|
||||
notify('Errors found in XMLDB file: '. $dbdir->path . '/install.xml');
|
||||
continue;
|
||||
}
|
||||
/// Arriving here, everything is ok, get the XMLDB structure
|
||||
$structure = $xmldb_file->getStructure();
|
||||
$o.=' <li>' . str_replace($CFG->dirroot . '/', '', $dbdir->path . '/install.xml');
|
||||
/// Getting tables
|
||||
if ($xmldb_tables = $structure->getTables()) {
|
||||
$o.=' <ul>';
|
||||
/// Foreach table, process its indexes and keys
|
||||
foreach ($xmldb_tables as $xmldb_table) {
|
||||
/// Skip table if not exists
|
||||
if (!table_exists($xmldb_table)) {
|
||||
continue;
|
||||
}
|
||||
$o.=' <li>' . $xmldb_table->getName();
|
||||
/// Keys
|
||||
if ($xmldb_keys = $xmldb_table->getKeys()) {
|
||||
$o.=' <ul>';
|
||||
foreach ($xmldb_keys as $xmldb_key) {
|
||||
$o.=' <li>' . $this->str['key'] . ': ' . $xmldb_key->readableInfo() . ' ';
|
||||
/// Primaries are skipped
|
||||
if ($xmldb_key->getType() == XMLDB_KEY_PRIMARY) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font></li>';
|
||||
continue;
|
||||
}
|
||||
/// If we aren't creating the keys or the key is a XMLDB_KEY_FOREIGN (not underlying index generated
|
||||
/// automatically by the RDBMS) create the underlying (created by us) index (if doesn't exists)
|
||||
if (!$generator->getKeySQL($xmldb_table, $xmldb_key) || $xmldb_key->getType() == XMLDB_KEY_FOREIGN) {
|
||||
/// Create the interim index
|
||||
$xmldb_index = new XMLDBIndex('anyname');
|
||||
$xmldb_index->setFields($xmldb_key->getFields());
|
||||
switch ($xmldb_key->getType()) {
|
||||
case XMLDB_KEY_UNIQUE:
|
||||
case XMLDB_KEY_FOREIGN_UNIQUE:
|
||||
$xmldb_index->setUnique(true);
|
||||
break;
|
||||
case XMLDB_KEY_FOREIGN:
|
||||
$xmldb_index->setUnique(false);
|
||||
break;
|
||||
}
|
||||
/// Check if the index exists in DB
|
||||
if (index_exists($xmldb_table, $xmldb_index)) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font>';
|
||||
} else {
|
||||
$o.='<font color="red">' . $this->str['missing'] . '</font>';
|
||||
/// Add the missing index to the list
|
||||
$obj = new object;
|
||||
$obj->table = $xmldb_table;
|
||||
$obj->index = $xmldb_index;
|
||||
$missing_indexes[] = $obj;
|
||||
}
|
||||
}
|
||||
$o.='</li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
/// Indexes
|
||||
if ($xmldb_indexes = $xmldb_table->getIndexes()) {
|
||||
$o.=' <ul>';
|
||||
foreach ($xmldb_indexes as $xmldb_index) {
|
||||
$o.=' <li>' . $this->str['index'] . ': ' . $xmldb_index->readableInfo() . ' ';
|
||||
/// Check if the index exists in DB
|
||||
if (index_exists($xmldb_table, $xmldb_index)) {
|
||||
$o.='<font color="green">' . $this->str['ok'] . '</font>';
|
||||
} else {
|
||||
$o.='<font color="red">' . $this->str['missing'] . '</font>';
|
||||
/// Add the missing index to the list
|
||||
$obj = new object;
|
||||
$obj->table = $xmldb_table;
|
||||
$obj->index = $xmldb_index;
|
||||
$missing_indexes[] = $obj;
|
||||
}
|
||||
$o.='</li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
}
|
||||
$o.=' </ul>';
|
||||
}
|
||||
$o.=' </li>';
|
||||
}
|
||||
$o.='</ul>';
|
||||
}
|
||||
|
||||
/// We have finished, let's show the results of the search
|
||||
$s = '';
|
||||
$r = '<table class="generalbox boxaligncenter boxwidthwide" border="0" cellpadding="5" cellspacing="0" id="results">';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
$r.= ' <h2 class="main">' . $this->str['searchresults'] . '</h2>';
|
||||
$r.= ' <p class="centerpara">' . $this->str['missingindexes'] . ': ' . count($missing_indexes) . '</p>';
|
||||
$r.= ' </td></tr>';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
|
||||
/// If we have found missing indexes inform about them
|
||||
if (count($missing_indexes)) {
|
||||
$r.= ' <p class="centerpara">' . $this->str['yesmissingindexesfound'] . '</p>';
|
||||
$r.= ' <ul>';
|
||||
foreach ($missing_indexes as $obj) {
|
||||
$xmldb_table = $obj->table;
|
||||
$xmldb_index = $obj->index;
|
||||
$sqlarr = $xmldb_table->getAddIndexSQL($CFG->dbtype, $CFG->prefix, $xmldb_index, true);
|
||||
$r.= ' <li>' . $this->str['table'] . ': ' . $xmldb_table->getName() . '. ' .
|
||||
$this->str['index'] . ': ' . $xmldb_index->readableInfo() . '</li>';
|
||||
$s.= '<code>' . str_replace("\n", '<br />', implode('<br />', $sqlarr)) . '</code><br />';
|
||||
|
||||
}
|
||||
$r.= ' </ul>';
|
||||
/// Add the SQL statements (all together)
|
||||
$r.= '<hr />' . $s;
|
||||
} else {
|
||||
$r.= ' <p class="centerpara">' . $this->str['nomissingindexesfound'] . '</p>';
|
||||
}
|
||||
$r.= ' </td></tr>';
|
||||
$r.= ' <tr><td class="generalboxcontent">';
|
||||
/// Add the complete log message
|
||||
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
|
||||
$r.= ' </td></tr>';
|
||||
$r.= '</table>';
|
||||
|
||||
$this->output = $b . $r . $o;
|
||||
}
|
||||
|
||||
/// Launch postaction if exists (leave this here!)
|
||||
if ($this->getPostAction() && $result) {
|
||||
return $this->launch($this->getPostAction());
|
||||
}
|
||||
|
||||
/// Return ok if arrived here
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -130,6 +130,18 @@ class get_db_directories extends XMLDBAction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, course formats (course/format/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('course/format', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/course/format/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, enrolment plugins (enrol/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('enrol', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -141,7 +153,7 @@ class get_db_directories extends XMLDBAction {
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Now, groups
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/group/db';
|
||||
|
||||
@@ -47,7 +47,8 @@ class main_view extends XMLDBAction {
|
||||
'delete' => 'xmldb',
|
||||
'reservedwords' => 'xmldb',
|
||||
'test' => 'xmldb',
|
||||
'gotolastused' => 'xmldb'
|
||||
'gotolastused' => 'xmldb',
|
||||
'checkindexes' => 'xmldb'
|
||||
));
|
||||
}
|
||||
|
||||
@@ -84,6 +85,8 @@ class main_view extends XMLDBAction {
|
||||
$b .= ' <a href="index.php?action=view_reserved_words">[' . $this->str['reservedwords'] . ']</a>';
|
||||
/// The test button
|
||||
$b .= ' <a href="index.php?action=test">[' . $this->str['test'] . ']</a>';
|
||||
/// The check indexes button
|
||||
$b .= ' <a href="index.php?action=check_indexes">[' . $this->str['checkindexes'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
/// Send buttons to output
|
||||
$o .= $b;
|
||||
|
||||
@@ -88,6 +88,7 @@ class new_table extends XMLDBAction {
|
||||
$field->setType(XMLDB_TYPE_INTEGER);
|
||||
$field->setLength(10);
|
||||
$field->setNotNull(true);
|
||||
$field->setUnsigned(true);
|
||||
$field->setSequence(true);
|
||||
$field->setComment('id of the table, please edit me');
|
||||
$field->setLoaded(true);
|
||||
|
||||
@@ -88,7 +88,7 @@ class new_table_from_mysql extends XMLDBAction {
|
||||
$dbtables = $db->MetaTables('TABLES');
|
||||
$selecttables = array();
|
||||
foreach ($dbtables as $dbtable) {
|
||||
$dbtable = str_replace($CFG->prefix, '', $dbtable);
|
||||
$dbtable = strtolower(str_replace($CFG->prefix, '', $dbtable));
|
||||
$i = $structure->findTableInArray($dbtable);
|
||||
if ($i === NULL) {
|
||||
$selecttables[$dbtable] = $dbtable;
|
||||
|
||||
@@ -92,7 +92,7 @@ class test extends XMLDBAction {
|
||||
$table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general');
|
||||
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, '');
|
||||
$table->addFieldInfo('intro', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('logo', XMLDB_TYPE_BINARY, 'big', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('assessed', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('assesstimestart', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
@@ -378,7 +378,22 @@ class test extends XMLDBAction {
|
||||
$tests['change field precision (number)'] = $test;
|
||||
}
|
||||
|
||||
/// 18th test. Change the sign of one numeric field to unsigned
|
||||
/// 18th test. Change the precision of one integer field to a smaller one
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$field = new XMLDBField('course');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
|
||||
$test->sql = $table->getAlterFieldSQL($CFG->dbtype, $CFG->prefix, $field, true);
|
||||
$test->status = change_field_precision($table, $field, false, false);
|
||||
if (!$test->status) {
|
||||
$test->error = $db->ErrorMsg();
|
||||
}
|
||||
$tests['change field precision (integer) to smaller one'] = $test;
|
||||
}
|
||||
|
||||
/// 19th test. Change the sign of one numeric field to unsigned
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -393,7 +408,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (unsigned)'] = $test;
|
||||
}
|
||||
|
||||
/// 19th test. Change the sign of one numeric field to signed
|
||||
/// 20th test. Change the sign of one numeric field to signed
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -408,7 +423,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field sign (signed)'] = $test;
|
||||
}
|
||||
|
||||
/// 20th test. Change the nullability of one char field to not null
|
||||
/// 21th test. Change the nullability of one char field to not null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -423,7 +438,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (not null)'] = $test;
|
||||
}
|
||||
|
||||
/// 21th test. Change the nullability of one char field to null
|
||||
/// 22th test. Change the nullability of one char field to null
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -438,7 +453,7 @@ class test extends XMLDBAction {
|
||||
$tests['change field nullability (null)'] = $test;
|
||||
}
|
||||
|
||||
/// 22th test. Dropping the default of one field
|
||||
/// 23th test. Dropping the default of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -453,7 +468,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 23th test. Creating the default for one field
|
||||
/// 24th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -468,7 +483,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field default of NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 24th test. Creating the default for one field
|
||||
/// 25th test. Creating the default for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -484,7 +499,7 @@ class test extends XMLDBAction {
|
||||
}
|
||||
|
||||
|
||||
/// 25th test. Dropping the default of one NOT NULL field
|
||||
/// 26th test. Dropping the default of one NOT NULL field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -499,7 +514,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop field default of NOT NULL field'] = $test;
|
||||
}
|
||||
|
||||
/// 26th test. Adding one unique index to the table
|
||||
/// 27th test. Adding one unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -514,7 +529,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 27th test. Adding one not unique index to the table
|
||||
/// 28th test. Adding one not unique index to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -529,7 +544,7 @@ class test extends XMLDBAction {
|
||||
$tests['add not unique index'] = $test;
|
||||
}
|
||||
|
||||
/// 28th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
/// 29th test. Re-add the same index than previous test. Check find_index_name() works.
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -548,7 +563,7 @@ class test extends XMLDBAction {
|
||||
$tests['check find_index_name()'] = $test;
|
||||
}
|
||||
|
||||
/// 29th test. Dropping one index from the table
|
||||
/// 30th test. Dropping one index from the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -563,7 +578,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop index'] = $test;
|
||||
}
|
||||
|
||||
/// 30th test. Adding one unique key to the table
|
||||
/// 31th test. Adding one unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -578,7 +593,7 @@ class test extends XMLDBAction {
|
||||
$tests['add unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 31th test. Adding one foreign+unique key to the table
|
||||
/// 32th test. Adding one foreign+unique key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -593,7 +608,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 32th test. Drop one key
|
||||
/// 33th test. Drop one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -608,7 +623,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign+unique key'] = $test;
|
||||
}
|
||||
|
||||
/// 33th test. Adding one foreign key to the table
|
||||
/// 34th test. Adding one foreign key to the table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -623,7 +638,7 @@ class test extends XMLDBAction {
|
||||
$tests['add foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 34th test. Drop one foreign key
|
||||
/// 35th test. Drop one foreign key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -638,7 +653,7 @@ class test extends XMLDBAction {
|
||||
$tests['drop foreign key'] = $test;
|
||||
}
|
||||
|
||||
/// 35th test. Adding one complex enum field
|
||||
/// 36th test. Adding one complex enum field
|
||||
if ($test->status) {
|
||||
/// Create a new field with complex specs (enums are good candidates)
|
||||
$field = new XMLDBField('type');
|
||||
@@ -653,7 +668,7 @@ class test extends XMLDBAction {
|
||||
$tests['add field with enum'] = $test;
|
||||
}
|
||||
|
||||
/// 36th test. Dropping the enum of one field
|
||||
/// 37th test. Dropping the enum of one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -668,7 +683,7 @@ class test extends XMLDBAction {
|
||||
$tests['delete enumlist from one field'] = $test;
|
||||
}
|
||||
|
||||
/// 37th test. Creating the enum for one field
|
||||
/// 38th test. Creating the enum for one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -682,7 +697,7 @@ class test extends XMLDBAction {
|
||||
$tests['add enumlist to one field'] = $test;
|
||||
}
|
||||
|
||||
/// 38th test. Renaming one index
|
||||
/// 39th test. Renaming one index
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -697,7 +712,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename index (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 39th test. Renaming one key
|
||||
/// 40th test. Renaming one key
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
@@ -712,13 +727,13 @@ class test extends XMLDBAction {
|
||||
$tests['rename key (experimental. DO NOT USE IT)'] = $test;
|
||||
}
|
||||
|
||||
/// 40th test. Renaming one field
|
||||
/// 41th test. Renaming one field
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
$field = new XMLDBField('type');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general', 'course');
|
||||
|
||||
|
||||
$test->sql = $table->getRenameFieldSQL($CFG->dbtype, $CFG->prefix, $field, 'newnameforthefield', true);
|
||||
$test->status = rename_field($table, $field, 'newnameforthefield', false, false);
|
||||
if (!$test->status) {
|
||||
@@ -727,11 +742,11 @@ class test extends XMLDBAction {
|
||||
$tests['rename field'] = $test;
|
||||
}
|
||||
|
||||
/// 41th test. Renaming one table
|
||||
/// 42th test. Renaming one table
|
||||
if ($test->status) {
|
||||
/// Get SQL code and execute it
|
||||
$test = new stdClass;
|
||||
|
||||
|
||||
$test->sql = $table->getRenameTableSQL($CFG->dbtype, $CFG->prefix, 'newnameforthetable', true);
|
||||
$test->status = rename_table($table, 'newnameforthetable', false, false);
|
||||
if (!$test->status) {
|
||||
@@ -740,7 +755,7 @@ class test extends XMLDBAction {
|
||||
$tests['rename table'] = $test;
|
||||
}
|
||||
|
||||
/// 42th test. Getting the PK sequence name for one table
|
||||
/// 43th test. Getting the PK sequence name for one table
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$table->setName('newnameforthetable');
|
||||
@@ -755,13 +770,13 @@ class test extends XMLDBAction {
|
||||
$tests['find sequence name'] = $test;
|
||||
}
|
||||
|
||||
/// 43th test. Inserting TEXT contents
|
||||
/// 44th test. Inserting TEXT contents
|
||||
$textlib = textlib_get_instance();
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
$test->sql = array();
|
||||
$basetext = '日本語 • Русский • Deutsch • English • Español • Français • Italiano • Nederlands • Polski • Português • Svenska • العربية • فارسی 한국어 • עברית • ไทย中文 Ελληνικά • Български • Српски • Українська • Bosanski • Català • Česky • Dansk • Eesti • Simple English • Esperanto • Euskara • Galego • Hrvatski • Ido • Bahasa Indonesia • Íslenska • Lëtzebuergesch • Lietuvių • Magyar • Bahasa Melayu اردو • ئۇيغۇرچه • हिन्दी • नेपाल भाषा मराठी • தமிழ் Հայերեն • Беларуская • Чăваш • Ирон æвзаг • Македонски • Сибирской говор • Afrikaans • Aragonés • Arpitan • Asturianu • Kreyòl Ayisyen • Azərbaycan • Bân-lâm-gú • Basa Banyumasan • Brezhoneg • Corsu • Cymraeg • Deitsch • Føroyskt • Frysk • Furlan • Gaeilge • Gàidhlig • Ilokano • Interlingua • Basa Jawa • Kapampangan • Kernewek • Kurdî كوردی • Ladino לאדינו • Latina • Latviešu • Limburgs • Lumbaart • Nedersaksisch • Nouormand • Occitan • O‘zbek • Piemontèis • Plattdüütsch • Ripoarisch • Sámegiella • Scots • Shqip • Sicilianu • Sinugboanon • Srpskohrvatski / Српскохрватски • Basa Sunda • Kiswahili • Tagalog • Tatarça • Walon • Winaray Авар • Башҡорт • Кыргызча Монгол • Қазақша • Тоҷикӣ • Удмурт • Armãneashce • Bamanankan • Eald Englisc • Gaelg • Interlingue • Kaszëbsczi • Kongo • Ligure • Lingála • lojban • Malagasy • Malti • Māori • Nāhuatl • Ekakairũ Naoero • Novial • Pangasinán • Tok Pisin • Romani / रोमानी • Rumantsch • Runa Simi • Sardu • Tetun • Türkmen / تركمن / Туркмен • Vèneto • Volapük • Võro • West-Vlaoms • Wollof • Zazaki • Žemaitėška';
|
||||
$basetext = "\\ ''語 • Русский • Deutsch • English • Español • Français • Italiano • Nederlands • Polski • Português • Svenska • العربية • فارسی 한국어 • עברית • ไทย中文 Ελληνικά • Български • Српски • Українська • Bosanski • Català • Česky • Dansk • Eesti • Simple English • Esperanto • Euskara • Galego • Hrvatski • Ido • Bahasa Indonesia • Íslenska • Lëtzebuergesch • Lietuvių • Magyar • Bahasa Melayu اردو • ئۇيغۇرچه • हिन्दी • नेपाल भाषा मराठी • தமிழ் Հայերեն • Беларуская • Чăваш • Ирон æвзаг • Македонски • Сибирской говор • Afrikaans • Aragonés • Arpitan • Asturianu • Kreyòl Ayisyen • Azərbaycan • Bân-lâm-gú • Basa Banyumasan • Brezhoneg • Corsu • Cymraeg • Deitsch • Føroyskt • Frysk • Furlan • Gaeilge • Gàidhlig • Ilokano • Interlingua • Basa Jawa • Kapampangan • Kernewek • Kurdî كوردی • Ladino לאדינו • Latina • Latviešu • Limburgs • Lumbaart • Nedersaksisch • Nouormand • Occitan • O‘zbek • Piemontèis • Plattdüütsch • Ripoarisch • Sámegiella • Scots • Shqip • Sicilianu • Sinugboanon • Srpskohrvatski / Српскохрватски • Basa Sunda • Kiswahili • Tagalog • Tatarça • Walon • Winaray Авар • Башҡорт • Кыргызча Монгол • Қазақша • Тоҷикӣ • Удмурт • Armãneashce • Bamanankan • Eald Englisc • Gaelg • Interlingue • Kaszëbsczi • Kongo • Ligure • Lingála • lojban • Malagasy • Malti • Māori • Nāhuatl • Ekakairũ Naoero • Novial • Pangasinán • Tok Pisin • Romani / रोमानी • Rumantsch • Runa Simi • Sardu • Tetun • Türkmen / تركمن / Туркмен • Vèneto • Volapük • Võro • West-Vlaoms • Wollof • Zazaki • Žemaitėška";
|
||||
/// Create one big text (1.500.000 chars)
|
||||
$fulltext = '';
|
||||
for ($i=0; $i<1000; $i++) { //1500 * 1000 chars
|
||||
@@ -794,7 +809,7 @@ class test extends XMLDBAction {
|
||||
$tests['insert record '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 44th test. Inserting BINARY contents
|
||||
/// 45th test. Inserting BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -823,7 +838,7 @@ class test extends XMLDBAction {
|
||||
$tests['insert record '. $textlen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 45th test. update_record with TEXT and BINARY contents
|
||||
/// 46th test. update_record with TEXT and BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -863,7 +878,7 @@ class test extends XMLDBAction {
|
||||
$tests['update record '. $textlen . ' cc. (text) and ' . $imglen . ' bytes (binary)'] = $test;
|
||||
}
|
||||
|
||||
/// 46th test. set_field with TEXT contents
|
||||
/// 47th test. set_field with TEXT contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
@@ -893,7 +908,7 @@ class test extends XMLDBAction {
|
||||
$tests['set field '. $textlen . ' cc. (text)'] = $test;
|
||||
}
|
||||
|
||||
/// 47th test. set_field with BINARY contents
|
||||
/// 48th test. set_field with BINARY contents
|
||||
if ($test->status) {
|
||||
$test = new stdClass;
|
||||
$test->status = false;
|
||||
|
||||
+3850
-1284
File diff suppressed because it is too large
Load Diff
+567
-189
@@ -1,190 +1,568 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
* Basic class for PGT database storage
|
||||
*/
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
// the integration into Tikiwiki).
|
||||
if (!class_exists('DB')) {
|
||||
@include_once('DB.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @class PGTStorageDB
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageDB
|
||||
*/
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageDB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_url='';
|
||||
|
||||
/**
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
*
|
||||
* @return a PEAR DB URL
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getURL()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_link = null;
|
||||
|
||||
/**
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
* stored.
|
||||
*
|
||||
* @return a handle of connection.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getLink()
|
||||
{
|
||||
return $this->_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_table = '';
|
||||
|
||||
/**
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
*
|
||||
* @return the name of a table.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "database";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $user the user to access the data with
|
||||
* @param $password the user's password
|
||||
* @param $database_type the type of the database hosting the data
|
||||
* @param $hostname the server hosting the database
|
||||
* @param $port the port the server is listening on
|
||||
* @param $database the name of the database
|
||||
* @param $table the name of the table storing the data
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
|
||||
// try to connect to the database
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
if ( DB::isError($this->_link) ) {
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
}
|
||||
var_dump($this->_link);
|
||||
phpCAS::traceBEnd();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
|
||||
|
||||
* Basic class for PGT database storage
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
|
||||
|
||||
// the integration into Tikiwiki).
|
||||
|
||||
|
||||
if (!class_exists('DB')) {
|
||||
|
||||
|
||||
@include_once('DB.php');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @class PGTStorageDB
|
||||
|
||||
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
|
||||
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @ingroup internalPGTStorageDB
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @addtogroup internalPGTStorageDB
|
||||
|
||||
|
||||
* @{
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_url='';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a PEAR DB URL
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getURL()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_url;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_link = null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
|
||||
|
||||
* stored.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a handle of connection.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getLink()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_link;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
|
||||
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_table = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the name of a table.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getTable()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_table;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving the type of storage
|
||||
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageType()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return "database";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving informations on the
|
||||
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
|
||||
|
||||
* @param $user the user to access the data with
|
||||
|
||||
|
||||
* @param $password the user's password
|
||||
|
||||
|
||||
* @param $database_type the type of the database hosting the data
|
||||
|
||||
|
||||
* @param $hostname the server hosting the database
|
||||
|
||||
|
||||
* @param $port the port the server is listening on
|
||||
|
||||
|
||||
* @param $database the name of the database
|
||||
|
||||
|
||||
* @param $table the name of the table storing the data
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// call the ancestor's constructor
|
||||
|
||||
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
|
||||
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
|
||||
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
|
||||
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
|
||||
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
|
||||
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// INITIALIZATION
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function init()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// if the storage has already been initialized, return immediatly
|
||||
|
||||
|
||||
if ( $this->isInitialized() )
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
// call the ancestor's method (mark as initialized)
|
||||
|
||||
|
||||
parent::init();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// try to connect to the database
|
||||
|
||||
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
|
||||
|
||||
if ( DB::isError($this->_link) ) {
|
||||
|
||||
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var_dump($this->_link);
|
||||
|
||||
|
||||
phpCAS::traceBEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,240 +1,718 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
* Basic class for PGT file storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorageFile
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageFile
|
||||
*/
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageFile
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_path;
|
||||
|
||||
/**
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
* on the filesystem.
|
||||
*
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
*
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getFormat()
|
||||
{
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "file";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
* @param $path the path where the PGT's should be stored
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
// check that the path is an absolute path
|
||||
if ( $path[0] != '/' ) {
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
}
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
$this->_path = $path;
|
||||
|
||||
// check the format and store it
|
||||
switch ($format) {
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
$this->_format = $format;
|
||||
break;
|
||||
default:
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou.
|
||||
*
|
||||
* @return a filename
|
||||
* @private
|
||||
*/
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
|
||||
phpCAS::traceEnd($filename);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
* warning on error.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
} else {
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
* corresponding file.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$pgt = FALSE;
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
} else {
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
// delete the PGT file
|
||||
@unlink($fname);
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
return $pgt;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
|
||||
|
||||
* Basic class for PGT file storage
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @class PGTStorageFile
|
||||
|
||||
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
|
||||
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @ingroup internalPGTStorageFile
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @addtogroup internalPGTStorageFile
|
||||
|
||||
|
||||
* @{
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
|
||||
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_path;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
|
||||
|
||||
* on the filesystem.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getPath()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_path;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
|
||||
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var $_format;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getFormat()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return $this->_format;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving the type of storage
|
||||
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageType()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return "file";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns an informational string giving informations on the
|
||||
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return an informational string.
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
|
||||
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
|
||||
|
||||
* @param $path the path where the PGT's should be stored
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// call the ancestor's constructor
|
||||
|
||||
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
|
||||
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// check that the path is an absolute path
|
||||
|
||||
|
||||
if ( $path[0] != '/' ) {
|
||||
|
||||
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
|
||||
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
|
||||
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
|
||||
|
||||
$this->_path = $path;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// check the format and store it
|
||||
|
||||
|
||||
switch ($format) {
|
||||
|
||||
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
|
||||
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
|
||||
|
||||
$this->_format = $format;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// INITIALIZATION
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function init()
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
// if the storage has already been initialized, return immediatly
|
||||
|
||||
|
||||
if ( $this->isInitialized() )
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
// call the ancestor's method (mark as initialized)
|
||||
|
||||
|
||||
parent::init();
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
// PGT I/O
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return a filename
|
||||
|
||||
|
||||
* @private
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
phpCAS::traceEnd($filename);
|
||||
|
||||
|
||||
return $filename;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
|
||||
|
||||
* warning on error.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt the PGT
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function write($pgt,$pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
|
||||
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
|
||||
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($f);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
|
||||
|
||||
* corresponding file.
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @param $pgt_iou the PGT iou
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
|
||||
|
||||
*
|
||||
|
||||
|
||||
* @public
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function read($pgt_iou)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
|
||||
$pgt = FALSE;
|
||||
|
||||
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
|
||||
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
|
||||
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// delete the PGT file
|
||||
|
||||
|
||||
@unlink($fname);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
|
||||
|
||||
return $pgt;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,188 +1,188 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
* Basic class for PGT storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorage
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorage
|
||||
*/
|
||||
|
||||
class PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorage
|
||||
* @{
|
||||
*/
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
*
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function PGTStorage($cas_parent)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// ERROR HANDLING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
* @deprecated not used.
|
||||
*/
|
||||
var $_error_message=FALSE;
|
||||
|
||||
/**
|
||||
* This method sets en error message, which can be read later by
|
||||
* PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @param $error_message an error message
|
||||
*
|
||||
* @protected
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function setErrorMessage($error_message)
|
||||
{
|
||||
$this->_error_message = $error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an error message set by PGTStorage::setErrorMessage().
|
||||
*
|
||||
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @public
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function getErrorMessage()
|
||||
{
|
||||
return $this->_error_message;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* a boolean telling if the storage has already been initialized. Written by
|
||||
* PGTStorage::init(), read by PGTStorage::isInitialized().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_initialized = FALSE;
|
||||
|
||||
/**
|
||||
* This method tells if the storage has already been intialized.
|
||||
*
|
||||
* @return a boolean
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function isInitialized()
|
||||
{
|
||||
return $this->_initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method initializes the object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->_initialized = TRUE;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method stores a PGT and its corresponding PGT Iuo.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
|
||||
* the corresponding storage entry.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
// include specific PGT storage classes
|
||||
include_once(dirname(__FILE__).'/pgt-file.php');
|
||||
include_once(dirname(__FILE__).'/pgt-db.php');
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
|
||||
* Basic class for PGT storage
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @class PGTStorage
|
||||
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
|
||||
*
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
*
|
||||
|
||||
* @ingroup internalPGTStorage
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class PGTStorage
|
||||
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
* @addtogroup internalPGTStorage
|
||||
|
||||
* @{
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// CONSTRUCTOR
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
|
||||
*
|
||||
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
|
||||
*
|
||||
|
||||
* @protected
|
||||
|
||||
*/
|
||||
|
||||
function PGTStorage($cas_parent)
|
||||
|
||||
{
|
||||
|
||||
phpCAS::traceBegin();
|
||||
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
|
||||
}
|
||||
|
||||
phpCAS::traceEnd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// DEBUGGING
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
|
||||
* used by the object (used for debugging purposes).
|
||||
|
||||
*
|
||||
|
||||
* @public
|
||||
|
||||
*/
|
||||
|
||||
function getStorageType()
|
||||
|
||||
{
|
||||
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
|
||||
*
|
||||
|
||||
* @public
|
||||
|
||||
*/
|
||||
|
||||
function getStorageInfo()
|
||||
|
||||
{
|
||||
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
|
||||
// ERROR HANDLING
|
||||
|
||||
// ########################################################################
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
|
||||
*
|
||||
|
||||
* @hideinitializer
|
||||
|
||||
* @private
|
||||
|
||||
* @deprecated not used.
|
||||
|
||||
*/
|
||||
|
||||
var $_error_message=FALSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This method sets en error message, which can be read later by
|
||||
|
||||
* PGTStorage::getErrorMessage().
|
||||
|
||||
*
|
||||
|
||||
* @param $error_message an error message
|
||||
|
||||
*
|
||||
|
||||
* @protected
|
||||
|
||||
* @deprecated not used.
|
||||
|
||||
*/
|
||||
|
||||
function setErrorMessage($error_message)
|
||||
|
||||
+6232
-2078
File diff suppressed because it is too large
Load Diff
+828
-276
File diff suppressed because it is too large
Load Diff
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'using server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentication wanted!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS logout wanted!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Authentication failed!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/english.php
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'using server',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'CAS Authentication wanted!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'CAS logout wanted!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'CAS Authentication failed!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,28 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'utilisant le serveur',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Déconnexion demandée !',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/english.php
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'utilisant le serveur',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'Déconnexion demandée !',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/german.php
|
||||
* @author Henrik Genssen <hg at mediafactory.de>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'via Server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentifizierung erforderlich!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS Abmeldung!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Anmeldung fehlgeschlagen!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/german.php
|
||||
|
||||
|
||||
* @author Henrik Genssen <hg at mediafactory.de>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> 'via Server',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'CAS Authentifizierung erforderlich!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'CAS Abmeldung!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'CAS Anmeldung fehlgeschlagen!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/greek.php
|
||||
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> '÷ñçóéìïðïéåßôáé ï åîõðçñåôçôÞò',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Áðáéôåßôáé ç ôáõôïðïßçóç CAS!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Áðáéôåßôáé ç áðïóýíäåóç áðü CAS!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Èá Ýðñåðå íá åß÷áôå áíáêáôåõèõíèåß óôïí åîõðçñåôçôÞ CAS. ÊÜíôå êëßê <a href="%s">åäþ</a> ãéá íá óõíå÷ßóåôå.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Ç ôáõôïðïßçóç CAS áðÝôõ÷å!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Äåí ôáõôïðïéçèÞêáôå.</p><p>Ìðïñåßôå íá îáíáðñïóðáèÞóåôå, êÜíïíôáò êëßê <a href="%s">åäþ</a>.</p><p>Åáí ôï ðñüâëçìá åðéìåßíåé, åëÜôå óå åðáöÞ ìå ôïí <a href="mailto:%s">äéá÷åéñéóôÞ</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Ç õðçñåóßá `<b>%s</b>\' äåí åßíáé äéáèÝóéìç (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/greek.php
|
||||
|
||||
|
||||
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
|
||||
=> '÷ñçóéìïðïéåßôáé ï åîõðçñåôçôÞò',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
|
||||
=> 'Áðáéôåßôáé ç ôáõôïðïßçóç CAS!',
|
||||
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
|
||||
=> 'Áðáéôåßôáé ç áðïóýíäåóç áðü CAS!',
|
||||
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
|
||||
=> 'Èá Ýðñåðå íá åß÷áôå áíáêáôåõèõíèåß óôïí åîõðçñåôçôÞ CAS. ÊÜíôå êëßê <a href="%s">åäþ</a> ãéá íá óõíå÷ßóåôå.',
|
||||
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
|
||||
=> 'Ç ôáõôïðïßçóç CAS áðÝôõ÷å!',
|
||||
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
|
||||
=> '<p>Äåí ôáõôïðïéçèÞêáôå.</p><p>Ìðïñåßôå íá îáíáðñïóðáèÞóåôå, êÜíïíôáò êëßê <a href="%s">åäþ</a>.</p><p>Åáí ôï ðñüâëçìá åðéìåßíåé, åëÜôå óå åðáöÞ ìå ôïí <a href="mailto:%s">äéá÷åéñéóôÞ</a>.</p>',
|
||||
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
=> 'Ç õðçñåóßá `<b>%s</b>\' äåí åßíáé äéáèÝóéìç (<b>%s</b>).'
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +1,53 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* @file languages/japanese.php
|
||||
|
||||
* @author fnorif (fnorif@yahoo.co.jp)
|
||||
|
||||
*
|
||||
|
||||
* Now Encoding is EUC-JP and LF
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
$this->_strings = array(
|
||||
|
||||
CAS_STR_USING_SERVER
|
||||
|
||||
=> 'using server',
|
||||
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
|
||||
=> 'CASによる認証を行います',
|
||||
|
||||
CAS_STR_LOGOUT
|
||||
|
||||
=> 'CASからログアウトします!',
|
||||
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
|
||||
=> 'CASサーバに行く必要があります。自動的に転送されない場合は <a href="%s">こちら</a> をクリックして続行します。',
|
||||
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
|
||||
=> 'CASによる認証に失敗しました',
|
||||
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
|
||||
=> '<p>認証できませんでした.</p><p>もう一度リクエストを送信する場合は<a href="%s">こちら</a>をクリック.</p><p>問題が解決しない場合は <a href="mailto:%s">このサイトの管理者</a>に問い合わせてください.</p>',
|
||||
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
|
||||
=> 'サービス `<b>%s</b>\' は利用できません (<b>%s</b>).'
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,24 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/languages.php
|
||||
* Internationalization constants
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* a phpCAS string index
|
||||
*/
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
//@}
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @file languages/languages.php
|
||||
|
||||
|
||||
* Internationalization constants
|
||||
|
||||
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
|
||||
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
|
||||
|
||||
* @ingroup internalLang
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* a phpCAS string index
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
|
||||
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
|
||||
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
|
||||
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
|
||||
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
|
||||
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
|
||||
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+8
-4
@@ -1,4 +1,8 @@
|
||||
CAS-module README
|
||||
|
||||
|
||||
|
||||
CAS-module README
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1126
-1258
File diff suppressed because it is too large
Load Diff
+24
-12
@@ -1,12 +1,24 @@
|
||||
|
||||
<div class="loginbox clearfix">
|
||||
<div class="loginpanel">
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string("accesCAS","auth");?></a>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string("accesNOCAS","auth");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="loginbox clearfix">
|
||||
|
||||
<div class="loginpanel">
|
||||
|
||||
<div>
|
||||
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string("accesCAS","auth");?></a>
|
||||
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string("accesNOCAS","auth");?></a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
+828
-434
File diff suppressed because it is too large
Load Diff
+17
-9
@@ -1,9 +1,17 @@
|
||||
<?PHP
|
||||
// version $Id$
|
||||
// List of CAS langages.
|
||||
// You can add langages in /CAS/langage.
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
$CASLANGUAGES = array (
|
||||
"english" => "English",
|
||||
"french" => "French");
|
||||
?>
|
||||
<?PHP
|
||||
|
||||
// version $Id$
|
||||
|
||||
// List of CAS langages.
|
||||
|
||||
// You can add langages in /CAS/langage.
|
||||
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
|
||||
$CASLANGUAGES = array (
|
||||
|
||||
"english" => "English",
|
||||
|
||||
"french" => "French");
|
||||
|
||||
?>
|
||||
|
||||
+3
-3
@@ -88,7 +88,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
|
||||
$userinfo = array();
|
||||
|
||||
$fpp = new fcFPP($this->config->host, $this->config->port);
|
||||
$fpp = new fcFPP($this->config->host, $this->config->fppport);
|
||||
if ($fpp->open()) {
|
||||
if ($fpp->login($this->config->userid, $this->config->passwd)) {
|
||||
$userinfo['firstname'] = $fpp->getUserInfo($username,"1202");
|
||||
@@ -121,7 +121,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
|
||||
$fcgroups = array();
|
||||
|
||||
$fpp = new fcFPP($this->config->host, $this->config->port);
|
||||
$fpp = new fcFPP($this->config->host, $this->config->fppport);
|
||||
if ($fpp->open()) {
|
||||
if ($fpp->login($this->config->userid, $this->config->passwd)) {
|
||||
$fcgroups = $fpp->getGroups($username);
|
||||
@@ -224,7 +224,7 @@ class auth_plugin_fc extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// save settings
|
||||
set_config('host', $config->user, 'auth/fc');
|
||||
set_config('host', $config->host, 'auth/fc');
|
||||
set_config('fppport', $config->fppport, 'auth/fc');
|
||||
set_config('userid', $config->userid, 'auth/fc');
|
||||
set_config('passwd', $config->passwd, 'auth/fc');
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class fcFPP
|
||||
$conn = fsockopen($host, $port, $errno, $errstr, 5);
|
||||
if (!$conn)
|
||||
{
|
||||
print_error('auth_fcconnfail','auth', array($errno, $errstr));
|
||||
print_error('auth_fcconnfail','auth', '', array($errno, $errstr));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+39
-10
@@ -48,7 +48,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
//hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) { // Can't send empty filter
|
||||
$this->config->objectclass='objectClass=*';
|
||||
} else if (strpos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
} else if (stripos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
$this->config->objectclass = 'objectClass='.$this->config->objectclass;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
else {
|
||||
@ldap_close($ldapconnection);
|
||||
print_error('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
print_error('auth_ldap_noconnect','auth','',$this->config->host_url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$newuser['userpassword'] = $extpassword;
|
||||
break;
|
||||
default:
|
||||
print_error('auth_ldap_unsupportedusertype','auth',$this->config->user_type);
|
||||
print_error('auth_ldap_unsupportedusertype','auth','',$this->config->user_type);
|
||||
}
|
||||
$uadd = ldap_add($ldapconnection, $this->config->user_attribute.'="'.$this->ldap_addslashes($userobject->username).','.$this->config->create_context.'"', $newuser);
|
||||
ldap_close($ldapconnection);
|
||||
@@ -431,7 +431,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
do {
|
||||
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
|
||||
$value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8');
|
||||
array_push($fresult, $value);
|
||||
// usernames are __always__ lowercase.
|
||||
array_push($fresult, moodle_strtolower($value));
|
||||
if (count($fresult) >= $bulk_insert_records) {
|
||||
$this->ldap_bulk_insert($fresult, $temptable);
|
||||
$fresult = array();
|
||||
@@ -694,7 +695,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id);
|
||||
if (empty($user)) { // trouble
|
||||
error_log("Cannot update non-existent user: ".stripslashes($username));
|
||||
print_error('auth_dbusernotexist','auth',$username);
|
||||
print_error('auth_dbusernotexist','auth','',$username);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -834,6 +835,21 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return true; // just change auth and skip update
|
||||
}
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
|
||||
// Before doing anything else, make sure really need to update anything
|
||||
// in the external LDAP server.
|
||||
$update_external = false;
|
||||
foreach ($attrmap as $key => $ldapkeys) {
|
||||
if (!empty($this->config->{'field_updateremote_'.$key})) {
|
||||
$update_external = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$update_external) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$extoldusername = $textlib->convert($olduser->username, 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
@@ -841,7 +857,6 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$search_attribs = array();
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
foreach ($attrmap as $key => $values) {
|
||||
if (!is_array($values)) {
|
||||
$values = array($values);
|
||||
@@ -862,9 +877,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$user_entry = $this->ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (empty($user_entry)) {
|
||||
$error = 'ldap: Could not find user while updating externally. '.
|
||||
'Details follow: search base: \''.$user_dn.'\'; search filter: \''.
|
||||
$this->config->objectclass.'\'; search attributes: ';
|
||||
foreach ($search_attribs as $attrib) {
|
||||
$error .= $attrib.' ';
|
||||
}
|
||||
error_log($error);
|
||||
return false; // old user not found!
|
||||
} else if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
error_log('ldap: Strange! More than one user record found in ldap. Only using the first one.');
|
||||
return false;
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -1216,7 +1238,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$sec=substr($time,12,2);
|
||||
$result = mktime($hr,$min,$sec,$mo,$dt,$yr);
|
||||
break;
|
||||
case 'posix':
|
||||
case 'rfc2307':
|
||||
case 'rfc2307bis':
|
||||
$result = $time * DAYSECS; //The shadowExpire contains the number of DAYS between 01/01/1970 and the actual expiration date
|
||||
break;
|
||||
case 'ad':
|
||||
@@ -1239,7 +1262,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
case 'edir':
|
||||
$result=date('YmdHis', $time).'Z';
|
||||
break;
|
||||
case 'posix':
|
||||
case 'rfc2307':
|
||||
case 'rfc2307bis':
|
||||
$result = $time ; //Already in correct format
|
||||
break;
|
||||
default:
|
||||
@@ -1338,6 +1362,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $this->config->version);
|
||||
}
|
||||
|
||||
// Fix MDL-10921
|
||||
if ($this->config->user_type == 'ad') {
|
||||
ldap_set_option($connresult, LDAP_OPT_REFERRALS, 0);
|
||||
}
|
||||
|
||||
if (!empty($binddn)) {
|
||||
//bind with search-user
|
||||
//$debuginfo .= 'Using bind user'.$binddn.'and password:'.$bindpwd;
|
||||
@@ -1360,7 +1389,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
//If any of servers are alive we have already returned connection
|
||||
print_error('auth_ldap_noconnect_all','auth',$this->config->user_type);
|
||||
print_error('auth_ldap_noconnect_all','auth', '', $debuginfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php // $Id$
|
||||
|
||||
/**
|
||||
* @author Martin Dougiamas
|
||||
@@ -89,7 +89,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// session okay, try getting the user
|
||||
if (!$user = get_complete_user_data('id', $mnet_session->userid)) {
|
||||
if (!$user = get_record('user', 'id', $mnet_session->userid)) {
|
||||
echo mnet_server_fault(3, get_string('authfail_usermismatch', 'mnet'));
|
||||
exit;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$userdata['session.gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
|
||||
$userdata['picture'] = $user->picture;
|
||||
if (!empty($user->picture)) {
|
||||
$imagefile = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$imagefile = make_user_directory($user->id, true) . "/f1.jpg";
|
||||
if (file_exists($imagefile)) {
|
||||
$userdata['imagehash'] = sha1(file_get_contents($imagefile));
|
||||
}
|
||||
@@ -285,11 +285,11 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$firsttime = false;
|
||||
|
||||
// get the local record for the remote user
|
||||
$localuser = get_record('user', 'username', $remoteuser->username, 'mnethostid', $remotehost->id);
|
||||
$localuser = get_record('user', 'username', addslashes($remoteuser->username), 'mnethostid', $remotehost->id);
|
||||
|
||||
// add the remote user to the database if necessary, and if allowed
|
||||
// TODO: refactor into a separate function
|
||||
if (! $localuser->id) {
|
||||
if (empty($localuser) || ! $localuser->id) {
|
||||
if (empty($this->config->auto_add_remote_users)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// TODO: fetch image if it has changed
|
||||
if ($key == 'imagehash') {
|
||||
$dirname = "{$CFG->dataroot}/users/{$localuser->id}";
|
||||
$dirname = make_user_directory($localuser->id, true);
|
||||
$filename = "$dirname/f1.jpg";
|
||||
|
||||
$localhash = '';
|
||||
@@ -1262,8 +1262,8 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG;
|
||||
|
||||
if ($user = get_record('user', 'username', addslashes($username), 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
$filename1 = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$filename2 = "{$CFG->dataroot}/users/{$user->id}/f2.jpg";
|
||||
$filename1 = make_user_directory($user->id, true) . "/f1.jpg";
|
||||
$filename2 = make_user_directory($user->id, true) . "/f2.jpg";
|
||||
$return = array();
|
||||
if (file_exists($filename1)) {
|
||||
$return['f1'] = base64_encode(file_get_contents($filename1));
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class auth_plugin_pam extends auth_plugin_base {
|
||||
|
||||
// call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth
|
||||
//if (pam_auth($username, $password, &$errormessage)) {
|
||||
if (pam_auth(stripslashes($username), strislashes($password))) {
|
||||
if (pam_auth(stripslashes($username), stripslashes($password))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -16,6 +16,8 @@ Changes:
|
||||
Added instructions for IIS
|
||||
- 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+
|
||||
- 03. 2007: Adapted authentication method to Moodle 1.8
|
||||
- 10. 2007: Removed the requirement for email address, surname and given name
|
||||
attributes on request of Markus Hagman
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* 2006-08-28 File created, code imported from lib.php
|
||||
* 2006-10-27 Upstream 1.7 changes merged in, added above credits from lib.php :-)
|
||||
* 2007-03-09 Fixed authentication but may need some other changes
|
||||
* 2007-10-03 Removed requirement for email address, surname and given name on request of Markus Hagman
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
@@ -51,7 +52,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
// If we are in the shibboleth directory then we trust the server var
|
||||
if (!empty($_SERVER[$this->config->user_attribute])) {
|
||||
return ($_SERVER[$this->config->user_attribute] == $username);
|
||||
return (strtolower($_SERVER[$this->config->user_attribute]) == strtolower($username));
|
||||
} else {
|
||||
// If we are not, the user has used the manual login and the login name is
|
||||
// unknown, so we return false.
|
||||
@@ -72,12 +73,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
global $CFG;
|
||||
|
||||
// Check whether we have got all the essential attributes
|
||||
if (
|
||||
empty($_SERVER[$this->config->user_attribute])
|
||||
|| empty($_SERVER[$this->config->field_map_firstname])
|
||||
|| empty($_SERVER[$this->config->field_map_lastname])
|
||||
|| empty($_SERVER[$this->config->field_map_email])
|
||||
) {
|
||||
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]."')"));
|
||||
}
|
||||
|
||||
@@ -87,7 +83,18 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
$search_attribs = array();
|
||||
|
||||
foreach ($attrmap as $key=>$value) {
|
||||
$result[$key] = $this->get_first_string($_SERVER[$value]);
|
||||
// Check if attribute is present
|
||||
if (!isset($_SERVER[$value])){
|
||||
$result[$key] = '';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make usename lowercase
|
||||
if ($key == 'username'){
|
||||
$result[$key] = strtolower($this->get_first_string($_SERVER[$value]));
|
||||
} else {
|
||||
$result[$key] = $this->get_first_string($_SERVER[$value]);
|
||||
}
|
||||
}
|
||||
|
||||
// Provide an API to modify the information to fit the Moodle internal
|
||||
@@ -118,7 +125,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
$moodleattributes = array();
|
||||
foreach ($fields as $field) {
|
||||
if ($configarray["field_map_$field"]) {
|
||||
if (isset($configarray["field_map_$field"])) {
|
||||
$moodleattributes[$field] = $configarray["field_map_$field"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/// If we can find the Shibboleth attribute, save it in session and return to main login page
|
||||
if (!empty($_SERVER[$pluginconfig->user_attribute])) { // Shibboleth auto-login
|
||||
$frm->username = $_SERVER[$pluginconfig->user_attribute];
|
||||
$frm->username = strtolower($_SERVER[$pluginconfig->user_attribute]);
|
||||
$frm->password = substr(base64_encode($_SERVER[$pluginconfig->user_attribute]),0,8);
|
||||
// The random password consists of the first 8 letters of the base 64 encoded user ID
|
||||
// This password is never used unless the user account is converted to manual
|
||||
|
||||
+2
-1
@@ -14,13 +14,14 @@
|
||||
$cancel = optional_param( 'cancel' );
|
||||
$launch = optional_param( 'launch' );
|
||||
|
||||
require_login();
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
require_login();
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
|
||||
@@ -58,29 +58,56 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
|
||||
//inform the user.
|
||||
// TODO: Move this logic to one function to be shared by any (manual, scheduled) backup
|
||||
if ($backupprefs->backup_users == 2) {
|
||||
if ($allmods = get_records("modules") ) {
|
||||
if ($allmods = get_records('modules') ) {
|
||||
foreach ($allmods as $mod) {
|
||||
/// Reset global user_info settings to "no" (0)
|
||||
$modname = $mod->name;
|
||||
$var = "backup_user_info_".$modname;
|
||||
$var = 'backup_user_info_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
$var = "backup_".$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
if ($modname == "exercise" || $modname == "workshop") {
|
||||
/// Reset each instance userinfo settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module userinfo to no (0)
|
||||
$backupprefs->mods[$modname]->userinfo = 0;
|
||||
/// Set the instances to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->userinfo = 0;
|
||||
$var = 'backup_user_info_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
/// If modules are workshop or exercise, disable their backup completely
|
||||
if ($modname == 'exercise' || $modname == 'workshop') {
|
||||
$var = 'backup_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
/// Reset each instance backup settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module backup to no (0)
|
||||
$backupprefs->mods[$modname]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instances';
|
||||
$backupprefs->$var = 0;
|
||||
/// Set the instances backup to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
}
|
||||
|
||||
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
|
||||
echo "<hr />";
|
||||
}
|
||||
|
||||
+14
-8
@@ -115,6 +115,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
<form id="form1" method="post" action="backup.php">
|
||||
<table cellpadding="5" style="margin-left:auto;margin-right:auto;">
|
||||
<?php
|
||||
/// Acummulator for hidden options and proper XHTML output
|
||||
$hidden_options = '';
|
||||
//Now, check modules and info and show posibilities
|
||||
if ($allmods = get_records("modules") ) {
|
||||
//Print option to select/deselect everything with 1 click.
|
||||
@@ -189,8 +191,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
}
|
||||
//Line
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>\n";
|
||||
|
||||
if (empty($to)) {
|
||||
|
||||
if (empty($to) && !empty($course->metacourse)) {
|
||||
//Now print the Metacourse tr
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\" colspan=\"2\"><b>";
|
||||
@@ -202,7 +204,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_metacourse" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_metacourse" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -218,7 +220,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_users" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_users" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -233,7 +235,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_logs" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_logs" value="0" />';
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
@@ -248,7 +250,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_user_files" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_user_files" value="0" />';
|
||||
}
|
||||
//Now print the Course Files tr
|
||||
echo "<tr>";
|
||||
@@ -272,7 +274,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" name="backup_messages" value="0" />';
|
||||
$hidden_options .= '<input type="hidden" name="backup_messages" value="0" />';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +320,10 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
//the temp-directory name and records in backup temp tables
|
||||
?>
|
||||
</table>
|
||||
<?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) ?>" />
|
||||
@@ -328,4 +334,4 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
<input type="submit" value="<?php print_string("continue") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
+33
-13
@@ -177,7 +177,7 @@ function schedule_backup_cron() {
|
||||
//Reference
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$message .= " ".get_string('backupfailed')."\n\n";
|
||||
$dest_url = $CFG->wwwroot.'/backup/log.php';
|
||||
$dest_url = $CFG->wwwroot.'/admin/report/backups/index.php';
|
||||
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
|
||||
//Set message priority
|
||||
$admin->priority = 1;
|
||||
@@ -192,7 +192,7 @@ function schedule_backup_cron() {
|
||||
$prefix = $site->shortname.": ";
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$prefix .= "[".strtoupper(get_string('error'))."] ";
|
||||
}
|
||||
}
|
||||
$subject = $prefix.get_string("scheduledbackupstatus");
|
||||
|
||||
//Send the message
|
||||
@@ -387,7 +387,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (!isset($$var)) {
|
||||
@@ -401,6 +401,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now set instances
|
||||
if ($coursemods = get_course_mods($course->id)) {
|
||||
foreach ($coursemods as $mod) {
|
||||
@@ -415,8 +416,15 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally, clean all the $preferences->mods[] not having instances. Nothing to backup about them
|
||||
foreach ($preferences->mods as $modname => $mod) {
|
||||
if (!isset($mod->instances)) {
|
||||
unset($preferences->mods[$modname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Convert other parameters
|
||||
if ($status) {
|
||||
$preferences->backup_metacourse = $backup_config->backup_sche_metacourse;
|
||||
@@ -429,7 +437,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$preferences->backup_destination = $backup_config->backup_sche_destination;
|
||||
$preferences->backup_keep = $backup_config->backup_sche_keep;
|
||||
}
|
||||
|
||||
|
||||
//Calculate the backup string
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating backup name");
|
||||
@@ -474,7 +482,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$keep_name .= moodle_strtolower($backup_shortname)."-";
|
||||
//And finally, clean everything
|
||||
$keep_name = clean_filename($keep_name);
|
||||
|
||||
|
||||
$preferences->backup_name = $backup_name;
|
||||
$preferences->keep_name = $keep_name;
|
||||
}
|
||||
@@ -643,10 +651,10 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," categories & questions");
|
||||
$status = backup_question_categories($backup_file,$preferences);
|
||||
}
|
||||
|
||||
|
||||
//Print logs if selected
|
||||
if ($status) {
|
||||
if ($preferences->backup_logs) {
|
||||
if ($preferences->backup_logs) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," logs");
|
||||
$status = backup_log_info($backup_file,$preferences);
|
||||
}
|
||||
@@ -657,7 +665,13 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," scales");
|
||||
$status = backup_scales_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
|
||||
//Print groupings info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groupings");
|
||||
$status = backup_groupings_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print groups info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groups");
|
||||
@@ -682,9 +696,9 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
$mods_to_backup = false;
|
||||
//Check if we have any mod to backup
|
||||
foreach ($preferences->mods as $module) {
|
||||
if ($module->backup) {
|
||||
if ($module->backup) {
|
||||
$mods_to_backup = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//If we have to backup some module
|
||||
if ($mods_to_backup) {
|
||||
@@ -703,7 +717,13 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
//Backup course format data, if any.
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," course format data");
|
||||
$status = backup_format_data($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
if ($status) {
|
||||
$status = backup_course_end($backup_file,$preferences);
|
||||
}
|
||||
@@ -713,7 +733,7 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
backup_close_xml($backup_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Now, if selected, copy user files
|
||||
if ($status) {
|
||||
if ($preferences->backup_user_files) {
|
||||
|
||||
+129
-188
@@ -2,82 +2,78 @@
|
||||
//This file contains all the function needed in the backup utility
|
||||
//except the mod-related funtions that are into every backuplib.php inside
|
||||
//every mod directory
|
||||
|
||||
//Calculate the number of users to backup and put their ids in backup_ids
|
||||
//Return an array of info (name,value)
|
||||
function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
//$backup_users=0-->all
|
||||
// 1-->course (needed + enrolled)
|
||||
// 2-->none
|
||||
|
||||
global $CFG;
|
||||
global $db;
|
||||
/**
|
||||
* This function calculates the users to be added to backup based in the
|
||||
* settings defined at backup. All the resulting user ids are sent to
|
||||
* backup_ids for later usage.
|
||||
* @param int $courseid id of the course to backup
|
||||
* @param int $backup_unique_code unique code of the backup being executed
|
||||
* @param int $backup_unique_code setting specifying what users to export (0=all, 1=needed, 2=none)
|
||||
* @param int $backup_messages flag (true/false) defining if messages must be
|
||||
* considered to extract needed users
|
||||
* @return array one array (key, value) sumarizing the result of the function (number of users)
|
||||
*/
|
||||
function user_check_backup($courseid,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$count_users = 0;
|
||||
$backupable_users = array();
|
||||
|
||||
//If we've selected none, simply return 0
|
||||
if ($backup_users == 0 or $backup_users == 1) {
|
||||
|
||||
//Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($course, $backup_messages);
|
||||
if ($backup_users == 0) { /// All users
|
||||
$backupable_users = backup_get_all_users();
|
||||
|
||||
//Calculate enrolled users (students + teachers)
|
||||
$enrolled_users = backup_get_enrolled_users($course);
|
||||
} else if ($backup_users == 1) { /// Needed users
|
||||
|
||||
//Calculate all users (every record in users table)
|
||||
$all_users = backup_get_all_users();
|
||||
/// Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($courseid, $backup_messages);
|
||||
|
||||
//Calculate course users (needed + enrolled)
|
||||
//First, needed
|
||||
$course_users = $needed_users;
|
||||
|
||||
//Now, enrolled
|
||||
/// Calculate enrolled users (having course:view cap)
|
||||
$enrolled_users = backup_get_enrolled_users($courseid);
|
||||
|
||||
/// Calculate backupable users (needed + enrolled)
|
||||
/// First, needed
|
||||
$backupable_users = $needed_users;
|
||||
|
||||
/// Now, enrolled
|
||||
if ($enrolled_users) {
|
||||
foreach ($enrolled_users as $enrolled_user) {
|
||||
$course_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
$backupable_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
}
|
||||
}
|
||||
|
||||
//Now, depending of parameters, create $backupable_users
|
||||
if ($backup_users == 0) {
|
||||
$backupable_users = $all_users;
|
||||
} else {
|
||||
$backupable_users = $course_users;
|
||||
}
|
||||
|
||||
//If we have backupable users
|
||||
if ($backupable_users) {
|
||||
//Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
//Is needed user (exists in needed_users)
|
||||
if (isset($needed_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} else if (isset($course_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} // Yu: also needed because they can view course
|
||||
// might need another variable
|
||||
|
||||
//Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
//Insert the record id. backup_users decide it.
|
||||
//When all users
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
//Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
}
|
||||
|
||||
//Prepare Info
|
||||
//Gets the user data
|
||||
/// If we have backupable users
|
||||
if ($backupable_users) {
|
||||
/// Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
/// Is needed user or enrolled user, mark it as needed
|
||||
if (isset($needed_users[$backupable_user->id]) || isset($enrolled_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} /// Yu: also needed because they can view course
|
||||
/// might need another variable
|
||||
|
||||
/// Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
/// TODO: Change this call inserting to a standard backup_putid() call
|
||||
/// And read data acordingly with backup_getid() when needed.
|
||||
/// TODO: Also analyse it the "needed" info is really needed for anything. Drop if not.
|
||||
/// Insert the user to the backup_ids table. backup_user_info() will use that info
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
/// Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
|
||||
/// Prepare Info
|
||||
/// Gets the user data
|
||||
$info[0][0] = get_string("users");
|
||||
$info[0][1] = $count_users;
|
||||
|
||||
@@ -313,7 +309,7 @@
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$backup_unique_code."/user_files",true);
|
||||
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$backup_unique_code."/user_files",true);
|
||||
|
||||
return $status;
|
||||
}
|
||||
@@ -634,7 +630,6 @@
|
||||
fwrite ($bf,full_tag("STUDENTS",3,false,$course->students));
|
||||
fwrite ($bf,full_tag("GUEST",3,false,$course->guest));
|
||||
fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate));
|
||||
fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod));
|
||||
fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections));
|
||||
//fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent)); INFO: This is out in 1.3
|
||||
fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes));
|
||||
@@ -657,11 +652,18 @@
|
||||
} else {
|
||||
$status = fwrite ($bf,full_tag("METACOURSE",3,false,$course->metacourse));
|
||||
}
|
||||
fwrite ($bf,full_tag("EXPIRENOTIFY",3,false,$course->expirynotify));
|
||||
fwrite ($bf,full_tag("NOTIFYSTUDENTS",3,false,$course->notifystudents));
|
||||
fwrite ($bf,full_tag("EXPIRYTHRESHOLD",3,false,$course->expirythreshold));
|
||||
fwrite ($bf,full_tag("ENROLLABLE",3,false,$course->enrollable));
|
||||
fwrite ($bf,full_tag("ENROLSTARTDATE",3,false,$course->enrolstartdate));
|
||||
fwrite ($bf,full_tag("ENROLENDDATE",3,false,$course->enrolenddate));
|
||||
fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod));
|
||||
|
||||
/// write local course overrides here?
|
||||
write_role_overrides_xml($bf, $context, 3);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 3);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 3);
|
||||
//Print header end
|
||||
fwrite ($bf,end_tag("HEADER",2,true));
|
||||
} else {
|
||||
@@ -912,7 +914,7 @@
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End Block
|
||||
fwrite ($bf,end_tag('BLOCK',3,true));
|
||||
}
|
||||
@@ -1048,9 +1050,9 @@
|
||||
// get all the role_capabilities overrides in this mod
|
||||
write_role_overrides_xml($bf, $context, 6);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 6);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 6);
|
||||
/// write role_assign code here
|
||||
|
||||
|
||||
fwrite ($bf,end_tag("MOD",5,true));
|
||||
}
|
||||
//check for next
|
||||
@@ -1145,26 +1147,10 @@
|
||||
/// write assign/override code for context_userid
|
||||
|
||||
$user->isneeded = strpos($user->info,"needed");
|
||||
//Output every user role (with its associated info)
|
||||
/*
|
||||
$user->isadmin = strpos($user->info,"admin");
|
||||
$user->iscoursecreator = strpos($user->info,"coursecreator");
|
||||
$user->isteacher = strpos($user->info,"teacher");
|
||||
$user->isstudent = strpos($user->info,"student");
|
||||
|
||||
|
||||
if ($user->isadmin!==false or
|
||||
$user->iscoursecreator!==false or
|
||||
$user->isteacher!==false or
|
||||
$user->isstudent!==false or
|
||||
$user->isneeded!==false) {
|
||||
*/
|
||||
|
||||
fwrite ($bf,start_tag("ROLES",4,true));
|
||||
if ($user->info != "needed" && $user->info!="") {
|
||||
//Begin ROLES tag
|
||||
|
||||
//PRINT ROLE INFO
|
||||
//Admins
|
||||
$roles = explode(",", $user->info);
|
||||
foreach ($roles as $role) {
|
||||
if ($role!="" && $role!="needed") {
|
||||
@@ -1172,66 +1158,10 @@
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,$role));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if ($user->isadmin!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"admin"));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//CourseCreator
|
||||
if ($user->iscoursecreator!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"coursecreator"));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//Teacher
|
||||
if ($user->isteacher!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"teacher"));
|
||||
//Get specific info for teachers
|
||||
$tea = get_record("user_teachers","userid",$user->old_id,"course",$preferences->backup_course);
|
||||
fwrite ($bf,full_tag("AUTHORITY",6,false,$tea->authority));
|
||||
fwrite ($bf,full_tag("TEA_ROLE",6,false,$tea->role));
|
||||
fwrite ($bf,full_tag("EDITALL",6,false,$tea->editall));
|
||||
fwrite ($bf,full_tag("TIMESTART",6,false,$tea->timestart));
|
||||
fwrite ($bf,full_tag("TIMEEND",6,false,$tea->timeend));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
|
||||
fwrite ($bf,full_tag("ENROL",6,false,$tea->enrol));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}
|
||||
//Student
|
||||
if ($user->isstudent!==false) {
|
||||
//Print ROLE start
|
||||
fwrite ($bf,start_tag("ROLE",5,true));
|
||||
//Print Role info
|
||||
fwrite ($bf,full_tag("TYPE",6,false,"student"));
|
||||
//Get specific info for students
|
||||
$stu = get_record("user_students","userid",$user->old_id,"course",$preferences->backup_course);
|
||||
fwrite ($bf,full_tag("TIMESTART",6,false,$stu->timestart));
|
||||
fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
|
||||
fwrite ($bf,full_tag("TIME",6,false,$stu->time));
|
||||
fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
|
||||
fwrite ($bf,full_tag("ENROL",6,false,$stu->enrol));
|
||||
//Print ROLE end
|
||||
fwrite ($bf,end_tag("ROLE",5,true));
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
//Needed
|
||||
if ($user->isneeded!==false) {
|
||||
//Print ROLE start
|
||||
@@ -1264,7 +1194,7 @@
|
||||
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End User tag
|
||||
fwrite ($bf,end_tag("USER",3,true));
|
||||
//Do some output
|
||||
@@ -1692,9 +1622,14 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get groups_members
|
||||
$groups_members = groups_get_member_records($groupid);
|
||||
|
||||
//Get groups_members that are being included in backup
|
||||
$groups_members = get_records_sql("SELECT gm.*
|
||||
FROM {$CFG->prefix}groups_members gm,
|
||||
{$CFG->prefix}backup_ids bi
|
||||
WHERE gm.groupid = $groupid
|
||||
AND bi.backup_code = $preferences->backup_unique_code
|
||||
AND bi.table_name = 'user'");
|
||||
|
||||
//Pring groups_members header
|
||||
if ($groups_members) {
|
||||
//Pring groups_members header
|
||||
@@ -1905,26 +1840,29 @@
|
||||
//in temp/backup/$backup_code dir
|
||||
$status = check_and_create_user_files_dir($preferences->backup_unique_code);
|
||||
|
||||
//Now iterate over directories under "users" to check if that user must be
|
||||
//copied to backup
|
||||
//Now iterate over directories under "user" to check if that user must be copied to backup
|
||||
|
||||
// Method to get a list of userid=>array(basedir => $basedir, userfolder => $userfolder)
|
||||
$userlist = get_user_directories();
|
||||
|
||||
$rootdir = $CFG->dataroot."/users";
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$preferences->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/user_files/".$dir);
|
||||
}
|
||||
foreach ($userlist as $userid => $userinfo) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = count_records("backup_ids","backup_code",$preferences->backup_unique_code, "table_name","user", "old_id",$userid);
|
||||
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$parts = explode('/', $userinfo['userfolder']);
|
||||
$status = true;
|
||||
|
||||
if (is_array($parts)) {
|
||||
$group = $parts[0];
|
||||
$userid = $parts[1];
|
||||
|
||||
// Create group dir first
|
||||
$status = check_dir_exists("$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/". $group, true);
|
||||
}
|
||||
$status = $status && backup_copy_file($userinfo['basedir'] . '/' . $userinfo['userfolder'],
|
||||
"$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/{$userinfo['userfolder']}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2294,40 +2232,43 @@
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_OVERRIDES", $startlevel, true));
|
||||
}
|
||||
|
||||
|
||||
/* function to print xml for assignment */
|
||||
function write_role_assignments_xml($bf, $context, $startlevel) {
|
||||
function write_role_assignments_xml($bf, $preferences, $context, $startlevel) {
|
||||
/// write role_assign code here
|
||||
fwrite ($bf, start_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
|
||||
|
||||
if ($roles = get_roles_with_assignment_on_context($context)) {
|
||||
foreach ($roles as $role) {
|
||||
foreach ($roles as $role) {
|
||||
fwrite ($bf, start_tag("ROLE", $startlevel+1, true));
|
||||
fwrite ($bf, full_tag("ID", $startlevel+2, false, $role->id));
|
||||
fwrite ($bf, full_tag("NAME", $startlevel+2, false, $role->name));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, start_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
if ($assignments = get_users_from_role_on_context($role, $context)) {
|
||||
foreach ($assignments as $assignment) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
/// Role assignments are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $assignment->userid)) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
while($filename = readdir($opendirectory)) {
|
||||
while(false !== ($filename = readdir($opendirectory))) {
|
||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||
$subdirs[] = $filename;
|
||||
}
|
||||
|
||||
+6
-6
@@ -119,7 +119,7 @@
|
||||
}
|
||||
|
||||
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
|
||||
while($entry = readdir($handle)) {
|
||||
while(false !== ($entry = readdir($handle))) {
|
||||
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
|
||||
$dir_subdirs[] = $dir. $slash .$entry;
|
||||
}
|
||||
@@ -143,7 +143,7 @@
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (rmdir($dir_subdirs[$i]) == FALSE) {
|
||||
if (remove_dir($dir_subdirs[$i]) == FALSE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -215,7 +215,7 @@
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -299,10 +299,10 @@
|
||||
if (!is_dir($to_file)) {
|
||||
//echo "<br />Creating ".$to_file; //Debug
|
||||
umask(0000);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
+3
-132
@@ -1,142 +1,13 @@
|
||||
<?php // $Id$
|
||||
// backup.php - allows admin to edit all configuration variables for scheduled backups
|
||||
// log.php - old scheduled backups report. Now redirecting
|
||||
// to the new admin one
|
||||
|
||||
require_once("../config.php");
|
||||
require_once("../backup/lib.php");
|
||||
|
||||
$courseid = optional_param('courseid',0,PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
//Get needed strings
|
||||
$backuploglaststatus = get_string("backuploglaststatus");
|
||||
$backuplogdetailed = get_string("backuplogdetailed");
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strbackup = get_string("backup");
|
||||
$strbackupdetails = get_string("backupdetails");
|
||||
$strlogs = get_string("logs");
|
||||
$strftimedatetime = get_string("strftimerecent");
|
||||
$strftimetime = get_string("strftimetime").":%S";
|
||||
$strerror = get_string("error");
|
||||
$strok = get_string("ok");
|
||||
$strunfinished = get_string("unfinished");
|
||||
$strskipped = get_string("skipped");
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
$strnext = get_string("next");
|
||||
|
||||
//Decide when to show last execution logs or detailed logs
|
||||
//Lastlog view
|
||||
if (!$courseid) {
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
|
||||
$strlogs);
|
||||
|
||||
print_heading($backuploglaststatus);
|
||||
print_simple_box_start('center');
|
||||
//Now, get every record from backup_courses
|
||||
$courses = get_records("backup_courses");
|
||||
|
||||
if (!$courses) {
|
||||
notify("No logs found!");
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
//Print table header
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
|
||||
foreach ($courses as $course) {
|
||||
//Get the course shortname
|
||||
$coursename = get_field ("course","fullname","id",$course->courseid);
|
||||
if ($coursename) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"log.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
|
||||
if ($course->laststatus == 1) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
|
||||
} else if ($course->laststatus == 2) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
|
||||
} else if ($course->laststatus == 3) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
|
||||
} else {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
|
||||
}
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
//Detailed View !!
|
||||
} else {
|
||||
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
|
||||
"<a href=\"log.php\">$strlogs</a> -> ".
|
||||
$strbackupdetails);
|
||||
|
||||
print_heading($backuplogdetailed);
|
||||
|
||||
$coursename = get_field("course","fullname","id","$courseid");
|
||||
print_heading("$strcourse: $coursename");
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
//First, me get all the distinct backups for that course in backup_log
|
||||
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid'
|
||||
ORDER BY laststarttime DESC");
|
||||
|
||||
//Iterate over backup executions
|
||||
if (!$executions) {
|
||||
notify("No logs found!");
|
||||
} else {
|
||||
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
|
||||
foreach($executions as $execution) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
|
||||
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
$logs = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}backup_log
|
||||
WHERE courseid = '$courseid' AND
|
||||
laststarttime = '$execution->laststarttime'
|
||||
ORDER BY id");
|
||||
if ($logs) {
|
||||
foreach ($logs as $log) {
|
||||
echo "<tr>";
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
|
||||
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
|
||||
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
|
||||
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" "," ",$log->info)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
print_footer();
|
||||
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
?>
|
||||
|
||||
+4
-2
@@ -50,11 +50,13 @@
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@@ -104,7 +106,7 @@
|
||||
print_header("$site->shortname: $strcourserestore", $site->fullname,
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
|
||||
print_heading(get_string("restorecancelled"));
|
||||
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
print_continue("$CFG->wwwroot/course/view.php?id=".$id);
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
+29
-12
@@ -18,13 +18,21 @@
|
||||
|
||||
if ($form1 = data_submitted()) {
|
||||
$currentcourseshortname = $course_header->course_shortname; //"store_ShortName";
|
||||
$course_header->course_shortname = $form1->shortname; //"update_ShortName";
|
||||
$course_header->course_fullname = $form1->fullname; //"update_FullName";
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
}
|
||||
$course_header->course_shortname = stripslashes_safe($form1->shortname); //"update_ShortName";
|
||||
$course_header->course_fullname = stripslashes_safe($form1->fullname); //"update_FullName";
|
||||
/// Roll dates 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 ($course_header->course_startdate) {
|
||||
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
|
||||
$currentcoursestartdate = $course_header->course_startdate;
|
||||
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
|
||||
$restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
|
||||
} else { // don't roll if the course hasn't start date
|
||||
$coursestartdatedateoffset = 0;
|
||||
$restore->course_startdateoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
///Enforce SESSION->course_header rewrite (PHP 4.x needed because assigns are by value) MDL-8298
|
||||
$SESSION->course_header = $course_header;
|
||||
@@ -153,6 +161,13 @@
|
||||
$restore->course_id=$course_id;
|
||||
}
|
||||
}
|
||||
|
||||
// pass in the course category param
|
||||
$cat_id = optional_param('restore_restorecatto', 0, PARAM_INT);
|
||||
if ($cat_id) {
|
||||
$restore->restore_restorecatto = $cat_id;
|
||||
}
|
||||
|
||||
//We have the object with data, put it in the session
|
||||
$SESSION->restore = $restore;
|
||||
|
||||
@@ -189,7 +204,7 @@
|
||||
// 2-New course: Create the restore object and launch the execute.
|
||||
|
||||
//If the user is a teacher and not a creator
|
||||
if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!user_can_create_courses()) {
|
||||
$restore->course_id = $id;
|
||||
if ($restore->restoreto == 0) {
|
||||
$restore->deleting = true;
|
||||
@@ -199,7 +214,8 @@
|
||||
}
|
||||
|
||||
//If the user is a creator (or admin)
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
//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) {
|
||||
$restore->deleting = true;
|
||||
@@ -209,7 +225,8 @@
|
||||
}
|
||||
|
||||
//Now, select the course if needed
|
||||
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
//if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and get_capability_courses('moodle/site:restore')) {
|
||||
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0)) {
|
||||
if ($courses = get_courses("all","c.fullname","c.id,c.fullname,c.shortname,c.visible")) {
|
||||
print_heading(get_string("choosecourse"));
|
||||
print_simple_box_start("center");
|
||||
@@ -222,7 +239,7 @@
|
||||
} else {
|
||||
$optdimmed = '';
|
||||
}
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
}
|
||||
print_simple_box_end();
|
||||
} else {
|
||||
@@ -232,7 +249,7 @@
|
||||
//Checks everything and execute restore
|
||||
} else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
|
||||
//Final access control check
|
||||
if ($restore->course_id == 0 and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($restore->course_id == 0 and !user_can_create_courses()) {
|
||||
error("You need to be a creator or admin to restore into new course!");
|
||||
} else if ($restore->course_id != 0 and !has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $restore->course_id))) {
|
||||
error("You need to be an edit teacher or admin to restore into selected course!");
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+143
-23
@@ -92,14 +92,17 @@
|
||||
}
|
||||
|
||||
if (!isset($restore_restoreto)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!user_can_create_courses()) {
|
||||
$restore_restoreto = 1;
|
||||
}
|
||||
if (has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
} else {
|
||||
$restore_restoreto = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($course_header->category->id)) {
|
||||
$course_header->category->id = 0;
|
||||
}
|
||||
|
||||
if(!isset($form1->startdate)) {
|
||||
$form1->startdate = $course_header->course_startdate; //$course_header->course_startdate;
|
||||
}
|
||||
@@ -171,25 +174,61 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo get_string("restoreto").":</b>";
|
||||
echo "</td><td colspan=\"3\">";
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
// permission should have been checked already
|
||||
|
||||
/**
|
||||
* if user has manageactivities in any course, we show
|
||||
* existingcoursedeleting
|
||||
* existingcourseadding
|
||||
* else we show
|
||||
* currentcoursedeleting
|
||||
* currentcourse
|
||||
* if user has course:create in any category, we show
|
||||
* newcourse
|
||||
*/
|
||||
|
||||
$mycourses = get_capability_courses('moodle/site:restore');
|
||||
// if the user can manage 2 or more courses,
|
||||
// or if the only course the user can manage is not the current course
|
||||
// we show options for existing courses
|
||||
if (count($mycourses) > 1 || !in_array($id, $mycourses)) {
|
||||
// if user can manage more than 1 course, or if user can restore to a single different course
|
||||
$restore_restoreto_options[0] = get_string("existingcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("existingcourseadding");
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
} else { // fix for MDL-7773
|
||||
// else if the user can write to current course
|
||||
} else if (has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))){
|
||||
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
$restore_restoreto_options[1] = get_string("currentcourseadding");
|
||||
}
|
||||
|
||||
// if user can create any course at all, give the option
|
||||
if (user_can_create_courses()) {
|
||||
$restore_restoreto_options[2] = get_string("newcourse");
|
||||
}
|
||||
|
||||
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
|
||||
echo "</td></tr>";
|
||||
if (iscreator()) { //display these fields conditionally
|
||||
if (user_can_create_courses()) { //display these fields conditionally
|
||||
|
||||
// find the list of cates user can edit
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string('category');
|
||||
echo " :</td>";
|
||||
echo "<td>";
|
||||
choose_from_menu(get_creatable_categories(), "restore_restorecatto", $course_header->category->id, "");
|
||||
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=\"15\" size=\"10\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
helpbutton("courseshortname", get_string("shortname")) ;
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("fullname");
|
||||
@@ -200,9 +239,19 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo"</td></tr>";
|
||||
echo "<tr valign=\"top\"> ";
|
||||
echo "<td align=\"right\"> ";
|
||||
print_string("startdate");
|
||||
echo ":</td><td>";
|
||||
print_date_selector("startday", "startmonth", "startyear", $form1->startdate);
|
||||
print_string("startdate");
|
||||
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);
|
||||
} 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>";
|
||||
}
|
||||
@@ -231,6 +280,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
$currentrow = 0;
|
||||
$nonrestmod = '';
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modrestore = $modname."_restore_mods";
|
||||
@@ -429,6 +479,7 @@ $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");
|
||||
$allroles = get_records('role');
|
||||
|
||||
echo ('<table width="100%" class="restore-form-instances">');
|
||||
echo ('<tr><td align="right" style="width:50%"><b>'.get_string('sourcerole').'</b></td><td align="left" style="width:50%"><b>'.get_string('targetrole').'</b></td></tr>');
|
||||
@@ -483,21 +534,34 @@ if ($info->backup_moodle_version < 2006092801) {
|
||||
}
|
||||
|
||||
foreach ($roles->roles as $roleid=>$role) {
|
||||
|
||||
$mappableroles = $siteroleschoicearray;
|
||||
|
||||
echo ('<tr><td align="right">');
|
||||
echo $role->name." (".($role->shortname).")";
|
||||
echo ('</td><td align="left">');
|
||||
|
||||
// see if any short name match
|
||||
$matchrole = 0;
|
||||
foreach ($siterolesarray as $siteroleid=>$siteroleshortname) {
|
||||
if ($siteroleshortname == $role->shortname) {
|
||||
$matchrole = $siteroleid;
|
||||
break;
|
||||
}
|
||||
|
||||
/// first, we see if any exact role definition is found
|
||||
/// if found, that is the only option of restoring to
|
||||
|
||||
if ($samerole = restore_samerole($roleid, $role)) {
|
||||
$matchrole = $samerole->id;
|
||||
// if an exact role is found, it does not matter whether this user can assign this role or not,
|
||||
// this will be presented as a valid option regardless
|
||||
$mappableroles[$samerole->id] = $allroles[$samerole->id]->name." (". $allroles[$samerole->id]->shortname.")";
|
||||
} else {
|
||||
// no exact role found, let's try to match shortname
|
||||
// this is useful in situations where basic roles differ slightly in definition
|
||||
$matchrole = 0;
|
||||
foreach ($siterolesarray as $siteroleid=>$siteroleshortname) {
|
||||
if ($siteroleshortname == $role->shortname) {
|
||||
$matchrole = $siteroleid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
choose_from_menu ($siteroleschoicearray, "roles_".$roleid, $matchrole, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
choose_from_menu ($mappableroles, "roles_".$roleid, $matchrole, 'new role', '', '0');
|
||||
echo ('</td></tr>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,3 +580,59 @@ echo ('</table>'); // end of role mappings table
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
/*
|
||||
* If there is a role with exactly the same definition, we pull it out from db
|
||||
*/
|
||||
function restore_samerole($roleid, $role) {
|
||||
global $CFG;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
// first let's use the id
|
||||
|
||||
if ($trole = get_records_sql("SELECT roleid,capability,permission
|
||||
FROM {$CFG->prefix}role_capabilities
|
||||
WHERE roleid = $roleid")) {
|
||||
|
||||
if (restore_is_samerole($trole, $role)) {
|
||||
$firstcap = array_shift($trole);
|
||||
return get_record('role', 'id', $firstcap->roleid);
|
||||
}
|
||||
}
|
||||
|
||||
// unfortunately then we have to loop all roles with the same number of capabiltiies
|
||||
if ($proles = get_records_sql("SELECT roleid, roleid
|
||||
FROM {$CFG->prefix}role_capabilities
|
||||
GROUP BY roleid
|
||||
HAVING COUNT(capability) = ".count($role->capabilities))) {
|
||||
foreach ($proles as $proleid=>$proleobj) {
|
||||
if ($prole = get_records('role_capabilities', 'roleid', $proleid)) {
|
||||
if (restore_is_samerole($prole, $role)) {
|
||||
return get_record('role', 'id', $proleid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* rolea from db, roleb from xml
|
||||
*/
|
||||
function restore_is_samerole($rolea, $roleb) {
|
||||
|
||||
if (count($rolea) != count($roleb->capabilities)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($rolea as $cap) {
|
||||
if ($cap->permission != $roleb->capabilities[$cap->capability]->permission) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
@@ -18,7 +18,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+224
-112
@@ -533,8 +533,18 @@
|
||||
$course_header->course_shortname = $currentshortname;
|
||||
|
||||
//Now calculate the category
|
||||
$category = get_record("course_categories","id",$course_header->category->id,
|
||||
"name",addslashes($course_header->category->name));
|
||||
|
||||
// first try to get it from restore
|
||||
if ($restore->restore_restorecatto) {
|
||||
$category = get_record('course_categories', 'id', $restore->restore_restorecatto);
|
||||
}
|
||||
|
||||
// else we try to get it from the xml file
|
||||
//Now calculate the category
|
||||
if (!$category) {
|
||||
$category = get_record("course_categories","id",$course_header->category->id,
|
||||
"name",addslashes($course_header->category->name));
|
||||
}
|
||||
//If no exists, try by name only
|
||||
if (!$category) {
|
||||
$category = get_record("course_categories","name",addslashes($course_header->category->name));
|
||||
@@ -585,7 +595,6 @@
|
||||
$course->guest = addslashes($course_header->course_guest);
|
||||
$course->startdate = addslashes($course_header->course_startdate);
|
||||
$course->startdate += $restore->course_startdateoffset;
|
||||
$course->enrolperiod = addslashes($course_header->course_enrolperiod);
|
||||
$course->numsections = addslashes($course_header->course_numsections);
|
||||
//$course->showrecent = addslashes($course_header->course_showrecent); INFO: This is out in 1.3
|
||||
$course->maxbytes = addslashes($course_header->course_maxbytes);
|
||||
@@ -606,6 +615,19 @@
|
||||
$course->timecreated = addslashes($course_header->course_timecreated);
|
||||
$course->timemodified = addslashes($course_header->course_timemodified);
|
||||
$course->metacourse = addslashes($course_header->course_metacourse);
|
||||
$course->expirynotify = isset($course_header->course_expirynotify) ? addslashes($course_header->course_expirynotify):0;
|
||||
$course->notifystudents = isset($course_header->course_notifystudents) ? addslashes($course_header->course_notifystudents) : 0;
|
||||
$course->expirythreshold = isset($course_header->course_expirythreshold) ? addslashes($course_header->course_expirythreshold) : 0;
|
||||
$course->enrollable = isset($course_header->course_enrollable) ? addslashes($course_header->course_enrollable) : 1;
|
||||
$course->enrolstartdate = isset($course_header->course_enrolstartdate) ? addslashes($course_header->course_enrolstartdate) : 0;
|
||||
if ($course->enrolstartdate) { //Roll course dates
|
||||
$course->enrolstartdate += $restore->course_startdateoffset;
|
||||
}
|
||||
$course->enrolenddate = isset($course_header->course_enrolenddate) ? addslashes($course_header->course_enrolenddate) : 0;
|
||||
if ($course->enrolenddate) { //Roll course dates
|
||||
$course->enrolenddate += $restore->course_startdateoffset;
|
||||
}
|
||||
$course->enrolperiod = addslashes($course_header->course_enrolperiod);
|
||||
//Calculate sortorder field
|
||||
$sortmax = get_record_sql('SELECT MAX(sortorder) AS max
|
||||
FROM ' . $CFG->prefix . 'course
|
||||
@@ -778,6 +800,11 @@
|
||||
continue;
|
||||
}
|
||||
$getid = backup_getid($restore->backup_unique_code, $parts[1], $instance->pageid);
|
||||
|
||||
if (empty($getid->new_id)) {
|
||||
// Failed, perhaps the module was not included in the restore MDL-13554
|
||||
continue;
|
||||
}
|
||||
$instance->pageid = $getid->new_id;
|
||||
}
|
||||
else {
|
||||
@@ -935,14 +962,18 @@
|
||||
// Yu: This part is called repeatedly for every instance,
|
||||
// so it is necessary to set the granular flag and check isset()
|
||||
// when the first instance of this type of mod is processed.
|
||||
if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
//if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
|
||||
if (!isset($restore->mods[$mod->type]->granular)) {
|
||||
if (isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
|
||||
// This defines whether we want to restore specific
|
||||
// instances of the modules (granular restore), or
|
||||
// whether we don't care and just want to restore
|
||||
// all module instances (non-granular).
|
||||
$restore->mods[$mod->type]->granular = true;
|
||||
} else {
|
||||
$restore->mods[$mod->type]->granular = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if we've to restore this module (and instance)
|
||||
@@ -1181,7 +1212,7 @@
|
||||
if (!$preferencescount) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grade').'</li>';
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grades').'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1192,7 +1223,7 @@
|
||||
if ($pref_rec->value == 0) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('respectingcurrentdata','grade').'</li>';
|
||||
echo '<li>'.get_string('respectingcurrentdata','grades').'</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1208,7 +1239,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_preferences' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1262,7 +1293,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_letter' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$counter,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1312,7 +1343,7 @@
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'grade_category' AND backup_code = '$restore->backup_unique_code'",
|
||||
"old_id",
|
||||
"old_id, old_id",
|
||||
"old_id",
|
||||
$countercat,
|
||||
$recordset_size);
|
||||
if ($recs) {
|
||||
@@ -1471,7 +1502,7 @@
|
||||
//in backup_ids->info will be the real info (serialized)
|
||||
$info = restore_read_xml_users($restore,$xml_file);
|
||||
}
|
||||
|
||||
|
||||
//Now, get evey user_id from $info and user data from $backup_ids
|
||||
//and create the necessary records (users, user_students, user_teachers
|
||||
//user_course_creators and user_admins
|
||||
@@ -1482,15 +1513,37 @@
|
||||
|
||||
$languages = get_list_of_languages();
|
||||
|
||||
/// Iterate over all users loaded from xml
|
||||
$counter = 0;
|
||||
foreach ($info->users as $userid) {
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
|
||||
$user = $rec->info;
|
||||
foreach (array_keys(get_object_vars($user)) as $field) {
|
||||
if (!is_array($user->$field)) {
|
||||
$user->$field = backup_todb($user->$field);
|
||||
if (is_null($user->$field)) {
|
||||
$user->$field = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now, recode some languages (Moodle 1.5)
|
||||
if ($user->lang == 'ma_nt') {
|
||||
$user->lang = 'mi_nt';
|
||||
}
|
||||
|
||||
//Country list updates - MDL-13060
|
||||
//Any user whose country code has been deleted or modified needs to be assigned a valid one.
|
||||
$country_update_map = array(
|
||||
'ZR' => 'CD',
|
||||
'TP' => 'TL',
|
||||
'FX' => 'FR',
|
||||
'KO' => 'RS',
|
||||
'CS' => 'RS',
|
||||
'WA' => 'GB');
|
||||
if (array_key_exists($user->country, $country_update_map)) {
|
||||
$user->country = $country_update_map[$user->country];
|
||||
}
|
||||
|
||||
//If language does not exist here - use site default
|
||||
if (!array_key_exists($user->lang, $languages)) {
|
||||
@@ -1562,17 +1615,13 @@
|
||||
if ($create_user) {
|
||||
//Unset the id because it's going to be inserted with a new one
|
||||
unset ($user->id);
|
||||
//We addslashes to necessary fields
|
||||
$user->username = addslashes($user->username);
|
||||
$user->firstname = addslashes($user->firstname);
|
||||
$user->lastname = addslashes($user->lastname);
|
||||
$user->email = addslashes($user->email);
|
||||
$user->institution = addslashes($user->institution);
|
||||
$user->department = addslashes($user->department);
|
||||
$user->address = addslashes($user->address);
|
||||
$user->city = addslashes($user->city);
|
||||
$user->url = addslashes($user->url);
|
||||
$user->description = restore_decode_absolute_links(addslashes($user->description));
|
||||
// relink the descriptions
|
||||
$user->description = restore_decode_absolute_links($user->description);
|
||||
|
||||
/// Disable pictures based on global setting of existing empty value (old backups can contain wrong empties)
|
||||
if (!empty($CFG->disableuserimages) || empty($user->picture)) {
|
||||
$user->picture = 0;
|
||||
}
|
||||
|
||||
//We need to analyse the AUTH field to recode it:
|
||||
// - if the field isn't set, we are in a pre 1.4 backup and we'll
|
||||
@@ -1604,7 +1653,7 @@
|
||||
|
||||
//We are going to create the user
|
||||
//The structure is exactly as we need
|
||||
$newid = insert_record ("user",$user);
|
||||
$newid = insert_record ("user", addslashes_recursive($user));
|
||||
//Put the new id
|
||||
$status = backup_putid($restore->backup_unique_code,"user",$userid,$newid,"new");
|
||||
}
|
||||
@@ -1745,9 +1794,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Do some output
|
||||
$counter++;
|
||||
if ($counter % 10 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 200 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
} /// End of loop over all the users loaded from xml
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -1790,7 +1850,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $unreadcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1855,7 +1915,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $readcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_read' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -1922,7 +1982,7 @@
|
||||
$counter = 0;
|
||||
while ($counter < $contactcount) {
|
||||
//Fetch recordset_size records in each iteration
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id, old_id",$counter,$recordset_size);
|
||||
$recs = get_records_select("backup_ids","table_name = 'message_contacts' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
if ($recs) {
|
||||
foreach ($recs as $rec) {
|
||||
//Get the full record from backup_ids
|
||||
@@ -2182,10 +2242,22 @@
|
||||
$gro->hidepicture = backup_todb($info['GROUP']['#']['HIDEPICTURE']['0']['#']);
|
||||
$gro->timecreated = backup_todb($info['GROUP']['#']['TIMECREATED']['0']['#']);
|
||||
$gro->timemodified = backup_todb($info['GROUP']['#']['TIMEMODIFIED']['0']['#']);
|
||||
|
||||
//Now search if that group exists (by name and description field) in
|
||||
|
||||
//Now search if that group exists (by name and description field) in
|
||||
//restore->course_id course
|
||||
$gro_db = groups_group_matches($restore->course_id, $gro->name, $gro->description);
|
||||
//Going to compare LOB columns so, use the cross-db sql_compare_text() in both sides.
|
||||
$description_clause = '';
|
||||
if (!empty($gro->description)) { /// Only for groups having a description
|
||||
$literal_description = "'" . $gro->description . "'";
|
||||
$description_clause = " AND " .
|
||||
sql_compare_text('description') . " = " .
|
||||
sql_compare_text($literal_description);
|
||||
}
|
||||
$gro_db = get_record_sql("SELECT *
|
||||
FROM {$CFG->prefix}groups g, {$CFG->prefix}groups_courses_groups gcg
|
||||
WHERE gcg.courseid = $restore->course_id
|
||||
AND g.id = gcg.groupid
|
||||
AND g.name = '{$gro->name}'" . $description_clause, true);
|
||||
//If it doesn't exist, create
|
||||
if (!$gro_db) {
|
||||
$create_group = true;
|
||||
@@ -2480,19 +2552,6 @@
|
||||
//Assign it to admin
|
||||
$eve->userid = $adminid;
|
||||
}
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
if (!empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$max_rec = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$eve->repeatid = empty($max_rec) ? 1 : $max_rec->repeatid + 1;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
}
|
||||
|
||||
//We have to recode the groupid field
|
||||
$group = backup_getid($restore->backup_unique_code,"groups",$eve->groupid);
|
||||
@@ -2505,6 +2564,22 @@
|
||||
|
||||
//The structure is equal to the db, so insert the event
|
||||
$newid = insert_record ("event",$eve);
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
//The repeatid now refers to the id of the original event. (see Bug#5956)
|
||||
if ($newid && !empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$eve->repeatid = $newid;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
$eve->id = $newid;
|
||||
// update the record to contain the correct repeatid
|
||||
update_record('event',$eve);
|
||||
}
|
||||
} else {
|
||||
//get current event id
|
||||
$newid = $eve_db->id;
|
||||
@@ -2569,48 +2644,53 @@
|
||||
|
||||
$counter = 0;
|
||||
|
||||
//First, we check to "users" exists and create is as necessary
|
||||
// 'users' is the old users folder, 'user' is the new one, with a new hierarchy. Detect which one is here and treat accordingly
|
||||
//in CFG->dataroot
|
||||
$dest_dir = $CFG->dataroot."/users";
|
||||
$dest_dir = $CFG->dataroot."/user";
|
||||
$status = check_dir_exists($dest_dir,true);
|
||||
|
||||
//Now, we iterate over "user_files" records to check if that user dir must be
|
||||
//copied (and renamed) to the "users" dir.
|
||||
$rootdir = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code."/user_files";
|
||||
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
$counter = 0;
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$restore->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If thar user exists in backup_ids
|
||||
if ($data) {
|
||||
//Only it user has been created now
|
||||
//or if it existed previously, but he hasn't image (see bug 1123)
|
||||
if ((strpos($data->info,"new") !== false) or
|
||||
(!check_dir_exists($dest_dir."/".$data->new_id,false))) {
|
||||
//Copy the old_dir to its new location (and name) !!
|
||||
//Only if destination doesn't exists
|
||||
if (!file_exists($dest_dir."/".$data->new_id)) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$dest_dir."/".$data->new_id,true);
|
||||
$counter ++;
|
||||
}
|
||||
//Do some output
|
||||
if ($counter % 2 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 40 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
$userlist = array();
|
||||
|
||||
if (is_dir($rootdir) && ($list = list_directories ($rootdir))) {
|
||||
$counter = 0;
|
||||
foreach ($list as $dir) {
|
||||
// If there are directories in this folder, we are in the new user hierarchy
|
||||
if ($newlist = list_directories("$rootdir/$dir")) {
|
||||
foreach ($newlist as $olduserid) {
|
||||
$userlist[$olduserid] = "$rootdir/$dir/$olduserid";
|
||||
}
|
||||
} else {
|
||||
$userlist[$dir] = "$rootdir/$dir";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($userlist as $olduserid => $backup_location) {
|
||||
//Look for dir like username in backup_ids
|
||||
//If that user exists in backup_ids
|
||||
if ($user = backup_getid($restore->backup_unique_code,"user",$olduserid)) {
|
||||
//Only if user has been created now or if it existed previously, but he hasn't got an image (see bug 1123)
|
||||
$newuserdir = make_user_directory($user->new_id, true); // Doesn't create the folder, just returns the location
|
||||
|
||||
// restore images if new user or image does not exist yet
|
||||
if (!empty($user->new) or !check_dir_exists($newuserdir)) {
|
||||
if (make_user_directory($user->new_id)) { // Creates the folder
|
||||
$status = backup_copy_file($backup_location, $newuserdir, true);
|
||||
$counter ++;
|
||||
}
|
||||
//Do some output
|
||||
if ($counter % 2 == 0) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo ".";
|
||||
if ($counter % 40 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2817,7 +2897,7 @@
|
||||
while ($counter < $count_logs) {
|
||||
//Get a chunk of records
|
||||
//Take old_id twice to avoid adodb limitation
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id,old_id",$counter,$recordset_size);
|
||||
$logs = get_records_select("backup_ids","table_name = 'log' AND backup_code = '$restore->backup_unique_code'","old_id","old_id",$counter,$recordset_size);
|
||||
//We have logs
|
||||
if ($logs) {
|
||||
//Iterate
|
||||
@@ -3244,7 +3324,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into INFO zone
|
||||
//if ($this->tree[2] == "INFO") //Debug
|
||||
@@ -3258,7 +3338,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into INFO zone
|
||||
//if ($this->tree[2] == "INFO") //Debug
|
||||
@@ -3273,7 +3353,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into COURSE_HEADER zone
|
||||
//if ($this->tree[3] == "HEADER") //Debug
|
||||
@@ -3287,7 +3367,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into BLOCKS zone
|
||||
//if ($this->tree[3] == "BLOCKS") //Debug
|
||||
@@ -3301,7 +3381,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into SECTIONS zone
|
||||
//if ($this->tree[3] == "SECTIONS") //Debug
|
||||
@@ -3315,7 +3395,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Accumulate all the data inside this tag
|
||||
if (isset($this->tree[3]) && $this->tree[3] == "FORMATDATA") {
|
||||
@@ -3338,7 +3418,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into METACOURSE zone
|
||||
//if ($this->tree[3] == "METACOURSE") //Debug
|
||||
@@ -3353,7 +3433,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GRADEBOOK zone
|
||||
//if ($this->tree[3] == "GRADEBOOK") //Debug
|
||||
@@ -3389,7 +3469,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into MESSAGES zone
|
||||
//if ($this->tree[3] == "MESSAGES") //Debug
|
||||
@@ -3416,7 +3496,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into QUESTION_CATEGORIES zone
|
||||
//if ($this->tree[3] == "QUESTION_CATEGORIES") //Debug
|
||||
@@ -3444,7 +3524,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into SCALES zone
|
||||
//if ($this->tree[3] == "SCALES") //Debug
|
||||
@@ -3471,7 +3551,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GROUPS zone
|
||||
//if ($this->tree[3] == "GROUPS") //Debug
|
||||
@@ -3498,7 +3578,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into GROUPINGS zone
|
||||
//if ($this->tree[3] == "GROUPINGS") //Debug
|
||||
@@ -3526,7 +3606,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into EVENTS zone
|
||||
//if ($this->tree[3] == "EVENTS") //Debug
|
||||
@@ -3554,7 +3634,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into MODULES zone
|
||||
//if ($this->tree[3] == "MODULES") //Debug
|
||||
@@ -3582,7 +3662,7 @@
|
||||
//} //Debug
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
//Check if we are into LOGS zone
|
||||
//if ($this->tree[3] == "LOGS") //Debug
|
||||
@@ -3605,7 +3685,7 @@
|
||||
$this->tree[$this->level] = $tagName;
|
||||
|
||||
//Output something to avoid browser timeouts...
|
||||
backup_flush();
|
||||
//backup_flush();
|
||||
|
||||
echo $this->level.str_repeat(" ",$this->level*2)."<".$tagName."><br />\n"; //Debug
|
||||
}
|
||||
@@ -3831,9 +3911,6 @@
|
||||
case "STARTDATE":
|
||||
$this->info->course_startdate = $this->getContents();
|
||||
break;
|
||||
case "ENROLPERIOD":
|
||||
$this->info->course_enrolperiod = $this->getContents();
|
||||
break;
|
||||
case "NUMSECTIONS":
|
||||
$this->info->course_numsections = $this->getContents();
|
||||
break;
|
||||
@@ -3882,6 +3959,27 @@
|
||||
case "METACOURSE":
|
||||
$this->info->course_metacourse = $this->getContents();
|
||||
break;
|
||||
case "EXPIRENOTIFY":
|
||||
$this->info->course_expirynotify = $this->getContents();
|
||||
break;
|
||||
case "NOTIFYSTUDENTS":
|
||||
$this->info->course_notifystudents = $this->getContents();
|
||||
break;
|
||||
case "EXPIRYTHRESHOLD":
|
||||
$this->info->course_expirythreshold = $this->getContents();
|
||||
break;
|
||||
case "ENROLLABLE":
|
||||
$this->info->course_enrollable = $this->getContents();
|
||||
break;
|
||||
case "ENROLSTARTDATE":
|
||||
$this->info->course_enrolstartdate = $this->getContents();
|
||||
break;
|
||||
case "ENROLENDDATE":
|
||||
$this->info->course_enrolenddate = $this->getContents();
|
||||
break;
|
||||
case "ENROLPERIOD":
|
||||
$this->info->course_enrolperiod = $this->getContents();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($this->tree[4] == "CATEGORY") {
|
||||
@@ -5420,11 +5518,20 @@
|
||||
$fp = fopen($xml_file,"r")
|
||||
or $status = false;
|
||||
if ($status) {
|
||||
while ($data = fread($fp, 4096) and !$moodle_parser->finished)
|
||||
xml_parse($xml_parser, $data, feof($fp))
|
||||
or die(sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
// MDL-9290 performance improvement on reading large xml
|
||||
$lasttime = time(); // crmas
|
||||
while ($data = fread($fp, 4096) and !$moodle_parser->finished) {
|
||||
|
||||
if ((time() - $lasttime) > 5) {
|
||||
$lasttime = time();
|
||||
backup_flush(1);
|
||||
}
|
||||
|
||||
xml_parse($xml_parser, $data, feof($fp))
|
||||
or die(sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
//Get info from parser
|
||||
@@ -5574,6 +5681,11 @@
|
||||
$info = restore_read_xml_info ($xml_file);
|
||||
//Reading course_header from file
|
||||
$course_header = restore_read_xml_course_header ($xml_file);
|
||||
|
||||
if(!is_object($course_header)){
|
||||
// ensure we fail if there is no course header
|
||||
$course_header = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
@@ -6687,7 +6799,7 @@
|
||||
$newcontext = get_context_instance($contextlevel, $oldinstance->new_id);
|
||||
$assignment->contextid = $newcontext->id; // new context id
|
||||
// might already have same assignment
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol);
|
||||
role_assign($assignment->roleid, $assignment->userid, 0, $assignment->contextid, $assignment->timestart, $assignment->timeend, $assignment->hidden, $assignment->enrol, $assignment->timemodified);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6704,7 +6816,7 @@
|
||||
foreach ($overrides as $override) {
|
||||
$override->capability = $override->name;
|
||||
$oldmodifier = backup_getid($restore->backup_unique_code,"user",$override->modifierid);
|
||||
$override->modifierid = $oldmodifier->new_id?$oldmodifier->new_id:0; // new modifier id here
|
||||
$override->modifierid = !empty($oldmodifier->new_id)?$oldmodifier->new_id:0; // new modifier id here
|
||||
$override->roleid = $role->new_id; // restored new role id
|
||||
|
||||
// hack to make the correct contextid for course level imports
|
||||
|
||||
@@ -41,7 +41,8 @@ class block_admin_tree extends block_base {
|
||||
$this->tempcontent .= " ";
|
||||
}
|
||||
$this->tempcontent .= '<a href="#" onclick="toggle(\'vh_span'. $this->spancounter .'\');return false">';
|
||||
$this->tempcontent .= '<span id="vh_span' . $this->spancounter . 'indicator"><img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" /></span> ';
|
||||
$this->tempcontent .= '<span id="vh_span' . $this->spancounter . 'indicator"><img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" /></span> ';
|
||||
|
||||
$this->tempcontent .= $visiblename . '</a><br /><span id="vh_span' . $this->spancounter . '">' . "\n";
|
||||
$this->currentdepth++;
|
||||
$this->spancounter++;
|
||||
@@ -66,12 +67,12 @@ class block_admin_tree extends block_base {
|
||||
if (is_a($content, 'admin_settingpage')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
$this->create_item($content->visiblename,$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=' . $content->name,$CFG->wwwroot .'/blocks/admin_tree/item.gif', $class);
|
||||
$this->create_item($content->visiblename,$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=' . $content->name,$CFG->pixpath .'/i/item.gif', $class);
|
||||
}
|
||||
} else if (is_a($content, 'admin_externalpage')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
$this->create_item($content->visiblename, $content->url, $CFG->wwwroot . '/blocks/admin_tree/item.gif', $class);
|
||||
$this->create_item($content->visiblename, $content->url, $CFG->pixpath . '/i/item.gif', $class);
|
||||
}
|
||||
} else if (is_a($content, 'admin_category')) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
@@ -144,11 +145,11 @@ class block_admin_tree extends block_base {
|
||||
$this->content->text .= 'function toggle(spanid) {' . "\n";
|
||||
$this->content->text .= ' if (getspan(spanid).innerHTML == "") {' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = vh_content[spanid];' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' } else {' . "\n";
|
||||
$this->content->text .= ' vh_content[spanid] = getspan(spanid).innerHTML;' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = "";' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' }' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
@@ -156,13 +157,13 @@ class block_admin_tree extends block_base {
|
||||
$this->content->text .= ' if (getspan(spanid).innerHTML !== "") {' . "\n";
|
||||
$this->content->text .= ' vh_content[spanid] = getspan(spanid).innerHTML;' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = "";' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/closed.gif" alt="'.$strfolderclosed.'" />\';' . "\n";
|
||||
$this->content->text .= ' }' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
$this->content->text .= 'function expand(spanid) {' . "\n";
|
||||
$this->content->text .= ' getspan(spanid).innerHTML = vh_content[spanid];' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= ' getspan(spanid + "indicator").innerHTML = \'<img src="' . $CFG->pixpath . '/i/open.gif" alt="'.$strfolderopened.'" />\';' . "\n";
|
||||
$this->content->text .= '}' . "\n";
|
||||
|
||||
$this->content->text .= 'function expandall() {' . "\n";
|
||||
|
||||
@@ -45,6 +45,12 @@ class block_calendar_month extends block_base {
|
||||
// We 'll need this later
|
||||
calendar_set_referring_course($courseshown);
|
||||
|
||||
// MDL-9059, set to show this course when admins go into a course, then unset it.
|
||||
if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$courseset = true;
|
||||
$SESSION->cal_courses_shown[$COURSE->id] = $COURSE;
|
||||
}
|
||||
|
||||
// Be VERY careful with the format for default courses arguments!
|
||||
// Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
|
||||
calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse);
|
||||
@@ -63,6 +69,11 @@ class block_calendar_month extends block_base {
|
||||
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
|
||||
|
||||
}
|
||||
|
||||
// MDL-9059, unset this so that it doesn't stay in session
|
||||
if (!empty($courseset)) {
|
||||
unset($SESSION->cal_courses_shown[$COURSE->id]);
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class block_loancalc extends block_base {
|
||||
|
||||
$this->content->text = '
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
//<![CDATA[
|
||||
function Next()
|
||||
{
|
||||
submitScreen("Next");
|
||||
@@ -148,7 +148,7 @@ function comp(v) { // general entry point for all cases
|
||||
|
||||
}
|
||||
} // function comp
|
||||
]]>
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<h1></h1>
|
||||
|
||||
@@ -9,6 +9,10 @@ class block_messages extends block_base {
|
||||
function get_content() {
|
||||
global $USER, $CFG;
|
||||
|
||||
if (!$CFG->messaging) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -259,17 +259,17 @@ class block_base {
|
||||
$title = '<div class="title">';
|
||||
|
||||
if (!empty($CFG->allowuserblockhiding)) {
|
||||
//Accessibility: added static 'alt' text for the +- icon.
|
||||
//TODO (nfreear): language string 'hide OR show block'
|
||||
$title .= '<div class="hide-show">'.
|
||||
'<a title="'.get_string('showhideblock','access').
|
||||
'" href="#" onclick="elementToggleHide(this, true, function(el) {'.
|
||||
'return findParentNode(el, \'DIV\', \'sideblock\'); '.
|
||||
'}, \''.$CFG->pixpath.'\' ); return false;">'.
|
||||
'<img src="'.$CFG->pixpath.'/spacer.gif" '.
|
||||
'id = "togglehide_inst'.$this->instance->id.'" '.
|
||||
'alt="'.get_string('showhideblock','access').'" class="hide-show-image" /></a></div>';
|
||||
}
|
||||
//Accessibility: added 'alt' text for the +- icon.
|
||||
//Theme the buttons using, Admin - Miscellaneous - smartpix.
|
||||
$strshow = addslashes_js(get_string('showblocka', 'access', strip_tags($this->title)));
|
||||
$strhide = addslashes_js(get_string('hideblocka', 'access', strip_tags($this->title)));
|
||||
$title .= '<input type="image" src="'.$CFG->pixpath.'/t/switch_minus.gif" '.
|
||||
'id="togglehide_inst'.$this->instance->id.'" '.
|
||||
'onclick="elementToggleHide(this, true, function(el) {'.
|
||||
'return findParentNode(el, \'DIV\', \'sideblock\'); },'.
|
||||
' \''.$strshow.'\', \''.$strhide.'\'); return false;" '.
|
||||
'alt="'.$strhide.'" title="'.$strhide.'" class="hide-show-image" />';
|
||||
}
|
||||
|
||||
//Accesssibility: added H2 (was in, weblib.php: print_side_block)
|
||||
$title .= '<h2>'.$this->title.'</h2>';
|
||||
@@ -324,6 +324,15 @@ class block_base {
|
||||
$this->str->assignroles = get_string('assignroles', 'role');
|
||||
}
|
||||
|
||||
// RTL support - exchange right and left arrows
|
||||
if (right_to_left()) {
|
||||
$rightarrow = 'left.gif';
|
||||
$leftarrow = 'right.gif';
|
||||
} else {
|
||||
$rightarrow = 'right.gif';
|
||||
$leftarrow = 'left.gif';
|
||||
}
|
||||
|
||||
$movebuttons = '<div class="commands">';
|
||||
|
||||
if ($this->instance->visible) {
|
||||
@@ -344,9 +353,10 @@ class block_base {
|
||||
}
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey));
|
||||
|
||||
// place holder for roles button
|
||||
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
|
||||
if (empty($this->instance->pinned)) {
|
||||
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
|
||||
}
|
||||
|
||||
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&blockaction=toggle">' .
|
||||
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
|
||||
@@ -361,7 +371,7 @@ class block_base {
|
||||
|
||||
if ($options & BLOCK_MOVE_LEFT) {
|
||||
$movebuttons .= '<a class="icon left" title="'. $this->str->moveleft .'" href="'.$script.'&blockaction=moveleft">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/left.gif" alt="'. $this->str->moveleft .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$leftarrow.'" alt="'. $this->str->moveleft .'" /></a>';
|
||||
}
|
||||
if ($options & BLOCK_MOVE_UP) {
|
||||
$movebuttons .= '<a class="icon up" title="'. $this->str->moveup .'" href="'.$script.'&blockaction=moveup">' .
|
||||
@@ -373,7 +383,7 @@ class block_base {
|
||||
}
|
||||
if ($options & BLOCK_MOVE_RIGHT) {
|
||||
$movebuttons .= '<a class="icon right" title="'. $this->str->moveright .'" href="'.$script.'&blockaction=moveright">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/right.gif" alt="'. $this->str->moveright .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$rightarrow.'" alt="'. $this->str->moveright .'" /></a>';
|
||||
}
|
||||
|
||||
$movebuttons .= '</div>';
|
||||
|
||||
@@ -55,29 +55,31 @@ class block_online_users extends block_base {
|
||||
}
|
||||
|
||||
if ($COURSE->id == SITEID) { // Site-level
|
||||
$courseselect = '';
|
||||
$timeselect = "AND (ul.timeaccess > $timefrom OR u.lastaccess > $timefrom)";
|
||||
} else {
|
||||
$select = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(u.lastaccess) as lastaccess ";
|
||||
$from = "FROM {$CFG->prefix}user u
|
||||
$groupmembers ";
|
||||
$where = "WHERE u.lastaccess > $timefrom
|
||||
$groupselect ";
|
||||
$order = "ORDER BY lastaccess DESC ";
|
||||
|
||||
} else { // Course-level
|
||||
$courseselect = "AND ul.courseid = '".$COURSE->id."'";
|
||||
$timeselect = "AND ul.timeaccess > $timefrom";
|
||||
$select = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(ul.timeaccess) as lastaccess ";
|
||||
$from = "FROM {$CFG->prefix}user_lastaccess ul,
|
||||
{$CFG->prefix}user u
|
||||
$groupmembers ";
|
||||
$where = "WHERE ul.timeaccess > $timefrom
|
||||
AND u.id = ul.userid
|
||||
AND ul.courseid = $COURSE->id
|
||||
$groupselect ";
|
||||
$order = "ORDER BY lastaccess DESC ";
|
||||
}
|
||||
|
||||
$groupby = "GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture ";
|
||||
|
||||
$SQL = $select . $from . $where . $groupby . $order;
|
||||
|
||||
$users = array();
|
||||
|
||||
$SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess
|
||||
FROM {$CFG->prefix}user_lastaccess ul,
|
||||
{$CFG->prefix}user u
|
||||
$groupmembers
|
||||
WHERE
|
||||
ul.userid = u.id
|
||||
$courseselect
|
||||
$timeselect
|
||||
$groupselect
|
||||
GROUP BY u.id
|
||||
ORDER BY ul.timeaccess DESC";
|
||||
|
||||
|
||||
|
||||
$users = array();
|
||||
$pcontext = get_related_contexts_string($context);
|
||||
|
||||
if ($pusers = get_records_sql($SQL, 0, 50)) { // We'll just take the most recent 50 maximum
|
||||
@@ -87,7 +89,7 @@ class block_online_users extends block_base {
|
||||
// user has a hidden role assigned at this context or any parent contexts,
|
||||
// ignore this user
|
||||
|
||||
$SQL = "SELECT id,id FROM {$CFG->prefix}role_assignments
|
||||
$SQL = "SELECT id FROM {$CFG->prefix}role_assignments
|
||||
WHERE userid = $puser->id
|
||||
AND contextid $pcontext
|
||||
AND hidden = 1";
|
||||
@@ -116,7 +118,7 @@ class block_online_users extends block_base {
|
||||
$this->content->text .= "<ul class='list'>\n";
|
||||
foreach ($users as $user) {
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
|
||||
$timeago = format_time(time() - $user->lastaccess); //bruno to calculate correctly on frontpage
|
||||
if ($user->username == 'guest') {
|
||||
$this->content->text .= '<div class="user">'.print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
|
||||
$this->content->text .= get_string('guestuser').'</div>';
|
||||
|
||||
@@ -8,7 +8,7 @@ class block_participants extends block_list {
|
||||
|
||||
function get_content() {
|
||||
|
||||
global $CFG;
|
||||
global $CFG, $COURSE;
|
||||
|
||||
if (empty($this->instance)) {
|
||||
$this->content = '';
|
||||
@@ -20,7 +20,8 @@ class block_participants extends block_list {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$currentcontext = get_context_instance(CONTEXT_COURSE, $this->instance->pageid)) {
|
||||
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
|
||||
if (!$currentcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id)) {
|
||||
$this->content = '';
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
$numids = count($rssidarray);
|
||||
$count = 0;
|
||||
foreach ($rssidarray as $rssid) {
|
||||
$output .= clean_text($this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false), FORMAT_HTML);
|
||||
$output .= $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
|
||||
if ($numids > 1 && $count != $numids -1 && !empty($rssfeedstring)) {
|
||||
$output .= '<hr style="width=:80%" />';
|
||||
}
|
||||
@@ -197,11 +197,14 @@
|
||||
} else {
|
||||
$feedtitle = $this->format_title($rss_record->preferredtitle);
|
||||
}
|
||||
// print_object($rss);
|
||||
|
||||
if (isset($this->config) &&
|
||||
isset($this->config->block_rss_client_show_channel_image) &&
|
||||
$this->config->block_rss_client_show_channel_image &&
|
||||
isset($rss->image) && isset($rss->image['link']) && isset($rss->image['title']) && isset($rss->image['url']) ) {
|
||||
|
||||
$rss->image['title'] = s($rss->image['title']);
|
||||
|
||||
$returnstring .= "\n".'<div class="image" title="'. $rss->image['title'] .'"><a href="'. $rss->image['link'] .'"><img src="'. $rss->image['url'] .'" alt="'. $rss->image['title'] .'" /></a></div>';
|
||||
}
|
||||
|
||||
@@ -235,7 +238,7 @@
|
||||
|
||||
$item['link'] = str_replace('&', '&', $item['link']);
|
||||
|
||||
$returnstring .= '<li><div class="link"><a href="'. $item['link'] .'">'. $item['title'] . "</a></div>\n";
|
||||
$returnstring .= '<li><div class="link"><a href="'. $item['link'] .'" onclick="this.target=\'_blank\'" >'. $item['title'] . "</a></div>\n";
|
||||
|
||||
if ($display_description && !empty($item['description'])) {
|
||||
$item['description'] = break_up_long_words($item['description'], 30);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
This block is a revamping of the Google Summer Of Code Project (2006) on Global Search engine
|
||||
for Moodle. New block version is completed and internationalized according to Moodle multilengual support.
|
||||
|
||||
This block instanciates a startup database model for the search engine.
|
||||
|
||||
## Installing
|
||||
|
||||
You need installing the following elements in order the global search to be available :
|
||||
|
||||
1. The global search bloc (this block)
|
||||
2. update the /search root package from CVS
|
||||
3. The antiword libraries
|
||||
4. The xpdf libraries
|
||||
|
||||
Both last libraries are provided as a patch called "global_search_libraries" in the contrib section.
|
||||
@@ -1,21 +1,25 @@
|
||||
<?php
|
||||
|
||||
/* This is the global search shortcut block - a single query can be entered, and
|
||||
the user will be redirected to the query page where they can enter more
|
||||
advanced queries, and view the results of their search. When searching from
|
||||
this block, the broadest possible selection of documents is searched.
|
||||
|
||||
Author: Michael Champanis (mchampan)
|
||||
Date: 2006 06 25
|
||||
|
||||
Todo: make strings -> get_string()
|
||||
* the user will be redirected to the query page where they can enter more
|
||||
* advanced queries, and view the results of their search. When searching from
|
||||
* this block, the broadest possible selection of documents is searched.
|
||||
*
|
||||
*
|
||||
* Todo: make strings -> get_string()
|
||||
*
|
||||
* @package search
|
||||
* @subpackage search block
|
||||
* @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
|
||||
* @date: 2006 06 25
|
||||
*/
|
||||
|
||||
class block_search extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = "Global Search"; //get_string()
|
||||
$this->version = 2006062500;
|
||||
$this->title = get_string('blockname', 'block_search');
|
||||
$this->cron = 1;
|
||||
$this->version = 2008031500;
|
||||
} //init
|
||||
|
||||
// only one instance of this block is required
|
||||
@@ -45,8 +49,8 @@
|
||||
//lazy check for the moment
|
||||
if (check_php_version("5.0.0")) {
|
||||
//fetch values if defined in admin, otherwise use defaults
|
||||
$label = (isset($CFG->block_search_text)) ? $CFG->block_search_text : "Search Moodle";
|
||||
$button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : "Go";
|
||||
$label = (!empty($CFG->block_search_text)) ? $CFG->block_search_text : get_string('searchmoodle', 'block_search');
|
||||
$button = (!empty($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go', 'block_search');
|
||||
|
||||
//basic search form
|
||||
$this->content->text =
|
||||
@@ -68,7 +72,17 @@
|
||||
function specialisation() {
|
||||
//empty!
|
||||
} //specialisation
|
||||
|
||||
/**
|
||||
* wraps up to search engine cron
|
||||
*
|
||||
*/
|
||||
function cron(){
|
||||
global $CFG;
|
||||
|
||||
include($CFG->dirroot.'/search/cron.php');
|
||||
}
|
||||
|
||||
} //block_search
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,19 +1,146 @@
|
||||
<div style="text-align:center;">
|
||||
<label for="block_search_text">Search label</label>
|
||||
<input id="block_search_text" type="text" name="block_search_text" value="<?php
|
||||
if(isset($CFG->block_search_text)) {
|
||||
p($CFG->block_search_text);
|
||||
} else {
|
||||
p("Search Moodle");
|
||||
} ?>"/><br/>
|
||||
|
||||
<label for="block_search_button">Button label</label>
|
||||
<input id="block_search_button" type="text" name="block_search_button" value="<?php
|
||||
if(isset($CFG->block_search_button)) {
|
||||
p($CFG->block_search_button);
|
||||
} else {
|
||||
p("Go");
|
||||
} ?>"/><br/><br/>
|
||||
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<table cellspacing="5">
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configsearchtext', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_text" type="text" name="block_search_text" value="<?php
|
||||
if(isset($CFG->block_search_text)) {
|
||||
p($CFG->block_search_text);
|
||||
} else {
|
||||
p(get_string('searchmoodle', 'block_search'));
|
||||
} ?>"/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configbuttonlabel', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_button" type="text" name="block_search_button" value="<?php
|
||||
if(isset($CFG->block_search_button)) {
|
||||
p($CFG->block_search_button);
|
||||
} else {
|
||||
p(get_string('go', 'block_search'));
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configenablefileindexing', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="1" <?php
|
||||
if(isset($CFG->block_search_enable_file_indexing) && $CFG->block_search_enable_file_indexing) {
|
||||
echo " checked=\"checked\" ";
|
||||
} ?> /> <?php print_string('yes') ?> -
|
||||
<input id="block_search_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="0" <?php
|
||||
if(!isset($CFG->block_search_enable_file_indexing) || !$CFG->block_search_enable_file_indexing) {
|
||||
echo " checked=\"checked\" ";
|
||||
} ?> /> <?php print_string('no') ?>
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configfiletypes', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_filetypes" type="text" name="block_search_filetypes" value="<?php
|
||||
if(isset($CFG->block_search_filetypes)) {
|
||||
p($CFG->block_search_filetypes);
|
||||
} else {
|
||||
p("PDF,TXT,HTML,PPT,XML,DOC,HTM");
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('usemoodleroot', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<?php
|
||||
$usemoodleroot = (isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
|
||||
$notusemoodleroot = (!isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
|
||||
?>
|
||||
<input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $usemoodleroot ?> value="1"/> <?php print_string('yes') ?> -
|
||||
<input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $notusemoodleroot ?> value="0"/> <?php print_string('no') ?>
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configpdftotextcmd', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_pdf_to_text_cmd" type="text" size="60" name="block_search_pdf_to_text_cmd" value="<?php
|
||||
if(isset($CFG->block_search_pdf_to_text_cmd)) {
|
||||
p($CFG->block_search_pdf_to_text_cmd);
|
||||
} else {
|
||||
$encoding = ($CFG->unicodedb) ? "-enc UTF-8" : "-enc ISO-8859-1" ;
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("lib/xpdf/win32/pdftotext.exe -eol dos $encoding -q");
|
||||
}
|
||||
else{
|
||||
p("lib/xpdf/linux/pdftotext $encoding -eol unix -q");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configwordtotextcmd', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_word_to_text_cmd" type="text" size="60" name="block_search_word_to_text_cmd" value="<?php
|
||||
if(isset($CFG->block_search_word_to_text_cmd)) {
|
||||
p($CFG->block_search_word_to_text_cmd);
|
||||
} else {
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("lib/antiword/win32/antiword/antiword.exe ");
|
||||
}
|
||||
else{
|
||||
p("lib/antiword/linux/usr/bin/antiword");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configwordtotextenv', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_word_to_text_env" type="text" size="60" name="block_search_word_to_text_env" value="<?php
|
||||
if(isset($CFG->block_search_word_to_text_env)) {
|
||||
echo stripslashes($CFG->block_search_word_to_text_env);
|
||||
} else {
|
||||
if ($CFG->ostype == 'WINDOWS'){
|
||||
p("HOME={$CFG->dirroot}\\lib\\antiword\\win32");
|
||||
}
|
||||
else{
|
||||
p("ANTIWORDHOME={$CFG->dirroot}/lib/antiword/linux/usr/share/antiword");
|
||||
}
|
||||
} ?>"/><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
<b><?php print_string('configlimitindexbody', 'block_search') ?>:</b>
|
||||
</td>
|
||||
<td valign="top" align="left">
|
||||
<input id="block_search_limit_index_body" type="text" size="8" name="block_search_limit_index_body" value="<?php
|
||||
if(isset($CFG->block_search_limit_index_body)) {
|
||||
p($CFG->block_search_limit_index_body);
|
||||
} else {
|
||||
p('');
|
||||
} ?>"/> <?php print_string('bytes', 'block_search') ?><br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" colspan="2">
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="blocks/search/db" VERSION="20070811" COMMENT="XMLDB file for Moodle search engine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="block_search_documents" COMMENT="table to store search index backups">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="docid"/>
|
||||
<FIELD NAME="docid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="doctype"/>
|
||||
<FIELD NAME="doctype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="none" SEQUENCE="false" ENUM="false" PREVIOUS="docid" NEXT="itemtype"/>
|
||||
<FIELD NAME="itemtype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="standard" SEQUENCE="false" ENUM="false" PREVIOUS="doctype" NEXT="title"/>
|
||||
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemtype" NEXT="url"/>
|
||||
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="title" NEXT="docdate"/>
|
||||
<FIELD NAME="docdate" TYPE="datetime" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="updated"/>
|
||||
<FIELD NAME="updated" TYPE="datetime" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="docdate" NEXT="courseid"/>
|
||||
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="updated" NEXT="groupid"/>
|
||||
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="mdl_search_docid" UNIQUE="false" FIELDS="docid" NEXT="mdl_search_doctype"/>
|
||||
<INDEX NAME="mdl_search_doctype" UNIQUE="false" FIELDS="doctype" PREVIOUS="mdl_search_docid" NEXT="mdl_search_itemtype"/>
|
||||
<INDEX NAME="mdl_search_itemtype" UNIQUE="false" FIELDS="itemtype" PREVIOUS="mdl_search_doctype"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to MySQL
|
||||
|
||||
function search_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 2006062500 and $result) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
|
||||
//
|
||||
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
|
||||
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
|
||||
//
|
||||
// This file is tailored to pgsql
|
||||
|
||||
function search_upgrade($oldversion=0) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 2006062500 and $result) {
|
||||
$result = true; //Nothing to do
|
||||
}
|
||||
|
||||
////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
}
|
||||
@@ -31,6 +31,81 @@ function xmldb_block_search_upgrade($oldversion=0) {
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
if ($result && $oldversion < 2007071302) {
|
||||
|
||||
/// Define table search_documents to be created
|
||||
$table = new XMLDBTable('search_documents');
|
||||
|
||||
/// Drop it if it existed before
|
||||
|
||||
drop_table($table, true, false);
|
||||
|
||||
/// Adding fields to table search_documents
|
||||
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->addFieldInfo('docid', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->addFieldInfo('doctype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none');
|
||||
$table->addFieldInfo('itemtype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard');
|
||||
$table->addFieldInfo('title', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('url', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('docdate', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('updated', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
|
||||
$table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
$table->addFieldInfo('groupid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||
|
||||
/// Adding keys to table search_documents
|
||||
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
/// Adding indexes to table search_documents
|
||||
$table->addIndexInfo('mdl_search_docid', XMLDB_INDEX_NOTUNIQUE, array('docid'));
|
||||
$table->addIndexInfo('mdl_search_doctype', XMLDB_INDEX_NOTUNIQUE, array('doctype'));
|
||||
$table->addIndexInfo('mdl_search_itemtype', XMLDB_INDEX_NOTUNIQUE, array('itemtype'));
|
||||
|
||||
/// Launch create table for search_documents
|
||||
$result = $result && create_table($table);
|
||||
}
|
||||
|
||||
/// Rename table search_documents to block_search_documents and
|
||||
/// fix some defaults (MDL-10572)
|
||||
if ($result && $oldversion < 2007081100) {
|
||||
|
||||
/// Define table search_documents to be renamed to block_search_documents
|
||||
$table = new XMLDBTable('search_documents');
|
||||
|
||||
/// Launch rename table for block_search_documents
|
||||
$result = $result && rename_table($table, 'block_search_documents');
|
||||
|
||||
/// Changing the default of field doctype on table block_search_documents to none
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('doctype');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none', 'docid');
|
||||
|
||||
/// Launch change of default for field doctype
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field itemtype on table block_search_documents to standard
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('itemtype');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard', 'doctype');
|
||||
|
||||
/// Launch change of default for field itemtype
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field title on table block_search_documents to drop it
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('title');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'itemtype');
|
||||
|
||||
/// Launch change of default for field title
|
||||
$result = $result && change_field_default($table, $field);
|
||||
|
||||
/// Changing the default of field url on table block_search_documents to drop it
|
||||
$table = new XMLDBTable('block_search_documents');
|
||||
$field = new XMLDBField('url');
|
||||
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'title');
|
||||
|
||||
/// Launch change of default for field url
|
||||
$result = $result && change_field_default($table, $field);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$string['blockname'] = 'Global Search';
|
||||
$string['configbuttonlabel'] = 'Button label';
|
||||
$string['configenablefileindexing'] = 'Enable file indexing';
|
||||
$string['configfiletypes'] = 'File types handled';
|
||||
$string['configlimitindexbody'] = 'Indexed body size limitation';
|
||||
$string['configpdftotextcmd'] = 'Path to command pdftotext';
|
||||
$string['configwordtotextcmd'] = 'Path to command doctotext';
|
||||
$string['configwordtotextenv'] = 'Environment setting for the MSWord converter';
|
||||
$string['configsearchtext'] = 'Search text';
|
||||
$string['go'] = 'Go!';
|
||||
$string['bytes'] = ' bytes (0 stands for no limits)';
|
||||
$string['searchmoodle'] = 'Search Moodle';
|
||||
?>
|
||||
+2
-2
@@ -8,7 +8,7 @@ $id = optional_param('id', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab - does nothing here
|
||||
|
||||
require_login();
|
||||
require_login($courseid);
|
||||
|
||||
if (empty($CFG->bloglevel)) {
|
||||
error('Blogging is disabled!');
|
||||
@@ -361,4 +361,4 @@ function add_tags_info($postid) {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
+6
-2
@@ -74,7 +74,7 @@ switch ($filtertype) {
|
||||
}
|
||||
$courseid = $course->id;
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course');
|
||||
}
|
||||
@@ -94,7 +94,7 @@ switch ($filtertype) {
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$courseid = $course->id;
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course/group');
|
||||
}
|
||||
@@ -131,6 +131,10 @@ switch ($filtertype) {
|
||||
}
|
||||
$userid = $filterselect;
|
||||
|
||||
if (!empty($courseid)) {
|
||||
require_login($courseid);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+10
-3
@@ -433,7 +433,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_COURSE_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
if (!empty($shared)) {
|
||||
@@ -443,7 +443,7 @@
|
||||
break;
|
||||
|
||||
case BLOG_GROUP_LEVEL:
|
||||
$mycourses = array_keys(get_my_courses($targetuserid));
|
||||
$mycourses = array_keys(get_my_courses($USER->id));
|
||||
$usercourses = array_keys(get_my_courses($targetuserid));
|
||||
$shared = array_intersect($mycourses, $usercourses);
|
||||
foreach ($shared as $courseid) {
|
||||
@@ -568,13 +568,20 @@
|
||||
// all users with a role assigned
|
||||
$context = get_context_instance(CONTEXT_COURSE, $filterselect);
|
||||
|
||||
// MDL-10037, hidden users' blogs should not appear
|
||||
if (has_capability('moodle/role:viewhiddenassigns', $context)) {
|
||||
$hiddensql = '';
|
||||
} else {
|
||||
$hiddensql = ' AND ra.hidden = 0 ';
|
||||
}
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = ra.userid '.$tagquerysql.'
|
||||
AND ra.contextid '.get_related_contexts_string($context).'
|
||||
AND u.id = p.userid
|
||||
AND u.deleted = 0
|
||||
'.$permissionsql.$typesql;
|
||||
'.$hiddensql.$permissionsql.$typesql;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user