Compare commits
1973 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65d75e1ba0 | |||
| 5592bd1276 | |||
| 8461061743 | |||
| c7d59ba103 | |||
| 01194e5659 | |||
| 3b2fbd7f2a | |||
| 804b2c9b2a | |||
| 7199229e75 | |||
| e02f1a7a5a | |||
| 0b547d9d9f | |||
| ca49f636b6 | |||
| a1c6b65182 | |||
| 41c92ff555 | |||
| c02629eacc | |||
| 43a630cee5 | |||
| 506ebce3b5 | |||
| 66705bc9e6 | |||
| c2014af3f8 | |||
| e7b5ef8566 | |||
| 47cac9922a | |||
| 77d6c3e061 | |||
| ffe7588d45 | |||
| 7171099926 | |||
| ff933bfa8f | |||
| 6939b5c1a4 | |||
| b5469f78cb | |||
| 8cc0d4ef93 | |||
| 7e6369972d | |||
| 2c81d559bd | |||
| 11e09e01aa | |||
| 4d2cf40ef9 | |||
| bee3f66eb0 | |||
| 42a7f43ee2 | |||
| 604ecf1515 | |||
| e7dd9cd247 | |||
| e32fa5fdb1 | |||
| 50689ece08 | |||
| 9ea5a54685 | |||
| 1c0cdbf585 | |||
| 1119468291 | |||
| ee8c88d560 | |||
| a746558c7b | |||
| 044410476a | |||
| c9e3c4eb64 | |||
| ce51dc43bd | |||
| 567952799e | |||
| abec7edecb | |||
| 21fc085746 | |||
| e1413627d5 | |||
| 7e94839b54 | |||
| f695451963 | |||
| 2e83ee535a | |||
| 0612a16255 | |||
| bdcc2476cf | |||
| 3f6ce53dea | |||
| 30ca2004f6 | |||
| 094593edb4 | |||
| 950d680645 | |||
| 2cc212c4fd | |||
| 2da979b64d | |||
| eb80e65d98 | |||
| 1917283bb5 | |||
| 36e5204979 | |||
| 3fce89ce50 | |||
| a7e3612d84 | |||
| cff71947e6 | |||
| 87511275ad | |||
| 46736d842a | |||
| 3d27822071 | |||
| d73dc24f17 | |||
| 32ace66be6 | |||
| 28d3cd6e8e | |||
| 58ae23893b | |||
| d319920857 | |||
| 76254c0477 | |||
| 3be9343138 | |||
| c917b1a105 | |||
| a028e77e30 | |||
| 08369b8511 | |||
| 1aa4084b07 | |||
| 5e8a3df88e | |||
| ba45bd83d8 | |||
| e71850acb6 | |||
| be508b4cf8 | |||
| 9b72cbf773 | |||
| 0cd4cd2961 | |||
| eaaed6e6f4 | |||
| ffcbae6150 | |||
| cc9bf1486e | |||
| 17b2352193 | |||
| b877ae6d21 | |||
| e45cfdec20 | |||
| b4e1433d38 | |||
| 8885e891f0 | |||
| f66815e06a | |||
| 8058ca4fb2 | |||
| 7d6b6b1a16 | |||
| a0b1f3342b | |||
| 13000c1379 | |||
| 899ccfe26f | |||
| 2a04f622fb | |||
| 8fe8df969e | |||
| 32bf9c271e | |||
| 3dc9d883ab | |||
| d5c0dec1cd | |||
| 103965d609 | |||
| b6feb2ab78 | |||
| 49f9224222 | |||
| ea4c27489e | |||
| 82891a2810 | |||
| c82c86d3ea | |||
| 8227e923fd | |||
| 44ac2f4d89 | |||
| cbe97e2692 | |||
| fa748dcdd1 | |||
| 1c79d89a7e | |||
| 65e428397d | |||
| d20f688bbb | |||
| cf3ea39a4f | |||
| 57317806b9 | |||
| ccbe95b8cd | |||
| 4efcefd50f | |||
| 2c52512f16 | |||
| e5fab0d257 | |||
| 394b4069b1 | |||
| b3f87b6b1a | |||
| e2b00e8ac1 | |||
| 5eb7c5195b | |||
| 2d7baa2ab2 | |||
| 7906cb1617 | |||
| 58b6781967 | |||
| 2832c32c6b | |||
| 79feabdc54 | |||
| 87a2d989ba | |||
| 77974be16f | |||
| 98cf5b5527 | |||
| 8630b7b8fa | |||
| 1b398350cf | |||
| 9aac0bdfb1 | |||
| f5a117e6ec | |||
| 997d166f7b | |||
| 306e9a5057 | |||
| 1473dd77c3 | |||
| 0e370c6489 | |||
| 1d24da74e8 | |||
| 286df7a18c | |||
| a7e39a4f82 | |||
| d5fa0471c5 | |||
| 71524486db | |||
| 10b7c5f95c | |||
| 45890b7eb4 | |||
| 28693deac8 | |||
| 73ec97c06b | |||
| d3d3cb86d6 | |||
| e68b133d62 | |||
| 0a779261c8 | |||
| b2fbd411d9 | |||
| 0b18091590 | |||
| f5a764a35c | |||
| 5c18bc078d | |||
| f2a19d7601 | |||
| 58e3d68846 | |||
| c93c4acefe | |||
| 82175fb502 | |||
| bb04106c41 | |||
| f7e96073b4 | |||
| 17e070e261 | |||
| 9d4222bb7f | |||
| d2f4b686fd | |||
| bb66bc469c | |||
| 527b1d3474 | |||
| 15f4610a57 | |||
| e613a1aacb | |||
| 0ea8ab74a2 | |||
| 66fbfc95b7 | |||
| b74316986b | |||
| a33b386e79 | |||
| d3d4056087 | |||
| ac04258a92 | |||
| 6326668d2b | |||
| 168bbfa435 | |||
| 5aa35fd087 | |||
| 4f810e39ad | |||
| 66d48264d0 | |||
| 2a5c20e237 | |||
| c99691f2de | |||
| 97f4847f35 | |||
| 5ae1e401db | |||
| 3e1bc1a46e | |||
| ee756bc391 | |||
| d36f86fc03 | |||
| a69f581c04 | |||
| 4fb64b5080 | |||
| 0719032352 | |||
| 143432338d | |||
| b000fba3c1 | |||
| 21cd910eb5 | |||
| 13ea07e24c | |||
| c65318bd3c | |||
| 97ac6f03aa | |||
| 1092a6d6c1 | |||
| d104b078a4 | |||
| 40ab2ed04b | |||
| f75507dadb | |||
| 0462087db7 | |||
| 7731eb7005 | |||
| 0bc4b09a66 | |||
| 23a7afd437 | |||
| 3a3045381d | |||
| 5cb48efd23 | |||
| c006a6305f | |||
| 818f68c0b8 | |||
| 985d26e786 | |||
| 2e7e59534c | |||
| 831e05b5a3 | |||
| 20821341eb | |||
| 0e8aa76a78 | |||
| 9f546911c2 | |||
| fac0662c6a | |||
| 6ea03ceca0 | |||
| c97c2b4ae9 | |||
| bec2148597 | |||
| aeb1e82ae5 | |||
| 500fa33277 | |||
| b703522d82 | |||
| b18525e3d4 | |||
| 461ca1b47e | |||
| 96ff52548d | |||
| a951a3a7cc | |||
| 66fea43d40 | |||
| b0f7cd073d | |||
| 7293bce7d7 | |||
| 7fd4f2f030 | |||
| 4393d509c0 | |||
| 251cc9e515 | |||
| 40c0a21f4e | |||
| c615c8b9b5 | |||
| 54f356203f | |||
| d83cdd1609 | |||
| 56aaef4dbf | |||
| b0e8c9d07c | |||
| 060a865087 | |||
| 3d36b7246f | |||
| 9b246f1366 | |||
| 02ae9049cf | |||
| 16d9e060b0 | |||
| c2e702dff9 | |||
| 94fe495c71 | |||
| b7fb958d30 | |||
| e8782e1a01 | |||
| 229ae9efc9 | |||
| ee5719014c | |||
| 73d0da2e76 | |||
| acb51756b2 | |||
| 3a37bc3182 | |||
| bae9a29ec2 | |||
| b8164f8b9e | |||
| 53c84c37c7 | |||
| 9a73229511 | |||
| 7e6e79a1a8 | |||
| 544a530e19 | |||
| bc3a9fff93 | |||
| 1c081ac632 | |||
| e2c9778fe7 | |||
| 0ae4106150 | |||
| f4ac741224 | |||
| 6909a0e410 | |||
| ccd99f576a | |||
| 581b14ecb7 | |||
| 3b386129c2 | |||
| 5e9fe46559 | |||
| 12acacebcd | |||
| a0eeecc7fb | |||
| 28ca97e6a7 | |||
| af65bb7957 | |||
| f49b1e379b | |||
| d9933413df | |||
| c9f6ccb2a0 | |||
| 3eb24a6e69 | |||
| 31f4ca3c15 | |||
| 4fb49dda67 | |||
| 5673c270ff | |||
| a6bac1a193 | |||
| 6338f9cac1 | |||
| 00e89cf2b7 | |||
| 6c0db78af0 | |||
| a428f715d7 | |||
| e20ea4cde6 | |||
| 4acd575cad | |||
| bb53eb49a8 | |||
| 2c0c202e55 | |||
| 98e60173a9 | |||
| 0bba3204fd | |||
| 94d30966ac | |||
| 1eb458f54d | |||
| 84885b9bda | |||
| cc3919d0bc | |||
| e4387c5776 | |||
| dac1b1cae2 | |||
| 3d9e194de6 | |||
| 5935cf5e66 | |||
| bc7f2e4944 | |||
| d3b195eed6 | |||
| 286ef9f6ac | |||
| d364e38b6a | |||
| f9318e82f9 | |||
| ed87f95535 | |||
| 9392abebd4 | |||
| 1e3d1148a3 | |||
| 3b6165a5d0 | |||
| d48a52d6b4 | |||
| 546eb4274c | |||
| 75d816bc7e | |||
| 8befb03723 | |||
| a1f5200104 | |||
| d8301555cd | |||
| 4914c939c6 | |||
| 2d3921b478 | |||
| e4f3c89ef6 | |||
| b92200dbc4 | |||
| 3d0f39ea96 | |||
| 05e2f6577b | |||
| 80b4f1e8d2 | |||
| 5e229d0e1b | |||
| 0a53e4b12c | |||
| dcb74f68c7 | |||
| 69bac29715 | |||
| b3f225c67d | |||
| 4ebc71d941 | |||
| e31d919deb | |||
| 11c82f1398 | |||
| 16bff0af46 | |||
| 13f7a01401 | |||
| 713324b8c4 | |||
| 3208d06283 | |||
| b12910d6f0 | |||
| a2816b7447 | |||
| 538c7feb3f | |||
| 8623f5d34f | |||
| bc738a326f | |||
| 2235d76688 | |||
| 81bd4c1d1a | |||
| 2ca60d4f84 | |||
| e0cd8349ff | |||
| 8b28857e69 | |||
| 4baced6731 | |||
| f5661d4525 | |||
| 1285f57c2e | |||
| e21b71f60a | |||
| c2678149c1 | |||
| fd0da9afbb | |||
| 150d7176ca | |||
| 6a55040085 | |||
| c6ee79ca86 | |||
| 0b50c5356f | |||
| 8a254e7138 | |||
| be6ca627f5 | |||
| e9a84e1016 | |||
| 2601887ca9 | |||
| 8ee39d43a8 | |||
| f07e38fbca | |||
| 64954387a6 | |||
| 0d14cbbe2b | |||
| 7662ce86ea | |||
| c69e659c45 | |||
| da7fac00ea | |||
| 4a762cb514 | |||
| 3e0b46f9dc | |||
| 52f18993ad | |||
| c5d843ede8 | |||
| e51a39cf34 | |||
| 55e92195ba | |||
| c589f054b4 | |||
| 79c5abb5d2 | |||
| 5253457317 | |||
| 871ba32077 | |||
| 3511770629 | |||
| 386c21b708 | |||
| b9aa74c7f5 | |||
| 537172328a | |||
| f4f0229152 | |||
| d01506b312 | |||
| 8b26c8fb4e | |||
| 7e62718e7c | |||
| 61f34d4260 | |||
| d7743238e5 | |||
| 838069d4fc | |||
| 11a61fa8eb | |||
| 81e31feeeb | |||
| 6c68f8a4a8 | |||
| a59f281522 | |||
| d60e730bbb | |||
| f5a5d102ca | |||
| 32b8a389a1 | |||
| cc09c0d071 | |||
| 797f4e9f89 | |||
| e06c28f04a | |||
| 5a3288003e | |||
| 1f3d624490 | |||
| 1e01c44eea | |||
| 897065d9dd | |||
| 562c7feb2d | |||
| ce1648f481 | |||
| dd513e0b70 | |||
| 913d8d935c | |||
| 43f0cd8eae | |||
| a6475bc27e | |||
| 516ca02e7e | |||
| 58208f5511 | |||
| f95efc39a5 | |||
| a82fa6146a | |||
| 062b672983 | |||
| 87ca8583aa | |||
| a4b1ac3b0d | |||
| 735f76f0f4 | |||
| cd6eda7ea8 | |||
| 48fd1cf621 | |||
| c5caa7199d | |||
| 8f3f4373dd | |||
| edf57f60fc | |||
| 8f1f4924b1 | |||
| 054ff00c61 | |||
| 6e5cdb10d4 | |||
| 80c6222023 | |||
| 65c1d6dde0 | |||
| 92aad49de4 | |||
| bd524b5471 | |||
| a1a7801540 | |||
| c72e019be4 | |||
| 74c810d36c | |||
| da52163058 | |||
| e92cdcdbd9 | |||
| a0e7eaaa11 | |||
| 8435575b16 | |||
| 73caeda7a2 | |||
| aad356e1ab | |||
| 4999b4216e | |||
| 4485ad9fe3 | |||
| f62ff28387 | |||
| 272a1af077 | |||
| 6d3cdc95c3 | |||
| 2064c7c223 | |||
| d893d6ebf0 | |||
| 5ef153b5b4 | |||
| 19486aae82 | |||
| 782acecf7d | |||
| 498b0ade38 | |||
| 6885225a8e | |||
| 1846d0a2c2 | |||
| f9c6edc8da | |||
| d19db94df3 | |||
| 9330f3e1fa | |||
| 8a30c5bec2 | |||
| e073353ff2 | |||
| b7e6e7a119 | |||
| 13733eb075 | |||
| 99b8fb5541 | |||
| 6ac660f4ac | |||
| 63dcec6662 | |||
| efdcc40927 | |||
| 8a6afdde27 | |||
| 0fece2d628 | |||
| e0734f6277 | |||
| 2e3a3337b1 | |||
| ebf0aeec86 | |||
| e875530645 | |||
| b475fec548 | |||
| 7eb7ca6786 | |||
| ef62ec7c66 | |||
| 06b9f960de | |||
| 1992b70a32 | |||
| 7eb43d9d01 | |||
| f8b6fda2a7 | |||
| 5bb3fdc73d | |||
| 93a4a32e2e | |||
| 7a38e689f2 | |||
| 5ba0a8b71e | |||
| 1e3f87b91e | |||
| b17cc53447 | |||
| cf7f20fc54 | |||
| 365b745202 | |||
| db8d52b560 | |||
| 602572d131 | |||
| 71186e4168 | |||
| 627e2cb6f5 | |||
| 0b75065449 | |||
| 63bcf21fbf | |||
| fc5e568fbf | |||
| 5194a4f938 | |||
| 82e0a886c2 | |||
| e57069e318 | |||
| c26c206276 | |||
| 8a16c85e8c | |||
| bdb0e3e233 | |||
| 97f4bb9fde | |||
| 02d0084a51 | |||
| 5af25dd922 | |||
| 665ba7679d | |||
| 0b32c364a1 | |||
| e041c56184 | |||
| dbc804de90 | |||
| 07715b2c5e | |||
| 04a3e8b1f0 | |||
| ab9cba84ae | |||
| f374ad64d1 | |||
| 435c0a785b | |||
| e5c825ab8a | |||
| c4c28a7468 | |||
| abf7d22073 | |||
| 48f1234896 | |||
| defb0f64f0 | |||
| f2f07143e3 | |||
| 0759221a5e | |||
| 3744e9ef24 | |||
| 0455e362ae | |||
| c5f0168382 | |||
| cc980ff6e5 | |||
| 65dc989055 | |||
| 38d739257d | |||
| 2c16f768ed | |||
| 254dfd1f0f | |||
| d944e872b7 | |||
| 1e1e2438c6 | |||
| 32579e3d1c | |||
| ed16449ba6 | |||
| 0c6b31f211 | |||
| 867ab98575 | |||
| b4de8efe5d | |||
| ea9700180d | |||
| 8e07f16724 | |||
| aa54c77cf7 | |||
| 02875a7622 | |||
| c6c934b578 | |||
| f0e870d0cf | |||
| c54c59e7d8 | |||
| 32af0dbef2 | |||
| 3da1e9c5f4 | |||
| 206c91a1c4 | |||
| 44bba1e66c | |||
| 62d6eb1f83 | |||
| c1dfbdaea4 | |||
| f38b8c88bf | |||
| 6e8e2bb04c | |||
| 988e9b0f64 | |||
| 7d80c9a0fe | |||
| 619c19d863 | |||
| 13eef19b99 | |||
| 50a8e2b90c | |||
| ddf17a0c4e | |||
| d84da076cc | |||
| c8b5ebc8e3 | |||
| d749b452d3 | |||
| ef1720eb6f | |||
| b95a25b7a8 | |||
| ec53ceed49 | |||
| c157c72d4c | |||
| 3835cc29f3 | |||
| aa44e74ce3 | |||
| 9300321849 | |||
| 64511f27aa | |||
| 522e4ab8c3 | |||
| 0ad6f487be | |||
| 255b8281b6 | |||
| d5e89c7964 | |||
| 906faa5a1f | |||
| f038db5c7c | |||
| fff59beb90 | |||
| 6e5dfc1b4b | |||
| d448df5a1c | |||
| 4bfc6cbdfd | |||
| c99f31c86b | |||
| 89eedbe1cb | |||
| 60c540f5a6 | |||
| 345a24669b | |||
| 87806bd4bc | |||
| 0d47dafb08 | |||
| 105eb2d512 | |||
| bd68242fb0 | |||
| bf4dde1e29 | |||
| 2340efe201 | |||
| aa87f6cb14 | |||
| 571709c448 | |||
| bec23ebe9c | |||
| e88e09a1f1 | |||
| 12d3294e0a | |||
| 4ec9d6b07d | |||
| dc5f29bf8c | |||
| 0088d8ce7e | |||
| a90d5b6082 | |||
| c9af47a031 | |||
| f7a197e8fa | |||
| 623e2d59d1 | |||
| e0260731dc | |||
| 1282d92329 | |||
| 1fdfed864f | |||
| 4bf780bf99 | |||
| 240363ac49 | |||
| c68631a272 | |||
| e5b7520dce | |||
| 4b51c3fb2f | |||
| d8bfab810c | |||
| 242f42a49f | |||
| f2d7523e1d | |||
| a1b6cb7da4 | |||
| 1f56978e1a | |||
| 8c4f5bc33f | |||
| 1f72738c04 | |||
| c6d9053948 | |||
| 274a1cc850 | |||
| 9165153bd3 | |||
| a478b383cd | |||
| 4e4955b55e | |||
| fb7e6a9a0d | |||
| 62f0cff4ce | |||
| 4c9c6f0ddb | |||
| 4bea11eae5 | |||
| 740972a826 | |||
| a53b72f516 | |||
| 224ac0b90f | |||
| f6fd87d97b | |||
| 7fa260c83c | |||
| 877f1e2485 | |||
| a17912002b | |||
| a9aaede659 | |||
| d2436bf26b | |||
| 3fa20034ae | |||
| 2e13c2864f | |||
| 15a9e839f2 | |||
| 847bb2fd19 | |||
| 6d139a20d6 | |||
| a262b1c15e | |||
| 302348cb4d | |||
| d183669cc1 | |||
| 6c1f6b016d | |||
| 983927938a | |||
| 7cfae72475 | |||
| 5e195c8235 | |||
| b1fbc8be30 | |||
| f7fa56821d | |||
| 62b4a55e5c | |||
| 8fb75b1d7a | |||
| c5ade93e96 | |||
| dcbdab7312 | |||
| 933b96a3a8 | |||
| 490e14d6cc | |||
| 93f1172f98 | |||
| e19a4892a9 | |||
| 5f75ca701e | |||
| b5655a6578 | |||
| 9a825e9082 | |||
| ecca8c346b | |||
| f057ecd40c | |||
| 418deec57c | |||
| 73254d7861 | |||
| 3f9e92b025 | |||
| 1f3ef341bd | |||
| c607a0ea03 | |||
| a83cdea8e3 | |||
| 6792aa17f6 | |||
| 63620c1d78 | |||
| 218ff7fb75 | |||
| 0680a761f7 | |||
| 43d67c7d22 | |||
| 5b526573d0 | |||
| 8fc7b48708 | |||
| c03ace0bdb | |||
| 9c29e6bfc6 | |||
| 27e053a25a | |||
| 1d64431c90 | |||
| f02cc7bf03 | |||
| 8e3391e166 | |||
| 165d5ca1a3 | |||
| 743fd57f2c | |||
| 7527707dd5 | |||
| 2eedb5babd | |||
| fa31cbab04 | |||
| 9ea6e88ff2 | |||
| a2c075aaac | |||
| 7387acb1e0 | |||
| 8e3cb48829 | |||
| 19161949aa | |||
| 5d3a303539 | |||
| 39a3b2af0f | |||
| 5d23030fc8 | |||
| 94446a8d68 | |||
| a9b2d797dc | |||
| ed7646af01 | |||
| e7dc0e4f15 | |||
| 95151a7493 | |||
| f6b8d22716 | |||
| cc518e4615 | |||
| e8b3db0f95 | |||
| 9d3e59b7ba | |||
| 7f3981ef41 | |||
| 4d16e6f650 | |||
| 6962ab2a64 | |||
| 5fa8b35428 | |||
| 6c831d73d3 | |||
| bfe239f1e6 | |||
| b2c1183316 | |||
| 7b518b7227 | |||
| 66c041bd00 | |||
| 9db58d015f | |||
| 1be35acd87 | |||
| 34e3e0b732 | |||
| cede8c8fa3 | |||
| 0df32c07c7 | |||
| 390b1cf724 | |||
| 4d7928e235 | |||
| 32f87cd80f | |||
| 1cf107ac7d | |||
| c251af9516 | |||
| 8005dfec30 | |||
| c393c9a44c | |||
| c2697aeeb2 | |||
| 0283b62467 | |||
| 17a0ab80ed | |||
| 210a02693d | |||
| 9acd97389e | |||
| dca379c260 | |||
| 48b58815eb | |||
| c913f22058 | |||
| c66edc0c29 | |||
| 90ffb070d0 | |||
| 37d795053c | |||
| 33df4820bf | |||
| 73ef9f11ba | |||
| 70e5759150 | |||
| 8a942e9c79 | |||
| 5774e05b33 | |||
| 90aab3868b | |||
| 3d70d2f8df | |||
| db75ffa618 | |||
| 56cab517e9 | |||
| d4f421493b | |||
| ad1630ae86 | |||
| 0445685775 | |||
| 7894f66662 | |||
| 82a3bbd629 | |||
| 6e695a1f4e | |||
| f978083108 | |||
| 4c3a837f21 | |||
| 970ea98196 | |||
| ca4fc3a908 | |||
| 489b2e19de | |||
| c6bd449dea | |||
| f1591379e8 | |||
| 54d264ea7c | |||
| f69f513d28 | |||
| ec7a9479f9 | |||
| d35218a111 | |||
| 394cc4a484 | |||
| db15d5d552 | |||
| 0d2ee05aa1 | |||
| 4eb9d73cc7 | |||
| 6b52c45e95 | |||
| 99f7c8df47 | |||
| 2192e94ef2 | |||
| b0e7781eb8 | |||
| 069dbaa91e | |||
| 6a971ac82a | |||
| b219363c03 | |||
| a148872083 | |||
| 0ca23ab0d6 | |||
| 7177a7a93d | |||
| 736956b1d0 | |||
| 3e26020006 | |||
| 25effd9682 | |||
| 020ce4787f | |||
| 3580b97516 | |||
| 6ad7a2da89 | |||
| 193cc59ca3 | |||
| 7c013eab3f | |||
| 0d003551eb | |||
| 07c92f644f | |||
| a1dc1a26db | |||
| ce6d939f26 | |||
| 493288848b | |||
| 77d587b42e | |||
| d186e24dff | |||
| 139fa3dee6 | |||
| 3f35d9da9d | |||
| 61faff2eec | |||
| c0d5964594 | |||
| e72a18576f | |||
| b18e27ea93 | |||
| ee8dd77019 | |||
| 350d29e7d8 | |||
| e8206e91b4 | |||
| 986f2bc884 | |||
| 1170f42f3a | |||
| 2054096041 | |||
| 4a04703937 | |||
| f733a88518 | |||
| 9f18286f31 | |||
| d23e60ad43 | |||
| 3c6a14ee12 | |||
| 69c6d6ca42 | |||
| 3af0788f9c | |||
| 9676a2860c | |||
| 2888dc67e1 | |||
| 71c3e668a5 | |||
| b678200478 | |||
| dfd0732d37 | |||
| 31b8823ff3 | |||
| 5e20081493 | |||
| 4e3b92aecc | |||
| e6edcdaff7 | |||
| 3c14b202eb | |||
| 763d96c685 | |||
| c90bfc60d2 | |||
| 91b3b50d28 | |||
| c3801e8c66 | |||
| e418ebf500 | |||
| ba6b4afc8b | |||
| e15dace905 | |||
| a648c81aac | |||
| 1a46de2f48 | |||
| 74680e68ed | |||
| 9e7d048f50 | |||
| 465679ab04 | |||
| f8e7cfb677 | |||
| 9306b4f5c5 | |||
| 1aeb49ce6e | |||
| 913f427e3b | |||
| e41ba00a95 | |||
| 557ab204c0 | |||
| 5125790ba9 | |||
| ca2b78b2d9 | |||
| 3a23a33f2a | |||
| 2624b8cfb2 | |||
| 58b44a97b8 | |||
| fb8f96c38d | |||
| 957e659644 | |||
| 139f64ab4c | |||
| ad5903f32c | |||
| 255d79e8bb | |||
| f82d20ef83 | |||
| cc455ee55f | |||
| 2612942b3f | |||
| 741af83691 | |||
| e19d0aa40c | |||
| a770bee3b4 | |||
| 9ae6f20211 | |||
| b2a7f16b29 | |||
| 7e380f7a62 | |||
| 0564d9f348 | |||
| e249546b1f | |||
| 13aac2d528 | |||
| 73018ff695 | |||
| dca6c88184 | |||
| 407dddf80a | |||
| 4c13c8322e | |||
| 5b3a9f3add | |||
| ace21471a1 | |||
| f6fea7895e | |||
| d54f58e745 | |||
| 20654b5f22 | |||
| ea99602131 | |||
| 00d541cb6f | |||
| 1b1d73538f | |||
| 1bbbf98c7b | |||
| f5f2ac2a84 | |||
| 98925bbd7f | |||
| 237287ac73 | |||
| 18aa02efdd | |||
| 48f758e26d | |||
| 9f01a22de1 | |||
| 0e247d1d4f | |||
| c7642843ba | |||
| 698945eb18 | |||
| 45efd8efad | |||
| 3816ad3b25 | |||
| 632859fca9 | |||
| ba83cc409d | |||
| 68abb79baf | |||
| 0538ad9c0c | |||
| 2e094399fd | |||
| 4c65f3cd14 | |||
| b7d40f71bc | |||
| edc70eac69 | |||
| a5ba72c655 | |||
| 3d7b0284aa | |||
| 96ed80ac0d | |||
| bbfd4e747b | |||
| 08570d71d5 | |||
| 550af6d0d2 | |||
| 931d8ad7c1 | |||
| 7bab64e437 | |||
| c7ad4ebfe4 | |||
| a45e98117b | |||
| a4b578acba | |||
| 8f55f04cae | |||
| f35e2e78bd | |||
| a3f57335a6 | |||
| 1d29db2505 | |||
| 4d6f2b14bf | |||
| ed5cf1be35 | |||
| bd7b9afc2b | |||
| 8bb45b3018 | |||
| d21d4c769c | |||
| 9ebf1ff327 | |||
| 02aad242c2 | |||
| 0cc6a219c4 | |||
| 7987cbb64c | |||
| 0345ccddab | |||
| f89efbdcd7 | |||
| ab3b0e99bc | |||
| 564c86821e | |||
| 61b8c43f38 | |||
| f39309cba8 | |||
| f1be9a633d | |||
| 74226d322e | |||
| 1f5f554d2b | |||
| b671a8f0aa | |||
| aa2b1ba10d | |||
| 094a70b7a1 | |||
| acbbc1e3d3 | |||
| 8794dfd840 | |||
| 325d9bd4d6 | |||
| a671e19ae8 | |||
| fbc1f0e5ba | |||
| ab84aff0ec | |||
| 85b22635ac | |||
| f1678f0ed1 | |||
| 857570c420 | |||
| f07e806dd8 | |||
| 556e66c964 | |||
| 0cc7163e28 | |||
| 3b384c750f | |||
| 28580a7575 | |||
| 02671df098 | |||
| 141dd0001f | |||
| 011bdd6a6c | |||
| 71b860de73 | |||
| 0e4d297634 | |||
| 45a8715ca3 | |||
| 9fe384b2f4 | |||
| 00611f4a3e | |||
| 1aae2de951 | |||
| 97578db412 | |||
| 80f7917245 | |||
| 14bb4c1ad9 | |||
| 5fe44967f8 | |||
| 9c2e402dd8 | |||
| 5c3a8f2654 | |||
| 85becf9549 | |||
| 8218ad778c | |||
| 2a0280735f | |||
| de09e4e445 | |||
| 78356e70e8 | |||
| e23cfada9c | |||
| b6e64bdc3f | |||
| 49022d40e1 | |||
| c40ff3464d | |||
| 4f569a8a67 | |||
| 31620715c6 | |||
| b685c67b66 | |||
| a8ee70a946 | |||
| bb0d1297d8 | |||
| e9b129a6a4 | |||
| 0872afb8d2 | |||
| 8bafccf4c4 | |||
| cb856ad077 | |||
| eb791e1258 | |||
| 30e04e5e2a | |||
| 42fd1a8187 | |||
| 654689ef2d | |||
| a312c55950 | |||
| 1406339b9f | |||
| 1a139531bf | |||
| ec74ba1539 | |||
| d1a734f2e3 | |||
| 5508ecf266 | |||
| 5bf4ae7fdb | |||
| c602026c33 | |||
| 8ca823ad43 | |||
| 1674b69f3c | |||
| 59c1249cae | |||
| 2a8167fcc1 | |||
| 063970335d | |||
| 072758e96a | |||
| d43aa0e36a | |||
| 0ffeb32266 | |||
| 3854fcb9f6 | |||
| d10296c0e1 | |||
| 14316a329b | |||
| 2cc8826edb | |||
| 9e864f2546 | |||
| 1a92acfb1b | |||
| a3c6822887 | |||
| a64573c79c | |||
| 4c15367f44 | |||
| 0153d1b515 | |||
| 3c2e8010af | |||
| 151744819b | |||
| 77cd174025 | |||
| a2ae4ee63b | |||
| 388370bf88 | |||
| 116c28e0e9 | |||
| 87b8241498 | |||
| f5024e6deb | |||
| fb56caace7 | |||
| 56ae2b7f26 | |||
| 643e83fd60 | |||
| 50ea3cc486 | |||
| 823844e709 | |||
| 779de749eb | |||
| 99312493b6 | |||
| 0f4aa108d9 | |||
| 8e6e45aa1a | |||
| 040ea6d217 | |||
| 2e47bfb16b | |||
| 3702d88a6e | |||
| 185441df1a | |||
| 1394c591c6 | |||
| 278b82afec | |||
| 5842492ff6 | |||
| c335b24901 | |||
| 3e70580216 | |||
| ae3071a0df | |||
| d778032a9e | |||
| 9d88867d0f | |||
| 49d4be8ba5 | |||
| 7ca341ae94 | |||
| b16206af1c | |||
| 741859448b | |||
| fd6024c0be | |||
| 9037920594 | |||
| 203968ccae | |||
| 9eb290680b | |||
| 1510c6c913 | |||
| faed109b67 | |||
| a0a264068f | |||
| 8db9017fd8 | |||
| 96b4500a91 | |||
| 2fbc9fcb8b | |||
| f9085923a2 | |||
| c612c32231 | |||
| f8d1a60893 | |||
| 947c93bc0a | |||
| f63a256c87 | |||
| cdfbc956fc | |||
| 9922fbf9d6 | |||
| 31df961fd2 | |||
| 288b5b4028 | |||
| e94ed1ae6e | |||
| 57be0ec8f7 | |||
| 1b7d1827de | |||
| b10c986edc | |||
| 18dd81c215 | |||
| 2468aba863 | |||
| c4826181c8 | |||
| 54ad70b035 | |||
| 66feb0092d | |||
| c852b07683 | |||
| 133e54629f | |||
| 7d9881cdea | |||
| 95ae6fbf1f | |||
| 169d90353f | |||
| dd6f51b926 | |||
| 8dea9afdee | |||
| 91b1bf8572 | |||
| 948cff69a6 | |||
| 1f1df4b191 | |||
| df226eb12d | |||
| 88d8fff6d7 | |||
| afd64674a5 | |||
| 26eee29f1e | |||
| 3c6767e8ad | |||
| 5bdab31478 | |||
| e883fe1ab2 | |||
| fa6947c2cd | |||
| 8536a9fbc6 | |||
| 19a7b0aaff | |||
| d3b10b9746 | |||
| 38aa918f2f | |||
| 3a9ad62295 | |||
| efd1898dc0 | |||
| 719faf3548 | |||
| e155f2040b | |||
| ec8d4ea9cd | |||
| 0425032153 | |||
| d00f6bbccf | |||
| 2e43c17e57 | |||
| 8d7c19f5d1 | |||
| e99f828c35 | |||
| 5d65584d34 | |||
| 92cb423293 | |||
| 7c3f0706a0 | |||
| 9ebd5c666d | |||
| df5be4fb9c | |||
| 75b281a8a1 | |||
| dc01248261 | |||
| e4aad71ea4 | |||
| 79d00fd3af | |||
| 9456e28c08 | |||
| 7649ed1209 | |||
| 87042d5731 | |||
| efcbd12a39 | |||
| 8efcefe411 | |||
| 751f367170 | |||
| 528029df3f | |||
| b6a671d653 | |||
| d8a7a8f691 | |||
| 09e3e4efb6 | |||
| e7d53ba351 | |||
| 558d74308f | |||
| 1ba41a5caf | |||
| 41cc574f95 | |||
| 5a7aef9c1c | |||
| 152f2f68ce | |||
| 7f761c27eb | |||
| 0ce6c76982 | |||
| 6219090e2c | |||
| a0ea30a741 | |||
| a40cd98d67 | |||
| d84e26d2c4 | |||
| c8d51449f7 | |||
| b2fb1d4096 | |||
| 2459ecc419 | |||
| 48441521aa | |||
| 2101eddc89 | |||
| 33cc11661b | |||
| 7e507929e6 | |||
| e671b92a2a | |||
| 53f5364123 | |||
| 5b2f502112 | |||
| 34126fd8f1 | |||
| fed8004f56 | |||
| 74a2040332 | |||
| 9a5d3d9d3d | |||
| cda98581a5 | |||
| 5e75f98c71 | |||
| 2dc20107b9 | |||
| cd6323f517 | |||
| cee5f24cc3 | |||
| a2e587548e | |||
| 56e5cb78a8 | |||
| 5a3951e035 | |||
| bc1982446c | |||
| eb3deee548 | |||
| 262bc9a40b | |||
| b8d8a34565 | |||
| a29910300d | |||
| d79dfb8586 | |||
| 30f5739a46 | |||
| 1e51f8fa07 | |||
| 3211d8b265 | |||
| c9ab907641 | |||
| c095ae4364 | |||
| c9534efc10 | |||
| 7edb720ac8 | |||
| 244cb43dff | |||
| 2b72207cc3 | |||
| a9aecc7b14 | |||
| c814ba2c1e | |||
| 8823667015 | |||
| 6ffb4d547c | |||
| 3434f2553a | |||
| 1877680610 | |||
| 8fc5a75c11 | |||
| eda7a6b347 | |||
| 5d4b57cb07 | |||
| 502e8e4c30 | |||
| 93f56c2a9d | |||
| 98e8766b5b | |||
| 5d5f22570f | |||
| 88540a03e6 | |||
| 7a222aa46e | |||
| 0dbc56ee8b | |||
| 7c3bf2a16b | |||
| c0d26d69f8 | |||
| d33c47e381 | |||
| 75d6eaaf31 | |||
| 6c5baec1b5 | |||
| fdc6e017b5 | |||
| c7d80b3a25 | |||
| 2979aead19 | |||
| 68e9ee7163 | |||
| 7b462b46f0 | |||
| 8297db894e | |||
| 4babe7c31f | |||
| 000f9787f6 | |||
| 020fe631c3 | |||
| 970166d4ac | |||
| df6447ef65 | |||
| 203b990fb0 | |||
| ab6bd700d8 | |||
| e629e57a2b | |||
| a8cd1b57da | |||
| 89d98b923b | |||
| de13f5b6fd | |||
| 098a26f514 | |||
| 802f6e34d7 | |||
| d0494b6ec0 | |||
| f8faba784a | |||
| a3534169ae | |||
| c447099bda | |||
| 14c5382464 | |||
| e70e08fa8e | |||
| 2328428fe1 | |||
| 123dcabe68 | |||
| 1c1b5fc676 | |||
| 89f02fd6b2 | |||
| 3efca70fda | |||
| 24ab562c73 | |||
| 3dcb2cda36 | |||
| e3d41efc04 | |||
| 1b3fa338bb | |||
| 5a01c73780 | |||
| ba33284ca1 | |||
| 5a661304aa | |||
| f653c544e9 | |||
| 52d3a9e351 | |||
| b94db131e5 | |||
| 7cc7b0c033 | |||
| 81c049d9c2 | |||
| d119a6f42f | |||
| f032a4bebd | |||
| 8b45b8e0a6 | |||
| 27b1710b01 | |||
| 98928f94e9 | |||
| 0ee8a5280e | |||
| 4855134e63 | |||
| 96be763dc5 | |||
| 8a8d3515d3 | |||
| b59914d977 | |||
| 4dc48514e5 | |||
| ac470e064e | |||
| 4b3f2d3739 | |||
| b8ca891023 | |||
| 70acd53078 | |||
| f1cac46f00 | |||
| 990ae1bb9d | |||
| 904eea079b | |||
| 676174682e | |||
| 870c9c02b3 | |||
| 7356223a7d | |||
| 9deccd7a44 | |||
| 5580a59ba7 | |||
| 7bf7c697d3 | |||
| c539258b52 | |||
| 0c9945f5c6 | |||
| 74ec307700 | |||
| f4687e66e7 | |||
| b4ed6f7392 | |||
| 54d9b6d847 | |||
| 83941d0192 | |||
| 9109202550 | |||
| 669b80b1e2 | |||
| 49f5a957cd | |||
| c35b90ebed | |||
| 68f67bbe75 | |||
| 099d1c8f62 | |||
| e599ca7241 | |||
| 19226c30b5 | |||
| ccd33d6b19 | |||
| 4de6676739 | |||
| ae817db2f8 | |||
| e93291d5ee | |||
| cfe0874655 | |||
| 75ed3a0add | |||
| 6b3eca01f2 | |||
| 51f90f8839 | |||
| 99797689e6 | |||
| 841dca3991 | |||
| 28fb4d1027 | |||
| e54510d166 | |||
| 72cd33b6f4 | |||
| c10708e9ce | |||
| ef1da4973c | |||
| bd4c23edf3 | |||
| 8354fc630f | |||
| 737b745890 | |||
| abd67b8e7f | |||
| b70a71f3eb | |||
| 673b34647a | |||
| 1539445279 | |||
| 9346aeddae | |||
| fba5ee935b | |||
| 2edb5cbdc4 | |||
| b3ed7949fb | |||
| 4100f63ab4 | |||
| 06553cdb82 | |||
| 34a90b1d22 | |||
| 598100a16b | |||
| 514dc2d92a | |||
| beca85894e | |||
| 022acf5df4 | |||
| 7d39e1b828 | |||
| 300185b2e4 | |||
| 20dce6a07d | |||
| d630b81286 | |||
| a59b768dee | |||
| 338f490b98 | |||
| 37bff835b0 | |||
| d0a2161941 | |||
| 757bc06941 | |||
| a20f71c7ef | |||
| 8a60457e13 | |||
| 90dc0f3071 | |||
| 7cdb6ee4a9 | |||
| 5a8100234f | |||
| 1c6f3513d9 | |||
| fcfe44d8b4 | |||
| 28f18faa37 | |||
| 8e4a35943c | |||
| 18284d3f65 | |||
| 45ee48d990 | |||
| abae4967bc | |||
| 6417390ca5 | |||
| 32db125642 | |||
| 13b78aa854 | |||
| 877c237cf5 | |||
| 8ed5c68a7f | |||
| 54b9c5feb0 | |||
| 03c03e08cc | |||
| 3dc3b31e77 | |||
| 51f2cdd803 | |||
| b12c6f2b1c | |||
| 2c15845dfb | |||
| f4b987c7a4 | |||
| 61bfc7eaa1 | |||
| f6a9b4c9b8 | |||
| cd268329ef | |||
| 32b0172953 | |||
| 56d0ff42c0 | |||
| fc137768fd | |||
| 5220582ed7 | |||
| 0b3cc31c2e | |||
| e1cd6c73e5 | |||
| 82df9925b8 | |||
| bbe0467bff | |||
| 58c8f24909 | |||
| a5c1df9bcf | |||
| b2744afe61 | |||
| 6d969cd512 | |||
| 03c358e331 | |||
| 0db058ef58 | |||
| 1bc0bbb4ef | |||
| 32932231fd | |||
| 9cdfe34923 | |||
| 36c04a1bdb | |||
| 73fcfef178 | |||
| f52a0de1c5 | |||
| ea9af5b1a2 | |||
| 1ac5aabb2f | |||
| ee7a11dc62 | |||
| ca6f03263d | |||
| 77a53d26bb | |||
| 414b66be32 | |||
| b5558e5742 | |||
| 9dbb215cf6 | |||
| 0a85b6161b | |||
| eb34ba19a9 | |||
| 8a48b86836 | |||
| 0196475e23 | |||
| 8245849ef9 | |||
| 0b5a4199d0 | |||
| 3dd157d0ee | |||
| 51528c6d6e | |||
| d07ae54371 | |||
| 4f497b2c4e | |||
| 482221882b | |||
| fab9a8452a | |||
| 0c7d5e2966 | |||
| 50ab9935c0 | |||
| 1e81a1295e | |||
| 200f64d220 | |||
| 1b1bd5929b | |||
| e489cc2f8d | |||
| 827100874d | |||
| 160684c811 | |||
| afbb79e1c6 | |||
| 1cd4d9dffe | |||
| f548abb84c | |||
| 1f44541d17 | |||
| 1cefec56ed | |||
| aeae7ec39d | |||
| 471e1be772 | |||
| 3e5d5d5741 | |||
| f1deee8860 | |||
| c08b2ecf09 | |||
| fae700ba1c | |||
| 7b8cd330a3 | |||
| 5645145115 | |||
| ad91f3744e | |||
| 7bf21a5064 | |||
| 3b37251a8a | |||
| 80d7317a79 | |||
| 47d75826be | |||
| 8478d321ec | |||
| 9e9511ca48 | |||
| 451761a403 | |||
| f5a587ce76 | |||
| ffb13064dc | |||
| d359ac1491 | |||
| 7521250967 | |||
| 0b0f2f864b | |||
| ed0acd0904 | |||
| b3f877de05 | |||
| 552254834b | |||
| 894722ed9c | |||
| dcc09c507e | |||
| da76b7ee70 | |||
| 3a041e458c | |||
| 134f59345f | |||
| 1769403fbd | |||
| eb923b5cc1 | |||
| 8e9fca4fff | |||
| bcc37dd0c1 | |||
| 58e84d7044 | |||
| c58364c3d3 | |||
| f6a54f01e3 | |||
| 678530de2b | |||
| ca6e796485 | |||
| 5d6dccfa8e | |||
| e941d7248b | |||
| fec02d75b9 | |||
| ab7005bfa4 | |||
| 2dd8e071a8 | |||
| e041eb354e | |||
| d6358f2d18 | |||
| 6ba9ac7e71 | |||
| 5e1cef5b04 | |||
| 5789b52a35 | |||
| eab947dabd | |||
| 2b2cdcd504 | |||
| d4833f2103 | |||
| f285e9514a | |||
| fc05711af3 | |||
| 603042b740 | |||
| 386aed2335 | |||
| 4e48f83df8 | |||
| 7b57c10fb9 | |||
| 1ea523a8b1 | |||
| 34d1510980 | |||
| db6988d87f | |||
| c5edbc12e8 | |||
| fa9e2d8b58 | |||
| 57aafd33f7 | |||
| c9ff03bdf4 | |||
| e967dcc1a7 | |||
| 15fbde6aee | |||
| 50b474966c | |||
| eeb28d3ff4 | |||
| 0f4452fcd0 | |||
| 343c223111 | |||
| 726f2a45dc | |||
| 6f23f8985a | |||
| 752569765e | |||
| 0570c31a3b | |||
| d1bbb75333 | |||
| 9822b38f10 | |||
| dc2ea6fb26 | |||
| 941f70858d | |||
| 3b0dc8cd12 | |||
| 5358318b6f | |||
| e88bc4a2c1 | |||
| 4970ebb19c | |||
| a6ec1e9dd0 | |||
| e0033fb83c | |||
| c5fbfafa62 | |||
| 5e0da4b5ee | |||
| 4b952ed3ff | |||
| c28f197deb | |||
| b63b4c2c19 | |||
| 1994116184 | |||
| d2d4b56c83 | |||
| 439e93b27f | |||
| 5234b78232 | |||
| cc701ed021 | |||
| 06ff2489ae | |||
| aac7fcb6fe | |||
| 9f34d8341a | |||
| 921899fc20 | |||
| f3768c4094 | |||
| 24ec59cd3c | |||
| 47b0cf06a3 | |||
| 7a3fa1280f | |||
| 2628f0bc16 | |||
| 070a606c68 | |||
| 8ef593442b | |||
| 83a66c9f3b | |||
| f312622c4e | |||
| 5fa1dcdb43 | |||
| f2c0c26767 | |||
| f96fdd4505 | |||
| 4e36e57bcb | |||
| dc99997eac | |||
| 32a6bb301e | |||
| b1062ec362 | |||
| 14a6c97e6c | |||
| a78a688961 | |||
| 661b8d9dec | |||
| 909abddce3 | |||
| 5678d4e4fa | |||
| ee9568e574 | |||
| 60b5a1e50a | |||
| 44f2b37760 | |||
| c3b4148b48 | |||
| 8569a0b96f | |||
| 1b14f9daf5 | |||
| 0d2521b4d3 | |||
| 29a8cc034b | |||
| 5862de1d22 | |||
| 2022d08058 | |||
| e3d945e86a | |||
| b3225d1a2f | |||
| d029c122af | |||
| eb1bf09594 | |||
| 6fdadd110b | |||
| b57ddf7b1d | |||
| 3c7d829b22 | |||
| 4a1db8bd3d | |||
| ed548587ab | |||
| dbd1755a42 | |||
| 09d1d1ac2e | |||
| 90f3a22a0b | |||
| 753775479c | |||
| c47b3a935b | |||
| 2eff9d1367 | |||
| 1437b25532 | |||
| 4e39b6ff35 | |||
| 01c48affff | |||
| d6949b0238 | |||
| f60ecf6045 | |||
| f0af72d2f9 | |||
| 9f51b7c925 | |||
| 4ad794c524 | |||
| 4aec47adba | |||
| f38de13d68 | |||
| e6096b71e5 | |||
| 8a789e52cc | |||
| bbb0032181 | |||
| 3751aaf098 | |||
| 75e27a12be | |||
| c19977a6f5 | |||
| 3d6d2b8153 | |||
| 7f4ea06814 | |||
| 3dda8f3cf3 | |||
| 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 |
+339
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
+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>";
|
||||
|
||||
+36
-11
@@ -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');
|
||||
@@ -173,7 +198,7 @@
|
||||
foreach ($assigns as $assign) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (role_unassign(0, $assign->id, 0, $context->id)) {
|
||||
mtrace("Deleted assignment for user $assign->id from course $assign->courseid");
|
||||
mtrace("removing user $assign->id from course $assign->courseid as they have not accessed the course for over $CFG->longtimenosee days");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,8 +224,8 @@
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if (!empty($CFG->deleteincompleteusers)) {
|
||||
$cuttime = $timenow - ($CFG->deleteincompleteusers * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
@@ -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,183 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ctyperecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
<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_EXTENSION name="ctype" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ctyperecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
<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_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="globalswarning" />
|
||||
</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="5.0.25">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="10.0" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.8" 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="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</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_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="safe_mode" value="0" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingsafemode" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
Executable
+275
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
|
||||
require_once('../config.php');
|
||||
/**
|
||||
* SCRIPT CONFIGURATION
|
||||
*/
|
||||
$starttimer = time()+microtime();
|
||||
|
||||
$settings = array();
|
||||
$settings['verbose'] = false;
|
||||
$settings['username'] = null;
|
||||
$settings['password'] = null;
|
||||
$settings['eolchar'] = '<br />'; // Character used to break lines
|
||||
|
||||
// Argument arrays: 0=>short name, 1=>long name
|
||||
$arguments = array(
|
||||
array('short'=>'u', 'long'=>'username', 'help' => 'Your moodle username', 'type'=>'STRING', 'default' => ''),
|
||||
array('short'=>'pw', 'long'=>'password', 'help' => 'Your moodle password', 'type'=>'STRING', 'default' => ''),
|
||||
array('short'=>'v', 'long' => 'verbose', 'help' => 'Display extra information about the process')
|
||||
);
|
||||
|
||||
// Building the USAGE output of the command line version
|
||||
if (isset($argv) && isset($argc)) {
|
||||
$help = "Moodle User Pix Fix. Restores user profile images that were not properly moved during 1.8.2 upgrade to newer versions.\n\n"
|
||||
. "Usage: {$argv[0]}; [OPTION] ...\n"
|
||||
. "Options:\n"
|
||||
. " -h, -?, -help, --help This output\n";
|
||||
|
||||
foreach ($arguments as $arg_array) {
|
||||
$equal = '';
|
||||
if (!empty($arg_array['type'])) {
|
||||
$equal = "={$arg_array['type']}";
|
||||
}
|
||||
|
||||
$padding1 = 5 - strlen($arg_array['short']);
|
||||
$padding2 = 30 - (strlen($arg_array['long']) + strlen($equal));
|
||||
$paddingstr1 = '';
|
||||
for ($i = 0; $i < $padding1; $i++) {
|
||||
$paddingstr1 .= ' ';
|
||||
}
|
||||
$paddingstr2 = '';
|
||||
for ($i = 0; $i < $padding2; $i++) {
|
||||
$paddingstr2 .= ' ';
|
||||
}
|
||||
|
||||
$help .= " -{$arg_array['short']},$paddingstr1--{$arg_array['long']}$equal$paddingstr2{$arg_array['help']}\n";
|
||||
}
|
||||
|
||||
$help .= "\nEmail nicolasconnault@gmail.com for any suggestions or bug reports.\n";
|
||||
|
||||
if ($argc == 1 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
|
||||
echo $help;
|
||||
die();
|
||||
|
||||
} else {
|
||||
|
||||
$settings['eolchar'] = "\n";
|
||||
$argv = arguments($argv);
|
||||
$argscount = 0;
|
||||
|
||||
foreach ($arguments as $arg_array) {
|
||||
$value = null;
|
||||
if (in_array($arg_array['short'], array_keys($argv))) {
|
||||
$value = $argv[$arg_array['short']];
|
||||
unset($argv[$arg_array['short']]);
|
||||
} elseif (in_array($arg_array['long'], array_keys($argv))) {
|
||||
$value = $argv[$arg_array['long']];
|
||||
unset($argv[$arg_array['long']]);
|
||||
}
|
||||
if (!is_null($value)) {
|
||||
$settings[$arg_array['long']] = $value;
|
||||
$argscount++;
|
||||
}
|
||||
}
|
||||
|
||||
// If some params are left in argv, it means they are not supported
|
||||
if ($argscount == 0 || count($argv) > 0) {
|
||||
echo $help;
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SCRIPT SETUP
|
||||
*/
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->dirroot .'/course/lib.php');
|
||||
verbose("Loading libraries...");
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
/**
|
||||
* WEB INTERFACE FORM
|
||||
*/
|
||||
|
||||
class pixfix_form extends moodleform {
|
||||
function definition() {
|
||||
global $arguments;
|
||||
$mform =& $this->_form;
|
||||
|
||||
foreach ($arguments as $arg_array) {
|
||||
$type = 'advcheckbox';
|
||||
|
||||
$label = ucfirst(str_replace('-', ' ', $arg_array['long']));
|
||||
if (!empty($arg_array['type'])) {
|
||||
$type = 'text';
|
||||
}
|
||||
|
||||
if ($arg_array['long'] == 'password' || $arg_array['long'] == 'username') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mform->addElement($type, $arg_array['long'], $label);
|
||||
|
||||
if (isset($arg_array['default'])) {
|
||||
$mform->setDefault($arg_array['long'], $arg_array['default']);
|
||||
}
|
||||
}
|
||||
$this->add_action_buttons(false, 'Restore Images');
|
||||
}
|
||||
|
||||
function definition_after_data() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$run_script = true;
|
||||
$web_interface = false;
|
||||
|
||||
// If eolchar is still <br />, load the web interface
|
||||
if ($settings['eolchar'] == '<br />') {
|
||||
print_header("User Pix-Fix");
|
||||
print_heading("User Pix-Fix");
|
||||
$mform = new pixfix_form();
|
||||
|
||||
if ($data = $mform->get_data(false)) {
|
||||
foreach ($arguments as $arg_array) {
|
||||
if (!empty($data->{$arg_array['long']})) {
|
||||
$settings[$arg_array['long']] = $data->{$arg_array['long']};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$run_script = false;
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', $systemcontext)) {
|
||||
// If not logged in, give link to login page for current site
|
||||
notify("You must be logged in as administrator before using this script.");
|
||||
require_login();
|
||||
} else {
|
||||
$mform->display();
|
||||
}
|
||||
|
||||
$web_interface = true;
|
||||
}
|
||||
|
||||
if ($run_script) {
|
||||
|
||||
// User authentication
|
||||
if (!$web_interface) {
|
||||
if (empty($settings['username'])) {
|
||||
echo "You must enter a valid username for a moodle administrator account on this site.{$settings['eolchar']}";
|
||||
die();
|
||||
} elseif (empty($settings['password'])) {
|
||||
echo "You must enter a valid password for a moodle administrator account on this site.{$settings['eolchar']}";
|
||||
die();
|
||||
} else {
|
||||
if (!$user = authenticate_user_login($settings['username'], $settings['password'])) {
|
||||
echo "Invalid username or password!{$settings['eolchar']}";
|
||||
die();
|
||||
}
|
||||
$USER = complete_user_login($user);
|
||||
if (!has_capability('moodle/site:doanything', $systemcontext)) {
|
||||
echo "You do not have administration privileges on this Moodle site. These are required for running the restore script.{$settings['eolchar']}";
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Script code here
|
||||
|
||||
// Look for old moodledata/users directory
|
||||
$oldusersdir = $CFG->dataroot . '/users';
|
||||
|
||||
if (!file_exists($oldusersdir)) {
|
||||
notify('The old directory for user profile images ('.$oldusersdir.') does not exist. Pictures cannot be restored!');
|
||||
} else {
|
||||
// Find user profile images that are not yet in the new directory
|
||||
$folders = get_directory_list($oldusersdir, '', false, true, false);
|
||||
|
||||
$restored_count = 0;
|
||||
|
||||
foreach ($folders as $userid) {
|
||||
$olddir = $oldusersdir . '/' . $userid;
|
||||
$files = get_directory_list($olddir);
|
||||
|
||||
if (empty($files)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create new user directory
|
||||
if (!$newdir = make_user_directory($userid)) {
|
||||
// some weird directory - do not stop the upgrade, just ignore it
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move contents of old directory to new one
|
||||
if (file_exists($olddir) && file_exists($newdir)) {
|
||||
$restored = false;
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (!file_exists($newdir . '/' . $file)) {
|
||||
copy($olddir . '/' . $file, $newdir . '/' . $file);
|
||||
verbose("Moved $olddir/$file into $newdir/$file");
|
||||
$restored = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($restored) {
|
||||
$restored_count++;
|
||||
}
|
||||
} else {
|
||||
notify("Could not move the contents of $olddir into $newdir!");
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eolchar'] == '<br />') {
|
||||
print_box_start('generalbox centerpara');
|
||||
}
|
||||
if ($restored_count > 0) {
|
||||
echo "Successfully restored profile images for $restored_count users!" . $settings['eolchar'];
|
||||
} else {
|
||||
echo "Did not find any user profile images in need of restoring." . $settings['eolchar'];
|
||||
}
|
||||
if ($settings['eolchar'] == '<br />') {
|
||||
print_box_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings['eolchar'] == '<br />') {
|
||||
print_footer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the standard $argv into an associative array taking var=val arguments into account
|
||||
* @param array $argv
|
||||
* @return array $_ARG
|
||||
*/
|
||||
function arguments($argv) {
|
||||
$_ARG = array();
|
||||
foreach ($argv as $arg) {
|
||||
if (ereg('--?([^=]+)=(.*)',$arg,$reg)) {
|
||||
$_ARG[$reg[1]] = $reg[2];
|
||||
} elseif(ereg('-([a-zA-Z0-9]+)',$arg,$reg)) {
|
||||
$_ARG[$reg[1]] = 'true';
|
||||
}
|
||||
}
|
||||
return $_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* If verbose is switched on, prints a string terminated by the global eolchar string.
|
||||
* @param string $string The string to STDOUT
|
||||
*/
|
||||
function verbose($string) {
|
||||
global $settings;
|
||||
if ($settings['verbose'] && !$settings['quiet']) {
|
||||
echo $string . $settings['eolchar'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+193
-1
@@ -525,11 +525,203 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
return 'Error counter was cleared.';
|
||||
} else {
|
||||
return '<p>Session errors can be caused by:<ul><li>unresolved problem in server software (aka random switching of users),</li><li>blocked or modified cookies,</li><li>deleting of active session files.</li></ul></p><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter.</a></p>';
|
||||
return '<p>Session errors can be caused by:</p><ul>' .
|
||||
'<li>unresolved problem in server software (aka random switching of users),</li>' .
|
||||
'<li>blocked or modified cookies,</li>' .
|
||||
'<li>deleting of active session files.</li>' .
|
||||
'</ul><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter</a></p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000012 extends problem_base {
|
||||
function title() {
|
||||
return 'Random questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
return record_exists_select('question', "qtype = 'random' AND parent <> id");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For random questions, question.parent should equal question.id. ' .
|
||||
'There are some questions in your database for which this is not true. ' .
|
||||
'One way that this could have happened is for random questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
|
||||
'<pre>UPDATE ' . $CFG->prefix . 'question SET parent = id WHERE qtype = \'random\' and parent <> id;</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000013 extends problem_base {
|
||||
function title() {
|
||||
return 'Multi-answer questions data consistency';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
$positionexpr = sql_position(sql_concat("','", "q.id", "','"),
|
||||
sql_concat("','", "qma.sequence", "','"));
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question_multianswer qma ON $positionexpr > 0
|
||||
WHERE qma.question <> q.parent") ||
|
||||
record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE q.category <> parent_q.category");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>For each sub-question whose id is listed in ' .
|
||||
'question_multianswer.sequence, its question.parent field should equal ' .
|
||||
'question_multianswer.question; and each sub-question should be in the same ' .
|
||||
'category as its parent. There are questions in your database for ' .
|
||||
'which this is not the case. One way that this could have happened is ' .
|
||||
'for multi-answer questions restored from backup before ' .
|
||||
'<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
|
||||
'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
|
||||
'<a href="http://cvs.moodle.org/moodle/question/type/multianswer/db/upgrade.php?revision=1.1.10.2&view=markup">/question/type/multianswer/db/upgrade.php' .
|
||||
'from the 1.9 stable branch</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000014 extends problem_base {
|
||||
function title() {
|
||||
return 'Only multianswer and random questions should be the parent of another question';
|
||||
}
|
||||
function exists() {
|
||||
global $CFG;
|
||||
return record_exists_sql("
|
||||
SELECT * FROM {$CFG->prefix}question q
|
||||
JOIN {$CFG->prefix}question parent_q ON parent_q.id = q.parent
|
||||
WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
return '<p>You have questions that violate this in your databse. ' .
|
||||
'You will need to investigate to determine how this happened.</p>';
|
||||
}
|
||||
function solution() {
|
||||
return '<p>It is impossible to give a solution without knowing more about ' .
|
||||
' how the problem was caused. You may be able to get help from the ' .
|
||||
'<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000017 extends problem_base {
|
||||
function title() {
|
||||
return 'Question categories tree structure';
|
||||
}
|
||||
function find_problems() {
|
||||
static $answer = null;
|
||||
|
||||
if (is_null($answer)) {
|
||||
$categories = get_records('question_categories', '', '', 'id');
|
||||
|
||||
// Look for missing parents.
|
||||
$missingparent = array();
|
||||
foreach ($categories as $category) {
|
||||
if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
|
||||
$missingparent[$category->id] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for loops.
|
||||
$loops = array();
|
||||
while (!empty($categories)) {
|
||||
$current = array_pop($categories);
|
||||
$thisloop = array($current->id => $current);
|
||||
while (true) {
|
||||
if (isset($thisloop[$current->parent])) {
|
||||
// Loop detected
|
||||
$loops[$current->id] = $thisloop;
|
||||
break;
|
||||
} else if (!isset($categories[$current->parent])) {
|
||||
// Got to the top level, or a category we already know is OK.
|
||||
break;
|
||||
} else {
|
||||
// Continue following the path.
|
||||
$current = $categories[$current->parent];
|
||||
$thisloop[$current->id] = $current;
|
||||
unset($categories[$current->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$answer = array($missingparent, $loops);
|
||||
}
|
||||
|
||||
return $answer;
|
||||
}
|
||||
function exists() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
return !empty($missingparent) || !empty($loops);
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
}
|
||||
function description() {
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$description = '<p>The question categories should be arranged into tree ' .
|
||||
' structures by the question_categories.parent field. Sometimes ' .
|
||||
' this tree structure gets messed up.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$description .= '<p>The following categories are missing their parents:</p><ul>';
|
||||
foreach ($missingparent as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$description .= '<p>The following categories form a loop of parents:</p><ul>';
|
||||
foreach ($loops as $loop) {
|
||||
$description .= "<li><ul>\n";
|
||||
foreach ($loop as $cat) {
|
||||
$description .= "<li>Category $cat->id: " . s($cat->name) . " has parent $cat->parent</li>\n";
|
||||
}
|
||||
$description .= "</ul></li>\n";
|
||||
}
|
||||
$description .= "</ul>\n";
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
list($missingparent, $loops) = $this->find_problems();
|
||||
|
||||
$solution = '<p>Consider executing the following SQL queries. These fix ' .
|
||||
'the problem by moving some categories to the top level.</p>';
|
||||
|
||||
if (!empty($missingparent)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
if (!empty($loops)) {
|
||||
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
|
||||
" SET parent = 0\n" .
|
||||
" WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
|
||||
}
|
||||
|
||||
return $solution;
|
||||
}
|
||||
}
|
||||
|
||||
class problem_00000x extends problem_base {
|
||||
function title() {
|
||||
|
||||
+33
-11
@@ -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();
|
||||
@@ -280,12 +281,18 @@
|
||||
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
remove_dir($CFG->dataroot . '/environment'); /// Always delete downloaded env. info to force use of the released one. MDL-9796
|
||||
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 +332,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 +415,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");
|
||||
|
||||
@@ -416,7 +427,7 @@
|
||||
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for changes to RPC functions
|
||||
require_once($CFG->dirroot.'/admin/mnet/adminlib.php');
|
||||
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
||||
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
@@ -537,15 +548,26 @@
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_box(get_string('globalsquoteswarning', 'admin'), 'generalbox adminwarning');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_box(get_string('globalswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
||||
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (substr($CFG->wwwroot, -1) == '/') {
|
||||
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
||||
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
$strinstallation = get_string('installation', 'install');
|
||||
@@ -580,7 +602,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>';
|
||||
|
||||
@@ -47,7 +47,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
// fetch the record in question
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
|
||||
error(get_string('recordnoexists','mnet'), '/admin/mnet/access_control.php');
|
||||
error(get_string('recordnoexists','mnet'), "/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@@ -62,7 +62,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
// require the access parameter, and it must be 'allow' or 'deny'
|
||||
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
|
||||
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
|
||||
error(get_string('invalidaccessparam', 'mnet') , '/admin/mnet/access_control.php');
|
||||
error(get_string('invalidaccessparam', 'mnet') , "/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
|
||||
@@ -75,7 +75,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
break;
|
||||
|
||||
default:
|
||||
print_error('invalidactionparam', 'mnet', '/admin/mnet/access_control.php');
|
||||
print_error('invalidactionparam', 'mnet', "/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// check permissions and verify form input
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error(get_string('nomodifyacl','mnet'), '/admin/mnet/access_control.php');
|
||||
error(get_string('nomodifyacl','mnet'), "/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
if (empty($form->username)) {
|
||||
$formerror['username'] = get_string('enterausername','mnet');
|
||||
|
||||
@@ -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();
|
||||
@@ -72,7 +72,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
if (!file_exists($filename)) return false;
|
||||
|
||||
if (extension_loaded('tokenizer')) {
|
||||
include_once $CFG->dirroot.'/admin/mnet/MethodTable.php';
|
||||
include_once "$CFG->dirroot/$CFG->admin/mnet/MethodTable.php";
|
||||
$functions = (array)MethodTable::create($filename,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
print_header("$site->shortname: $strmnetsettings", "$site->fullname",
|
||||
'<a href="'.$CFG->wwwroot.'/admin/index.php">'.$stradministration.'</a> -> '.
|
||||
'<a href="'.$CFG->wwwroot.'/admin/mnet/index.php">'.get_string('mnetsettings', 'mnet').'</a> -> Delete host');
|
||||
'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.$stradministration.'</a> -> '.
|
||||
'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/mnet/index.php">'.get_string('mnetsettings', 'mnet').'</a> -> Delete host');
|
||||
|
||||
print_heading(get_string('mnetsettings', 'mnet'));
|
||||
?>
|
||||
@@ -46,7 +46,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$link = $CFG->wwwroot . '/admin/mnet/enr_course_enrol.php?'
|
||||
$link = "$CFG->wwwroot/$CFG->admin/mnet/enr_course_enrol.php?"
|
||||
. "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}";
|
||||
echo '<tr>'
|
||||
. "<td>$icon</td>"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
. '</tr>';
|
||||
$hosts = $enrolment->list_remote_servers();
|
||||
foreach ($hosts as $host) {
|
||||
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursesurl = "{$CFG->wwwroot}/$CFG->admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
|
||||
if (empty($coursecount)) {
|
||||
$coursecount = '?';
|
||||
|
||||
@@ -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')) {
|
||||
@@ -91,6 +96,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
|
||||
$mnet_peer->deleted = $form->deleted;
|
||||
$mnet_peer->updateparams->deleted = $form->deleted;
|
||||
}
|
||||
|
||||
if (isset($form->public_key)) {
|
||||
@@ -101,9 +107,10 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
} else {
|
||||
$oldkey = $mnet_peer->public_key;
|
||||
$mnet_peer->public_key = $form->public_key;
|
||||
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
$mnet_peer->updateparams->public_key = $form->public_key;
|
||||
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
$mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($form->public_key);
|
||||
if ($mnet_peer->public_key_expires == false) {
|
||||
$mnet_peer->public_key == $oldkey;
|
||||
$errmsg = '<br />';
|
||||
foreach ($mnet_peer->error as $err) {
|
||||
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
// if the config.html contains a hidden form field giving
|
||||
// the module name then the form does not have to prefix all
|
||||
// its variable names, we will do it here.
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
|
||||
+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")) {
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php //$Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.org //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.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 //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/security/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
require_login();
|
||||
|
||||
$issue = optional_param('issue', '', PARAM_FILE); // show detailed info about one issue only
|
||||
|
||||
$issues = report_security_get_issue_list();
|
||||
|
||||
// test if issue valid string
|
||||
if (array_search($issue, $issues, true) === false) {
|
||||
$issue = '';
|
||||
}
|
||||
|
||||
// we may need a bit more memory and this may take a long time to process
|
||||
@raise_memory_limit('128M');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Print the header.
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportsecurity', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading(get_string('reportsecurity', 'report_security'));
|
||||
|
||||
while(@ob_end_flush());
|
||||
@flush();
|
||||
|
||||
$strok = '<span class="statusok">'.get_string('statusok', 'report_security').'</span>';
|
||||
$strinfo = '<span class="statusinfo">'.get_string('statusinfo', 'report_security').'</span>';
|
||||
$strwarning = '<span class="statuswarning">'.get_string('statuswarning', 'report_security').'</span>';
|
||||
$strserious = '<span class="statusserious">'.get_string('statusserious', 'report_security').'</span>';
|
||||
$strcritical = '<span class="statuscritical">'.get_string('statuscritical', 'report_security').'</span>';
|
||||
|
||||
$strissue = get_string('issue', 'report_security');
|
||||
$strstatus = get_string('status', 'report_security');
|
||||
$strdesc = get_string('description', 'report_security');
|
||||
$strconfig = get_string('configuration', 'report_security');
|
||||
|
||||
$statusarr = array(REPORT_SECURITY_OK => $strok,
|
||||
REPORT_SECURITY_INFO => $strinfo,
|
||||
REPORT_SECURITY_WARNING => $strwarning,
|
||||
REPORT_SECURITY_SERIOUS => $strserious,
|
||||
REPORT_SECURITY_CRITICAL => $strcritical);
|
||||
|
||||
$url = "$CFG->wwwroot/$CFG->admin/report/security/index.php";
|
||||
|
||||
if ($issue and ($result = $issue(true))) {
|
||||
$table = new object();
|
||||
$table->head = array($strissue, $strstatus, $strdesc, $strconfig);
|
||||
$table->size = array('30%', '10%', '50%', '10%' );
|
||||
$table->align = array('left', 'left', 'left', 'left');
|
||||
$table->width = '90%';
|
||||
$table->data = array();
|
||||
|
||||
// print detail of one issue only
|
||||
$row = array();
|
||||
$row[0] = report_security_doc_link($issue, $result->name);
|
||||
$row[1] = $statusarr[$result->status];
|
||||
$row[2] = $result->info;
|
||||
$row[3] = is_null($result->link) ? ' ' : $result->link;
|
||||
|
||||
$CFG->pagepath = "report/security/$issue"; // help link in footer
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
print_table($table);
|
||||
|
||||
print_box($result->details, 'generalbox boxwidthnormal boxaligncenter'); // TODO: add proper css
|
||||
|
||||
print_continue($url);
|
||||
|
||||
} else {
|
||||
$table = new object();
|
||||
$table->head = array($strissue, $strstatus, $strdesc);
|
||||
$table->size = array('30%', '10%', '60%' );
|
||||
$table->align = array('left', 'left', 'left');
|
||||
$table->width = '90%';
|
||||
$table->data = array();
|
||||
|
||||
foreach ($issues as $issue) {
|
||||
$result = $issue(false);
|
||||
if (!$result) {
|
||||
// ignore this test
|
||||
continue;
|
||||
}
|
||||
$row = array();
|
||||
$row[0] = "<a href='$url?issue=$result->issue'>$result->name</a>";
|
||||
$row[1] = $statusarr[$result->status];
|
||||
$row[2] = $result->info;
|
||||
|
||||
$table->data[] = $row;
|
||||
}
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
@@ -0,0 +1,742 @@
|
||||
<?php //$Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.org //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.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 //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once("$CFG->libdir/adminlib.php");
|
||||
|
||||
|
||||
define('REPORT_SECURITY_OK', 'ok');
|
||||
define('REPORT_SECURITY_INFO', 'info');
|
||||
define('REPORT_SECURITY_WARNING', 'warning');
|
||||
define('REPORT_SECURITY_SERIOUS', 'serious');
|
||||
define('REPORT_SECURITY_CRITICAL', 'critical');
|
||||
|
||||
function report_security_get_issue_list() {
|
||||
return array(
|
||||
'report_security_check_globals',
|
||||
'report_security_check_unsecuredataroot',
|
||||
'report_security_check_displayerrors',
|
||||
'report_security_check_noauth',
|
||||
'report_security_check_embed',
|
||||
'report_security_check_mediafilterswf',
|
||||
'report_security_check_openprofiles',
|
||||
'report_security_check_google',
|
||||
'report_security_check_configrw',
|
||||
'report_security_check_defaultuserrole',
|
||||
'report_security_check_guestrole',
|
||||
'report_security_check_defaultcourserole',
|
||||
'report_security_check_courserole',
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
function report_security_doc_link($issue, $name) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->docroot)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
$lang = str_replace('_utf8', '', current_language());
|
||||
|
||||
$str = "<a onclick=\"this.target='docspopup'\" href=\"$CFG->docroot/$lang/report/security/$issue\">";
|
||||
$str .= "<img class=\"iconhelp\" src=\"$CFG->httpswwwroot/pix/docs.gif\" alt=\"\" />$name</a>";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
///=============================================
|
||||
/// Issue checks
|
||||
///=============================================
|
||||
|
||||
|
||||
/**
|
||||
* Verifies register globals PHP setting.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_globals($detailed=false) {
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_globals';
|
||||
$result->name = get_string('check_globals_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
if (ini_get_bool('register_globals')) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_globals_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_globals_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_globals_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies unsupported noauth setting
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_noauth($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_noauth';
|
||||
$result->name = get_string('check_noauth_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/auth.php\">".get_string('authentication').'</a>';
|
||||
|
||||
if (is_enabled_auth('none')) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_noauth_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_noauth_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_noauth_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sloppy embedding - this should have been removed long ago!!
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_embed($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_embed';
|
||||
$result->name = get_string('check_embed_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=sitepolicies\">".get_string('sitepolicies', 'admin').'</a>';
|
||||
|
||||
if (!empty($CFG->allowobjectembed)) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_embed_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_embed_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_embed_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sloppy swf embedding - this should have been removed long ago!!
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_mediafilterswf($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_mediafilterswf';
|
||||
$result->name = get_string('check_mediafilterswf_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/filters.php\">".get_string('filtersettings', 'admin').'</a>';
|
||||
|
||||
if (!empty($CFG->textfilters)) {
|
||||
$activefilters = explode(',', $CFG->textfilters);
|
||||
} else {
|
||||
$activefilters = array();
|
||||
}
|
||||
|
||||
if (array_search('filter/mediaplugin', $activefilters) !== false and !empty($CFG->filter_mediaplugin_enable_swf)) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_mediafilterswf_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_mediafilterswf_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_mediafilterswf_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies fatal misconfiguration of dataroot
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_unsecuredataroot($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_unsecuredataroot';
|
||||
$result->name = get_string('check_unsecuredataroot_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
$insecuredataroot = is_dataroot_insecure();
|
||||
|
||||
if ($insecuredataroot) {
|
||||
$result->status = REPORT_SECURITY_SERIOUS;
|
||||
$result->info = get_string('check_unsecuredataroot_warning', 'report_security', $CFG->dataroot);
|
||||
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_unsecuredataroot_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_unsecuredataroot_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies disaplying of errors - problem for lib files and 3rd party code
|
||||
* because we can not disable debugging in these scripts (they do not include config.php)
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_displayerrors($detailed=false) {
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_displayerrors';
|
||||
$result->name = get_string('check_displayerrors_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_displayerrors_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_displayerrors_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_displayerrors_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies open profiles - originaly open by default, not anymore because spammer abused it a lot
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_openprofiles($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_openprofiles';
|
||||
$result->name = get_string('check_openprofiles_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=sitepolicies\">".get_string('sitepolicies', 'admin').'</a>';
|
||||
|
||||
if (empty($CFG->forcelogin) and empty($CFG->forceloginforprofiles)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_openprofiles_error', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_openprofiles_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_openprofiles_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies google access not combined with disabled guest access
|
||||
* because attackers might gain guest access by modifying browser signature.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_google($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_google';
|
||||
$result->name = get_string('check_google_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=sitepolicies\">".get_string('sitepolicies', 'admin').'</a>';
|
||||
|
||||
if (empty($CFG->opentogoogle)) {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_google_ok', 'report_security');
|
||||
} else if (!empty($CFG->guestloginbutton)) {
|
||||
$result->status = REPORT_SECURITY_INFO;
|
||||
$result->info = get_string('check_google_info', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_SERIOUS;
|
||||
$result->info = get_string('check_google_error', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_google_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies config.php is not writable anymore after installation,
|
||||
* config files were changed on several outdated server.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_configrw($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_configrw';
|
||||
$result->name = get_string('check_configrw_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
if (is_writable($CFG->dirroot.'/config.php')) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_configrw_warning', 'report_security');
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_configrw_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_configrw_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sanity of default user role.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_defaultuserrole($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_defaultuserrole';
|
||||
$result->name = get_string('check_defaultuserrole_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=userpolicies\">".get_string('userpolicies', 'admin').'</a>';;
|
||||
|
||||
if (!$default_role = get_record('role', 'id', $CFG->defaultuserroleid)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_defaultuserrole_notset', 'report_security');
|
||||
$result->details = $result->info;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// first test if do anything enabled - that would be really crazy!
|
||||
$sql = "SELECT COUNT(DISTINCT rc.contextid)
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability = 'moodle/site:doanything'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $default_role->id";
|
||||
|
||||
$anythingcount = count_records_sql($sql);
|
||||
|
||||
// risky caps - usually very dangerous
|
||||
$sql = "SELECT COUNT(DISTINCT rc.contextid)
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
JOIN {$CFG->prefix}capabilities cap ON cap.name = rc.capability
|
||||
WHERE ".sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG))." <> 0
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $default_role->id";
|
||||
|
||||
$riskycount = count_records_sql($sql);
|
||||
|
||||
// default role can not have view cap in all courses - this would break moodle badly
|
||||
$viewcap = record_exists('role_capabilities', 'roleid', $default_role->id, 'permission', CAP_ALLOW, 'capability', 'moodle/course:view');
|
||||
|
||||
// it may have either no or 'user' legacy type - nothing else, or else it would break during upgrades badly
|
||||
$legacyok = false;
|
||||
$sql = "SELECT rc.capability, 1
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability LIKE 'moodle/legacy:%'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $default_role->id";
|
||||
$legacycaps = get_records_sql($sql);
|
||||
if (!$legacycaps) {
|
||||
$legacyok = true;
|
||||
} else if (count($legacycaps) == 1 and isset($legacycaps['moodle/legacy:user'])) {
|
||||
$legacyok = true;
|
||||
}
|
||||
|
||||
if ($anythingcount or $riskycount or $viewcap or !$legacyok) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_defaultuserrole_error', 'report_security', format_string($default_role->name));
|
||||
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_defaultuserrole_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_defaultuserrole_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sanity of guest role
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_guestrole($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_guestrole';
|
||||
$result->name = get_string('check_guestrole_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=userpolicies\">".get_string('userpolicies', 'admin').'</a>';;
|
||||
|
||||
if (!$guest_role = get_record('role', 'id', $CFG->guestroleid)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_guestrole_notset', 'report_security');
|
||||
$result->details = $result->info;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// first test if do anything enabled - that would be really crazy!
|
||||
$sql = "SELECT COUNT(DISTINCT rc.contextid)
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability = 'moodle/site:doanything'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $guest_role->id";
|
||||
|
||||
$anythingcount = count_records_sql($sql);
|
||||
|
||||
// risky caps - usually very dangerous
|
||||
$sql = "SELECT COUNT(DISTINCT rc.contextid)
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
JOIN {$CFG->prefix}capabilities cap ON cap.name = rc.capability
|
||||
WHERE ".sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG))." <> 0
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $guest_role->id";
|
||||
|
||||
$riskycount = count_records_sql($sql);
|
||||
|
||||
// it may have either no or 'guest' legacy type - nothing else, or else it would break during upgrades badly
|
||||
$legacyok = false;
|
||||
$sql = "SELECT rc.capability, 1
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability LIKE 'moodle/legacy:%'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $guest_role->id";
|
||||
$legacycaps = get_records_sql($sql);
|
||||
if (!$legacycaps) {
|
||||
$legacyok = true;
|
||||
} else if (count($legacycaps) == 1 and isset($legacycaps['moodle/legacy:guest'])) {
|
||||
$legacyok = true;
|
||||
}
|
||||
|
||||
if ($anythingcount or $riskycount or !$legacyok) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_guestrole_error', 'report_security', format_string($guest_role->name));
|
||||
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_guestrole_ok', 'report_security');
|
||||
}
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_guestrole_details', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies sanity of site default course role.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_defaultcourserole($detailed=false) {
|
||||
global $CFG;
|
||||
|
||||
$problems = array();
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_defaultcourserole';
|
||||
$result->name = get_string('check_defaultcourserole_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = "<a href=\"$CFG->wwwroot/$CFG->admin/settings.php?section=userpolicies\">".get_string('userpolicies', 'admin').'</a>';;
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_defaultcourserole_details', 'report_security');
|
||||
}
|
||||
|
||||
if (!$student_role = get_record('role', 'id', $CFG->defaultcourseroleid)) {
|
||||
$result->status = REPORT_SECURITY_WARNING;
|
||||
$result->info = get_string('check_defaultcourserole_notset', 'report_security');
|
||||
$result->details = get_string('check_defaultcourserole_details', 'report_security');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// first test if do anything enabled - that would be really crazy!
|
||||
$sql = "SELECT DISTINCT rc.contextid
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability = 'moodle/site:doanything'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $student_role->id";
|
||||
|
||||
if ($anything_contexts = get_records_sql($sql)) {
|
||||
foreach($anything_contexts as $contextid) {
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/manage.php?action=view&roleid=$CFG->defaultcourseroleid";
|
||||
} else {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid&roleid=$CFG->defaultcourseroleid";
|
||||
}
|
||||
$problems[] = get_string('check_defaultcourserole_anything', 'report_security', $a);
|
||||
}
|
||||
}
|
||||
|
||||
// risky caps - usually very dangerous
|
||||
$sql = "SELECT DISTINCT rc.contextid
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
JOIN {$CFG->prefix}capabilities cap ON cap.name = rc.capability
|
||||
WHERE ".sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG))." <> 0
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $student_role->id";
|
||||
|
||||
if ($riskycontexts = get_records_sql($sql)) {
|
||||
foreach($riskycontexts as $contextid=>$unused) {
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/manage.php?action=view&roleid=$CFG->defaultcourseroleid";
|
||||
} else {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid&roleid=$CFG->defaultcourseroleid";
|
||||
}
|
||||
$problems[] = get_string('check_defaultcourserole_risky', 'report_security', $a);
|
||||
}
|
||||
}
|
||||
|
||||
// course creator or administrator does not make any sense here
|
||||
$sql = "SELECT rc.capability, 1
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability LIKE 'moodle/legacy:%'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid = $student_role->id";
|
||||
$legacycaps = get_records_sql($sql);
|
||||
if (isset($legacycaps['moodle/legacy:coursecreator']) or isset($legacycaps['moodle/legacy:admin'])) {
|
||||
$problems[] = get_string('check_defaultcourserole_legacy', 'report_security');
|
||||
}
|
||||
|
||||
if ($problems) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_defaultcourserole_error', 'report_security', format_string($student_role->name));
|
||||
if ($detailed) {
|
||||
$result->details .= "<ul>";
|
||||
foreach ($problems as $problem) {
|
||||
$result->details .= "<li>$problem</li>";
|
||||
}
|
||||
$result->details .= "</ul>";
|
||||
}
|
||||
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_defaultcourserole_ok', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sanity of default roles in courses.
|
||||
* @param bool $detailed
|
||||
* @return object result
|
||||
*/
|
||||
function report_security_check_courserole($detailed=false) {
|
||||
global $CFG, $SITE;
|
||||
|
||||
$problems = array();
|
||||
|
||||
$result = new object();
|
||||
$result->issue = 'report_security_check_courserole';
|
||||
$result->name = get_string('check_courserole_name', 'report_security');
|
||||
$result->info = null;
|
||||
$result->details = null;
|
||||
$result->status = null;
|
||||
$result->link = null;
|
||||
|
||||
if ($detailed) {
|
||||
$result->details = get_string('check_courserole_details', 'report_security');
|
||||
}
|
||||
|
||||
// get list of all student roles selected in courses excluding the default course role
|
||||
$sql = "SELECT r.*
|
||||
FROM {$CFG->prefix}role r
|
||||
JOIN {$CFG->prefix}course c ON c.defaultrole = r.id
|
||||
WHERE c.id <> $SITE->id AND r.id <> $CFG->defaultcourseroleid";
|
||||
|
||||
if (!$student_roles = get_records_sql($sql)) {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_courserole_notyet', 'report_security');
|
||||
$result->details = get_string('check_courserole_details', 'report_security');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$roleids = array_keys($student_roles);
|
||||
|
||||
$sql = "SELECT DISTINCT rc.roleid
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE (rc.capability = 'moodle/legacy:coursecreator' OR rc.capability = 'moodle/legacy:admin'
|
||||
OR rc.capability = 'moodle/legacy:teacher' OR rc.capability = 'moodle/legacy:editingteacher')
|
||||
AND rc.permission = ".CAP_ALLOW."";
|
||||
|
||||
$riskyroleids = get_records_sql($sql);
|
||||
$riskyroleids = array_keys($riskyroleids);
|
||||
|
||||
|
||||
// first test if do anything enabled - that would be really crazy!!!!!!
|
||||
$inroles = implode(',', $roleids);
|
||||
$sql = "SELECT rc.roleid, rc.contextid
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
WHERE rc.capability = 'moodle/site:doanything'
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid IN ($inroles)
|
||||
GROUP BY rc.roleid, rc.contextid
|
||||
ORDER BY rc.roleid, rc.contextid";
|
||||
|
||||
$rs = get_recordset_sql($sql);
|
||||
while ($res = rs_fetch_next_record($rs)) {
|
||||
$roleid = $res->roleid;
|
||||
$contextid = $res->contextid;
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/manage.php?action=view&roleid=$roleid";
|
||||
} else {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid&roleid=$roleid";
|
||||
}
|
||||
$problems[] = get_string('check_courserole_anything', 'report_security', $a);
|
||||
}
|
||||
rs_close($rs);
|
||||
|
||||
// any XSS legacy cap does not make any sense here!
|
||||
$inroles = implode(',', $riskyroleids);
|
||||
$sql = "SELECT DISTINCT c.id, c.shortname
|
||||
FROM {$CFG->prefix}course c
|
||||
WHERE c.defaultrole IN ($inroles)
|
||||
ORDER BY c.sortorder";
|
||||
if ($courses = get_records_sql($sql)) {
|
||||
foreach ($courses as $course) {
|
||||
$a = (object)array('url'=>"$CFG->wwwroot/course/edit.php?id=$course->id", 'shortname'=>$course->shortname);
|
||||
$problems[] = get_string('check_courserole_riskylegacy', 'report_security', $a);
|
||||
}
|
||||
} else {
|
||||
$course = array();
|
||||
}
|
||||
|
||||
// risky caps in any level for roles not marked as risky yet - usually very dangerous!!
|
||||
if ($checkroles = array_diff($roleids, $riskyroleids)) {
|
||||
$inroles = implode(',', $checkroles);
|
||||
$sql = "SELECT rc.roleid, rc.contextid
|
||||
FROM {$CFG->prefix}role_capabilities rc
|
||||
JOIN {$CFG->prefix}capabilities cap ON cap.name = rc.capability
|
||||
WHERE ".sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG))." <> 0
|
||||
AND rc.permission = ".CAP_ALLOW."
|
||||
AND rc.roleid IN ($inroles)
|
||||
GROUP BY rc.roleid, rc.contextid
|
||||
ORDER BY rc.roleid, rc.contextid";
|
||||
$rs = get_recordset_sql($sql);
|
||||
while ($res = rs_fetch_next_record($rs)) {
|
||||
$roleid = $res->roleid;
|
||||
$contextid = $res->contextid;
|
||||
if ($contextid == SYSCONTEXTID) {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/manage.php?action=view&roleid=$roleid";
|
||||
} else {
|
||||
$a = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid&roleid=$roleid";
|
||||
}
|
||||
$problems[] = get_string('check_courserole_risky', 'report_security', $a);
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
|
||||
|
||||
if ($problems) {
|
||||
$result->status = REPORT_SECURITY_CRITICAL;
|
||||
$result->info = get_string('check_courserole_error', 'report_security');
|
||||
if ($detailed) {
|
||||
$result->details .= "<ul>";
|
||||
foreach ($problems as $problem) {
|
||||
$result->details .= "<li>$problem</li>";
|
||||
}
|
||||
$result->details .= "</ul>";
|
||||
}
|
||||
|
||||
} else {
|
||||
$result->status = REPORT_SECURITY_OK;
|
||||
$result->info = get_string('check_courserole_ok', 'report_security');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Executable
+372
@@ -0,0 +1,372 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Spam Cleaner
|
||||
*
|
||||
* Helps an admin to clean up spam in Moodle
|
||||
*
|
||||
* @version $Id$
|
||||
* @authors Dongsheng Cai, Martin Dougiamas, Amr Hourani
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
*/
|
||||
|
||||
// Configuration
|
||||
|
||||
// List of known spammy keywords, please add more here
|
||||
|
||||
$autokeywords = array(
|
||||
"<img",
|
||||
"fuck",
|
||||
"casino",
|
||||
"porn",
|
||||
"xxx",
|
||||
"cialis",
|
||||
"viagra",
|
||||
"poker",
|
||||
"warcraft"
|
||||
);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
function delete_user($user) {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time());
|
||||
$updateuser->email = '';
|
||||
$updateuser->idnumber = '';
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
role_unassign(0, $user->id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$keyword = optional_param('keyword', '', PARAM_RAW);
|
||||
$autodetect = optional_param('autodetect', '', PARAM_RAW);
|
||||
$del = optional_param('del', '', PARAM_RAW);
|
||||
$delall = optional_param('delall', '', PARAM_RAW);
|
||||
$ignore = optional_param('ignore', '', PARAM_RAW);
|
||||
$reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportspamcleaner', $adminroot);
|
||||
|
||||
// Implement some AJAX calls
|
||||
|
||||
// Delete one user
|
||||
if (!empty($del) && confirm_sesskey() && ($id != $USER->id)) {
|
||||
if (isset($SESSION->users_result[$id])) {
|
||||
$user = $SESSION->users_result[$id];
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete lots of users
|
||||
if (!empty($delall) && confirm_sesskey()) {
|
||||
if (!empty($SESSION->users_result)) {
|
||||
foreach ($SESSION->users_result as $userid => $user) {
|
||||
if ($userid != $USER->id) {
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$userid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($ignore)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
// Print headers and things
|
||||
|
||||
print_spamcleaner_javascript();
|
||||
|
||||
print_box(get_string('spamcleanerintro', 'report_spamcleaner'));
|
||||
|
||||
print_box_start(); // The forms section at the top
|
||||
|
||||
?>
|
||||
|
||||
<div class="mdl-align">
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'report_spamcleaner')?>" />
|
||||
</div>
|
||||
</form>
|
||||
<p><?php echo get_string('spameg', 'report_spamcleaner');?></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'report_spamcleaner');?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
print_box_end();
|
||||
|
||||
echo '<div id="result" class="mdl-align">';
|
||||
|
||||
// Print list of resulting profiles
|
||||
|
||||
if (!empty($keyword)) { // Use the keyword(s) supplied by the user
|
||||
$keywords = explode(',', $keyword);
|
||||
foreach ($keywords as $key => $keyword) {
|
||||
$keywords[$key] = trim($keyword);
|
||||
}
|
||||
search_spammers($keywords);
|
||||
|
||||
} else if (!empty($autodetect)) { // Use the inbuilt keyword list to detect users
|
||||
search_spammers($autokeywords);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/// Functions
|
||||
|
||||
|
||||
function search_spammers($keywords) {
|
||||
|
||||
global $CFG, $USER, $DB;
|
||||
|
||||
if (!is_array($keywords)) {
|
||||
$keywords = array($keywords); // Make it into an array
|
||||
}
|
||||
|
||||
$like = sql_ilike();
|
||||
|
||||
$keywordfull = array();
|
||||
foreach ($keywords as $keyword) {
|
||||
$keyword = addslashes($keyword); // Just to be safe
|
||||
$keywordfull[] = " description $like '%$keyword%' ";
|
||||
$keywordfull2[] = " p.summary $like '%$keyword%' ";
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
|
||||
$sql = "SELECT * FROM {$CFG->prefix}user WHERE deleted = 0 AND id <> {$USER->id} AND $conditions"; // Exclude oneself
|
||||
$sql2= "SELECT u.*, p.summary FROM {$CFG->prefix}user AS u, {$CFG->prefix}post AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> {$USER->id}";
|
||||
$spamusers_desc = get_recordset_sql($sql);
|
||||
$spamusers_blog = get_recordset_sql($sql2);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
print_box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
}
|
||||
|
||||
function print_user_list($users_rs, $keywords) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
// reset session everytime this function is called
|
||||
$SESSION->users_result = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ($users_rs as $rs) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (!$count) {
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'report_spamcleaner').'</th><th>'.get_string('spamoperation', 'report_spamcleaner').'</th></tr>';
|
||||
}
|
||||
$count++;
|
||||
filter_user($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$count) {
|
||||
echo get_string('spamcannotfinduser', 'report_spamcleaner');
|
||||
|
||||
} else {
|
||||
echo '</table>';
|
||||
echo '<div class="mld-align">
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'report_spamcleaner').'</button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
function filter_user($user, $keywords, $count) {
|
||||
global $CFG;
|
||||
$image_search = false;
|
||||
if (in_array('<img', $keywords)) {
|
||||
$image_search = true;
|
||||
}
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
}
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->pixpath.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
foreach ($keywords as $keyword) {
|
||||
if (preg_match('#'.$keyword.'#', $user->description)
|
||||
&& ($keyword != '<img')) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
} else {
|
||||
unset($user);
|
||||
}
|
||||
} else {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function print_user_entry($user, $keywords, $count) {
|
||||
|
||||
global $SESSION, $CFG;
|
||||
|
||||
$smalluserobject = new object; // All we need to delete them later
|
||||
$smalluserobject->id = $user->id;
|
||||
$smalluserobject->email = $user->email;
|
||||
$smalluserobject->auth = $user->auth;
|
||||
$smalluserobject->firstname = $user->firstname;
|
||||
$smalluserobject->lastname = $user->lastname;
|
||||
|
||||
if (empty($SESSION->users_result[$user->id])) {
|
||||
$SESSION->users_result[$user->id] = $smalluserobject;
|
||||
$html = '<tr valign="top" id="row-'.$user->id.'" class="result-row">';
|
||||
$html .= '<td width="10">'.$count.'</td>';
|
||||
$html .= '<td width="30%" align="left"><a href="'.$CFG->wwwroot."/user/view.php?course=1&id=".$user->id.'" title="'.s($user->username).'">'.fullname($user).'</a>';
|
||||
|
||||
$html .= "<ul>";
|
||||
$profile_set = array('city'=>true, 'country'=>true, 'email'=>true);
|
||||
foreach ($profile_set as $key=>$value) {
|
||||
if (isset($user->$key)){
|
||||
$html .= '<li>'.$user->$key.'</li>';
|
||||
}
|
||||
}
|
||||
$html .= "</ul>";
|
||||
$html .= '</td>';
|
||||
|
||||
foreach ($keywords as $keyword) {
|
||||
$user->description = highlight($keyword, $user->description);
|
||||
}
|
||||
|
||||
$html .= '<td align="left">'.format_text($user->description, FORMAT_MOODLE).'</td>';
|
||||
$html .= '<td width="100px" align="center">';
|
||||
$html .= '<button onclick="del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function print_spamcleaner_javascript() {
|
||||
global $CFG;
|
||||
|
||||
$sesskey = sesskey();
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/connection/connection-min.js"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var row = null;
|
||||
var delall_cb = {
|
||||
success: function(o){
|
||||
var resp = o.responseText;
|
||||
if(resp){
|
||||
window.location.href=window.location.href;
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
YAHOO.util.Event.addListener("removeall_btn", "click", function(){
|
||||
var yes = confirm('<?php echo get_string('spamdeleteallconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?delall=yes&sesskey=<?php echo $sesskey;?>', delall_cb);
|
||||
}
|
||||
});
|
||||
}
|
||||
var del_cb = {
|
||||
success: function(o) {
|
||||
var resp = o.responseText;
|
||||
if(row) {
|
||||
if(resp){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
} else {
|
||||
alert('<?php echo get_string('spamcannotdelete', 'report_spamcleaner');?>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ignore_cb = {
|
||||
success: function(o){
|
||||
var resp = o.responseText;
|
||||
if(row) {
|
||||
if(resp){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_user(obj, id) {
|
||||
var yes = confirm('<?php echo get_string('spamdeleteconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
row = obj;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?del=yes&sesskey=<?php echo $sesskey;?>&id='+id, del_cb);
|
||||
}
|
||||
}
|
||||
function ignore_user(obj, id) {
|
||||
row = obj;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', '<?php echo me();?>?ignore=yes&sesskey=<?php echo $sesskey;?>&id='+id, ignore_cb);
|
||||
}
|
||||
window.onload = function(){
|
||||
init();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
// spam cleaner
|
||||
$ADMIN->add('reports', new admin_externalpage('reportspamcleaner', get_string('spamcleaner','report_spamcleaner'), "$CFG->wwwroot/$CFG->admin/report/spamcleaner/index.php", 'moodle/site:config'));
|
||||
|
||||
+9
-14
@@ -43,9 +43,8 @@
|
||||
</label>
|
||||
<?php check_theme_arrows(); ?>
|
||||
<p class="arrow_button">
|
||||
<input name="add" id="add" type="submit" value="<?php echo ' '.$THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
|
||||
<br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo ' '.$THEME->rarrow.' '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
|
||||
<input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$THEME->rarrow; ?>" title="<?php print_string('remove'); ?>" />
|
||||
</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
@@ -58,13 +57,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 +71,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();
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
// This file defines settingpages and externalpages under the "mnet" category
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/index.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/index.php",
|
||||
'moodle/site:config'));
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/peers.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/peers.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', get_string('ssoaccesscontrol', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/access_control.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/access_control.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('mnetenrol', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/enr_hosts.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/enr_hosts.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/trustedhosts.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/trustedhosts.php",
|
||||
'moodle/site:config'));
|
||||
?>
|
||||
|
||||
@@ -33,8 +33,11 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', '
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('profilesforenrolledusersonly', get_string('profilesforenrolledusersonly','admin'),get_string('configprofilesforenrolledusersonly', 'admin'),'1'));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', get_string('emailchangeconfirmation', 'admin'), get_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $ADMIN->add('server', $temp, 0);
|
||||
|
||||
// "email" settingpage
|
||||
$temp = new admin_settingpage('mail', get_string('mail','admin'));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
|
||||
@@ -155,6 +155,15 @@ $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('delet
|
||||
6 => get_string('numhours', '', 6),
|
||||
1 => get_string('numhours', '', 1))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'),
|
||||
168 => get_string('numdays', '', 7),
|
||||
144 => get_string('numdays', '', 6),
|
||||
120 => get_string('numdays', '', 5),
|
||||
96 => get_string('numdays', '', 4),
|
||||
72 => get_string('numdays', '', 3),
|
||||
48 => get_string('numdays', '', 2),
|
||||
24 => get_string('numdays', '', 1))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
|
||||
1000 => get_string('numdays', '', 1000),
|
||||
365 => get_string('numdays', '', 365),
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+16
-4
@@ -118,8 +118,9 @@
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
// not sure if this is needed. unenrol_student($user->id); // From all courses
|
||||
delete_records('role_assignments', 'userid', $user->id); // unassign all roles
|
||||
// Removing a user may have more requirements than just removing their role assignments.
|
||||
// Use 'role_unassign' to make sure that all necessary actions occur.
|
||||
role_unassign(0, $user->id);
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
} else {
|
||||
@@ -202,7 +203,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere, false);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
@@ -303,7 +304,18 @@
|
||||
|
||||
$mainadmin = get_admin();
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$override = new object();
|
||||
$override->firstname = 'firstname';
|
||||
$override->lastname = 'lastname';
|
||||
$fullnamelanguage = get_string('fullnamedisplay', '', $override);
|
||||
if (($CFG->fullnamedisplay == 'firstname lastname') or
|
||||
($CFG->fullnamedisplay == 'firstname') or
|
||||
($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
|
||||
$fullnamedisplay = "$firstname / $lastname";
|
||||
} else { // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname')
|
||||
$fullnamedisplay = "$lastname / $firstname";
|
||||
}
|
||||
$table->head = array ($fullnamedisplay, $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -84,7 +84,7 @@ class edit_field extends XMLDBAction {
|
||||
/// Fetch request data
|
||||
$tableparam = required_param('table', PARAM_CLEAN);
|
||||
if (!$table =& $structure->getTable($tableparam)) {
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparm;
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparam;
|
||||
return false;
|
||||
}
|
||||
$fieldparam = required_param('field', PARAM_CLEAN);
|
||||
|
||||
@@ -84,7 +84,7 @@ class edit_index extends XMLDBAction {
|
||||
/// Fetch request data
|
||||
$tableparam = required_param('table', PARAM_CLEAN);
|
||||
if (!$table =& $structure->getTable($tableparam)) {
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparm;
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparam;
|
||||
return false;
|
||||
}
|
||||
$indexparam = required_param('index', PARAM_CLEAN);
|
||||
|
||||
@@ -84,7 +84,7 @@ class edit_key extends XMLDBAction {
|
||||
/// Fetch request data
|
||||
$tableparam = required_param('table', PARAM_CLEAN);
|
||||
if (!$table =& $structure->getTable($tableparam)) {
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparm;
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparam;
|
||||
return false;
|
||||
}
|
||||
$keyparam = required_param('key', PARAM_CLEAN);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -80,7 +80,7 @@ class view_table_sql extends XMLDBAction {
|
||||
/// Get parameters
|
||||
$tableparam = required_param('table', PARAM_PATH);
|
||||
if (!$table =& $structure->getTable($tableparam)) {
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparm;
|
||||
$this->errormsg = 'Wrong table specified: ' . $tableparam;
|
||||
return false;
|
||||
}
|
||||
$generatorparam = optional_param('generator', null, PARAM_ALPHANUM);
|
||||
|
||||
+3849
-1283
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ########################################################################
|
||||
<?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');
|
||||
|
||||
}
|
||||
|
||||
|
||||
<?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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+6231
-2077
File diff suppressed because it is too large
Load Diff
+498
-277
@@ -1,277 +1,498 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
* @file domxml-php4-php5.php
|
||||
|
||||
* Require PHP5, uses built-in DOM extension.
|
||||
|
||||
* To be used in PHP4 scripts using DOMXML extension.
|
||||
|
||||
* Allows PHP4/DOMXML scripts to run on PHP5/DOM.
|
||||
|
||||
* (Requires PHP5/XSL extension for domxml_xslt functions)
|
||||
|
||||
*
|
||||
|
||||
* Typical use:
|
||||
|
||||
* <pre>
|
||||
|
||||
* {
|
||||
|
||||
* if (version_compare(PHP_VERSION,'5','>='))
|
||||
|
||||
* require_once('domxml-php4-to-php5.php');
|
||||
|
||||
* }
|
||||
|
||||
* </pre>
|
||||
|
||||
*
|
||||
|
||||
* Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
|
||||
*
|
||||
|
||||
* ------------------------------------------------------------------<br>
|
||||
|
||||
* Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
|
||||
|
||||
*
|
||||
|
||||
* Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
|
||||
|
||||
* http://creativecommons.org/licenses/by-sa/2.0/fr/
|
||||
|
||||
* http://alexandre.alapetite.net/divers/apropos/#by-sa
|
||||
|
||||
* - Attribution. You must give the original author credit
|
||||
|
||||
* - Share Alike. If you alter, transform, or build upon this work,
|
||||
|
||||
* you may distribute the resulting work only under a license identical to this one
|
||||
|
||||
* - The French law is authoritative
|
||||
|
||||
* - Any of these conditions can be waived if you get permission from Alexandre Alapetite
|
||||
|
||||
* - Please send to Alexandre Alapetite the modifications you make,
|
||||
|
||||
* in order to improve this file for the benefit of everybody
|
||||
|
||||
*
|
||||
|
||||
* If you want to distribute this code, please do it as a link to:
|
||||
|
||||
* http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function domxml_new_doc($version) {return new php4DOMDocument('');}
|
||||
|
||||
function domxml_open_file($filename) {return new php4DOMDocument($filename);}
|
||||
|
||||
function domxml_open_mem($str)
|
||||
|
||||
{
|
||||
|
||||
$dom=new php4DOMDocument('');
|
||||
|
||||
$dom->myDOMNode->loadXML($str);
|
||||
|
||||
return $dom;
|
||||
|
||||
}
|
||||
|
||||
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);}
|
||||
|
||||
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
|
||||
|
||||
|
||||
|
||||
class php4DOMAttr extends php4DOMNode
|
||||
|
||||
{
|
||||
|
||||
function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;}
|
||||
|
||||
function Name() {return $this->myDOMNode->name;}
|
||||
|
||||
function Specified() {return $this->myDOMNode->specified;}
|
||||
|
||||
function Value() {return $this->myDOMNode->value;}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class php4DOMDocument extends php4DOMNode
|
||||
|
||||
{
|
||||
|
||||
function php4DOMDocument($filename='')
|
||||
|
||||
{
|
||||
|
||||
$this->myDOMNode=new DOMDocument();
|
||||
|
||||
if ($filename!='') $this->myDOMNode->load($filename);
|
||||
|
||||
}
|
||||
|
||||
function create_attribute($name,$value)
|
||||
|
||||
{
|
||||
|
||||
$myAttr=$this->myDOMNode->createAttribute($name);
|
||||
|
||||
$myAttr->value=$value;
|
||||
|
||||
return new php4DOMAttr($myAttr,$this);
|
||||
|
||||
}
|
||||
|
||||
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
|
||||
|
||||
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
|
||||
|
||||
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
|
||||
|
||||
function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);}
|
||||
|
||||
function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
|
||||
function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);}
|
||||
|
||||
function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();}
|
||||
|
||||
function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);}
|
||||
|
||||
function get_elements_by_tagname($name)
|
||||
|
||||
{
|
||||
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
|
||||
$nodeSet=array();
|
||||
|
||||
$i=0;
|
||||
|
||||
if (isset($myDOMNodeList))
|
||||
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
|
||||
{
|
||||
|
||||
$nodeSet[]=new php4DOMElement($node,$this);
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
return $nodeSet;
|
||||
|
||||
}
|
||||
|
||||
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
|
||||
|
||||
function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class php4DOMElement extends php4DOMNode
|
||||
|
||||
{
|
||||
|
||||
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
|
||||
|
||||
function get_elements_by_tagname($name)
|
||||
|
||||
{
|
||||
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
|
||||
$nodeSet=array();
|
||||
|
||||
$i=0;
|
||||
|
||||
if (isset($myDOMNodeList))
|
||||
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
|
||||
{
|
||||
|
||||
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
return $nodeSet;
|
||||
|
||||
}
|
||||
|
||||
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
|
||||
|
||||
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
|
||||
|
||||
function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);}
|
||||
|
||||
function tagname() {return $this->myDOMNode->tagName;}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class php4DOMNode
|
||||
|
||||
{
|
||||
|
||||
var $myDOMNode;
|
||||
|
||||
var $myOwnerDocument;
|
||||
|
||||
function php4DOMNode($aDomNode,$aOwnerDocument)
|
||||
|
||||
{
|
||||
|
||||
$this->myDOMNode=$aDomNode;
|
||||
|
||||
$this->myOwnerDocument=$aOwnerDocument;
|
||||
|
||||
}
|
||||
|
||||
function __get($name)
|
||||
|
||||
{
|
||||
|
||||
if ($name=='type') return $this->myDOMNode->nodeType;
|
||||
|
||||
elseif ($name=='tagname') return $this->myDOMNode->tagName;
|
||||
|
||||
elseif ($name=='content') return $this->myDOMNode->textContent;
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$myErrors=debug_backtrace();
|
||||
|
||||
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
|
||||
function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
|
||||
function attributes()
|
||||
<?php
|
||||
/*
|
||||
Requires PHP5, uses built-in DOM extension.
|
||||
To be used in PHP4 scripts using DOMXML extension: allows PHP4/DOMXML scripts to run on PHP5/DOM.
|
||||
(Optional: requires PHP5/XSL extension for domxml_xslt functions, PHP>=5.1 for XPath evaluation functions, and PHP>=5.1/libxml for DOMXML error reports)
|
||||
|
||||
Typical use:
|
||||
{
|
||||
if (PHP_VERSION>='5')
|
||||
require_once('domxml-php4-to-php5.php');
|
||||
}
|
||||
|
||||
Version 1.20a, 2008-11-06, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
|
||||
------------------------------------------------------------------
|
||||
Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
|
||||
|
||||
Copyright 2004-2008, GNU Lesser General Public License,
|
||||
http://www.gnu.org/licenses/lgpl.html
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.html>
|
||||
|
||||
== Rights and obligations ==
|
||||
- Attribution: You must give the original author credit.
|
||||
- Share Alike: If you alter or transform this library,
|
||||
you may distribute the resulting library only under the same license GNU/LGPL.
|
||||
- In case of jurisdiction dispute, the French law is authoritative.
|
||||
- Any of these conditions can be waived if you get permission from Alexandre Alapetite.
|
||||
- Not required, but please send to Alexandre Alapetite the modifications you make,
|
||||
in order to improve this file for the benefit of everybody.
|
||||
|
||||
If you want to distribute this code, please do it as a link to:
|
||||
http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
*/
|
||||
|
||||
define('DOMXML_LOAD_PARSING',0);
|
||||
define('DOMXML_LOAD_VALIDATING',1);
|
||||
define('DOMXML_LOAD_RECOVERING',2);
|
||||
define('DOMXML_LOAD_SUBSTITUTE_ENTITIES',4);
|
||||
//define('DOMXML_LOAD_COMPLETE_ATTRS',8);
|
||||
define('DOMXML_LOAD_DONT_KEEP_BLANKS',16);
|
||||
|
||||
function domxml_new_doc($version) {return new php4DOMDocument();}
|
||||
function domxml_new_xmldoc($version) {return new php4DOMDocument();}
|
||||
function domxml_open_file($filename,$mode=DOMXML_LOAD_PARSING,&$error=null)
|
||||
{
|
||||
$dom=new php4DOMDocument($mode);
|
||||
$errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
|
||||
if ($errorMode) libxml_use_internal_errors(true);
|
||||
if (!$dom->myDOMNode->load($filename)) $dom=null;
|
||||
if ($errorMode)
|
||||
{
|
||||
$error=array_map('_error_report',libxml_get_errors());
|
||||
libxml_clear_errors();
|
||||
}
|
||||
return $dom;
|
||||
}
|
||||
function domxml_open_mem($str,$mode=DOMXML_LOAD_PARSING,&$error=null)
|
||||
{
|
||||
$dom=new php4DOMDocument($mode);
|
||||
$errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
|
||||
if ($errorMode) libxml_use_internal_errors(true);
|
||||
if (!$dom->myDOMNode->loadXML($str)) $dom=null;
|
||||
if ($errorMode)
|
||||
{
|
||||
$error=array_map('_error_report',libxml_get_errors());
|
||||
libxml_clear_errors();
|
||||
}
|
||||
return $dom;
|
||||
}
|
||||
function html_doc($html_doc,$from_file=false)
|
||||
{
|
||||
$dom=new php4DOMDocument();
|
||||
if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc);
|
||||
else $result=$dom->myDOMNode->loadHTML($html_doc);
|
||||
return $result ? $dom : null;
|
||||
}
|
||||
function html_doc_file($filename) {return html_doc($filename,true);}
|
||||
function xmldoc($str) {return domxml_open_mem($str);}
|
||||
function xmldocfile($filename) {return domxml_open_file($filename);}
|
||||
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->xpath_eval($eval_str,$contextnode);}
|
||||
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
|
||||
function xpath_register_ns($xpath_context,$prefix,$namespaceURI) {return $xpath_context->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
|
||||
function _entityDecode($text) {return html_entity_decode(strtr($text,array('''=>'\'')),ENT_QUOTES,'UTF-8');}
|
||||
function _error_report($error) {return array('errormessage'=>$error->message,'nodename'=>'','line'=>$error->line,'col'=>$error->column)+($error->file==''?array():array('directory'=>dirname($error->file),'file'=>basename($error->file)));}
|
||||
|
||||
class php4DOMAttr extends php4DOMNode
|
||||
{
|
||||
function __get($name)
|
||||
{
|
||||
if ($name==='name') return $this->myDOMNode->name;
|
||||
else return parent::__get($name);
|
||||
}
|
||||
function name() {return $this->myDOMNode->name;}
|
||||
function set_content($text) {}
|
||||
//function set_value($content) {return $this->myDOMNode->value=htmlspecialchars($content,ENT_QUOTES);}
|
||||
function specified() {return $this->myDOMNode->specified;}
|
||||
function value() {return $this->myDOMNode->value;}
|
||||
}
|
||||
|
||||
class php4DOMDocument extends php4DOMNode
|
||||
{
|
||||
function php4DOMDocument($mode=DOMXML_LOAD_PARSING)
|
||||
{
|
||||
$this->myDOMNode=new DOMDocument();
|
||||
$this->myOwnerDocument=$this;
|
||||
if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true;
|
||||
if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true;
|
||||
if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true;
|
||||
if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false;
|
||||
}
|
||||
function add_root($name)
|
||||
{
|
||||
if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
|
||||
return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument);
|
||||
}
|
||||
function create_attribute($name,$value)
|
||||
{
|
||||
$myAttr=$this->myDOMNode->createAttribute($name);
|
||||
$myAttr->value=htmlspecialchars($value,ENT_QUOTES);
|
||||
return new php4DOMAttr($myAttr,$this);
|
||||
}
|
||||
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
|
||||
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
|
||||
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
|
||||
function create_element_ns($uri,$name,$prefix=null)
|
||||
{
|
||||
if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri);
|
||||
if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri));
|
||||
return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this);
|
||||
}
|
||||
function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22
|
||||
function create_processing_instruction($target,$data=''){return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target,$data),$this);}
|
||||
function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content),$this);}
|
||||
function document_element() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);}
|
||||
function dump_file($filename,$compressionmode=false,$format=false)
|
||||
{
|
||||
$format0=$this->myDOMNode->formatOutput;
|
||||
$this->myDOMNode->formatOutput=$format;
|
||||
$res=$this->myDOMNode->save($filename);
|
||||
$this->myDOMNode->formatOutput=$format0;
|
||||
return $res;
|
||||
}
|
||||
function dump_mem($format=false,$encoding=false)
|
||||
{
|
||||
$format0=$this->myDOMNode->formatOutput;
|
||||
$this->myDOMNode->formatOutput=$format;
|
||||
$encoding0=$this->myDOMNode->encoding;
|
||||
if ($encoding) $this->myDOMNode->encoding=$encoding;
|
||||
$dump=$this->myDOMNode->saveXML();
|
||||
$this->myDOMNode->formatOutput=$format0;
|
||||
if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding
|
||||
return $dump;
|
||||
}
|
||||
function free()
|
||||
{
|
||||
if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
|
||||
$this->myDOMNode=null;
|
||||
$this->myOwnerDocument=null;
|
||||
}
|
||||
function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this);
|
||||
return $nodeSet;
|
||||
}
|
||||
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
|
||||
function root() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);}
|
||||
function xpath_new_context() {return new php4DOMXPath($this);}
|
||||
}
|
||||
|
||||
class php4DOMElement extends php4DOMNode
|
||||
{
|
||||
function add_namespace($uri,$prefix)
|
||||
{
|
||||
if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false;
|
||||
else
|
||||
{
|
||||
$this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
|
||||
function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name),$this->myOwnerDocument);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
return $nodeSet;
|
||||
}
|
||||
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
|
||||
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
|
||||
function set_attribute($name,$value)
|
||||
{
|
||||
//return $this->myDOMNode->setAttribute($name,$value); //Does not return a DomAttr
|
||||
$myAttr=$this->myDOMNode->ownerDocument->createAttribute($name);
|
||||
$myAttr->value=htmlspecialchars($value,ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07
|
||||
$this->myDOMNode->setAttributeNode($myAttr);
|
||||
return new php4DOMAttr($myAttr,$this->myOwnerDocument);
|
||||
}
|
||||
/*function set_attribute_node($attr)
|
||||
{
|
||||
$this->myDOMNode->setAttributeNode($this->_importNode($attr));
|
||||
return $attr;
|
||||
}*/
|
||||
function set_name($name)
|
||||
{
|
||||
if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name);
|
||||
else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name);
|
||||
$myDOMNodeList=$this->myDOMNode->attributes;
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i++))
|
||||
if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value);
|
||||
else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value);
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node);
|
||||
$this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode);
|
||||
$this->myDOMNode=$newNode;
|
||||
return true;
|
||||
}
|
||||
function tagname() {return $this->tagname;}
|
||||
}
|
||||
|
||||
class php4DOMNode
|
||||
{
|
||||
public $myDOMNode;
|
||||
public $myOwnerDocument;
|
||||
function php4DOMNode($aDomNode,$aOwnerDocument)
|
||||
{
|
||||
$this->myDOMNode=$aDomNode;
|
||||
$this->myOwnerDocument=$aOwnerDocument;
|
||||
}
|
||||
function __get($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'type': return $this->myDOMNode->nodeType;
|
||||
case 'tagname': return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement
|
||||
case 'content': return $this->myDOMNode->textContent;
|
||||
case 'value': return $this->myDOMNode->value;
|
||||
default:
|
||||
$myErrors=debug_backtrace();
|
||||
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function add_child($newnode) {return append_child($newnode);}
|
||||
function add_namespace($uri,$prefix) {return false;}
|
||||
function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);}
|
||||
function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);}
|
||||
function attributes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->attributes;
|
||||
if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
|
||||
return $nodeSet;
|
||||
}
|
||||
function child_nodes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument);
|
||||
return $nodeSet;
|
||||
}
|
||||
function children() {return $this->child_nodes();}
|
||||
function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
|
||||
//dump_node($node) should only be called on php4DOMDocument
|
||||
function dump_node($node=null) {return $node==null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode);}
|
||||
function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
|
||||
function get_content() {return $this->myDOMNode->textContent;}
|
||||
function has_attributes() {return $this->myDOMNode->hasAttributes();}
|
||||
function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
|
||||
function insert_before($newnode,$refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode),$refnode==null?null:$refnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function is_blank_node() {return ($this->myDOMNode->nodeType===XML_TEXT_NODE)&&preg_match('%^\s*$%',$this->myDOMNode->nodeValue);}
|
||||
function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
|
||||
function new_child($name,$content)
|
||||
{
|
||||
$mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
|
||||
$mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content)));
|
||||
$this->myDOMNode->appendChild($mySubNode);
|
||||
return new php4DOMElement($mySubNode,$this->myOwnerDocument);
|
||||
}
|
||||
function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
|
||||
function node_name() {return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName;} //Avoid namespace prefix for DOMElement
|
||||
function node_type() {return $this->myDOMNode->nodeType;}
|
||||
function node_value() {return $this->myDOMNode->nodeValue;}
|
||||
function owner_document() {return $this->myOwnerDocument;}
|
||||
function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
|
||||
function prefix() {return $this->myDOMNode->prefix;}
|
||||
function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
|
||||
function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
|
||||
function replace_child($newnode,$oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode),$oldnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode),$this->myDOMNode),$this->myOwnerDocument);}
|
||||
function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text)));} //Entity problem reported by AL-DesignWorks 2007-09-07
|
||||
//function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);}
|
||||
function set_namespace($uri,$prefix=null)
|
||||
{//Contributions by Daniel Walker 2006-09-08
|
||||
$nsprefix=$this->myDOMNode->lookupPrefix($uri);
|
||||
if ($nsprefix==null)
|
||||
{
|
||||
$nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix;
|
||||
if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE)
|
||||
{
|
||||
if (($prefix!=null)&&$this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)&&
|
||||
($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)!=$uri))
|
||||
{//Remove namespace
|
||||
$parent=$this->myDOMNode->ownerElement;
|
||||
$parent->removeAttributeNode($this->myDOMNode);
|
||||
$parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue);
|
||||
$this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName);
|
||||
return;
|
||||
}
|
||||
$this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri);
|
||||
}
|
||||
}
|
||||
if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE)
|
||||
{
|
||||
$parent=$this->myDOMNode->ownerElement;
|
||||
$parent->removeAttributeNode($this->myDOMNode);
|
||||
$parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue);
|
||||
$this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName);
|
||||
}
|
||||
elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE)
|
||||
{
|
||||
$NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName);
|
||||
foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true));
|
||||
foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true));
|
||||
$xpath=new DOMXPath($this->myDOMNode->ownerDocument);
|
||||
$myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces
|
||||
foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue);
|
||||
$this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode);
|
||||
$this->myDOMNode=$NewNode;
|
||||
}
|
||||
}
|
||||
function unlink_node()
|
||||
{
|
||||
if ($this->myDOMNode->parentNode!=null)
|
||||
{
|
||||
if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode);
|
||||
else $this->myDOMNode->parentNode->removeChild($this->myDOMNode);
|
||||
}
|
||||
}
|
||||
protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument
|
||||
static function _newDOMElement($aDOMNode,$aOwnerDocument)
|
||||
{//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper
|
||||
if ($aDOMNode==null) return null;
|
||||
switch ($aDOMNode->nodeType)
|
||||
{
|
||||
case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument);
|
||||
case XML_TEXT_NODE: return new php4DOMText($aDOMNode,$aOwnerDocument);
|
||||
case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode,$aOwnerDocument);
|
||||
case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode,$aOwnerDocument);
|
||||
default: return new php4DOMNode($aDOMNode,$aOwnerDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class php4DomProcessingInstruction extends php4DOMNode
|
||||
{
|
||||
function data() {return $this->myDOMNode->data;}
|
||||
function target() {return $this->myDOMNode->target;}
|
||||
}
|
||||
|
||||
class php4DOMText extends php4DOMNode
|
||||
{
|
||||
function __get($name)
|
||||
{
|
||||
if ($name==='tagname') return '#text';
|
||||
else return parent::__get($name);
|
||||
}
|
||||
function tagname() {return '#text';}
|
||||
function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;}
|
||||
}
|
||||
|
||||
if (!defined('XPATH_NODESET'))
|
||||
{
|
||||
define('XPATH_UNDEFINED',0);
|
||||
define('XPATH_NODESET',1);
|
||||
define('XPATH_BOOLEAN',2);
|
||||
define('XPATH_NUMBER',3);
|
||||
define('XPATH_STRING',4);
|
||||
/*define('XPATH_POINT',5);
|
||||
define('XPATH_RANGE',6);
|
||||
define('XPATH_LOCATIONSET',7);
|
||||
define('XPATH_USERS',8);
|
||||
define('XPATH_XSLT_TREE',9);*/
|
||||
}
|
||||
|
||||
class php4DOMNodelist
|
||||
{
|
||||
private $myDOMNodelist;
|
||||
public $nodeset;
|
||||
public $type=XPATH_UNDEFINED;
|
||||
public $value;
|
||||
function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
|
||||
{
|
||||
if (!isset($aDOMNodelist)) return;
|
||||
elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist))
|
||||
{
|
||||
if ($aDOMNodelist->length>0)
|
||||
{
|
||||
$this->myDOMNodelist=$aDOMNodelist;
|
||||
$this->nodeset=array();
|
||||
$this->type=XPATH_NODESET;
|
||||
$i=0;
|
||||
while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument);
|
||||
}
|
||||
}
|
||||
elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist))
|
||||
{
|
||||
$this->type=XPATH_NUMBER;
|
||||
$this->value=$aDOMNodelist;
|
||||
}
|
||||
elseif (is_bool($aDOMNodelist))
|
||||
{
|
||||
$this->type=XPATH_BOOLEAN;
|
||||
$this->value=$aDOMNodelist;
|
||||
}
|
||||
elseif (is_string($aDOMNodelist))
|
||||
{
|
||||
$this->type=XPATH_STRING;
|
||||
$this->value=$aDOMNodelist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class php4DOMXPath
|
||||
{
|
||||
public $myDOMXPath;
|
||||
private $myOwnerDocument;
|
||||
function php4DOMXPath($dom_document)
|
||||
{
|
||||
//TODO: If $dom_document is a DomElement, make that default $contextnode and modify XPath. Ex: '/test'
|
||||
$this->myOwnerDocument=$dom_document->myOwnerDocument;
|
||||
$this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode);
|
||||
}
|
||||
function xpath_eval($eval_str,$contextnode=null)
|
||||
{
|
||||
if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str);
|
||||
else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str);
|
||||
$xp=new php4DOMNodelist($xp,$this->myOwnerDocument);
|
||||
return ($xp->type===XPATH_UNDEFINED) ? false : $xp;
|
||||
}
|
||||
function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
|
||||
}
|
||||
|
||||
if (extension_loaded('xsl'))
|
||||
{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
|
||||
function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
|
||||
function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
|
||||
function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
|
||||
class php4DomXsltStylesheet
|
||||
{
|
||||
private $myxsltProcessor;
|
||||
function php4DomXsltStylesheet($dom_document)
|
||||
{
|
||||
$this->myxsltProcessor=new xsltProcessor();
|
||||
$this->myxsltProcessor->importStyleSheet($dom_document);
|
||||
}
|
||||
function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
|
||||
{
|
||||
foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value);
|
||||
$myphp4DOMDocument=new php4DOMDocument();
|
||||
$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
|
||||
return $myphp4DOMDocument;
|
||||
}
|
||||
function result_dump_file($dom_document,$filename)
|
||||
{
|
||||
$html=$dom_document->myDOMNode->saveHTML();
|
||||
file_put_contents($filename,$html);
|
||||
return $html;
|
||||
}
|
||||
function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
<?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 !',
|
||||
<?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
|
||||
|
||||
<?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
|
||||
|
||||
<?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>).'
|
||||
);
|
||||
|
||||
<?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
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
<?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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+56
-11
@@ -58,7 +58,7 @@ class auth_plugin_cas extends auth_plugin_base {
|
||||
*/
|
||||
function user_login ($username, $password) {
|
||||
$this->connectCAS();
|
||||
return phpCAS::isAuthenticated();
|
||||
return phpCAS::isAuthenticated() && (phpCAS::getUser() == $username);
|
||||
}
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
@@ -84,24 +84,43 @@ class auth_plugin_cas extends auth_plugin_base {
|
||||
*/
|
||||
function loginpage_hook() {
|
||||
global $frm;
|
||||
global $test;
|
||||
global $CFG;
|
||||
global $SESSION;
|
||||
|
||||
$site = get_site();
|
||||
$CASform = get_string("CASform","auth");
|
||||
$username = optional_param("username");
|
||||
|
||||
if (!empty($username)) {
|
||||
return;
|
||||
if (strstr($SESSION->wantsurl,'ticket') || strstr($SESSION->wantsurl,'NOCAS'))
|
||||
unset($SESSION->wantsurl);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test si cas activ� et param�tres non remplis
|
||||
if (empty($this->config->hostname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Connection to CAS server
|
||||
$this->connectCAS();
|
||||
|
||||
// Gestion de la connection CAS si accès direct d'un ent ou autre
|
||||
// Gestion de la connection CAS si acc�s direct d'un ent ou autre
|
||||
if (phpCAS::checkAuthentication()) {
|
||||
$frm->username=phpCAS::getUser();
|
||||
$frm->password="cas";
|
||||
// if (phpCAS::getUser()=='esup9992')
|
||||
// $frm->username='erhar0062';
|
||||
$frm->password="passwdCas";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["loginguest"]== true) {
|
||||
$frm->username="guest";
|
||||
$frm->password="guest";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->config->multiauth) {
|
||||
$authCAS = optional_param("authCAS");
|
||||
@@ -208,8 +227,6 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
$config->baseuri = '';
|
||||
if (!isset ($config->language))
|
||||
$config->language = '';
|
||||
if (!isset ($config->use_cas))
|
||||
$config->use_cas = '';
|
||||
if (!isset ($config->proxycas))
|
||||
$config->proxycas = '';
|
||||
if (!isset ($config->logoutcas))
|
||||
@@ -255,7 +272,6 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
set_config('casversion', $config->casversion, 'auth/cas');
|
||||
set_config('baseuri', $config->baseuri, 'auth/cas');
|
||||
set_config('language', $config->language, 'auth/cas');
|
||||
set_config('use_cas', $config->use_cas, 'auth/cas');
|
||||
set_config('proxycas', $config->proxycas, 'auth/cas');
|
||||
set_config('logoutcas', $config->logoutcas, 'auth/cas');
|
||||
set_config('multiauth', $config->multiauth, 'auth/cas');
|
||||
@@ -389,7 +405,7 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
$result[$key] = $ldapval;
|
||||
}
|
||||
}
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close($ldapconnection);
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
@@ -419,6 +435,16 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
* @return connection result
|
||||
*/
|
||||
function ldap_connect($binddn='',$bindpwd='') {
|
||||
// Cache ldap connections (they are expensive to set up
|
||||
// and can drain the TCP/IP ressources on the server if we
|
||||
// are syncing a lot of users (as we try to open a new connection
|
||||
// to get the user details). This is the least invasive way
|
||||
// to reuse existing connections without greater code surgery.
|
||||
if(!empty($this->ldapconnection)) {
|
||||
$this->ldapconns++;
|
||||
return $this->ldapconnection;
|
||||
}
|
||||
|
||||
//Select bind password, With empty values use
|
||||
//ldap_bind_* variables or anonymous bind if ldap_bind_* are empty
|
||||
if ($binddn == '' and $bindpwd == '') {
|
||||
@@ -453,6 +479,10 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
ldap_set_option($connresult, LDAP_OPT_DEREF, $this->config->opt_deref);
|
||||
}
|
||||
if ($bindresult) {
|
||||
// Set the connection counter so we can call PHP's ldap_close()
|
||||
// when we call $this->ldap_close() for the last 'open' connection.
|
||||
$this->ldapconns = 1;
|
||||
$this->ldapconnection = $connresult;
|
||||
return $connresult;
|
||||
}
|
||||
$debuginfo .= "<br/>Server: '$server' <br/> Connection: '$connresult'<br/> Bind result: '$bindresult'</br>";
|
||||
@@ -461,6 +491,18 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
print_error('auth_ldap_noconnect_all','auth',$this->config->user_type);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* disconnects from a ldap server
|
||||
*
|
||||
*/
|
||||
function ldap_close() {
|
||||
$this->ldapconns--;
|
||||
if($this->ldapconns == 0) {
|
||||
@ldap_close($this->ldapconnection);
|
||||
unset($this->ldapconnection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* retuns user attribute mappings between moodle and ldap
|
||||
*
|
||||
@@ -613,7 +655,7 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
print "Connecting to ldap...\n";
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
if (!$ldapconnection) {
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close($ldapconnection);
|
||||
print get_string('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
exit;
|
||||
}
|
||||
@@ -862,6 +904,7 @@ if ( !is_object($PHPCAS_CLIENT) ) {
|
||||
} else {
|
||||
print "No users to be added\n";
|
||||
}
|
||||
$this->ldap_close();
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
@@ -1000,6 +1043,7 @@ if (!empty($this->config->attrcreators)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->ldap_close();
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
@@ -1039,6 +1083,7 @@ if (!empty($this->config->attrcreators)) {
|
||||
array_push($fresult, ($users[$i][$this->config->user_attribute][0]) );
|
||||
}
|
||||
}
|
||||
$this->ldap_close();
|
||||
return $fresult;
|
||||
}
|
||||
/**
|
||||
|
||||
+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>
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@@ -45,4 +45,4 @@ if (!is_enabled_auth('cas')) {
|
||||
$casauth = get_auth_plugin('cas');
|
||||
$casauth->sync_users(1000, true);
|
||||
|
||||
?>
|
||||
?>
|
||||
+413
-17
@@ -1,432 +1,828 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
global $CFG;
|
||||
|
||||
require_once 'languages.php';
|
||||
|
||||
|
||||
|
||||
$createoptions[0] = get_string("no");
|
||||
|
||||
$createoptions[1] = get_string("yes");
|
||||
|
||||
|
||||
|
||||
// set to defaults if undefined (CAS)
|
||||
|
||||
if (!isset ($config->hostname))
|
||||
|
||||
$config->hostname = '';
|
||||
|
||||
if (!isset ($config->port))
|
||||
|
||||
$config->port = '';
|
||||
|
||||
if (!isset ($config->casversion))
|
||||
|
||||
$config->casversion = '';
|
||||
|
||||
if (!isset ($config->baseuri))
|
||||
|
||||
$config->baseuri = '';
|
||||
|
||||
if (!isset ($config->language))
|
||||
|
||||
$config->language = '';
|
||||
if (!isset ($config->use_cas))
|
||||
$config->use_cas = '';
|
||||
|
||||
if (!isset ($config->proxycas))
|
||||
|
||||
$config->proxycas = '';
|
||||
|
||||
if (!isset ($config->logoutcas))
|
||||
|
||||
$config->logoutcas = '';
|
||||
|
||||
if (!isset ($config->multiauth))
|
||||
|
||||
$config->multiauth = '';
|
||||
|
||||
// set to defaults if undefined (LDAP)
|
||||
|
||||
if (!isset($config->host_url))
|
||||
|
||||
{ $config->host_url = ''; }
|
||||
|
||||
if (empty($config->ldapencoding))
|
||||
|
||||
{ $config->ldapencoding = 'utf-8'; }
|
||||
|
||||
if (!isset($config->contexts))
|
||||
|
||||
{ $config->contexts = ''; }
|
||||
|
||||
if (!isset($config->user_type))
|
||||
|
||||
{ $config->user_type = 'default'; }
|
||||
|
||||
if (!isset($config->user_attribute))
|
||||
|
||||
{ $config->user_attribute = ''; }
|
||||
|
||||
if (!isset($config->search_sub))
|
||||
|
||||
{ $config->search_sub = ''; }
|
||||
|
||||
if (!isset($config->opt_deref))
|
||||
|
||||
{ $config->opt_deref = LDAP_DEREF_NEVER; }
|
||||
|
||||
if (!isset($config->bind_dn))
|
||||
|
||||
{$config->bind_dn = ''; }
|
||||
|
||||
if (!isset($config->bind_pw))
|
||||
|
||||
{$config->bind_pw = ''; }
|
||||
|
||||
if (!isset($config->version))
|
||||
|
||||
{$config->version = '2'; }
|
||||
|
||||
if (!isset($config->objectclass))
|
||||
|
||||
{$config->objectclass = ''; }
|
||||
|
||||
if (!isset($config->memberattribute))
|
||||
|
||||
{$config->memberattribute = ''; }
|
||||
|
||||
if (!isset($config->memberattribute_isdn))
|
||||
|
||||
{$config->memberattribute_isdn = ''; }
|
||||
|
||||
if (!isset($config->groupecreators))
|
||||
|
||||
{$config->groupecreators = ''; }
|
||||
|
||||
if (!isset($config->attrcreators))
|
||||
|
||||
{$config->attrcreators = ''; }
|
||||
if (!isset($config->removeuser))
|
||||
|
||||
if (!isset($config->removeuser))
|
||||
|
||||
{$config->removeuser = 0; }
|
||||
|
||||
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
|
||||
|
||||
if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
|
||||
notify(get_string('auth_ldap_noextension','auth'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_use_cas', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'use_cas', $config->use_cas, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_enabled', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($err['hostname'])) {
|
||||
|
||||
formerr($err['hostname']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_hostname', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($err['baseuri'])) {
|
||||
|
||||
formerr($err['baseuri']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($err['port'])) {
|
||||
|
||||
formerr($err['port']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_port', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($err['casversion'])) {
|
||||
|
||||
formerr($err['casversion']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_version', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_language', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_proxycas_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, 'proxycas', $config->proxycas, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_proxycas', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, 'logoutcas', $config->logoutcas, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_logoutcas', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><?php print_string('auth_cas_multiauth_key', 'auth') ?>:</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, 'multiauth', $config->multiauth, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_cas_multiauth', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
|
||||
|
||||
<?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_host_url','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
$versions = array();
|
||||
|
||||
$versions[2] = '2';
|
||||
|
||||
$versions[3] = '3';
|
||||
|
||||
choose_from_menu($versions, 'version', $config->version, '');
|
||||
|
||||
if (isset($err['version'])) formerr($err['version']);
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_version','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($err['ldapencoding'])) {
|
||||
|
||||
formerr($err['ldapencoding']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
|
||||
|
||||
<?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_bind_dn','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
|
||||
|
||||
<?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_bind_pw','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
|
||||
|
||||
<?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_user_type', 'auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
|
||||
|
||||
<?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_contexts', 'auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_search_sub','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
$opt_deref = array();
|
||||
|
||||
$opt_deref[LDAP_DEREF_NEVER] = get_string('no');
|
||||
|
||||
$opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
|
||||
|
||||
choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, '');
|
||||
|
||||
if (isset($err['opt_deref'])) formerr($err['opt_deref']);
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_opt_deref','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
|
||||
|
||||
<?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_user_attribute','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
|
||||
|
||||
<?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_memberattribute','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
|
||||
|
||||
<?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
|
||||
|
||||
<?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_ldap_objectclass','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('coursecreators') ?> </h4>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="attrcreators_key"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
|
||||
|
||||
<?php if (isset($err['attrcreators'])) formerr($err['attrcreators']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_attrcreators','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
|
||||
<td align="right"><label for="groupecreators_key"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
|
||||
|
||||
<?php if (isset($err['groupecreators'])) formerr($err['groupecreators']); ?>
|
||||
|
||||
</td><td>
|
||||
|
||||
<?php print_string('auth_ldap_groupecreators','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
<h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
|
||||
<td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
$deleteopt = array();
|
||||
|
||||
$deleteopt['0'] = get_string('auth_remove_keep','auth');
|
||||
|
||||
$deleteopt['1'] = get_string('auth_remove_suspend','auth');
|
||||
|
||||
$deleteopt['2'] = get_string('auth_remove_delete','auth');
|
||||
|
||||
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php print_string('auth_remove_user','auth') ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$help = get_string('auth_ldapextrafields','auth');
|
||||
|
||||
$help .= get_string('auth_updatelocal_expl','auth');
|
||||
|
||||
$help .= get_string('auth_fieldlock_expl','auth');
|
||||
|
||||
$help .= get_string('auth_updateremote_expl','auth');
|
||||
|
||||
$help .= '<hr />';
|
||||
|
||||
$help .= get_string('auth_updateremote_ldap','auth');
|
||||
|
||||
|
||||
|
||||
print_auth_lock_options('cas', $user_fields, $help, true, true);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
</table>
|
||||
+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");
|
||||
|
||||
?>
|
||||
|
||||
@@ -173,6 +173,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
if ($rs = $authdb->Execute($sql)) {
|
||||
if ( $rs->RecordCount() == 1 ) {
|
||||
$fields_obj = rs_fetch_record($rs);
|
||||
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
|
||||
foreach ($selectfields as $localname=>$externalname) {
|
||||
$result[$localname] = $textlib->convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
|
||||
}
|
||||
@@ -429,6 +430,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
print_error('auth_dbcantconnect','auth');
|
||||
} else if ( $rs->RecordCount() ) {
|
||||
while ($rec = rs_fetch_next_record($rs)) {
|
||||
$rec = (object)array_change_key_case((array)$rec , CASE_LOWER);
|
||||
array_push($result, $rec->username);
|
||||
}
|
||||
}
|
||||
|
||||
+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');
|
||||
|
||||
+3
-2
@@ -16,7 +16,8 @@
|
||||
/* */
|
||||
/* 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. */
|
||||
/* the Free Software Foundation; either version 2 of the License or any */
|
||||
/* later version. */
|
||||
/************************************************************************/
|
||||
/* Author: Torsten Anderson, torsten.anderson@skeria.skelleftea.se
|
||||
*/
|
||||
@@ -50,7 +51,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;
|
||||
}
|
||||
|
||||
|
||||
+116
-33
@@ -45,11 +45,36 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$this->config->{$key} = $value[$this->config->user_type];
|
||||
}
|
||||
}
|
||||
//hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) { // Can't send empty filter
|
||||
$this->config->objectclass='objectClass=*';
|
||||
} else if (strpos($this->config->objectclass, 'objectClass=') !== 0) {
|
||||
$this->config->objectclass = 'objectClass='.$this->config->objectclass;
|
||||
|
||||
// Hack prefix to objectclass
|
||||
if (empty($this->config->objectclass)) {
|
||||
// Can't send empty filter
|
||||
$this->config->objectclass='(objectClass=*)';
|
||||
} else if (stripos($this->config->objectclass, 'objectClass=') === 0) {
|
||||
// Value is 'objectClass=some-string-here', so just add ()
|
||||
// around the value (filter _must_ have them).
|
||||
$this->config->objectclass = '('.$this->config->objectclass.')';
|
||||
} else if (stripos($this->config->objectclass, '(') !== 0) {
|
||||
// Value is 'some-string-not-starting-with-left-parentheses',
|
||||
// which is assumed to be the objectClass matching value.
|
||||
// So build a valid filter with it.
|
||||
$this->config->objectclass = '(objectClass='.$this->config->objectclass.')';
|
||||
} else {
|
||||
// There is an additional possible value
|
||||
// '(some-string-here)', that can be used to specify any
|
||||
// valid filter string, to select subsets of users based
|
||||
// on any criteria. For example, we could select the users
|
||||
// whose objectClass is 'user' and have the
|
||||
// 'enabledMoodleUser' attribute, with something like:
|
||||
//
|
||||
// (&(objectClass=user)(enabledMoodleUser=1))
|
||||
//
|
||||
// This is only used in the functions that deal with the
|
||||
// whole potential set of users (currently sync_users()
|
||||
// and get_user_list() only).
|
||||
//
|
||||
// In this particular case we don't need to do anything,
|
||||
// so leave $this->config->objectclass as is.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -84,20 +109,20 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
//if ldap_user_dn is empty, user does not exist
|
||||
if (!$ldap_user_dn) {
|
||||
ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to bind with current username and password
|
||||
$ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, $extpassword);
|
||||
ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
if ($ldap_login) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ldap_close($ldapconnection);
|
||||
print_error('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
$this->ldap_close();
|
||||
print_error('auth_ldap_noconnect','auth','',$this->config->host_url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -170,7 +195,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -273,10 +298,10 @@ 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);
|
||||
$this->ldap_close();
|
||||
return $uadd;
|
||||
|
||||
}
|
||||
@@ -303,7 +328,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
$user_dn = $this->ldap_find_userdn($ldapconnection, $extusername);
|
||||
$search_attribs = array($this->config->expireattr);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, 'objectclass=*', $search_attribs);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||
if ($sr) {
|
||||
$info = $this->ldap_get_entries($ldapconnection, $sr);
|
||||
if (!empty ($info) and !empty($info[0][$this->config->expireattr][0])) {
|
||||
@@ -391,7 +416,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
|
||||
if (!$ldapconnection) {
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
print get_string('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
exit;
|
||||
}
|
||||
@@ -400,7 +425,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
//// get user's list from ldap to sql in a scalable fashion
|
||||
////
|
||||
// prepare some data we'll need
|
||||
$filter = "(&(".$this->config->user_attribute."=*)(".$this->config->objectclass."))";
|
||||
$filter = '(&('.$this->config->user_attribute.'=*)'.$this->config->objectclass.')';
|
||||
|
||||
$contexts = explode(";",$this->config->contexts);
|
||||
|
||||
@@ -431,7 +456,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
do {
|
||||
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
|
||||
$value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8');
|
||||
array_push($fresult, $value);
|
||||
// usernames are __always__ lowercase.
|
||||
array_push($fresult, moodle_strtolower($value));
|
||||
if (count($fresult) >= $bulk_insert_records) {
|
||||
$this->ldap_bulk_insert($fresult, $temptable);
|
||||
$fresult = array();
|
||||
@@ -645,6 +671,9 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user->confirmed = 1;
|
||||
$user->auth = 'ldap';
|
||||
$user->mnethostid = $CFG->mnet_localhost_id;
|
||||
// get_userinfo_asobj() might have replaced $user->username with the value
|
||||
// from the LDAP server (which can be mixed-case). Make sure it's lowercase
|
||||
$user->username = trim(moodle_strtolower($user->username));
|
||||
if (empty($user->lang)) {
|
||||
$user->lang = $CFG->lang;
|
||||
}
|
||||
@@ -671,6 +700,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
} else {
|
||||
print "No users to be added\n";
|
||||
}
|
||||
$this->ldap_close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -694,7 +724,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;
|
||||
}
|
||||
|
||||
@@ -765,7 +795,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
error ('auth: ldap user_activate() does not support selected usertype:"'.$this->config->user_type.'" (..yet)');
|
||||
}
|
||||
$result = ldap_modify($ldapconnection, $userdn, $newinfo);
|
||||
ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -790,7 +820,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
error ('auth: ldap user_disable() does not support selected usertype (..yet)');
|
||||
}
|
||||
$result = ldap_modify($ldapconnection, $userdn, $newinfo);
|
||||
ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return $result;
|
||||
}*/
|
||||
|
||||
@@ -834,6 +864,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 +886,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 +906,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$user_entry = $this->ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (empty($user_entry)) {
|
||||
$error = 'ldap: Could not find user while updating externally. '.
|
||||
'Details follow: search base: \''.$user_dn.'\'; search filter: \''.
|
||||
$this->config->objectclass.'\'; search attributes: ';
|
||||
foreach ($search_attribs as $attrib) {
|
||||
$error .= $attrib.' ';
|
||||
}
|
||||
error_log($error);
|
||||
return false; // old user not found!
|
||||
} else if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
error_log('ldap: Strange! More than one user record found in ldap. Only using the first one.');
|
||||
return false;
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -890,6 +941,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
$nuvalue = $textlib->convert($newuser->$key, 'utf-8', $this->config->ldapencoding);
|
||||
empty($nuvalue) ? $nuvalue = array() : $nuvalue;
|
||||
$ouvalue = $textlib->convert($olduser->$key, 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
foreach ($ldapkeys as $ldapkey) {
|
||||
@@ -953,11 +1005,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
} else {
|
||||
error_log("ERROR:No user found in LDAP");
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1019,7 +1071,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
//Update password expiration time, grace logins count
|
||||
$search_attribs = array($this->config->expireattr, 'passwordExpirationInterval','loginGraceLimit' );
|
||||
$sr = ldap_read($ldapconnection, $user_dn, 'objectclass=*', $search_attribs);
|
||||
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||
if ($sr) {
|
||||
$info=$this->ldap_get_entries($ldapconnection, $sr);
|
||||
$newattrs = array();
|
||||
@@ -1081,7 +1133,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
}
|
||||
|
||||
@ldap_close($ldapconnection);
|
||||
$this->ldap_close();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1208,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
'rfc2307' => 'shadowExpire',
|
||||
'rfc2307bis' => 'shadowExpire',
|
||||
'samba' => '', //No support yet
|
||||
'ad' => '', //No support yet
|
||||
'ad' => 'pwdLastSet',
|
||||
'default' => ''
|
||||
);
|
||||
return $default;
|
||||
@@ -1314,6 +1366,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
* @return connection result
|
||||
*/
|
||||
function ldap_connect($binddn='',$bindpwd='') {
|
||||
// Cache ldap connections (they are expensive to set up
|
||||
// and can drain the TCP/IP ressources on the server if we
|
||||
// are syncing a lot of users (as we try to open a new connection
|
||||
// to get the user details). This is the least invasive way
|
||||
// to reuse existing connections without greater code surgery.
|
||||
if(!empty($this->ldapconnection)) {
|
||||
$this->ldapconns++;
|
||||
return $this->ldapconnection;
|
||||
}
|
||||
|
||||
//Select bind password, With empty values use
|
||||
//ldap_bind_* variables or anonymous bind if ldap_bind_* are empty
|
||||
if ($binddn == '' and $bindpwd == '') {
|
||||
@@ -1340,6 +1402,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;
|
||||
@@ -1355,6 +1422,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
if ($bindresult) {
|
||||
// Set the connection counter so we can call PHP's ldap_close()
|
||||
// when we call $this->ldap_close() for the last 'open' connection.
|
||||
$this->ldapconns = 1;
|
||||
$this->ldapconnection = $connresult;
|
||||
return $connresult;
|
||||
}
|
||||
|
||||
@@ -1362,10 +1433,22 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* disconnects from a ldap server
|
||||
*
|
||||
*/
|
||||
function ldap_close() {
|
||||
$this->ldapconns--;
|
||||
if($this->ldapconns == 0) {
|
||||
@ldap_close($this->ldapconnection);
|
||||
unset($this->ldapconnection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* retuns dn of username
|
||||
*
|
||||
@@ -1453,7 +1536,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
|
||||
if ($filter=="*") {
|
||||
$filter = "(&(".$this->config->user_attribute."=*)(".$this->config->objectclass."))";
|
||||
$filter = '(&('.$this->config->user_attribute.'=*)'.$this->config->objectclass.')';
|
||||
}
|
||||
|
||||
$contexts = explode(";",$this->config->contexts);
|
||||
@@ -1645,7 +1728,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
if (!isset($config->forcechangepassword))
|
||||
{$config->forcechangepassword = 0; }
|
||||
if (!isset($config->stdchangepassword))
|
||||
{$config->forcechangepassword = 0; }
|
||||
{$config->stdchangepassword = 0; }
|
||||
if (!isset($config->passtype))
|
||||
{$config->passtype = 'plaintext'; }
|
||||
if (!isset($config->changepasswordurl))
|
||||
@@ -1666,7 +1749,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
set_config('bind_dn', $config->bind_dn, 'auth/ldap');
|
||||
set_config('bind_pw', $config->bind_pw, 'auth/ldap');
|
||||
set_config('version', $config->version, 'auth/ldap');
|
||||
set_config('objectclass', $config->objectclass, 'auth/ldap');
|
||||
set_config('objectclass', trim($config->objectclass), 'auth/ldap');
|
||||
set_config('memberattribute', $config->memberattribute, 'auth/ldap');
|
||||
set_config('memberattribute_isdn', $config->memberattribute_isdn, 'auth/ldap');
|
||||
set_config('creators', $config->creators, 'auth/ldap');
|
||||
@@ -1733,7 +1816,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
// If UF_DONT_EXPIRE_PASSWD flag is set in user's
|
||||
// userAccountControl attribute, the password doesn't expire.
|
||||
$sr = ldap_read($ldapconn, $user_dn, 'objectclass=*',
|
||||
$sr = ldap_read($ldapconn, $user_dn, '(objectClass=*)',
|
||||
array('userAccountControl'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error getting userAccountControl for $user_dn");
|
||||
@@ -1779,7 +1862,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
// details below).
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
$sr = ldap_read($ldapconn, ROOTDSE, 'objectclass=*',
|
||||
$sr = ldap_read($ldapconn, ROOTDSE, '(objectClass=*)',
|
||||
array('defaultNamingContext'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error querying rootDSE for Active Directory");
|
||||
@@ -1789,7 +1872,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$domaindn = $info[0]['defaultNamingContext'][0];
|
||||
|
||||
$sr = ldap_read ($ldapconn, $domaindn, 'objectclass=*',
|
||||
$sr = ldap_read ($ldapconn, $domaindn, '(objectClass=*)',
|
||||
array('maxPwdAge'));
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$maxpwdage = $info[0]['maxPwdAge'][0];
|
||||
|
||||
@@ -86,7 +86,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$varsions = array();
|
||||
$versions = array();
|
||||
$versions[2] = '2';
|
||||
$versions[3] = '3';
|
||||
choose_from_menu($versions, 'version', $config->version, '');
|
||||
|
||||
+84
-60
@@ -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));
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
// verify the remote host is configured locally before attempting RPC call
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot)) {
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot, 'deleted', 0)) {
|
||||
error(get_string('notpermittedtoland', 'mnet'));
|
||||
}
|
||||
|
||||
@@ -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 = '';
|
||||
@@ -771,76 +771,76 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
join("\n", $mnet_request->error));
|
||||
break;
|
||||
}
|
||||
$mnethostlogssql = '
|
||||
SELECT
|
||||
mhostlogs.remoteid, mhostlogs.time, mhostlogs.userid, mhostlogs.ip,
|
||||
mhostlogs.course, mhostlogs.module, mhostlogs.cmid, mhostlogs.action,
|
||||
mhostlogs.url, mhostlogs.info, mhostlogs.username, c.fullname as coursename,
|
||||
c.modinfo
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
l.id as remoteid, l.time, l.userid, l.ip, l.course, l.module, l.cmid,
|
||||
l.action, l.url, l.info, u.username
|
||||
FROM
|
||||
' . $CFG->prefix . 'user u
|
||||
INNER JOIN ' . $CFG->prefix . 'log l on l.userid = u.id
|
||||
WHERE
|
||||
u.mnethostid = ' . $mnethostid . '
|
||||
AND l.id > ' . $mnet_request->response['last log id'] . '
|
||||
ORDER BY remoteid ASC
|
||||
LIMIT 500
|
||||
) mhostlogs
|
||||
INNER JOIN ' . $CFG->prefix . 'course c on c.id = mhostlogs.course
|
||||
ORDER by mhostlogs.remoteid ASC';
|
||||
|
||||
$query = "SELECT
|
||||
l.id as remoteid,
|
||||
l.time,
|
||||
l.userid,
|
||||
l.ip,
|
||||
l.course,
|
||||
l.module,
|
||||
l.cmid,
|
||||
l.action,
|
||||
l.url,
|
||||
l.info,
|
||||
c.fullname as coursename,
|
||||
c.modinfo as modinfo,
|
||||
u.username
|
||||
FROM
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}log l,
|
||||
{$CFG->prefix}course c
|
||||
WHERE
|
||||
l.userid = u.id AND
|
||||
u.mnethostid = '$mnethostid' AND
|
||||
l.id > '".$mnet_request->response['last log id']."' AND
|
||||
c.id = l.course
|
||||
ORDER BY
|
||||
remoteid ASC";
|
||||
$mnethostlogs = get_records_sql($mnethostlogssql);
|
||||
|
||||
$results = get_records_sql($query);
|
||||
if ($mnethostlogs == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (false == $results) continue;
|
||||
$processedlogs = array();
|
||||
|
||||
$param = array();
|
||||
|
||||
foreach($results as $result) {
|
||||
if (!empty($result->modinfo) && !empty($result->cmid)) {
|
||||
$modinfo = unserialize($result->modinfo);
|
||||
unset($result->modinfo);
|
||||
foreach($mnethostlogs as $hostlog) {
|
||||
// Extract the name of the relevant module instance from the
|
||||
// course modinfo if possible.
|
||||
if (!empty($hostlog->modinfo) && !empty($hostlog->cmid)) {
|
||||
$modinfo = unserialize($hostlog->modinfo);
|
||||
unset($hostlog->modinfo);
|
||||
$modulearray = array();
|
||||
foreach($modinfo as $module) {
|
||||
$modulearray[$module->cm] = urldecode($module->name);
|
||||
}
|
||||
$result->resource_name = $modulearray[$result->cmid];
|
||||
$hostlog->resource_name = $modulearray[$hostlog->cmid];
|
||||
} else {
|
||||
$result->resource_name = '';
|
||||
$hostlog->resource_name = '';
|
||||
}
|
||||
|
||||
$param[] = array (
|
||||
'remoteid' => $result->remoteid,
|
||||
'time' => $result->time,
|
||||
'userid' => $result->userid,
|
||||
'ip' => $result->ip,
|
||||
'course' => $result->course,
|
||||
'coursename' => $result->coursename,
|
||||
'module' => $result->module,
|
||||
'cmid' => $result->cmid,
|
||||
'action' => $result->action,
|
||||
'url' => $result->url,
|
||||
'info' => $result->info,
|
||||
'resource_name' => $result->resource_name,
|
||||
'username' => $result->username
|
||||
$processedlogs[] = array (
|
||||
'remoteid' => $hostlog->remoteid,
|
||||
'time' => $hostlog->time,
|
||||
'userid' => $hostlog->userid,
|
||||
'ip' => $hostlog->ip,
|
||||
'course' => $hostlog->course,
|
||||
'coursename' => $hostlog->coursename,
|
||||
'module' => $hostlog->module,
|
||||
'cmid' => $hostlog->cmid,
|
||||
'action' => $hostlog->action,
|
||||
'url' => $hostlog->url,
|
||||
'info' => $hostlog->info,
|
||||
'resource_name' => $hostlog->resource_name,
|
||||
'username' => $hostlog->username
|
||||
);
|
||||
}
|
||||
|
||||
unset($result);
|
||||
unset($hostlog);
|
||||
|
||||
$mnet_request = new mnet_xmlrpc_client();
|
||||
$mnet_request->set_method('auth/mnet/auth.php/refresh_log');
|
||||
|
||||
// set $token and $useragent parameters
|
||||
$mnet_request->add_param($param);
|
||||
$mnet_request->add_param($processedlogs);
|
||||
|
||||
if ($mnet_request->send($mnet_peer) === true) {
|
||||
if ($mnet_request->response['code'] > 0) {
|
||||
@@ -885,10 +885,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
unset($logEntryObj->username);
|
||||
|
||||
$logEntryObj = $this->trim_logline($logEntryObj);
|
||||
$insertok = insert_record('mnet_log', addslashes_object($logEntryObj), false);
|
||||
|
||||
if ($insertok) {
|
||||
$MNET_REMOTE_CLIENT->last_log_id = $logEntryObj->remoteid;
|
||||
$MNET_REMOTE_CLIENT->updateparams->last_log_id = $logEntryObj->remoteid;
|
||||
} else {
|
||||
$returnString .= 'Record with id '.$logEntryObj->remoteid." failed to insert.\n";
|
||||
}
|
||||
@@ -1262,8 +1264,8 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG;
|
||||
|
||||
if ($user = get_record('user', 'username', addslashes($username), 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
$filename1 = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$filename2 = "{$CFG->dataroot}/users/{$user->id}/f2.jpg";
|
||||
$filename1 = make_user_directory($user->id, true) . "/f1.jpg";
|
||||
$filename2 = make_user_directory($user->id, true) . "/f2.jpg";
|
||||
$return = array();
|
||||
if (file_exists($filename1)) {
|
||||
$return['f1'] = base64_encode(file_get_contents($filename1));
|
||||
@@ -1311,9 +1313,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
svc.apiversion,
|
||||
h2s.id as h2s_id
|
||||
FROM
|
||||
{$CFG->prefix}mnet_host h,
|
||||
{$CFG->prefix}mnet_service svc,
|
||||
{$CFG->prefix}mnet_host2service h2s
|
||||
WHERE
|
||||
h.deleted = '0' AND
|
||||
h.id = h2s.hostid AND
|
||||
h2s.hostid = '$mnethostid' AND
|
||||
h2s.serviceid = svc.id AND
|
||||
svc.name = '$servicename' AND
|
||||
@@ -1348,6 +1353,25 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims a log line from mnet peer to limit each part to a length which can be stored in our DB
|
||||
*
|
||||
* @param object $logline The log information to be trimmed
|
||||
* @return object The passed logline object trimmed to not exceed storable limits
|
||||
*/
|
||||
function trim_logline ($logline) {
|
||||
$limits = array('ip' => 15, 'coursename' => 40, 'module' => 20, 'action' => 40,
|
||||
'url' => 255);
|
||||
foreach ($limits as $property => $limit) {
|
||||
if (isset($logline->$property)) {
|
||||
$logline->$property = substr($logline->$property, 0, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
return $logline;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -168,6 +170,39 @@ Example file:
|
||||
?>
|
||||
--
|
||||
|
||||
|
||||
How to upgrade your Service Provider to 2.x
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact
|
||||
that in version 2.0 the default behaviour regarding attribute propagation
|
||||
changed.
|
||||
While the Service Provider 1.3.x published the Shibboleth attributes to the
|
||||
web server environment as HTTP Request headers, the Service Provider 2.x
|
||||
publishes attributes as environment variables, which increases the security for
|
||||
some platforms.
|
||||
However, this change has the effect that the attribute names change.
|
||||
E.g. while the surname attribute was published as 'HTTP_SHIB_PERSON_SURNAME'
|
||||
with 1.3.x, this attribute will be available in $_SERVER['Shib-Person-surname']
|
||||
or depending on your /etc/shibboleth/attribute-map.xml file just as
|
||||
$_SERVER['sn'].
|
||||
Because Moodle needs to know what Shibboleth attributes it shall map onto which
|
||||
Moodle user profile field, one has to make sure the mapping is updated as well
|
||||
after the Service Provider upgrade.
|
||||
|
||||
********************************************************************************
|
||||
Because you risk locking yourself out of Moodle it is strongly
|
||||
recommended to use the following approach when upgrading the Service Provider:
|
||||
1. Enable manual authentication before the upgrade.
|
||||
2. Make sure that you have at least one manual account with administration
|
||||
privileges working before upgrading your Service Provider to 2.x.
|
||||
3. After the SP upgrade, use this account to log into Moodle and adapt the
|
||||
attribute mapping in 'Site Administration -> Users -> Shibboleth' to reflect
|
||||
the changed attribute names.
|
||||
4. Test the login with a Shibboleth account
|
||||
5. If all is working, disable manual authentication again
|
||||
********************************************************************************
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
In case of problems and questions with Shibboleth authentication, contact
|
||||
Lukas Haemmerle <haemmerle@switch.ch> or Markus Hagman <hagman@hytti.uku.fi>
|
||||
|
||||
@@ -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
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
// If we can find any (user independent) Shibboleth attributes but no user
|
||||
// attributes we probably didn't receive any user attributes
|
||||
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])) {
|
||||
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID']) || !empty($_SERVER['Shib-Application-ID'])) {
|
||||
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
|
||||
} else {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
|
||||
+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/$CFG->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) {
|
||||
|
||||
+140
-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,15 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get groups_members
|
||||
$groups_members = groups_get_member_records($groupid);
|
||||
|
||||
//Get groups_members that are being included in backup
|
||||
$groups_members = get_records_sql("SELECT gm.*
|
||||
FROM {$CFG->prefix}groups_members gm,
|
||||
{$CFG->prefix}backup_ids bi
|
||||
WHERE gm.groupid = $groupid
|
||||
AND bi.backup_code = $preferences->backup_unique_code
|
||||
AND bi.table_name = 'user'
|
||||
AND bi.old_id = gm.userid");
|
||||
|
||||
//Pring groups_members header
|
||||
if ($groups_members) {
|
||||
//Pring groups_members header
|
||||
@@ -1843,6 +1779,16 @@
|
||||
|
||||
global $CFG,$preferences;
|
||||
|
||||
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
|
||||
/// heavy interlinking. Just a few cpu cycles saved.
|
||||
if ($content === NULL) {
|
||||
return NULL;
|
||||
} else if ($content === '') {
|
||||
return '';
|
||||
} else if (is_numeric($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Use one static variable to cache all the require_once calls that,
|
||||
//under PHP5 seems to increase load too much, and we are requiring
|
||||
//them here thousands of times (one per content). MDL-8700.
|
||||
@@ -1905,26 +1851,29 @@
|
||||
//in temp/backup/$backup_code dir
|
||||
$status = check_and_create_user_files_dir($preferences->backup_unique_code);
|
||||
|
||||
//Now iterate over directories under "users" to check if that user must be
|
||||
//copied to backup
|
||||
//Now iterate over directories under "user" to check if that user must be copied to backup
|
||||
|
||||
// Method to get a list of userid=>array(basedir => $basedir, userfolder => $userfolder)
|
||||
$userlist = get_user_directories();
|
||||
|
||||
$rootdir = $CFG->dataroot."/users";
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$preferences->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/user_files/".$dir);
|
||||
}
|
||||
foreach ($userlist as $userid => $userinfo) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = count_records("backup_ids","backup_code",$preferences->backup_unique_code, "table_name","user", "old_id",$userid);
|
||||
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$parts = explode('/', $userinfo['userfolder']);
|
||||
$status = true;
|
||||
|
||||
if (is_array($parts)) {
|
||||
$group = $parts[0];
|
||||
$userid = $parts[1];
|
||||
|
||||
// Create group dir first
|
||||
$status = check_dir_exists("$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/". $group, true);
|
||||
}
|
||||
$status = $status && backup_copy_file($userinfo['basedir'] . '/' . $userinfo['userfolder'],
|
||||
"$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/{$userinfo['userfolder']}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2294,40 +2243,43 @@
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_OVERRIDES", $startlevel, true));
|
||||
}
|
||||
|
||||
|
||||
/* function to print xml for assignment */
|
||||
function write_role_assignments_xml($bf, $context, $startlevel) {
|
||||
function write_role_assignments_xml($bf, $preferences, $context, $startlevel) {
|
||||
/// write role_assign code here
|
||||
fwrite ($bf, start_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
|
||||
|
||||
if ($roles = get_roles_with_assignment_on_context($context)) {
|
||||
foreach ($roles as $role) {
|
||||
foreach ($roles as $role) {
|
||||
fwrite ($bf, start_tag("ROLE", $startlevel+1, true));
|
||||
fwrite ($bf, full_tag("ID", $startlevel+2, false, $role->id));
|
||||
fwrite ($bf, full_tag("NAME", $startlevel+2, false, $role->name));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, full_tag("SHORTNAME", $startlevel+2, false, $role->shortname));
|
||||
fwrite ($bf, start_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
if ($assignments = get_users_from_role_on_context($role, $context)) {
|
||||
foreach ($assignments as $assignment) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
/// Role assignments are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $assignment->userid)) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
fwrite ($bf, end_tag("ROLE", $startlevel+1, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
while($filename = readdir($opendirectory)) {
|
||||
while(false !== ($filename = readdir($opendirectory))) {
|
||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||
$subdirs[] = $filename;
|
||||
}
|
||||
|
||||
+6
-6
@@ -119,7 +119,7 @@
|
||||
}
|
||||
|
||||
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
|
||||
while($entry = readdir($handle)) {
|
||||
while(false !== ($entry = readdir($handle))) {
|
||||
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
|
||||
$dir_subdirs[] = $dir. $slash .$entry;
|
||||
}
|
||||
@@ -143,7 +143,7 @@
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (rmdir($dir_subdirs[$i]) == FALSE) {
|
||||
if (remove_dir($dir_subdirs[$i]) == FALSE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -215,7 +215,7 @@
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -299,10 +299,10 @@
|
||||
if (!is_dir($to_file)) {
|
||||
//echo "<br />Creating ".$to_file; //Debug
|
||||
umask(0000);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
+3
-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;
|
||||
}
|
||||
|
||||
@@ -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 and we have passed some custom startyear/month/day. MDL-12922
|
||||
if ($course_header->course_startdate && !empty($form1->startyear)) {
|
||||
$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;
|
||||
@@ -231,7 +239,7 @@
|
||||
} else {
|
||||
$optdimmed = '';
|
||||
}
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
|
||||
}
|
||||
print_simple_box_end();
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
+109
-17
@@ -99,6 +99,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -220,24 +224,41 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<td align=\"right\">";
|
||||
print_string("shortname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"15\" size=\"10\" value=\"$form1->shortname\" alt=\"".get_string("shortname")."\" />" ;
|
||||
echo "<td><input type=\"text\" name=\"shortname\" maxlength=\"15\" size=\"10\" value=\"".s($form1->shortname)."\" alt=\"".get_string("shortname")."\" />" ;
|
||||
helpbutton("courseshortname", get_string("shortname")) ;
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
if (isset($err["shortname"])) formerr($err["shortname"]);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr valign=\"top\" >";
|
||||
echo "<td align=\"right\">";
|
||||
print_string("fullname");
|
||||
echo " :</td>";
|
||||
echo "<td><input type=\"text\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"$form1->fullname\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
echo "<td><input type=\"text\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"".s($form1->fullname)."\" alt=\" ".get_string("fullname")."\" />" ;
|
||||
helpbutton("coursefullname", get_string("fullname")) ;
|
||||
if (isset($err["fullname"])) formerr($err["fullname"]);
|
||||
echo"</td></tr>";
|
||||
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>";
|
||||
} else {
|
||||
/// If user cannot create course, prevent any change in startyear/month/day (so restore wont calculate any roll. MDL-12922
|
||||
echo '<input type="hidden" name="startyear" value="0" />';
|
||||
echo '<input type="hidden" name="startmonth" value="0" />';
|
||||
echo '<input type="hidden" name="startday" value="0" />';
|
||||
}
|
||||
//Line
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
@@ -264,6 +285,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";
|
||||
@@ -462,6 +484,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>');
|
||||
@@ -516,21 +539,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>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,3 +585,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");
|
||||
}
|
||||
}
|
||||
|
||||
+281
-108
@@ -71,6 +71,42 @@
|
||||
echo "<ul>";
|
||||
}
|
||||
|
||||
// Recode links in the course summary.
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('course');
|
||||
}
|
||||
$course = get_record('course', 'id', $restore->course_id, '', '', '', '', 'id,summary');
|
||||
$coursesummary = restore_decode_content_links_worker($course->summary, $restore);
|
||||
if ($coursesummary != $course->summary) {
|
||||
$course->summary = addslashes($coursesummary);
|
||||
if (!update_record('course', $course)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
// Recode links in section summaries.
|
||||
$sections = get_records('course_sections', 'course', $restore->course_id, 'id', 'id,summary');
|
||||
if ($sections) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('sections');
|
||||
}
|
||||
foreach ($sections as $section) {
|
||||
$sectionsummary = restore_decode_content_links_worker($section->summary, $restore);
|
||||
if ($sectionsummary != $section->summary) {
|
||||
$section->summary = addslashes($sectionsummary);
|
||||
if (!update_record('course_sections', $section)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Restore links in modules.
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
@@ -595,7 +631,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);
|
||||
@@ -616,6 +651,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
|
||||
@@ -788,6 +836,11 @@
|
||||
continue;
|
||||
}
|
||||
$getid = backup_getid($restore->backup_unique_code, $parts[1], $instance->pageid);
|
||||
|
||||
if (empty($getid->new_id)) {
|
||||
// Failed, perhaps the module was not included in the restore MDL-13554
|
||||
continue;
|
||||
}
|
||||
$instance->pageid = $getid->new_id;
|
||||
}
|
||||
else {
|
||||
@@ -843,10 +896,22 @@
|
||||
|
||||
//Add this instance
|
||||
$instance->blockid = $blocks[$instance->name]->id;
|
||||
|
||||
if ($newid = insert_record('block_instance', $instance)) {
|
||||
if (!empty($instance->id)) { // this will only be set if we come from 1.7 and above backups
|
||||
backup_putid ($restore->backup_unique_code,"block_instance",$instance->id,$newid);
|
||||
|
||||
if (!empty($instance->id)) {
|
||||
$oldid = $instance->id;
|
||||
} else {
|
||||
$oldid = 0;
|
||||
}
|
||||
|
||||
if ($instance->id = insert_record('block_instance', $instance)) {
|
||||
// Create block instance
|
||||
if (!$blockobj = block_instance($instance->name, $instance)) {
|
||||
$status = false;
|
||||
break;
|
||||
}
|
||||
// Save oldid after block restore process because info will be over-written with blank string
|
||||
if ($oldid) {
|
||||
backup_putid ($restore->backup_unique_code,"block_instance",$oldid,$instance->id);
|
||||
}
|
||||
} else {
|
||||
$status = false;
|
||||
@@ -909,6 +974,11 @@
|
||||
//Get section id when restoring in existing course
|
||||
$rec = get_record("course_sections","course",$restore->course_id,
|
||||
"section",$section->section);
|
||||
//If section exists, has empty summary and backup has some summary, use it. MDL-8848
|
||||
if ($rec && empty($rec->summary) && !empty($section->summary)) {
|
||||
$rec->summary = $section->summary;
|
||||
update_record("course_sections", $rec);
|
||||
}
|
||||
//If that section doesn't exist, get section 0 (every mod will be
|
||||
//asigned there
|
||||
if(!$rec) {
|
||||
@@ -1195,7 +1265,7 @@
|
||||
if (!$preferencescount) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grade').'</li>';
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grades').'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,7 +1276,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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1222,7 +1292,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) {
|
||||
@@ -1276,7 +1346,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) {
|
||||
@@ -1326,7 +1396,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) {
|
||||
@@ -1485,7 +1555,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
|
||||
@@ -1496,15 +1566,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)) {
|
||||
@@ -1576,17 +1668,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
|
||||
@@ -1618,7 +1706,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");
|
||||
}
|
||||
@@ -1759,9 +1847,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;
|
||||
}
|
||||
|
||||
@@ -1804,7 +1903,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
|
||||
@@ -1869,7 +1968,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
|
||||
@@ -1936,7 +2035,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
|
||||
@@ -2196,10 +2295,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;
|
||||
@@ -2494,19 +2605,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);
|
||||
@@ -2519,6 +2617,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;
|
||||
@@ -2546,8 +2660,18 @@
|
||||
//step in the restore execution, because we need to have it
|
||||
//finished to know all the oldid, newid equivaleces
|
||||
function restore_decode_absolute_links($content) {
|
||||
|
||||
global $CFG,$restore;
|
||||
|
||||
global $CFG,$restore;
|
||||
|
||||
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
|
||||
/// heavy interlinking. Just a few cpu cycles saved.
|
||||
if ($content === NULL) {
|
||||
return NULL;
|
||||
} else if ($content === '') {
|
||||
return '';
|
||||
} else if (is_numeric($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Now decode wwwroot and file.php calls
|
||||
$search = array ("$@FILEPHP@$");
|
||||
@@ -2583,48 +2707,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2831,7 +2960,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
|
||||
@@ -3219,6 +3348,18 @@
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
// MDL-14326 remove empty course modules instance's (credit goes to John T. Macklin from Remote Learner)
|
||||
$course_modules_inst_zero = get_records_sql("SELECT id, course, instance
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE id = '$cm_module->new_id' AND
|
||||
instance = '0'");
|
||||
|
||||
if($course_modules_inst_zero){ // Clean up the invalid instances
|
||||
foreach($course_modules_inst_zero as $course_modules_inst){
|
||||
delete_records('course_modules', 'id',$course_modules_inst->id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3258,7 +3399,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
|
||||
@@ -3272,7 +3413,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
|
||||
@@ -3287,7 +3428,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
|
||||
@@ -3301,7 +3442,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
|
||||
@@ -3315,7 +3456,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
|
||||
@@ -3329,7 +3470,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") {
|
||||
@@ -3352,7 +3493,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
|
||||
@@ -3367,7 +3508,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
|
||||
@@ -3403,7 +3544,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
|
||||
@@ -3430,7 +3571,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
|
||||
@@ -3458,7 +3599,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
|
||||
@@ -3485,7 +3626,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
|
||||
@@ -3512,7 +3653,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
|
||||
@@ -3540,7 +3681,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
|
||||
@@ -3568,7 +3709,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
|
||||
@@ -3596,7 +3737,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
|
||||
@@ -3619,7 +3760,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
|
||||
}
|
||||
@@ -3845,9 +3986,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;
|
||||
@@ -3896,6 +4034,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") {
|
||||
@@ -5434,11 +5593,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
|
||||
@@ -5588,6 +5756,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')) {
|
||||
@@ -6701,7 +6874,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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6718,7 +6891,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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user