Compare commits
1609 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e045c25873 | |||
| 9fb9a19634 | |||
| ac45cb6868 | |||
| d6398c1aa7 | |||
| b959c6e367 | |||
| c2a020b29c | |||
| 979078fd7e | |||
| 5cb0b4571b | |||
| 3e91a8c1c6 | |||
| 947398763d | |||
| eb09bdfc8f | |||
| 80f906ef5b | |||
| df5fd088ce | |||
| a7b41a3858 | |||
| 8729b26e66 | |||
| 4c01616d7e | |||
| d7a113ccf6 | |||
| 16cebcc326 | |||
| 01642a7176 | |||
| fb24b67aa0 | |||
| faf39f00fc | |||
| eeb562d148 | |||
| b3c5d55d51 | |||
| e0c4317044 | |||
| 2abc0d001d | |||
| f285be0eaf | |||
| 55954755f4 | |||
| cdeb1274c4 | |||
| d658317313 | |||
| 297c72fd2f | |||
| ef40013c24 | |||
| 9ed313978a | |||
| 2caa535789 | |||
| e38099e42d | |||
| 579ef29363 | |||
| 321cc00de4 | |||
| 66a1817c9c | |||
| 0561809c5d | |||
| 863b73aff3 | |||
| 14439b54d0 | |||
| ecbd19b23a | |||
| bf5ee9d9d6 | |||
| 00e1dce31e | |||
| a7f0a47456 | |||
| 3e4fae4d8d | |||
| 84ca389754 | |||
| 4874505398 | |||
| c1dcb5d292 | |||
| ce4c57764c | |||
| d46a3b303d | |||
| 66ef299f5e | |||
| 603cf45886 | |||
| 81a74ce130 | |||
| bf1e6b85f5 | |||
| 7055e88f97 | |||
| 7d8c97dcc4 | |||
| 2d60f585aa | |||
| 95416b9889 | |||
| 6649c902cd | |||
| 2fd1b1a9a3 | |||
| 1e5575ae9e | |||
| 41f7e89fb6 | |||
| e6da58fb3c | |||
| 81590f6553 | |||
| 30c6a88aee | |||
| cd4a340157 | |||
| 7446f0d0ff | |||
| 478503ba0f | |||
| ec573b8969 | |||
| 886ef74dff | |||
| 860a2858f4 | |||
| 06ecd61c8b | |||
| 88010c44ce | |||
| fc7de9bb75 | |||
| 70484742a9 | |||
| 52b6a471c5 | |||
| e7288e1e7e | |||
| e487fa20dc | |||
| 92bb71dcec | |||
| 21a6060f3d | |||
| 3a5677d49c | |||
| 6494eb8fe0 | |||
| 1b8dbf5466 | |||
| aafb64be36 | |||
| dfd00d9d32 | |||
| 0c76f8bc3a | |||
| e1ecf0a918 | |||
| 4f75c6c949 | |||
| d02317b6da | |||
| 9ba3aacb99 | |||
| fb6099f56d | |||
| 45e83c7913 | |||
| 895ac595b7 | |||
| 34710324e5 | |||
| eed364d080 | |||
| 2422634052 | |||
| 4340e07b2c | |||
| 468eff4e21 | |||
| fc74c5674a | |||
| dc8320a6f8 | |||
| 6b7b9ad10c | |||
| e18bc77b56 | |||
| 8440f947ca | |||
| 11abfe0569 | |||
| ad08d64332 | |||
| f468c0e4c1 | |||
| 1c8e6588aa | |||
| 443fd25436 | |||
| 3c956dbd60 | |||
| bdda301ebf | |||
| fbdc843096 | |||
| 7f3c24f40b | |||
| 5834d7813a | |||
| ca0908b961 | |||
| d40e15ee7a | |||
| 207c5454b9 | |||
| 0875ca82c2 | |||
| a1a85b1779 | |||
| f15a666f64 | |||
| 1b81ef9090 | |||
| 4b0ce9f3b7 | |||
| cca8a446da | |||
| db3568deb4 | |||
| 2240b6c451 | |||
| ebe6a497eb | |||
| b7b280b44c | |||
| 7da25cbffe | |||
| 817a4d47b1 | |||
| 9609d14e81 | |||
| 13b8d2e6eb | |||
| 9228301b3f | |||
| b6630ed3dc | |||
| d0f3b3f6fc | |||
| 42e5c3de66 | |||
| 70efd67049 | |||
| 7e836fe858 | |||
| 328f98af9b | |||
| 5a045ae328 | |||
| a45e386284 | |||
| e5375362ac | |||
| 052547f2e7 | |||
| ff29df4190 | |||
| b02d7ca8fd | |||
| 1a38880ad2 | |||
| 03ccee2431 | |||
| f4f3ac35a5 | |||
| 02bbdb1a05 | |||
| b055ae802b | |||
| e3ce6d9434 | |||
| ae933e4f1f | |||
| 0b920406c8 | |||
| d1620b4c11 | |||
| 3abe79ff52 | |||
| 7614a54d59 | |||
| c617406e19 | |||
| 58d2845b5c | |||
| 2bff64d017 | |||
| 678165c2f5 | |||
| 2b298ce72c | |||
| 9a3bb4366c | |||
| 85ca3686cb | |||
| 84620a0041 | |||
| 95fcbce2a1 | |||
| 40777e9fd0 | |||
| 26c2a9b587 | |||
| 68d87c70d4 | |||
| da837fdb78 | |||
| 162e13cc89 | |||
| 59d4af490e | |||
| 7e555c8958 | |||
| becdc870ed | |||
| ebf2deff6a | |||
| 75407fe763 | |||
| 7c437a57e0 | |||
| a8a80afccd | |||
| 23c58c6375 | |||
| 8d45fcc505 | |||
| 70e1cd76c8 | |||
| 79c57d1b99 | |||
| 70c7e67dcb | |||
| ff073582cf | |||
| 1d3318d93f | |||
| 39ca046247 | |||
| fb0d5a229e | |||
| 0ff0cbe326 | |||
| cdae66cbad | |||
| f639d4fdae | |||
| 85c62f1c93 | |||
| a0f6fa7987 | |||
| 4a1cbc606d | |||
| 5c457d48e9 | |||
| 509f1f07a9 | |||
| 8885b483cb | |||
| 773242671f | |||
| 47cc17f258 | |||
| 6450b75034 | |||
| e4cfa65450 | |||
| 3b798d4e6c | |||
| 6253ee1ef2 | |||
| cda4480961 | |||
| 94fdd21d38 | |||
| 77aafcbbfb | |||
| 137c04383f | |||
| 00a2ce3bf9 | |||
| a789bed6ef | |||
| 897e6a3507 | |||
| a49d9fe97f | |||
| ec5e9fc647 | |||
| 4abc7c0630 | |||
| 528ddea1b3 | |||
| a9608e5795 | |||
| e8b2de8d18 | |||
| abc597e27b | |||
| 296f1fc6c3 | |||
| ccf77fbe00 | |||
| a5db1182c4 | |||
| ce4da52bb8 | |||
| 2f2dafc16a | |||
| e21492da15 | |||
| 34ca70feba | |||
| c83adc965f | |||
| d5c871bbd0 | |||
| 2bbe9bcb1c | |||
| 3e2d9e9567 | |||
| 40beb0f097 | |||
| 1bc05922bc | |||
| fb18d9cab7 | |||
| 4520a06ef1 | |||
| 3514c326aa | |||
| 93bb63f06f | |||
| 8d43fd582f | |||
| 5ce3dfb28e | |||
| e76d70aaef | |||
| 1910bda1d6 | |||
| 8d81931a47 | |||
| f37cb203d8 | |||
| 3f5c88c898 | |||
| a85da4da7e | |||
| 0c412f3b3c | |||
| e0d2d6ec88 | |||
| 9d9a65e9af | |||
| 845df47c11 | |||
| abe9371c58 | |||
| 3e79f5f4f9 | |||
| 8fefbc38ad | |||
| 7c534ccd8a | |||
| d8c68f7860 | |||
| 2dbe84a629 | |||
| 9a94ae5494 | |||
| 3af6627e64 | |||
| 8d9e5477a4 | |||
| 0e3dd76c50 | |||
| 0820aedbf7 | |||
| ce26bd19ea | |||
| 691d35efc2 | |||
| a0a1aeb694 | |||
| cb1113b7c8 | |||
| d36088f711 | |||
| 40cc3341ad | |||
| d7414e9068 | |||
| f5563d1efd | |||
| 67e9830697 | |||
| d01b47381b | |||
| c6a10296eb | |||
| 3674039ca0 | |||
| f0417bf3cb | |||
| 13e60ec63c | |||
| 07cd3ecabd | |||
| 1d68f3cd73 | |||
| 23290eea4d | |||
| f050e82eb6 | |||
| 8aa669ca72 | |||
| 8abba9e902 | |||
| 023dc2c338 | |||
| 11db0ce1ec | |||
| c9379ddbaa | |||
| 2bd2bb878d | |||
| fe8aad143d | |||
| cae4cdb309 | |||
| 8809ff2b35 | |||
| 6bea13a914 | |||
| 0e04dc36c2 | |||
| 68d924ce8a | |||
| bf5cc256fd | |||
| 247958fbe9 | |||
| bf4fe92223 | |||
| 9bcbf6a743 | |||
| 7c84c844f9 | |||
| 676dbd7285 | |||
| 81ac2c8630 | |||
| 55f9f1432f | |||
| 9f476e5fe2 | |||
| 4663bd9f09 | |||
| bde6d304f9 | |||
| 764d44c11e | |||
| c2c3f6e885 | |||
| 22f8303fc7 | |||
| b0cfc7cbd5 | |||
| 118a639ff3 | |||
| f4989ae561 | |||
| 4ff82c1505 | |||
| e2a7235da8 | |||
| 062c59e346 | |||
| 3cc55cab9e | |||
| 3742f86ac1 | |||
| 9a28eacb84 | |||
| 446b5e025c | |||
| 5c89371717 | |||
| 2b27d0a946 | |||
| 15ef45da52 | |||
| 3444317011 | |||
| e17d507d5a | |||
| 7db37fd580 | |||
| 6497764c84 | |||
| 37829534f6 | |||
| 554fbddf7d | |||
| 529d7f47bf | |||
| 45b3a8554a | |||
| 8f3d4e4ef5 | |||
| a067240cbf | |||
| ef2f763ee8 | |||
| 56d3da5a01 | |||
| 1aa8ff170f | |||
| 8ec088f738 | |||
| e7c13fcb46 | |||
| 343a1ea8e0 | |||
| 216237369e | |||
| 10fc5f6e22 | |||
| 462f360429 | |||
| c0ea84fbf3 | |||
| 3a6b6c0d74 | |||
| 64aa333345 | |||
| ea41587638 | |||
| fbadfe0295 | |||
| 4b1edf80c1 | |||
| 1286c71e5a | |||
| 62eefc5487 | |||
| aafc01514e | |||
| 671b83e238 | |||
| 0197c39ba1 | |||
| 40168efe75 | |||
| dfa4162d8a | |||
| 0c05267ff4 | |||
| 992c135e19 | |||
| b3c7ea0c94 | |||
| 1e281f706a | |||
| 9ae0b39497 | |||
| 137fcd2015 | |||
| 7ccfee94ad | |||
| 5e7ee078a9 | |||
| 28dcf434c6 | |||
| 0042320984 | |||
| 8da1406e3a | |||
| 0ef8d9cab6 | |||
| d55f1be549 | |||
| d4097a429c | |||
| 9b4327c71d | |||
| 097eb89c65 | |||
| 8c21e87a7b | |||
| 253f9eee33 | |||
| bb803227f1 | |||
| f0d60d1631 | |||
| 99c4cc6fdf | |||
| 58e24e2f1a | |||
| bca26abf4c | |||
| 9241a50fb7 | |||
| 6d1bb31cda | |||
| 661406a466 | |||
| cd57295a36 | |||
| 6acef6e30b | |||
| 1610eb0f85 | |||
| 6cf7303684 | |||
| 4ed23b4f9e | |||
| fabdbdb3f6 | |||
| 43e2896e63 | |||
| 025451ff7d | |||
| cafaa207ef | |||
| e59461215d | |||
| 0ebee25007 | |||
| ce197abbef | |||
| 9036033b8a | |||
| 81bf069328 | |||
| 9ff8ae7953 | |||
| 4527713fdc | |||
| ae4dc90cb7 | |||
| 7ab78c274b | |||
| 20f08456a8 | |||
| 94bbc1f5e2 | |||
| 4610edf1b6 | |||
| 847da17ddb | |||
| f3fa18a199 | |||
| 8b85c2cf5d | |||
| c309cf8612 | |||
| 2685a2eee1 | |||
| 416622f005 | |||
| 8f95983a3e | |||
| 0a16e0f268 | |||
| 37646f6f0e | |||
| aa7b876f03 | |||
| 16f89f2ccf | |||
| 524e369670 | |||
| c72ab7a328 | |||
| c74677ca95 | |||
| 0f8c983585 | |||
| 59a6d971a4 | |||
| 45e948f87e | |||
| c0226d096a | |||
| aaf3348589 | |||
| 158c4b5c80 | |||
| a3eba6f2d2 | |||
| 8d7e790de7 | |||
| ed289f97e5 | |||
| 5d7ce9bf29 | |||
| fbb5ad35e7 | |||
| 9e2df8519a | |||
| e4cc5dbc7f | |||
| 34e92f9b8b | |||
| 6e2284138b | |||
| 73a4864b82 | |||
| 1a6a597fff | |||
| 9df49de633 | |||
| 404d380856 | |||
| cbc0bc50b1 | |||
| ae767e7bd3 | |||
| 2ccbd6ccf1 | |||
| 8dbf6bb9e0 | |||
| 652fab8576 | |||
| 31942aff61 | |||
| 5006792896 | |||
| 786542c572 | |||
| edaaa46655 | |||
| c0bea40aaf | |||
| 7dd535056e | |||
| 555bfa16d0 | |||
| 470be2688b | |||
| 135d93ec9e | |||
| 75943600ed | |||
| 7fd3f594da | |||
| 55904e49dc | |||
| 4c5da8022e | |||
| 2f47a361ff | |||
| 9197627ade | |||
| 4b168cfabc | |||
| ffa6c35826 | |||
| b0e924a51e | |||
| 58a9623c54 | |||
| 1bde9b823c | |||
| 76eea68b9e | |||
| 8c0a6839f2 | |||
| a1f951f3a4 | |||
| 72449953e4 | |||
| f359daab58 | |||
| b33888d124 | |||
| 1a5e85a22c | |||
| 0dd1becdc7 | |||
| 61e35a87da | |||
| 0c34a17b09 | |||
| 52f24bfec6 | |||
| b2787982b7 | |||
| 8f4c3dae23 | |||
| a8c2fc5dee | |||
| a3b2f4cbeb | |||
| 1e066cbf29 | |||
| 79dd326093 | |||
| 1f775e8c46 | |||
| 7b6c65a560 | |||
| c935b991a1 | |||
| 28ca56c93d | |||
| ec3200262d | |||
| 8539018ed4 | |||
| 245de1a597 | |||
| 3fdd49a75a | |||
| 3ff6c931ee | |||
| c7da0d864e | |||
| e97c7b28c5 | |||
| 2ffbe91234 | |||
| 4f3835b601 | |||
| 445a3c1233 | |||
| 4989bc7951 | |||
| 8eb102ff1c | |||
| 9b6cf38c96 | |||
| 203743c638 | |||
| c691deff3a | |||
| bf01ed8211 | |||
| 93cc66aeae | |||
| f103bb199e | |||
| 476f7cc8ee | |||
| e9a1bffc8f | |||
| 377d7c7515 | |||
| 7bc643ebaf | |||
| 184f9c2b66 | |||
| 93fa4ca922 | |||
| 552de335d0 | |||
| 9e6e743dfc | |||
| f9bbb1031e | |||
| 290b74fd49 | |||
| 7122026066 | |||
| 70cade16e3 | |||
| 9146dd83de | |||
| 9e162a23da | |||
| 3df033ca4a | |||
| 5241345d02 | |||
| 62cf504bdd | |||
| cf47a79c1d | |||
| 12e91437f3 | |||
| a065fdd6f9 | |||
| e0ddea8b8f | |||
| d7df238204 | |||
| db2105c889 | |||
| 367dfbd905 | |||
| b17e52001c | |||
| 153fd875b5 | |||
| a43dc9df02 | |||
| f9f150290f | |||
| 8779cb8b46 | |||
| d7378d19ec | |||
| 6219022575 | |||
| d9ec40f57f | |||
| ea790c7db1 | |||
| f0403cbba2 | |||
| 88b5f9b726 | |||
| 4d0ec2a375 | |||
| 7cb4fb6a88 | |||
| 504317a519 | |||
| 110351a2a6 | |||
| 9599ee24b9 | |||
| 78baa1aaad | |||
| 1f4025a70e | |||
| 7e147392e1 | |||
| b7f0d27621 | |||
| 0428d11d76 | |||
| b5a5a482bd | |||
| 699768ebbc | |||
| 6bd9066b7f | |||
| 6af4e1c8c4 | |||
| a5c41b6a5a | |||
| 0bffc5576e | |||
| 21982b71a6 | |||
| 41a5c34f91 | |||
| d08b6757e6 | |||
| dfeb385672 | |||
| b36064f742 | |||
| 3dfb5e4379 | |||
| 7f9f7ec944 | |||
| 1828849b1e | |||
| ff7253c2c1 | |||
| 52257f15d7 | |||
| 4c1af19cf6 | |||
| 48a2b5ad42 | |||
| 9e8cabd7eb | |||
| e28cc09b24 | |||
| 6282be2fd9 | |||
| e6b8565063 | |||
| bce83e8c76 | |||
| e2bf5eec99 | |||
| 87ab475575 | |||
| 9022696d6d | |||
| 418cc2032b | |||
| 25769ccd61 | |||
| d0e6183436 | |||
| ca3c1ddf40 | |||
| ec9f7c117e | |||
| 7f0984c1f3 | |||
| dc8207c52a | |||
| 4419fe33a5 | |||
| ba0dabcc31 | |||
| 3810ca294d | |||
| f493763e04 | |||
| 3140dc600d | |||
| 30739f6651 | |||
| 071d36c917 | |||
| 0540d3479c | |||
| 721a2de984 | |||
| 78d68eb5b2 | |||
| 5c5cb3ec7e | |||
| b06855297c | |||
| dbd0f586a2 | |||
| eb2a36fb55 | |||
| a45296043e | |||
| 4bf57cbfa6 | |||
| 43d78a231d | |||
| 45d44e7e80 | |||
| ff6bc9fbc2 | |||
| 4bdf76ae71 | |||
| 97feab527e | |||
| 903f3f54ed | |||
| a1fec0e3ce | |||
| e07f4ac436 | |||
| 25a37d70ff | |||
| 5446beaa73 | |||
| cb6281b339 | |||
| 3696a3723e | |||
| 8fa821d514 | |||
| 9bb4b97e3d | |||
| 87c39bf549 | |||
| 91f54796bd | |||
| fd52f257ff | |||
| 94c9630d78 | |||
| 84718c0056 | |||
| 0a16d1722a | |||
| abb8f34ecf | |||
| 8af16cbfdb | |||
| 54c5ce36db | |||
| 0b17d072cf | |||
| cd4469af52 | |||
| 01d0a4f289 | |||
| 8f8f6e7c92 | |||
| 90fe299739 | |||
| bceb6eb9d8 | |||
| 7989f2ee28 | |||
| 78a0f36730 | |||
| b2a48214f8 | |||
| 76d9513015 | |||
| 4d89cba698 | |||
| e8189c3074 | |||
| af17ae8a1b | |||
| 8626d4bc24 | |||
| f0b99a9fec | |||
| fcb9e23701 | |||
| ab496d313c | |||
| 0e53408ad7 | |||
| 4b1f48e2ae | |||
| 5530732c16 | |||
| 5b4e26864a | |||
| 1081ccc99b | |||
| c0ad0e5a98 | |||
| b6db8ab49d | |||
| ce455a9a79 | |||
| b6d3fccd59 | |||
| 78be3cdb8b | |||
| 837588a772 | |||
| f398c77963 | |||
| 2fd2fdbdb9 | |||
| 92d3d576fb | |||
| ef06f7f85b | |||
| e7a5ad8da9 | |||
| d8882ec822 | |||
| e21f0b1042 | |||
| b6057d4afa | |||
| bf18b2aa09 | |||
| db365a121d | |||
| d243cd17c5 | |||
| 01be5c29cc | |||
| 1ac2df9163 | |||
| 800fa68224 | |||
| 4876f94726 | |||
| c5c47d0c43 | |||
| 731f877fdb | |||
| acb417721d | |||
| 60f8f5bf42 | |||
| df18c3141e | |||
| 4edc434002 | |||
| 3ce66e9f7b | |||
| fb3501f935 | |||
| 757d66b504 | |||
| 9861a3997a | |||
| e05e5d132e | |||
| 6488b3be2e | |||
| 748e20f006 | |||
| da0dcaef1b | |||
| 9babd808f8 | |||
| 57c07037a7 | |||
| 2eb862ba18 | |||
| e5c482b517 | |||
| 61c7621b80 | |||
| 595687a2f1 | |||
| 6e2e65e499 | |||
| 997a36bb09 | |||
| 8b03cdac79 | |||
| 6b0bfc914c | |||
| 9f5ceda372 | |||
| d550a1409b | |||
| e56a129d56 | |||
| 9a8d870765 | |||
| be724f381e | |||
| c6a0fc48df | |||
| 61e6471fce | |||
| 3ad11e88b2 | |||
| 156f63c804 | |||
| ca9de648a8 | |||
| 66d6716a02 | |||
| 19906f7074 | |||
| b8dececceb | |||
| 068be51fa0 | |||
| 85a430d5be | |||
| 3b00cdbff0 | |||
| 9e0bad4909 | |||
| b430f84c4c | |||
| 014161956c | |||
| 5f842b21bd | |||
| ca3a97b8c1 | |||
| 5b6af116c1 | |||
| a9fd5db642 | |||
| 2f26b36af3 | |||
| c2fe49c5e7 | |||
| 7df5ccc871 | |||
| cf507be4c0 | |||
| 9e8bc0e590 | |||
| b50965414e | |||
| f2592eb65e | |||
| e9d837a1a2 | |||
| a650e7bb3a | |||
| 974dde3777 | |||
| 0ba544e97d | |||
| 72395f4d2a | |||
| 74780decb8 | |||
| f167056a18 | |||
| 375016e822 | |||
| ec6c6dae3f | |||
| 463b6cbe64 | |||
| 08f4e03f53 | |||
| 593d5992c0 | |||
| 671a35735b | |||
| c7bbf43c12 | |||
| 8dd4116941 | |||
| 821a2a750b | |||
| 4351ce8a6b | |||
| d97feb678a | |||
| 1f49b80193 | |||
| 2edb2fbaf1 | |||
| 7aa8c1329f | |||
| 04f64ffbe0 | |||
| bdc1bb3358 | |||
| 8e42353e0e | |||
| 1ab3830750 | |||
| 45ce915b79 | |||
| 2a28db59c3 | |||
| f18d2309fb | |||
| bc516d11c1 | |||
| 75ee3dfa69 | |||
| 7dac46e80c | |||
| 23cbd7e82b | |||
| e2612a5522 | |||
| 41fd2c3924 | |||
| 7020a2ac33 | |||
| cf3f87a641 | |||
| 2500eb7ead | |||
| 0115262560 | |||
| 7c944b7cbe | |||
| e264752381 | |||
| 075f61025c | |||
| 085fecaf86 | |||
| 970d2432d7 | |||
| 0d8057b119 | |||
| 2786c8fd73 | |||
| e1555199db | |||
| 6defede491 | |||
| 47e1151f92 | |||
| e8dc4c6cb1 | |||
| db8598ca48 | |||
| b0252a5c00 | |||
| 47cc07674c | |||
| 29f26fd747 | |||
| 9c336062b7 | |||
| 594f4f574a | |||
| 3802128b59 | |||
| 657ed64b03 | |||
| b39a349ec4 | |||
| 8c30f7fc26 | |||
| 81de99d733 | |||
| 7235680eed | |||
| ce5a0d7b65 | |||
| 89719f7030 | |||
| 1d03d41680 | |||
| de161d3c49 | |||
| 509b0c983d | |||
| 877d109b01 | |||
| dc5ea21614 | |||
| 4a08d3bac9 | |||
| f555bfac15 | |||
| 5fb8a656c1 | |||
| bfc8a717df | |||
| b65b99cab8 | |||
| 296f9b6a82 | |||
| 7409a0e99a | |||
| f08318d7fb | |||
| 890cdce488 | |||
| 5a739340da | |||
| 751ad21e9c | |||
| a9a72d76f9 | |||
| 31e0c05036 | |||
| 2a0d5695b3 | |||
| cf9281719f | |||
| 8cde300d8c | |||
| 50d1bd1c2a | |||
| 58cac329b7 | |||
| 011dd960f4 | |||
| 0389288693 | |||
| e5b094bed6 | |||
| 4a0d23143a | |||
| bdd5bba791 | |||
| 1159927f08 | |||
| b9a69f5b1f | |||
| 947e63afb8 | |||
| d221dc7482 | |||
| 14da408e08 | |||
| 4ca9e54f7f | |||
| 154877b2ff | |||
| 303c064224 | |||
| e521d0f799 | |||
| 4d4b237efb | |||
| 727929f1fa | |||
| 26e8b7a96e | |||
| 4d59b9d9fa | |||
| 7c018f428c | |||
| 3c3ff8ace3 | |||
| 70c6b92b97 | |||
| b27229da41 | |||
| 0801278026 | |||
| d9bda8a421 | |||
| 42f8e247d2 | |||
| ed3ee5e357 | |||
| 8b4a8f616f | |||
| f470cf47b7 | |||
| e43202e7a3 | |||
| e70d37080c | |||
| 98d6d9288b | |||
| 1c2ecdd3dd | |||
| 1d94add47e | |||
| dd1ac4af5c | |||
| 9982cf19c9 | |||
| 7d72568ba9 | |||
| 2ad6c7b8fe | |||
| c73628d1dc | |||
| d976a7d9dc | |||
| 2683c51739 | |||
| 7262b0c5a9 | |||
| 26be3a96c4 | |||
| 33ca51fbdf | |||
| 642a7105e5 | |||
| 4233e8b7b6 | |||
| f7352c8340 | |||
| 90b7248055 | |||
| 3c13c14e59 | |||
| 0cf15fb3e6 | |||
| c966aa2c71 | |||
| d367b64be3 | |||
| 862dd9d01a | |||
| 675c2419d1 | |||
| 3453faf411 | |||
| 9fcb7001e6 | |||
| 6a9c63b3c4 | |||
| f248698fed | |||
| 5510929c42 | |||
| 8cbaea4f7a | |||
| bb52c312de | |||
| 152fa94009 | |||
| a59462f1a4 | |||
| 8f08bf55d9 | |||
| 85c23c24f6 | |||
| 174e5dfc05 | |||
| 3ed3433efd | |||
| 6cb344928f | |||
| 2c56bea007 | |||
| 6ac70d87d4 | |||
| e58d9e9f8e | |||
| 80f91aad31 | |||
| fa1df4db7b | |||
| ce499284a0 | |||
| 5359b97581 | |||
| f3f60456ff | |||
| e0e1d29889 | |||
| 42ce3dfc9f | |||
| 71338fc369 | |||
| 7aae797ec1 | |||
| c5749e312f | |||
| 17f32ca725 | |||
| 7648eae997 | |||
| 62a29aa8e0 | |||
| 93727c9b8e | |||
| b2681766d7 | |||
| afd38cb133 | |||
| d3fcae7237 | |||
| 6b66913982 | |||
| 68875532e6 | |||
| 519c36a6fb | |||
| 93f30556b3 | |||
| b3f180f91b | |||
| ac76e8c5bf | |||
| 3c4e7ea962 | |||
| 3d83f4255a | |||
| 21e5dd9414 | |||
| 9b6b1f3afa | |||
| 148c0decf6 | |||
| 0df7a3d616 | |||
| 46385c64bd | |||
| 91b890f705 | |||
| 683b038d09 | |||
| a04aa7c7df | |||
| 8e2958d1a1 | |||
| 39d860b52d | |||
| 7c37e6755c | |||
| d21dbfd55d | |||
| 723a084744 | |||
| 1ace15420e | |||
| 1df5e775ff | |||
| b547c1396f | |||
| ffbbe44116 | |||
| 7a7056e0bb | |||
| ab505564c9 | |||
| 527bd0664c | |||
| 6285e5af65 | |||
| 792f362b93 | |||
| db69332665 | |||
| 94a7bfecb0 | |||
| 8665733354 | |||
| a6abb7fda7 | |||
| 380199a948 | |||
| 2da1b09809 | |||
| a75dde8a5c | |||
| 3c98b96d40 | |||
| 3bd8388689 | |||
| 5ceee287f3 | |||
| 319e0b4d9a | |||
| 84bed3d71b | |||
| 381b712d96 | |||
| 87c9582273 | |||
| ae9910b3aa | |||
| 91607e97ed | |||
| 71c7eb7260 | |||
| 5b6037f3ac | |||
| d2ae521e17 | |||
| 11f0eb9979 | |||
| 4e1af8f1b3 | |||
| a68c438d5c | |||
| 9a7b7e38b9 | |||
| 43e57712eb | |||
| 55ebb7277b | |||
| 0ca2898178 | |||
| d1910944e2 | |||
| 257343b354 | |||
| 7989c3edc6 | |||
| accaf2e9f6 | |||
| 15f93e462f | |||
| d628dcedd2 | |||
| 8b42d3bbb7 | |||
| c92a464165 | |||
| 08410ed897 | |||
| aea1aa849b | |||
| fe2f0270d3 | |||
| bd6cea2f98 | |||
| b13b2b54a6 | |||
| 5a16abc079 | |||
| 0dd1864b73 | |||
| c23b03b50c | |||
| c5c150c146 | |||
| a555df3d69 | |||
| 87b270ef6a | |||
| 3f8f8601e2 | |||
| ad0957be6d | |||
| 5bdb86e23b | |||
| cb55f92d17 | |||
| 9c3d643dad | |||
| af053ebd3e | |||
| f241382c56 | |||
| 055d04ad68 | |||
| 02cac21426 | |||
| ee031ca12d | |||
| 2332c5b8da | |||
| a2842bc86c | |||
| 8d0db8766b | |||
| 746be7faee | |||
| 3b117ede45 | |||
| af5f09db42 | |||
| 48988ba271 | |||
| 1060c5998e | |||
| 9f5d13105d | |||
| 777816e6c7 | |||
| 0e0fd96278 | |||
| 5aa3fe9c10 | |||
| 882a1343ab | |||
| cb48f665eb | |||
| 0a786db090 | |||
| e9dec637ff | |||
| 954e74f2dd | |||
| dc3906acce | |||
| 4fc9ea71f9 | |||
| abe58b4a43 | |||
| 662231384d | |||
| c76465c42b | |||
| e2a73d8a93 | |||
| 7764cd6cc7 | |||
| 0a870ce21a | |||
| 55be7faa95 | |||
| 60afff1419 | |||
| 1c8d340d1b | |||
| 31d3c58089 | |||
| 4a900a1e3b | |||
| 2564d898d3 | |||
| cea03e39c7 | |||
| e38e49335c | |||
| 8d137d3be6 | |||
| 766b1926ed | |||
| 842721d87f | |||
| 247147c8dd | |||
| 75108f21ad | |||
| 9fa06fc780 | |||
| ed90d891a1 | |||
| d8f6207bee | |||
| 381fd47442 | |||
| f868caa529 | |||
| 4378a0456e | |||
| f829d4a446 | |||
| b49d086945 | |||
| 0aa07c2fa0 | |||
| 4d15a1932a | |||
| c2540e76e1 | |||
| c3c4013f08 | |||
| 210deee299 | |||
| 9c71a2396b | |||
| 6ba16921db | |||
| 245505f928 | |||
| d086c991ee | |||
| c8c625a0be | |||
| a71dd3f315 | |||
| a40fe0a766 | |||
| b2a39ba822 | |||
| 845c5d725b | |||
| ac12e36125 | |||
| 08a7bbc9ff | |||
| 52b0b2684c | |||
| 7c96968699 | |||
| c629a2ef7f | |||
| d500edf243 | |||
| b666f6f3aa | |||
| f66e4015b8 | |||
| a84533fee3 | |||
| b49beecf63 | |||
| 74b111bc7f | |||
| a8c5a14b7c | |||
| f9ad31d809 | |||
| db26bf99f5 | |||
| e4857c41fb | |||
| 37d9720b15 | |||
| 24e6ae8cc6 | |||
| e31d492145 | |||
| e5708be88c | |||
| c34713bfca | |||
| 364f72aa05 | |||
| 4e5d63c403 | |||
| 79bad718b6 | |||
| 01ed826fff | |||
| d842884534 | |||
| b51bfdd111 | |||
| db47e0ffbb | |||
| ceab443d08 | |||
| 5675d86412 | |||
| ad0d007abd | |||
| 69e5d0ef95 | |||
| f32f831749 | |||
| cdd0bfcc1a | |||
| 6153b68ff9 | |||
| 716f1ef9f1 | |||
| 101fb762f1 | |||
| 368cc39e7e | |||
| 806b78fd12 | |||
| 6c619b41c8 | |||
| f02f53f09b | |||
| c4acc71042 | |||
| a5fe571a1c | |||
| 9fa998f63b | |||
| 4b6776536a | |||
| b7a99c865f | |||
| 059c9be198 | |||
| f132783767 | |||
| 26ee0fa9cd | |||
| d3c653c13f | |||
| 1f6823d18f | |||
| 4d833069bd | |||
| 03b17f7a0d | |||
| 5b549b306d | |||
| 6c9ac19b6f | |||
| 83523cccd6 | |||
| 4846e7e856 | |||
| ad9c1a9966 | |||
| 67c80485b9 | |||
| b764301306 | |||
| 993c547bd6 | |||
| 558bfc50fe | |||
| dc13c4f8a3 | |||
| d485515725 | |||
| f8a7befdd5 | |||
| ad5cbccfd3 | |||
| f07794ae81 | |||
| 9930ae9e6b | |||
| 6bcb0ad140 | |||
| 78066f113a | |||
| e2e91ea8ce | |||
| 3b0b90d5c1 | |||
| ad890b4490 | |||
| ea369699c4 | |||
| 87db2759da | |||
| 6bd4ab8c5e | |||
| c887b2c522 | |||
| 02f54468a8 | |||
| d9316decdd | |||
| 39cc4b9f1a | |||
| 9cd9700ad6 | |||
| 6c9ceb3c2e | |||
| d52eafd9ae | |||
| 14f409f698 | |||
| 762b68827e | |||
| c4257b0ff9 | |||
| 76e4168089 | |||
| a58e869ce2 | |||
| 8798f3049f | |||
| 0d163e9ece | |||
| cb7e142c73 | |||
| 17e05203ff | |||
| 92ac252418 | |||
| c9dc31afe8 | |||
| 493dd6c934 | |||
| a2adf92023 | |||
| 005072a3ef | |||
| 8bed6c33cd | |||
| 0ac7fcd7da | |||
| 8aec60b652 | |||
| d4f4fa2abe | |||
| 7620c403ec | |||
| df1a564fa6 | |||
| e20fd196ce | |||
| fd10b9422d | |||
| 80f7504f86 | |||
| a203cb09be | |||
| 131015e234 | |||
| 8494b4356c | |||
| 3b1bd3405b | |||
| d4e2861046 | |||
| 008809ad21 | |||
| 89a750dbeb | |||
| c0db85f0b2 | |||
| ef02670d09 | |||
| 7764e1afe0 | |||
| 2c36ba5bb8 | |||
| 1f046e1625 | |||
| 31a8a7e4e1 | |||
| 120f722403 | |||
| 2854559b92 | |||
| 696d638772 | |||
| 2e0b0c94f8 | |||
| d6070215b8 | |||
| 7ca5f47dcb | |||
| 008c431636 | |||
| 17e44aad44 | |||
| cad170cba8 | |||
| b215544c31 | |||
| 5d10e3f43d | |||
| 354cd59314 | |||
| 1ede3a6712 | |||
| 8558e34ed5 | |||
| 614b05ec8b | |||
| ed2bc33154 | |||
| 1ab501974f | |||
| 87753e76d1 | |||
| 0b06840128 | |||
| 9abc42b262 | |||
| 90080d990a | |||
| e7fcbec49e | |||
| 1576c4d233 | |||
| 6ac068ae5c | |||
| 7074cb559f | |||
| 9138c1f9a8 | |||
| 98ed0ea1af | |||
| 6abfa47012 | |||
| 59b08215b2 | |||
| c7c1adeb8d | |||
| 9230c9417b | |||
| 23f0f6f72d | |||
| 7eb1d32847 | |||
| fadb4b239b | |||
| f319b5bf61 | |||
| 4a373dbaf9 | |||
| c612f884dc | |||
| b543159952 | |||
| 667fdd514e | |||
| 951f480ab9 | |||
| bcbb41a0fa | |||
| ba39176b59 | |||
| 4305306220 | |||
| 8864d0f442 | |||
| 741162fbbe | |||
| f1e4622ccb | |||
| 4241549aed | |||
| 9e0d96f36b | |||
| 7e5b0b4e9c | |||
| 9be2fc8f19 | |||
| f8cbf4713a | |||
| 1a7d693572 | |||
| 31922db550 | |||
| 3cf94d16ed | |||
| ae471b7ab6 | |||
| f00c241f7d | |||
| cbd20ae8ba | |||
| 7bbe252c59 | |||
| a7d6e5b0f7 | |||
| e4edbb9e0b | |||
| 80895066a2 | |||
| 40385816cd | |||
| 1be6adbd3e | |||
| d416d809a1 | |||
| bf3c381651 | |||
| 9338d432f9 | |||
| b2ef8fc07e | |||
| 53ff8d79ee | |||
| ed55a25fd5 | |||
| c92727ae6b | |||
| 5cc8148eb8 | |||
| 92b2d0f2dd | |||
| ec27637e08 | |||
| 319047dfb1 | |||
| 67145bac78 | |||
| 7675f212ee | |||
| 25e0480339 | |||
| 8a286fda3e | |||
| 5e73ea768b | |||
| fdecc5c6da | |||
| f3e4a7a514 | |||
| f966e024ef | |||
| f3410ae74b | |||
| 7e70535f09 | |||
| 8def180d7a | |||
| e123a4e191 | |||
| df5ee47979 | |||
| b18207cd3a | |||
| f750f104ca | |||
| cc1b52fddf | |||
| e6f1411d72 | |||
| 90f08155c5 | |||
| 24f49eaa7e | |||
| 086617bac8 | |||
| 088f9942ef | |||
| 6befbe8050 | |||
| 62385afcd3 | |||
| b9f7637ea8 | |||
| 5e435e4635 | |||
| 362af1586a | |||
| c8305b464f | |||
| f5303bd518 | |||
| d040f940a2 | |||
| c97ab4b00a | |||
| 5e8720e3a3 | |||
| 3cef39f10a | |||
| 0e938d8e6c | |||
| 6a9781ab1f | |||
| 18ecdd56aa | |||
| f9452850dd | |||
| d2925a9397 | |||
| 537cef4fdd | |||
| 8319d93b45 | |||
| 41a96d7c4d | |||
| 1b88c2ef22 | |||
| 0d4057f406 | |||
| 07182b5324 | |||
| 0070770144 | |||
| 03240ae37b | |||
| 0ee01f0cda | |||
| 23febf1491 | |||
| cf299069d4 | |||
| b3abd77235 | |||
| 45c65f2b7e | |||
| 6ef50f6983 | |||
| 378d834f44 | |||
| 9a1e5c1750 | |||
| 6a691a2dba | |||
| a44d38fc25 | |||
| 826153a73d | |||
| 1e76d6529c | |||
| 6dce2448c4 | |||
| 828a4b2350 | |||
| 8300665144 | |||
| 4ccdd406cb | |||
| fc5711d43c | |||
| 1e35150951 | |||
| af6ca730d4 | |||
| e60154c553 | |||
| b2a2b9af0c | |||
| a3fcc4d416 | |||
| 1809c83ef3 | |||
| 88b5a2a15c | |||
| ee9534257d | |||
| 4b612862c7 | |||
| 75bf99a13c | |||
| fd10cafb1a | |||
| 831a8bae99 | |||
| 36b84580e0 | |||
| 4bb8788c44 | |||
| e8e5f86657 | |||
| be310ffda8 | |||
| cacc23f041 | |||
| 72a4c9a290 | |||
| 5d68b50a62 | |||
| 6a1055bf37 | |||
| 67e43279bb | |||
| 3f4bcbd03a | |||
| 74acff4411 | |||
| d6a54ada6e | |||
| d556c2aeaa | |||
| df313f0e94 | |||
| 4d4ef0e0b8 | |||
| 9717970b60 | |||
| 4f2ae57c31 | |||
| 6266a81cf7 | |||
| d0f6aa914a | |||
| 4c7701a6d9 | |||
| b1d476b800 | |||
| eae483c5a4 | |||
| 22da58c579 | |||
| 9b657e0dec | |||
| 8e6f38a406 | |||
| 537515d8e8 | |||
| 3c5f492e9d | |||
| 1301de5879 | |||
| 87698fefb6 | |||
| 7fd096aa14 | |||
| 78dea37dbc | |||
| 8117a6dc8a | |||
| 866002a1ef | |||
| c4a0e8dab6 | |||
| b3f66a5f13 | |||
| 78fb084d02 | |||
| 08f1de55d0 | |||
| 29949f0031 | |||
| 24dea5f76b | |||
| f5f53ceb7a | |||
| 3638683cdd | |||
| ed1061fd15 | |||
| fab77ea872 | |||
| ebb351fa65 | |||
| c8bf751abf | |||
| fc10786ff1 | |||
| 841c716376 | |||
| ca36c9581f | |||
| c03b88f607 | |||
| abf7820411 | |||
| 6cdd66e3c5 | |||
| 316e201245 | |||
| 54c9dab53b | |||
| c60272d855 | |||
| d7895072ac | |||
| 3a1d81851f | |||
| 3e82837cc0 | |||
| 6f0c99c7a8 | |||
| 7dbf7695da | |||
| 0c64299b01 | |||
| 70f97a5995 | |||
| a9530ec147 | |||
| fe5cf88b17 | |||
| 9f79ed8a3c | |||
| 868d207889 | |||
| c28941370e | |||
| 5c0cd26dbf | |||
| 8e9aa7d060 | |||
| 49cb76f312 | |||
| d91d2fa6d3 | |||
| 20dbeadfb3 | |||
| 8ed24b7dda | |||
| 1ca7a8001b | |||
| 5aab521e4d | |||
| a1332df845 | |||
| eb2d09c49c | |||
| e2c0f78d63 | |||
| d7440e481e | |||
| 5fd7a8cc89 | |||
| 7429a293b7 | |||
| a31fec1556 | |||
| a8cecdc232 | |||
| b0d3c33001 | |||
| b3ede2a6f5 | |||
| a804689232 | |||
| 62e0242116 | |||
| 0321eb66d0 | |||
| 604c996ca6 | |||
| ba7b72a53d | |||
| 077b7e99c1 | |||
| 7099595c4d | |||
| e723db1680 | |||
| 19043b2c61 | |||
| 97b0c002ec | |||
| 3c9367fb62 | |||
| a064e86c8b | |||
| f0cb717a7e | |||
| ed14ae8128 | |||
| 05888cfc84 | |||
| cca1df961b | |||
| fb4f768789 | |||
| 1fda1af9d2 | |||
| 6d338ba5f9 | |||
| 63d4e986d0 | |||
| 9595f6a388 | |||
| c50d4d9039 | |||
| 1a5d7ed12e | |||
| e18bb176e1 | |||
| 42fd053ddc | |||
| d873273749 | |||
| cba3313110 | |||
| 122ea396cf | |||
| 1b068b9049 | |||
| 8069349d65 | |||
| 1de8317f92 | |||
| 0ff7b38264 | |||
| 9fc48040ba | |||
| 1752044872 | |||
| 685ecea312 | |||
| ef90bd2c06 | |||
| bcf99ba3b9 | |||
| 48e385f582 | |||
| f9baa9c1cc | |||
| 564f9b03e6 | |||
| a270bb477a | |||
| 23f4b83ec6 | |||
| 28c5a47afc | |||
| b52e9a106c | |||
| 0d2fdd9cd9 | |||
| 591234f350 | |||
| 1b2f2b82f0 | |||
| 85e21f03a1 | |||
| 864dbb4ae7 | |||
| 247475fc9f | |||
| 2fb18d1cdc | |||
| 74f65d5ef6 | |||
| 3443f0a7b2 | |||
| ab05be1a23 | |||
| 0aba3fd198 | |||
| 2466ff5d77 | |||
| fc0966ba1f | |||
| 83e674cd7f | |||
| 9468a32a8e | |||
| 01cd957389 | |||
| d0d30cb9a0 | |||
| 3bbc55a650 | |||
| 0f1d2d8c94 | |||
| da8b22453c | |||
| d490ba1476 | |||
| 408a5a1b03 | |||
| 0ec5eaa5ca | |||
| e4173bf72a | |||
| 55a96b2f3e | |||
| 1a42831794 | |||
| 571acdabaa | |||
| f7396c7867 | |||
| c1bfa6076c | |||
| f9e8f1118d | |||
| 8d1ea9fbed | |||
| 9197f258b9 | |||
| bbaae076fa | |||
| 7ba21c9f41 | |||
| 8f211852b7 | |||
| 0a1dc0b126 | |||
| 104b23ff7f | |||
| d7355da165 | |||
| 64a985181b | |||
| 9fb2199303 | |||
| 0e4429dfec | |||
| 09a47d4232 | |||
| f39c91312f | |||
| f0769c5367 | |||
| 68199074d8 | |||
| 8807ea9497 | |||
| 60061f9d34 | |||
| 4cbb779866 | |||
| 7add89d356 | |||
| a3faf996f5 | |||
| 1dd6d5a8a2 | |||
| c4020445c4 | |||
| 3b455ec7d2 | |||
| 760f271b07 | |||
| bf28e6d08a | |||
| 13f366f87b | |||
| c9c2c6df00 | |||
| ba1fa71220 | |||
| 08afbd8644 | |||
| 3e1a16bbbc | |||
| 2620831e61 | |||
| 040c22892d | |||
| 43059890b7 | |||
| 03796898f6 | |||
| ecaa25ff09 | |||
| 9a055d09c9 | |||
| c95fff4fa9 | |||
| 324480d4b2 | |||
| 4d4a11fd68 | |||
| 89a8bdc8cc | |||
| 8a2bccf264 | |||
| f697f01e35 | |||
| 976fe7c655 | |||
| e6ecbb498b | |||
| 37e6138a3c | |||
| e7514ae3f1 | |||
| 81f9b42660 | |||
| 7c5bebadf1 | |||
| d1a0531ca4 | |||
| 5f536e23ed | |||
| 16d42c3776 | |||
| ca108ade8d | |||
| 8997698305 | |||
| 9cb996a977 | |||
| 6f7fcae9f2 | |||
| 44089f2cb4 | |||
| 5140419a14 | |||
| d0bc1c59ae | |||
| f3726ba3b2 | |||
| e1079fc4f1 | |||
| a8500a96f8 | |||
| 325bbaaa17 | |||
| 12961dfd4d | |||
| c646026617 | |||
| 6dfa18dff6 | |||
| 269a213980 | |||
| 311a061ce1 | |||
| f152f333d0 | |||
| 24ec651269 | |||
| 8abe956ca8 | |||
| 8e1ae566f2 | |||
| b0b359cd73 | |||
| 1ad395e023 | |||
| b1e07b8879 | |||
| 4d78c38a37 | |||
| bb9cae5afc | |||
| 9051e08619 | |||
| cec1b35f86 | |||
| 2fe45c4a0a | |||
| b40e18c325 | |||
| d72975122f | |||
| 7508d0918f | |||
| a91a3c5c79 | |||
| a30e48bc6a | |||
| 6cb0f10970 | |||
| a0de778c07 | |||
| b866247504 | |||
| 33dc359ccc | |||
| 9b6c468b16 | |||
| de028f7715 | |||
| 4be0a0c1b5 | |||
| 7873f331ea | |||
| f8961f9bc0 | |||
| d0949f39e9 | |||
| 042699bf23 | |||
| 49163d4fb6 | |||
| 6ad9639961 | |||
| 694c70e8e6 | |||
| 4398b01077 | |||
| 95df21e3ae | |||
| 6fe671e94a | |||
| 92fa909b5e | |||
| 7b23572651 | |||
| e9369e5282 | |||
| 74b0c7ac01 | |||
| e01a96ef15 | |||
| 00d69809d4 | |||
| 02d7853dab | |||
| 7f5f0ae62b | |||
| b5a814308a | |||
| f22675fed9 | |||
| 1f45359727 | |||
| 7fe0a5d596 | |||
| e83bdb2c03 | |||
| 3b253287d7 | |||
| bf252c1d4a | |||
| cf0d9e996b | |||
| 670eea76db | |||
| 59359cde79 | |||
| 2794229c55 | |||
| 626caefd89 | |||
| 6880e3bb16 | |||
| ed0dd58cf2 | |||
| 1c52f98506 | |||
| 5aac129459 | |||
| 43efbf3deb | |||
| 408964a73b | |||
| b0c015e156 | |||
| b47138f834 | |||
| 40652b156b | |||
| afa39a8fa8 | |||
| c52128df17 | |||
| c0234d300b | |||
| ddc35e5bd5 | |||
| fb904d1889 | |||
| 5d7850d42e | |||
| 52657c4298 | |||
| bd2930f2b1 | |||
| 6cebd028b9 | |||
| 1e006c3d5f | |||
| d5ebb85dce | |||
| be653a00cc | |||
| a1dfc10135 | |||
| e67dfebaca | |||
| 33a9f3495e | |||
| e1f8632d26 | |||
| 82192c1bd8 | |||
| b59efda13c | |||
| 044f9df97e | |||
| 3743bfe506 | |||
| 90beaec2eb | |||
| f758baa9ac | |||
| 42a5861017 | |||
| c9ddd414c7 | |||
| 6b0ee8e3d7 | |||
| e4db399ca5 | |||
| 43b3cb4230 | |||
| 8bf4dbe31c | |||
| 471a2de79c | |||
| a0ba79ded7 | |||
| 252b76e7aa | |||
| fe6ed5c2c2 | |||
| ea95720fe5 | |||
| 916ad6bf7e | |||
| ef10c059ef | |||
| 770f2e2ab1 | |||
| e364a5368d |
+294
-267
@@ -1,303 +1,330 @@
|
||||
<?php
|
||||
<?PHP // $Id$
|
||||
// config.php - allows admin to edit all configuration variables
|
||||
|
||||
/**
|
||||
* Allows admin to edit all auth plugin settings.
|
||||
*
|
||||
* JH: copied and Hax0rd from admin/enrol.php and admin/filters.php
|
||||
*
|
||||
*/
|
||||
require_once('../config.php');
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
|
||||
// get currently installed and enabled auth plugins
|
||||
$authsavailable = get_list_of_plugins('auth');
|
||||
|
||||
//revert auth_plugins_enabled
|
||||
if (isset($CFG->auth_plugins_enabled)) {
|
||||
set_config('auth', $CFG->auth_plugins_enabled);
|
||||
delete_records('config', 'name', 'auth_plugins_enabled');
|
||||
unset($CFG->auth_plugins_enabled);
|
||||
}
|
||||
|
||||
get_enabled_auth_plugins(true); // fix the list of enabled auths
|
||||
if (empty($CFG->auth)) {
|
||||
$authsenabled = array();
|
||||
} else {
|
||||
$authsenabled = explode(',', $CFG->auth);
|
||||
}
|
||||
|
||||
if (!isset($CFG->registerauth)) {
|
||||
set_config('registerauth', '');
|
||||
}
|
||||
|
||||
if (!isset($CFG->auth_instructions)) {
|
||||
set_config('auth_instructions', '');
|
||||
}
|
||||
|
||||
if (!empty($auth) and !exists_auth_plugin($auth)) {
|
||||
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
|
||||
}
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// process actions
|
||||
$focus = '';
|
||||
|
||||
$status = '';
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
switch ($action) {
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
case 'save':
|
||||
if (data_submitted() and confirm_sesskey()) {
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
// save settings
|
||||
set_config('guestloginbutton', required_param('guestloginbutton', PARAM_BOOL));
|
||||
set_config('alternateloginurl', stripslashes(trim(required_param('alternateloginurl', PARAM_RAW))));
|
||||
set_config('registerauth', required_param('register', PARAM_SAFEDIR));
|
||||
set_config('auth_instructions', stripslashes(trim(required_param('auth_instructions', PARAM_RAW))));
|
||||
$config = (array)$config;
|
||||
|
||||
// enable registerauth in $CFG->auth if needed
|
||||
if (!empty($CFG->registerauth) and !in_array($CFG->registerauth, $authsenabled)) {
|
||||
$authsenabled[] = $CFG->registerauth;
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
// extract and sanitize the auth key explicitly
|
||||
$modules = get_list_of_plugins("auth");
|
||||
if (in_array($config['auth'], $modules)) {
|
||||
$auth = $config['auth'];
|
||||
} else {
|
||||
notify("Error defining the authentication method");
|
||||
}
|
||||
|
||||
// load the auth plugin library
|
||||
require_once("{$CFG->dirroot}/auth/$auth/lib.php");
|
||||
|
||||
$err = array();
|
||||
if (function_exists('auth_validate_form')) {
|
||||
auth_validate_form($config, $err);
|
||||
}
|
||||
|
||||
if (count($err) == 0) {
|
||||
foreach ($config as $name => $value) {
|
||||
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
|
||||
$plugin = "auth/$auth";
|
||||
$name = $matches[1];
|
||||
if (! set_config($name, $value, $plugin)) {
|
||||
notify("Problem saving config $name as $value for plugin $plugin");
|
||||
}
|
||||
} else { // normal handling for
|
||||
if (! set_config($name, $value)) {
|
||||
notify("Problem saving config $name as $value");
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect("auth.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
exit;
|
||||
|
||||
} else {
|
||||
foreach ($err as $key => $value) {
|
||||
$focus = "form.$key";
|
||||
}
|
||||
$status = get_string('changessaved');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
// remove from enabled list
|
||||
$key = array_search($auth, $authsenabled);
|
||||
if ($key !== false) {
|
||||
unset($authsenabled[$key]);
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
|
||||
if ($auth == $CFG->registerauth) {
|
||||
set_config('registerauth', '');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'enable':
|
||||
// add to enabled list
|
||||
if (!in_array($auth, $authsenabled)) {
|
||||
$authsenabled[] = $auth;
|
||||
$authsenabled = array_unique($authsenabled);
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth plugin is valid
|
||||
if ($key === false) {
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
}
|
||||
// move down the list
|
||||
if ($key < (count($authsenabled) - 1)) {
|
||||
$fsave = $authsenabled[$key];
|
||||
$authsenabled[$key] = $authsenabled[$key + 1];
|
||||
$authsenabled[$key + 1] = $fsave;
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'up':
|
||||
$key = array_search($auth, $authsenabled);
|
||||
// check auth is valid
|
||||
if ($key === false) {
|
||||
error(get_string('pluginnotenabled', 'auth', $auth), $url);
|
||||
}
|
||||
// move up the list
|
||||
if ($key >= 1) {
|
||||
$fsave = $authsenabled[$key];
|
||||
$authsenabled[$key] = $authsenabled[$key - 1];
|
||||
$authsenabled[$key - 1] = $fsave;
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// display strings
|
||||
$txt = get_strings(array('authenticationplugins', 'users', 'administration',
|
||||
'settings', 'edit', 'name', 'enable', 'disable',
|
||||
'up', 'down', 'none'));
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
|
||||
// construct the display array, with enabled auth plugins at the top, in order
|
||||
$displayauths = array();
|
||||
$registrationauths = array();
|
||||
$registrationauths[''] = $txt->disable;
|
||||
foreach ($authsenabled as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($authsavailable as $auth) {
|
||||
if (array_key_exists($auth, $displayauths)) {
|
||||
continue; //already in the list
|
||||
}
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$displayauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = get_string("auth_{$auth}title", 'auth');
|
||||
}
|
||||
}
|
||||
|
||||
// build the display table
|
||||
$table = new flexible_table('auth_admin_table');
|
||||
$table->define_columns(array('name', 'enable', 'order', 'settings'));
|
||||
$table->define_headers(array($txt->name, $txt->enable, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("{$CFG->wwwroot}/{$CFG->admin}/auth.php");
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
//add always enabled plugins first
|
||||
$displayname = "<span>".$displayauths['manual']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=manual\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
$displayname = "<span>".$displayauths['nologin']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=nologin\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
|
||||
|
||||
// iterate through auth plugins and add to the display table
|
||||
$updowncount = 1;
|
||||
$authcount = count($authsenabled);
|
||||
$url = "auth.php?sesskey=" . sesskey();
|
||||
foreach ($displayauths as $auth => $name) {
|
||||
if ($auth == 'manual' or $auth == 'nologin') {
|
||||
continue;
|
||||
}
|
||||
// hide/show link
|
||||
if (in_array($auth, $authsenabled)) {
|
||||
$hideshow = "<a href=\"$url&action=disable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"disable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=disable&auth=$auth\"><input type=\"checkbox\" checked /></a>";
|
||||
$enabled = true;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$url&action=enable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"enable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=enable&auth=$auth\"><input type=\"checkbox\" /></a>";
|
||||
$enabled = false;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
// up/down link (only if auth is enabled)
|
||||
$updown = '';
|
||||
if ($enabled) {
|
||||
if ($updowncount > 1) {
|
||||
$updown .= "<a href=\"$url&action=up&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount < $authcount) {
|
||||
$updown .= "<a href=\"$url&action=down&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
|
||||
}
|
||||
++ $updowncount;
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
if (empty($config)) {
|
||||
$config = $CFG;
|
||||
}
|
||||
|
||||
// settings link
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=$auth\">{$txt->settings}</a>";
|
||||
$modules = get_list_of_plugins("auth");
|
||||
$options = array();
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = get_string("auth_$module"."title", "auth");
|
||||
}
|
||||
asort($options);
|
||||
if (!empty($auth) && in_array($auth, $modules)) {
|
||||
} else {
|
||||
$auth = $config->auth;
|
||||
}
|
||||
|
||||
// add a row to the table
|
||||
$table->add_data(array($displayname, $hideshow, $updown, $settings));
|
||||
}
|
||||
// changepassword link replaced by individual auth setting
|
||||
if (!empty($config->changepassword)) {
|
||||
if (empty($config->{'auth_'.$auth.'_changepasswordurl'})) {
|
||||
$config->{'auth_'.$auth.'_changepasswordurl'} = $config->changepassword;
|
||||
}
|
||||
set_config('changepassword','');
|
||||
}
|
||||
|
||||
// output form
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$auth = clean_param($auth,PARAM_SAFEDIR);
|
||||
require_once("$CFG->dirroot/auth/$auth/lib.php"); //just to make sure that current authentication functions are loaded
|
||||
if (! isset($config->guestloginbutton)) {
|
||||
$config->guestloginbutton = 1;
|
||||
}
|
||||
if (! isset($config->alternateloginurl)) {
|
||||
$config->alternateloginurl = '';
|
||||
}
|
||||
if (! isset($config->auth_instructions)) {
|
||||
$config->auth_instructions = "";
|
||||
}
|
||||
if (! isset($config->changepassword)) {
|
||||
$config->changepassword = "";
|
||||
}
|
||||
if (! isset($config->{'auth_'.$auth.'_changepasswordurl'})) {
|
||||
$config->{'auth_'.$auth.'_changepasswordurl'} = '';
|
||||
}
|
||||
if (! isset($config->{'auth_'.$auth.'_changepasswordhelp'})) {
|
||||
$config->{'auth_'.$auth.'_changepasswordhelp'} = '';
|
||||
}
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
//print stus messages
|
||||
if ($status !== '') {
|
||||
notify($status, 'notifysuccess');
|
||||
}
|
||||
$guestoptions[0] = get_string("hide");
|
||||
$guestoptions[1] = get_string("show");
|
||||
|
||||
print_simple_box(get_string('configauthenticationplugins', 'admin'), 'center', '700');
|
||||
$createoptions[0] = get_string("no");
|
||||
$createoptions[1] = get_string("yes");
|
||||
|
||||
$table->print_html();
|
||||
$strauthentication = get_string("authentication");
|
||||
$strauthenticationoptions = get_string("authenticationoptions","auth");
|
||||
$strsettings = get_string("settings");
|
||||
$strusers = get_string("users");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$guestoptions = array();
|
||||
$guestoptions[0] = get_string("hide");
|
||||
$guestoptions[1] = get_string("show");
|
||||
echo "<center><b>";
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"authmenu\" method=\"post\" action=\"auth.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
|
||||
print_string("chooseauthmethod","auth");
|
||||
|
||||
echo '<hr />';
|
||||
echo ' ';
|
||||
|
||||
echo '<form '.$CFG->frametarget.' id="adminsettings" method="post" action="auth.php">';
|
||||
echo '<div class="settingsform">';
|
||||
print_heading(get_string('auth_common_settings', 'auth'));
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
echo '<fieldset>';
|
||||
##echo '<table cellspacing="0" cellpadding="5" border="0" style="margin-left:auto;margin-right:auto">';
|
||||
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
|
||||
|
||||
// User self registration
|
||||
echo '<div class="form-item" id="admin-register">';
|
||||
echo '<label for = "menuregister">' . get_string("selfregistration", "auth");
|
||||
echo '<span class="form-shortname">registerauth</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($registrationauths, "register", $CFG->registerauth, "");
|
||||
echo '<div class="description">' . get_string("selfregistration_help", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
echo "</b></center><br />";
|
||||
|
||||
print_simple_box_start("center", "100%");
|
||||
print_heading($options[$auth]);
|
||||
|
||||
print_simple_box_start("center", "60%", '', 5, 'informationbox');
|
||||
print_string("auth_$auth"."description", "auth");
|
||||
print_simple_box_end();
|
||||
|
||||
echo "<hr />";
|
||||
|
||||
print_heading($strsettings);
|
||||
|
||||
echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";
|
||||
|
||||
require_once("$CFG->dirroot/auth/$auth/config.html");
|
||||
$CFG->pagepath = 'auth/' . $auth;
|
||||
|
||||
echo '<tr><td colspan="3">';
|
||||
print_heading(get_string('auth_common_settings', 'auth'));
|
||||
echo '<td/></tr>';
|
||||
|
||||
if ($auth != "email" and $auth != "none" and $auth != "manual") {
|
||||
// display box for URL to change password. NB now on a per-method basis (multiple auth)
|
||||
echo "<tr valign=\"top\">";
|
||||
echo "<td align=\"right\" nowrap=\"nowrap\">";
|
||||
print_string("changepassword", "auth");
|
||||
echo ":</td>";
|
||||
echo "<td>";
|
||||
$passurl = $config->{'auth_'.$auth.'_changepasswordurl'};
|
||||
echo "<input type=\"text\" name=\"auth_{$auth}_changepasswordurl\" size=\"40\" value=\"$passurl\" />";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
print_string("auth_changepasswordurl_expl","auth",$auth);
|
||||
echo "</td></tr>";
|
||||
|
||||
// display textbox for lost password help. NB now on a per-method basis (multiple auth)
|
||||
echo "<tr valign=\"top\">";
|
||||
echo "<td align=\"right\" nowrap=\"nowrap\">";
|
||||
print_string("auth_changepasswordhelp", "auth");
|
||||
echo ":</td>";
|
||||
echo "<td>";
|
||||
$passhelp = $config->{'auth_'.$auth.'_changepasswordhelp'};
|
||||
echo "<textarea name=\"auth_{$auth}_changepasswordhelp\" cols=\"30\" rows=\"10\" wrap=\"virtual\">";
|
||||
echo $passhelp;
|
||||
echo "</textarea>\n";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
print_string("auth_changepasswordhelp_expl","auth",$auth);
|
||||
echo "</td></tr>";
|
||||
|
||||
}
|
||||
|
||||
echo "<tr valign=\"top\">";
|
||||
echo "<td align=\"right\" nowrap=\"nowrap\">";
|
||||
print_string("guestloginbutton", "auth");
|
||||
echo ":</td>";
|
||||
echo "<td>";
|
||||
choose_from_menu($guestoptions, "guestloginbutton", $config->guestloginbutton, "");
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
print_string("showguestlogin","auth");
|
||||
echo "</td></tr>";
|
||||
|
||||
if (function_exists('auth_user_create')){
|
||||
echo "<tr valign=\"top\">";
|
||||
echo "<td align=\"right\" nowrap=\"nowrap\">";
|
||||
print_string("auth_user_create", "auth");
|
||||
echo ":</td>";
|
||||
echo "<td>";
|
||||
choose_from_menu($createoptions, "auth_user_create", $config->auth_user_create, "");
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
print_string("auth_user_creation","auth");
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
// Login as guest button enabled
|
||||
echo '<div class="form-item" id="admin-guestloginbutton">';
|
||||
echo '<label for = "menuguestloginbutton">' . get_string("guestloginbutton", "auth");
|
||||
echo '<span class="form-shortname">guestloginbutton</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($guestoptions, "guestloginbutton", $CFG->guestloginbutton, "");
|
||||
echo '<div class="description">' . get_string("showguestlogin", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
/// An alternate url for the login form. It means we can use login forms that are integrated
|
||||
/// into non-moodle pages
|
||||
echo '<div class="form-item" id="admin-alternateloginurl">';
|
||||
echo '<label for = "alternateloginurl">' . get_string("alternateloginurl", "auth");
|
||||
echo '<span class="form-shortname">alternateloginurl</span>';
|
||||
echo '</label>';
|
||||
echo '<input type="text" size="60" name="alternateloginurl" id="alternateloginurl" value="'.$CFG->alternateloginurl."\" />\n";
|
||||
echo '<div class="description">' . get_string("alternatelogin", "auth", htmlspecialchars($CFG->wwwroot.'/login/index.php')) . '</div>';
|
||||
echo '</div>';
|
||||
echo '<tr valign="top">';
|
||||
echo '<td algin="right" nowrap="nowrap">';
|
||||
print_string('alternateloginurl', 'auth');
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo '<input type="text" size="40" name="alternateloginurl" alt="'.get_string('alternateloginurl', 'auth').'" value="'.$config->alternateloginurl.'" />';
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
print_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php'));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
/// Instructions about login/password
|
||||
/// to be showed to users
|
||||
echo '<div class="form-item" id="admin-auth_instructions">';
|
||||
echo '<label for = "auth_instructions">' . get_string("instructions", "auth");
|
||||
echo '<span class="form-shortname">auth_instructions</span>';
|
||||
echo '</label>';
|
||||
echo '<textarea cols="30" rows="4" name="auth_instructions" id="auth_instructions">'.s($CFG->auth_instructions)."</textarea>\n";
|
||||
echo '<div class="description">' . get_string("authinstructions", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</table>';
|
||||
echo '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
|
||||
echo '</form>';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Good enough for most auth plugins
|
||||
// but some may want a custom one if they are offering
|
||||
// other options
|
||||
// Note: pluginconfig_ fields have special handling.
|
||||
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
|
||||
|
||||
echo '<tr><td colspan="3">';
|
||||
if ($retrieveopts) {
|
||||
print_heading(get_string('auth_data_mapping', 'auth'));
|
||||
} else {
|
||||
print_heading(get_string('auth_fieldlocks', 'auth'));
|
||||
}
|
||||
echo '<td/></tr>';
|
||||
|
||||
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
|
||||
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
|
||||
'locked' => get_string('locked', 'auth'));
|
||||
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
|
||||
'onlogin' => get_string('update_onlogin', 'auth'));
|
||||
$updateextoptions = array('0' => get_string('update_never', 'auth'),
|
||||
'1' => get_string('update_onupdate', 'auth'));
|
||||
|
||||
$pluginconfig = get_config("auth/$auth");
|
||||
|
||||
// helptext is on a field with rowspan
|
||||
if (empty($helptext)) {
|
||||
$helptext = ' ';
|
||||
}
|
||||
|
||||
foreach ($user_fields as $field) {
|
||||
|
||||
// Define some vars we'll work with
|
||||
if(empty($pluginconfig->{"field_map_$field"})) {
|
||||
$pluginconfig->{"field_map_$field"} = '';
|
||||
}
|
||||
if(empty($pluginconfig->{"field_updatelocal_$field"})) {
|
||||
$pluginconfig->{"field_updatelocal_$field"} = '';
|
||||
}
|
||||
if (empty($pluginconfig->{"field_updateremote_$field"})) {
|
||||
$pluginconfig->{"field_updateremote_$field"} = '';
|
||||
}
|
||||
if (empty($pluginconfig->{"field_lock_$field"})) {
|
||||
$pluginconfig->{"field_lock_$field"} = '';
|
||||
}
|
||||
|
||||
// define the fieldname we display to the user
|
||||
$fieldname = $field;
|
||||
if ($fieldname === 'lang') {
|
||||
$fieldname = get_string('language');
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} else {
|
||||
$fieldname = get_string($fieldname);
|
||||
}
|
||||
|
||||
echo '<tr valign="top"><td align="right">';
|
||||
echo $fieldname;
|
||||
echo '</td><td>';
|
||||
|
||||
if ($retrieveopts) {
|
||||
$varname = 'field_map_' . $field;
|
||||
|
||||
echo "<input name=\"pluginconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\">";
|
||||
echo '<div align="right">';
|
||||
echo get_string('auth_updatelocal', 'auth') . ' ';
|
||||
choose_from_menu($updatelocaloptions, "pluginconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
|
||||
echo '<br />';
|
||||
if ($updateopts) {
|
||||
echo get_string('auth_updateremote', 'auth') . ' ';
|
||||
' ';
|
||||
choose_from_menu($updateextoptions, "pluginconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, "");
|
||||
echo '<br />';
|
||||
|
||||
|
||||
}
|
||||
echo get_string('auth_fieldlock', 'auth') . ' ';
|
||||
choose_from_menu($lockoptions, "pluginconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
|
||||
echo '</div>';
|
||||
} else {
|
||||
choose_from_menu($lockoptions, "pluginconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
|
||||
}
|
||||
echo '</td>';
|
||||
if (!empty($helptext)) {
|
||||
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
|
||||
$helptext = '';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Edit configuration for an individual auth plugin
|
||||
*/
|
||||
|
||||
require_once '../config.php';
|
||||
require_once $CFG->libdir.'/adminlib.php';
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('userauthentication', $adminroot);
|
||||
$auth = required_param('auth', PARAM_SAFEDIR);
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$err = array();
|
||||
|
||||
// save configuration changes
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$frm = stripslashes_recursive($frm);
|
||||
|
||||
$authplugin->validate_form($frm, $err);
|
||||
|
||||
if (count($err) == 0) {
|
||||
|
||||
// save plugin config
|
||||
if ($authplugin->process_config($frm)) {
|
||||
|
||||
// save field lock configuration
|
||||
foreach ($frm as $name => $value) {
|
||||
if (preg_match('/^lockconfig_(.+?)$/', $name, $matches)) {
|
||||
$plugin = "auth/$auth";
|
||||
$name = $matches[1];
|
||||
if (!set_config($name, $value, $plugin)) {
|
||||
error("Problem saving config $name as $value for plugin $plugin");
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect("auth.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
foreach ($err as $key => $value) {
|
||||
$focus = "form.$key";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$frm = get_config("auth/$auth");
|
||||
}
|
||||
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "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);
|
||||
|
||||
// output configuration form
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
// choose an authentication method
|
||||
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
|
||||
echo "<div>\n";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />\n";
|
||||
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_simple_box_end();
|
||||
echo "<hr />\n";
|
||||
$authplugin->config_form($frm, $err, $user_fields);
|
||||
print_simple_box_end();
|
||||
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Good enough for most auth plugins
|
||||
// but some may want a custom one if they are offering
|
||||
// other options
|
||||
// Note: lockconfig_ fields have special handling.
|
||||
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
|
||||
|
||||
echo '<tr><td colspan="3">';
|
||||
if ($retrieveopts) {
|
||||
print_heading(get_string('auth_data_mapping', 'auth'));
|
||||
} else {
|
||||
print_heading(get_string('auth_fieldlocks', 'auth'));
|
||||
}
|
||||
echo '</td></tr>';
|
||||
|
||||
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
|
||||
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
|
||||
'locked' => get_string('locked', 'auth'));
|
||||
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
|
||||
'onlogin' => get_string('update_onlogin', 'auth'));
|
||||
$updateextoptions = array('0' => get_string('update_never', 'auth'),
|
||||
'1' => get_string('update_onupdate', 'auth'));
|
||||
|
||||
$pluginconfig = get_config("auth/$auth");
|
||||
|
||||
// helptext is on a field with rowspan
|
||||
if (empty($helptext)) {
|
||||
$helptext = ' ';
|
||||
}
|
||||
|
||||
foreach ($user_fields as $field) {
|
||||
|
||||
// Define some vars we'll work with
|
||||
if (!isset($pluginconfig->{"field_map_$field"})) {
|
||||
$pluginconfig->{"field_map_$field"} = '';
|
||||
}
|
||||
if (!isset($pluginconfig->{"field_updatelocal_$field"})) {
|
||||
$pluginconfig->{"field_updatelocal_$field"} = '';
|
||||
}
|
||||
if (!isset($pluginconfig->{"field_updateremote_$field"})) {
|
||||
$pluginconfig->{"field_updateremote_$field"} = '';
|
||||
}
|
||||
if (!isset($pluginconfig->{"field_lock_$field"})) {
|
||||
$pluginconfig->{"field_lock_$field"} = '';
|
||||
}
|
||||
|
||||
// define the fieldname we display to the user
|
||||
$fieldname = $field;
|
||||
if ($fieldname === 'lang') {
|
||||
$fieldname = get_string('language');
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} else {
|
||||
$fieldname = get_string($fieldname);
|
||||
}
|
||||
|
||||
if ($retrieveopts) {
|
||||
$varname = 'field_map_' . $field;
|
||||
|
||||
echo '<tr valign="top"><td align="right">';
|
||||
echo '<label for="lockconfig_'.$varname.'">'.$fieldname.'</label>';
|
||||
echo '</td><td>';
|
||||
|
||||
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
|
||||
echo '<div style="text-align: right">';
|
||||
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label> ';
|
||||
choose_from_menu($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
|
||||
echo '<br />';
|
||||
if ($updateopts) {
|
||||
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label> ';
|
||||
choose_from_menu($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, "");
|
||||
echo '<br />';
|
||||
|
||||
|
||||
}
|
||||
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label> ';
|
||||
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<tr valign="top"><td align="right">';
|
||||
echo '<label for="menulockconfig_field_lock_'.$field.'">'.$fieldname.'</label>';
|
||||
echo '</td><td>';
|
||||
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
|
||||
}
|
||||
echo '</td>';
|
||||
if (!empty($helptext)) {
|
||||
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
|
||||
$helptext = '';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+1
-1
@@ -59,7 +59,7 @@
|
||||
|
||||
print_heading($strblockname);
|
||||
|
||||
print_simple_box(get_string('configwarning', 'admin'), 'center', '50%');
|
||||
print_simple_box('<center>'.get_string('configwarning', 'admin').'</center>', 'center', '50%');
|
||||
echo '<br />';
|
||||
|
||||
echo '<form method="post" action="block.php">';
|
||||
|
||||
+11
-14
@@ -17,6 +17,7 @@
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$multiple = optional_param('multiple', 0, PARAM_INT);
|
||||
|
||||
|
||||
/// Print headings
|
||||
|
||||
$strmanageblocks = get_string('manageblocks');
|
||||
@@ -28,7 +29,6 @@
|
||||
$strcourses = get_string('blockinstances', 'admin');
|
||||
$strname = get_string('name');
|
||||
$strmultiple = get_string('blockmultiple', 'admin');
|
||||
$strshowblockcourse = get_string('showblockcourse');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
@@ -165,8 +165,11 @@
|
||||
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'multiple', 'delete', 'settings'));
|
||||
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings));
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
|
||||
|
||||
$table->set_attribute('cellspacing', '0');
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->set_attribute('class', 'generaltable generalbox');
|
||||
|
||||
$table->setup();
|
||||
|
||||
foreach ($blockbyname as $blockname => $blockid) {
|
||||
@@ -181,21 +184,14 @@
|
||||
}
|
||||
|
||||
$count = count_records('block_instance', 'blockid', $blockid);
|
||||
if ($count>0) {
|
||||
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
}
|
||||
else {
|
||||
$blocklist = "$count";
|
||||
}
|
||||
$class = ''; // Nothing fancy, by default
|
||||
|
||||
if ($blocks[$blockid]->visible) {
|
||||
$visible = '<a href="blocks.php?hide='.$blockid.'&sesskey='.$USER->sesskey.'" title="'.$strhide.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon" alt="'.$strhide.'" /></a>';
|
||||
'<img src="'.$CFG->pixpath.'/i/hide.gif" height="16" width="16" alt="" /></a>';
|
||||
} else {
|
||||
$visible = '<a href="blocks.php?show='.$blockid.'&sesskey='.$USER->sesskey.'" title="'.$strshow.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/show.gif" class="icon" alt="'.$strshow.'" /></a>';
|
||||
'<img src="'.$CFG->pixpath.'/i/show.gif" height="16" width="16" alt="" /></a>';
|
||||
$class = ' class="dimmed_text"'; // Leading space required!
|
||||
}
|
||||
if ($blockobject->instance_allow_multiple()) {
|
||||
@@ -212,8 +208,8 @@
|
||||
|
||||
$table->add_data(array(
|
||||
'<span'.$class.'>'.$blockobject->get_title().'</span>',
|
||||
$blocklist,
|
||||
'<span'.$class.'>'.$blockobject->get_version().'</span>',
|
||||
$count,
|
||||
$blockobject->get_version(),
|
||||
$visible,
|
||||
$multiple,
|
||||
$delete,
|
||||
@@ -232,8 +228,9 @@
|
||||
$table->define_headers(array($strname, $strdelete));
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
|
||||
|
||||
$table->set_attribute('cellspacing', '0');
|
||||
$table->set_attribute('id', 'incompatible');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->set_attribute('class', 'generaltable generalbox');
|
||||
|
||||
$table->setup();
|
||||
|
||||
|
||||
+28
-56
@@ -17,11 +17,7 @@
|
||||
/// from the command line.
|
||||
|
||||
define('FULLME', 'cron');
|
||||
|
||||
|
||||
/// Do not set moodle cookie because we do not need it here, it is better to emulate session
|
||||
$nomoodlecookie = true;
|
||||
|
||||
|
||||
/// The current directory in PHP version 4.3.0 and above isn't necessarily the
|
||||
/// directory of the script when run from the command line. The require_once()
|
||||
/// would fail, so we'll have to chdir()
|
||||
@@ -33,51 +29,39 @@
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
/// extra safety
|
||||
@session_write_close();
|
||||
|
||||
/// check if execution allowed
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) { // if the script is accessed via the web.
|
||||
if (!empty($CFG->cronclionly)) {
|
||||
// This script can only be run via the cli.
|
||||
print_error('cronerrorclionly', 'admin');
|
||||
exit;
|
||||
}
|
||||
// This script is being called via the web, so check the password if there is one.
|
||||
if (!empty($CFG->cronremotepassword)) {
|
||||
$pass = optional_param('password', '', PARAM_RAW);
|
||||
if($pass != $CFG->cronremotepassword) {
|
||||
// wrong password.
|
||||
print_error('cronerrorpassword', 'admin');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if (!$alreadyadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
unset($_SESSION['USER']);
|
||||
unset($USER);
|
||||
unset($_SESSION['SESSION']);
|
||||
unset($SESSION);
|
||||
$USER = get_admin(); /// Temporarily, to provide environment for this script
|
||||
// we need to override the admin timezone to the moodle timezone!
|
||||
$USER->timezone = $CFG->timezone;
|
||||
}
|
||||
|
||||
//unset test cookie, user must login again anyway
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
|
||||
|
||||
/// emulate normal session
|
||||
$SESSION = new object();
|
||||
$USER = get_admin(); /// Temporarily, to provide environment for this script
|
||||
|
||||
/// ignore admins timezone, language and locale - use site deafult instead!
|
||||
$USER->timezone = $CFG->timezone;
|
||||
/// switch to site language and locale
|
||||
if (!empty($CFG->courselang)) {
|
||||
unset ($CFG->courselang);
|
||||
}
|
||||
if (!empty($SESSION->lang)) {
|
||||
unset ($SESSION->lang);
|
||||
}
|
||||
$USER->lang = '';
|
||||
$USER->theme = '';
|
||||
course_setup(SITEID);
|
||||
moodle_setlocale();
|
||||
|
||||
/// send mime type and encoding
|
||||
if (check_browser_version('MSIE')) {
|
||||
//ugly IE hack to work around downloading instead of viewing
|
||||
@header('Content-Type: text/html; charset=utf-8');
|
||||
@header('Content-Type: text/html; charset='.current_charset());
|
||||
echo "<xmp>"; //<pre> is not good enough for us here
|
||||
} else {
|
||||
//send proper plaintext header
|
||||
@header('Content-Type: text/plain; charset=utf-8');
|
||||
@header('Content-Type: text/plain; charset='.current_charset());
|
||||
}
|
||||
|
||||
/// no more headers and buffers
|
||||
while(@ob_end_flush());
|
||||
|
||||
/// increase memory limit (PHP 5.2 does different calculation, we need more memory now)
|
||||
@raise_memory_limit('128M');
|
||||
|
||||
@@ -103,6 +87,8 @@
|
||||
mtrace("Error: could not update timestamp for $mod->fullname");
|
||||
}
|
||||
}
|
||||
/// Reset possible changes by modules to time_limit. MDL-11597
|
||||
@set_time_limit(0);
|
||||
mtrace("done.");
|
||||
}
|
||||
}
|
||||
@@ -127,6 +113,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.');
|
||||
}
|
||||
}
|
||||
@@ -137,7 +125,7 @@
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages(true);
|
||||
get_list_of_languages();
|
||||
}
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
@@ -173,7 +161,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("Deleted student enrolment for user $assign->id from course $assign->courseid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,26 +308,10 @@
|
||||
unset($enrol);
|
||||
}
|
||||
|
||||
/// Run the auth cron, if any
|
||||
$auths = get_enabled_auth_plugins();
|
||||
|
||||
mtrace("Running auth crons if required...");
|
||||
foreach ($auths as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
if (method_exists($authplugin, 'cron')) {
|
||||
mtrace("Running cron for auth/$auth...");
|
||||
$authplugin->cron();
|
||||
if (!empty($authplugin->log)) {
|
||||
mtrace($authplugin->log);
|
||||
}
|
||||
}
|
||||
unset($authplugin);
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
if (!empty($topframe)) {
|
||||
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
|
||||
"<a $CFG->frametarget href=\"index.php\">$stradministration</a> -> Database performance");
|
||||
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> Database performance");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
+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') {
|
||||
|
||||
+4
-7
@@ -52,9 +52,8 @@
|
||||
|
||||
print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
|
||||
|
||||
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
|
||||
echo "<div>";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
|
||||
|
||||
$table = new stdClass();
|
||||
$table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings);
|
||||
@@ -64,7 +63,6 @@
|
||||
$table->data = array();
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
|
||||
foreach ($modules as $module) {
|
||||
|
||||
// skip if directory is empty
|
||||
@@ -75,7 +73,7 @@
|
||||
$name = get_string("enrolname", "enrol_$module");
|
||||
$plugin = enrolment_factory::factory($module);
|
||||
$enable = '<input type="checkbox" name="enable[]" value="'.$module.'"';
|
||||
if (in_array($module, $enabledplugins)) {
|
||||
if (stristr($CFG->enrol_plugins_enabled, $module) !== false) {
|
||||
$enable .= ' checked="checked"';
|
||||
}
|
||||
if ($module == 'manual') {
|
||||
@@ -98,8 +96,7 @@
|
||||
|
||||
print_table($table);
|
||||
|
||||
echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></div>\n";
|
||||
echo "</div>";
|
||||
echo "<center><input type=\"submit\" value=\"".get_string("savechanges")."\"></center>\n";
|
||||
echo "</form>";
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
+14
-7
@@ -44,10 +44,17 @@
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
|
||||
echo "<div>";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
|
||||
echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
|
||||
echo "<div align=\"center\"><p><b>";
|
||||
|
||||
|
||||
/// Choose an enrolment method
|
||||
echo get_string('chooseenrolmethod').': ';
|
||||
choose_from_menu ($options, "enrol", $enrol, "",
|
||||
"document.location='enrol_config.php?enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
|
||||
|
||||
echo "</b></p></div>";
|
||||
|
||||
/// Print current enrolment type description
|
||||
print_simple_box_start("center", "80%");
|
||||
@@ -61,11 +68,11 @@
|
||||
|
||||
$enrolment->config_form($frm);
|
||||
|
||||
echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
|
||||
print_simple_box_end();
|
||||
echo "</div>";
|
||||
echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
|
||||
echo "</form>";
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
exit;
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
/// Start of main box
|
||||
print_simple_box_start('center');
|
||||
|
||||
echo "<div style=\"text-align:center\">".$stradminhelpenvironment."</div><br />";
|
||||
echo "<center>".$stradminhelpenvironment."</center><br />";
|
||||
|
||||
/// Get current Moodle version
|
||||
$current_version = $CFG->release;
|
||||
@@ -121,11 +121,11 @@
|
||||
}
|
||||
|
||||
/// Print form and popup menu
|
||||
echo '<div style="text-align:center">'.$strmoodleversion.' ';
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/environment.php?version=",
|
||||
$versions, 'selectversion', $version, '');
|
||||
echo '</div>';
|
||||
|
||||
echo '<center><form method="post" action="environment.php">';
|
||||
echo $strmoodleversion.' ';
|
||||
choose_from_menu ($versions, 'version', $version, null, 'this.form.submit();' );
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '</form></center>';
|
||||
/// End of main box
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
+60
-6
@@ -102,19 +102,73 @@
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="optional">
|
||||
</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_CHECK message="curlrecommended" />
|
||||
<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="openssl" level="optional">
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.0" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.2.4" 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_EXTENSIONS>
|
||||
|
||||
+3
-3
@@ -74,21 +74,21 @@
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading( $filtername );
|
||||
|
||||
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
|
||||
print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center",'');
|
||||
|
||||
?>
|
||||
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
|
||||
<div style="text-align: center">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
|
||||
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
|
||||
|
||||
<center>
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
|
||||
</div>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
+13
-8
@@ -182,10 +182,15 @@
|
||||
// construct the flexible table ready to display
|
||||
$table = new flexible_table(FILTER_TABLE);
|
||||
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
|
||||
$table->column_style('hideshow', 'text-align', 'center');
|
||||
$table->column_style('order', 'text-align', 'center');
|
||||
$table->column_style('settings', 'text-align', 'center');
|
||||
$table->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
$table->set_attribute('id', 'filters');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'flexible generaltable generalbox');
|
||||
$table->set_attribute('style', 'margin:auto;');
|
||||
$table->set_attribute('cellpadding', '5');
|
||||
$table->setup();
|
||||
|
||||
// iterate through filters adding to display table
|
||||
@@ -196,13 +201,13 @@
|
||||
// get hide/show link
|
||||
if (in_array($path, $activefilters)) {
|
||||
$hideshow = "<a href=\"$myurl&action=hide&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"$txt->hide\" /></a>";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" height=\"16\" width=\"16\" alt=\"hide\" /></a>";
|
||||
$hidden = false;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$myurl&action=show&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"$txt->show\" /></a>";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" height=\"16\" width=\"16\" alt=\"show\" /></a>";
|
||||
$hidden = true;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
@@ -212,17 +217,17 @@
|
||||
if (!$hidden) {
|
||||
if ($updowncount>1) {
|
||||
$updown .= "<a href=\"$myurl&action=up&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/up.gif\" alt=\"$txt->up\" /></a> ";
|
||||
$updown .= "<img src=\"$img/up.gif\" alt=\"up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount<$activefilterscount) {
|
||||
$updown .= "<a href=\"$myurl&action=down&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/down.gif\" alt=\"$txt->down\" /></a>";
|
||||
$updown .= "<img src=\"$img/down.gif\" alt=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" alt=\"\" />";
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" />";
|
||||
}
|
||||
++$updowncount;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ while(!feof($fd)) {
|
||||
|
||||
$user = get_record("user","id",$log->userid);
|
||||
$course = get_record("course","id",$log->course);
|
||||
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
|
||||
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
|
||||
$a->date = userdate($log->time);
|
||||
|
||||
$a->action = $action;
|
||||
@@ -78,7 +78,7 @@ function notify_admins_unknown($file,$a) {
|
||||
global $site;
|
||||
|
||||
$admins = get_admins();
|
||||
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
|
||||
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
|
||||
$body = get_string('virusfoundlateradminnolog','moodle',$a);
|
||||
foreach ($admins as $admin) {
|
||||
email_to_user($admin,$admin,$subject,$body);
|
||||
|
||||
+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() {
|
||||
|
||||
+76
-123
@@ -28,8 +28,7 @@
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
||||
$agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
|
||||
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
|
||||
|
||||
/// check upgrade status first
|
||||
@@ -38,11 +37,6 @@
|
||||
}
|
||||
upgrade_check_running("Upgrade already running in this session, please wait!<br />Click on the exclamation marks to ignore this warning (<a href=\"index.php?ignoreupgradewarning=1\">!!!</a>).", 10);
|
||||
|
||||
/// set install/upgrade autocontinue session flag
|
||||
if ($autopilot) {
|
||||
$_SESSION['installautopilot'] = $autopilot;
|
||||
}
|
||||
|
||||
/// Check some PHP server settings
|
||||
|
||||
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
||||
@@ -59,11 +53,11 @@
|
||||
error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
|
||||
}
|
||||
|
||||
if (empty($CFG->prefix) && $CFG->dbfamily != 'mysql') { //Enforce prefixes for everybody but mysql
|
||||
if (empty($CFG->prefix) && $CFG->dbtype != 'mysql') { //Enforce prefixes for everybody but mysql
|
||||
error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
|
||||
}
|
||||
|
||||
if ($CFG->dbfamily == 'oracle' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
|
||||
if ($CFG->dbtype == 'oci8po' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
|
||||
error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
|
||||
}
|
||||
|
||||
@@ -97,14 +91,6 @@
|
||||
$CFG->version = "";
|
||||
}
|
||||
|
||||
if (is_readable("$CFG->dirroot/version.php")) {
|
||||
include_once("$CFG->dirroot/version.php"); # defines $version
|
||||
}
|
||||
|
||||
if (!$version or !$release) {
|
||||
error('Main version.php was not readable or specified');# without version, stop
|
||||
}
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
|
||||
if (! $tables = $db->Metatables() ) { // No tables yet at all.
|
||||
@@ -122,43 +108,31 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$linktoscrolltoerrors = '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>';
|
||||
if (! $maintables) {
|
||||
/// hide errors from headers in case debug enabled in config.php
|
||||
$origdebug = $CFG->debug;
|
||||
$CFG->debug = DEBUG_MINIMAL;
|
||||
error_reporting($CFG->debug);
|
||||
if (empty($agreelicense)) {
|
||||
$strlicense = get_string('license');
|
||||
if (empty($agreelicence)) {
|
||||
$strlicense = get_string("license");
|
||||
print_header($strlicense, $strlicense, $strlicense, "", "", false, " ", " ");
|
||||
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
|
||||
print_heading(get_string('copyrightnotice'));
|
||||
print_box(text_to_html(get_string('gpl')), 'copyrightnotice');
|
||||
print_heading(get_string("copyrightnotice"));
|
||||
print_simple_box_start('center');
|
||||
echo text_to_html(get_string("gpl"));
|
||||
print_simple_box_end();
|
||||
echo "<br />";
|
||||
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1",
|
||||
notice_yesno(get_string("doyouagree"), "index.php?agreelicence=true",
|
||||
"http://docs.moodle.org/en/License");
|
||||
print_footer('none');
|
||||
exit;
|
||||
}
|
||||
if (empty($confirmrelease)) {
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="agreelicense" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
|
||||
$strdatabasesetup = get_string("databasesetup");
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup,
|
||||
"", upgrade_get_javascript(), false, " ", " ");
|
||||
"", $linktoscrolltoerrors, false, " ", " ");
|
||||
/// return to original debugging level
|
||||
$CFG->debug = $origdebug;
|
||||
error_reporting($CFG->debug);
|
||||
@@ -169,11 +143,6 @@
|
||||
/// But we prioritise install.xml (XMLDB) if present
|
||||
|
||||
change_db_encoding(); // first try to change db encoding to utf8
|
||||
if (!setup_is_unicodedb()) {
|
||||
// If could not convert successfully, throw error, and prevent installation
|
||||
print_error('unicoderequired', 'admin');
|
||||
}
|
||||
|
||||
$status = false;
|
||||
if (file_exists("$CFG->libdir/db/install.xml")) {
|
||||
$status = install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
||||
@@ -183,21 +152,13 @@
|
||||
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.");
|
||||
}
|
||||
|
||||
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
|
||||
set_config('unicodedb', 1);
|
||||
|
||||
/// Continue with the instalation
|
||||
$db->debug = false;
|
||||
if ($status) {
|
||||
//ugly hack - install new groups: MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('statsrolesupgraded',time());
|
||||
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
$adminroot = admin_get_root();
|
||||
@@ -213,19 +174,15 @@
|
||||
'enrol' => 'manual',
|
||||
'enrol_plugins_enabled' => 'manual',
|
||||
'guestloginbutton' => 1,
|
||||
'registerauth' => 'email',
|
||||
'style' => 'default',
|
||||
'template' => 'default',
|
||||
'theme' => 'standardwhite',
|
||||
'filter_multilang_converted' => 1));
|
||||
'theme' => 'standardwhite'));
|
||||
|
||||
notify($strdatabasesuccess, "green");
|
||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||
} else {
|
||||
error("Error: Main databases NOT set up successfully");
|
||||
}
|
||||
print_continue('index.php');
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -233,6 +190,13 @@
|
||||
/// Check version of Moodle code on disk compared with database
|
||||
/// and upgrade if possible.
|
||||
|
||||
if ( is_readable("$CFG->dirroot/version.php")) {
|
||||
include_once("$CFG->dirroot/version.php"); # defines $version
|
||||
}
|
||||
if (!$version) {
|
||||
error('Main version.php was not readable or specified');# without version, stop
|
||||
}
|
||||
|
||||
if (file_exists("$CFG->dirroot/lib/db/$CFG->dbtype.php")) {
|
||||
include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines old upgrades
|
||||
}
|
||||
@@ -245,12 +209,6 @@
|
||||
if ($CFG->version) {
|
||||
if ($version > $CFG->version) { // upgrade
|
||||
|
||||
/// If the database is not already Unicode then we do not allow upgrading!
|
||||
/// Instead, we print an error telling them to upgrade to 1.7 first. MDL-6857
|
||||
if (empty($CFG->unicodedb)) {
|
||||
print_error('unicodeupgradeerror', 'error', '', $version);
|
||||
}
|
||||
|
||||
$a->oldversion = "$CFG->release ($CFG->version)";
|
||||
$a->newversion = "$release ($version)";
|
||||
$strdatabasechecking = get_string("databasechecking", "", $a);
|
||||
@@ -266,17 +224,18 @@
|
||||
}
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
|
||||
exit;
|
||||
|
||||
} else if (empty($confirmrelease)){
|
||||
} else if (empty($confirmrelease)) {
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
|
||||
print_simple_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'center');
|
||||
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
@@ -286,21 +245,20 @@
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<form action="index.php">';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '<div class="continuebutton"><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
print_footer('none');
|
||||
die;
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", upgrade_get_javascript(), false, " ", " ");
|
||||
"", $linktoscrolltoerrors, false, " ", " ");
|
||||
|
||||
/// return to original debugging level
|
||||
$CFG->debug = $origdebug;
|
||||
@@ -325,9 +283,6 @@
|
||||
/// 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();
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
@@ -342,17 +297,13 @@
|
||||
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
||||
notify($strdatabasesuccess, "green");
|
||||
print_continue("upgradesettings.php");
|
||||
print_footer('none');
|
||||
exit;
|
||||
} else {
|
||||
error('Upgrade failed! (Could not update version in config table)');
|
||||
notify("Upgrade failed! (Could not update version in config table)");
|
||||
}
|
||||
/// Main upgrade not success
|
||||
} else {
|
||||
notify('Main Upgrade failed! See lib/db/upgrade.php');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
print_footer('none');
|
||||
die;
|
||||
notify("Upgrade failed! See /version.php");
|
||||
}
|
||||
upgrade_log_finish();
|
||||
}
|
||||
@@ -375,11 +326,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// ugly hack - convert to new groups if upgrading from 1.7; must be reworked
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
upgrade_group_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
@@ -407,24 +353,14 @@
|
||||
/// 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 course formats and upgrade if necessary
|
||||
upgrade_plugins('format','course/format',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check for local database customisations
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
require_once("$CFG->dirroot/lib/locallib.php");
|
||||
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');
|
||||
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
/// just make sure upgrade logging is properly terminated
|
||||
upgrade_log_finish();
|
||||
|
||||
unset($_SESSION['installautopilot']);
|
||||
|
||||
/// Set up the blank site - to be customized later at the end of install.
|
||||
if (! $site = get_site()) {
|
||||
// We are about to create the site "course"
|
||||
@@ -488,7 +424,18 @@
|
||||
|
||||
/// Check if the guest user exists. If not, create one.
|
||||
if (! record_exists("user", "username", "guest")) {
|
||||
if (! $guest = create_guest_record()) {
|
||||
$guest->auth = "manual";
|
||||
$guest->username = "guest";
|
||||
$guest->password = md5("guest");
|
||||
$guest->firstname = addslashes(get_string("guestuser"));
|
||||
$guest->lastname = " ";
|
||||
$guest->email = "root@localhost";
|
||||
$guest->description = addslashes(get_string("guestuserinfo"));
|
||||
$guest->confirmed = 1;
|
||||
$guest->lang = $CFG->lang;
|
||||
$guest->timemodified= time();
|
||||
|
||||
if (! $guest->id = insert_record("user", $guest)) {
|
||||
notify("Could not create guest user record !!!");
|
||||
}
|
||||
}
|
||||
@@ -496,7 +443,7 @@
|
||||
|
||||
/// Set up the admin user
|
||||
if (empty($CFG->rolesactive)) {
|
||||
create_admin_user();
|
||||
redirect('user.php');
|
||||
}
|
||||
|
||||
/// Check for valid admin user
|
||||
@@ -508,7 +455,7 @@
|
||||
|
||||
/// check that site is properly customized
|
||||
if (empty($site->shortname) or empty($site->shortname)) {
|
||||
redirect('settings.php?section=frontpagesettings&return=site');
|
||||
redirect('settings.php?section=frontpage&return=site');
|
||||
}
|
||||
|
||||
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
||||
@@ -529,20 +476,31 @@
|
||||
|
||||
/// Deprecated database! Warning!!
|
||||
if (!empty($CFG->migrated_to_new_db)) {
|
||||
print_box(print_string('dbmigrationdeprecateddb', 'admin'), 'generalbox adminwarning');
|
||||
print_simple_box_start('center','60%');
|
||||
print_string('dbmigrationdeprecateddb','admin');
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
/// Check for any special upgrades that might need to be run
|
||||
if (!empty($CFG->upgrade)) {
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
|
||||
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center", '60%');
|
||||
print_spacer(10,10);
|
||||
}
|
||||
|
||||
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_simple_box(get_string('globalswarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
print_simple_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'center', '60%');
|
||||
}
|
||||
|
||||
if (substr($CFG->wwwroot, -1) == '/') {
|
||||
print_simple_box(get_string('cfgwwwrootslashwarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
||||
print_simple_box(get_string('cfgwwwrootwarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
@@ -550,19 +508,18 @@
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
$strinstallation = get_string('installation', 'install');
|
||||
$helpbutton = helpbutton('install', $strinstallation, 'moodle', true, false, '', true);
|
||||
print_box(get_string('cronwarning', 'admin')." ".$helpbutton, 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// Print multilang upgrade notice if needed
|
||||
if (empty($CFG->filter_multilang_converted)) {
|
||||
print_box(get_string('multilangupgradenotice', 'admin'), 'generalbox adminwarning');
|
||||
print_simple_box(get_string('cronwarning', 'admin')." ".$helpbutton, 'center', '60%');
|
||||
}
|
||||
|
||||
/// Alert if we are currently in maintenance mode
|
||||
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
|
||||
print_box(get_string('sitemaintenancewarning', 'admin'), 'generalbox adminwarning');
|
||||
print_simple_box(get_string('sitemaintenancewarning', 'admin') , 'center', '60%');
|
||||
}
|
||||
|
||||
/// Alert to display the utf-8 migration button (if !unicode yet and DB is MySQL or PG)
|
||||
if (empty($CFG->unicodedb) && in_array($CFG->dbtype, array('mysql', 'postgres7'))) {
|
||||
print_simple_box(get_string('unicodeupgradenotice', 'admin') , 'center', '60%');
|
||||
}
|
||||
|
||||
/// Print slightly annoying registration button every six months ;-)
|
||||
/// You can set the "registered" variable to something far in the future
|
||||
@@ -570,10 +527,12 @@
|
||||
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_box_start('generalbox adminwarning');
|
||||
print_simple_box_start('center','60%');
|
||||
echo '<div align="center">';
|
||||
print_string('pleaseregister', 'admin');
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
print_box_end();
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
$registrationbuttonshown = true;
|
||||
}
|
||||
|
||||
@@ -584,26 +543,20 @@
|
||||
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
||||
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
||||
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
||||
print_box($copyrighttext, 'copyright');
|
||||
echo '<p class="copyright">'.$copyrighttext.'</p>';
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if (empty($registrationbuttonshown)) {
|
||||
echo '<div align="center">';
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
if (optional_param('dbmigrate')) { // ??? Is this actually used?
|
||||
print_box_start();
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/utfdbmigrate.php');
|
||||
db_migrate2utf8();
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
|
||||
|
||||
if ($CFG->dbfamily != 'mysql') {
|
||||
if ($CFG->dbtype != 'mysql') {
|
||||
notice('This function is for MySQL databases only!', 'index.php');
|
||||
}
|
||||
|
||||
|
||||
+123
-214
@@ -1,6 +1,38 @@
|
||||
<?PHP // $Id$
|
||||
/**
|
||||
* Display the admin/language menu and process strings translation.
|
||||
*
|
||||
* CHANGES
|
||||
*
|
||||
* 2006/11/07 mudrd8mz
|
||||
* Fixed bug MDL-7361. Thanks to Dan Poltawski for the patch proposal.
|
||||
*
|
||||
* 2006/06/08 mudrd8mz
|
||||
* 1) Fixed bug 5745 reported by Harry Smith so now can edit en_utf8_local pack
|
||||
* 2) More notification messages included
|
||||
*
|
||||
* 2006/05/30 mudrd8mz
|
||||
* Merged with version by Mitsuhiro Yoshida - display icon links instead of text links
|
||||
* (I have changed the position of arrow icons to not to be so close each other)
|
||||
*
|
||||
* 2006/05/19 mudrd8mz
|
||||
* A lot of changes to support translation of *_utf8_local langugage packs. Needs testing
|
||||
*
|
||||
* 2006/05/16 mudrd8mz
|
||||
* 1) LANG_DEFAULT_FILE can be now set. moodle.php used to be opened automatically.
|
||||
* As it was (and still is) one of the biggest files it usually took a long time to load the page
|
||||
* even if you just want to choose the file to translate.
|
||||
* 2) added links from "missing" to "compare" mode page
|
||||
* 3) english strings are now key-sorted in "missing" mode
|
||||
* 4) list of files with missing strings is now displayed at the top of "missing" page
|
||||
*
|
||||
* 2006/05/14 mudrd8mz Improvements of lang.php,v 1.65 2006/04/10 22:15:57 stronk7 Exp
|
||||
* 1) "go to first missing string" link can be displayed (see LANG_DISPLAY_MISSING_LINKS)
|
||||
* 2) "go to next missing" link can be displayed (see LANG_DISPLAY_MISSING_LINKS)
|
||||
* 3) submit button may be repeated (see LANG_SUBMIT_REPEAT*)
|
||||
* 4) added (empty) "summary" attribute for the <table>'s
|
||||
* 5) added error_reporting(E_ALL ^ E_NOTICE); in "compare" mode (even in debug environment
|
||||
* we know that missing keys are missing strings here, not bugs ;-)
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
@@ -14,8 +46,6 @@
|
||||
define('LANG_DEFAULT_FILE', ''); // default file to translate. Empty allowed
|
||||
define('LANG_LINK_MISSING_STRINGS', 1); // create links from "missing" page to "compare" page?
|
||||
define('LANG_DEFAULT_USELOCAL', 0); // should *_utf8_local be used by default?
|
||||
define('LANG_MISSING_TEXT_MAX_LEN', 60); // maximum length of the missing text to display
|
||||
define('LANG_KEEP_ORPHANS', 1); // keep orphaned strings (i.e. strings w/o English reference)
|
||||
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
$currentfile = optional_param('currentfile', LANG_DEFAULT_FILE, PARAM_FILE);
|
||||
@@ -37,37 +67,42 @@
|
||||
$streditstrings = get_string("editstrings", 'admin');
|
||||
$stredithelpdocs = get_string("edithelpdocs", 'admin');
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$strgotofirst = get_string('gotofirst','admin');
|
||||
$strfilestoredin = get_string('filestoredin', 'admin');
|
||||
$strfilestoredinhelp = get_string('filestoredinhelp', 'admin');
|
||||
$strswitchlang = get_string('switchlang', 'admin');
|
||||
$strchoosefiletoedit = get_string('choosefiletoedit', 'admin');
|
||||
$strgotofirst = get_string('gotofirstmissing','admin');
|
||||
$strfilestoredin = get_string('langstorein', 'admin');
|
||||
$strfilestoredinhelp = get_string('langstoreinhelp', 'admin');
|
||||
$strswitchlangdirbtn = get_string('langstoreswitch', 'admin');
|
||||
$strchoosefiletoedit = get_string('langchoosefile', 'admin');
|
||||
$streditennotallowed = get_string('langnoeditenglish', 'admin');
|
||||
$strfilecreated = get_string('filecreated', 'admin');
|
||||
$strprev = get_string('previous');
|
||||
$strnext = get_string('next');
|
||||
$strfilecreated = get_string('langfilecreated', 'admin');
|
||||
|
||||
// FIXME / TODO
|
||||
// remove following lines after adding string into proper english lang pack
|
||||
$strgotofirst = 'go to first missing string';
|
||||
$strfilestoredin = 'Save file into folder :';
|
||||
$strfilestoredinhelp = 'Where the file will be stored';
|
||||
$strswitchlangdirbtn = 'switch';
|
||||
$strchoosefiletoedit = 'Choose file to edit from the box above';
|
||||
$streditennotallowed = 'Language en_utf8 cannot be edited with this page - switch to local';
|
||||
$strfilecreated = 'New file created';
|
||||
|
||||
$currentlang = current_language();
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
case "missing":
|
||||
// Missing array keys are not bugs here but missing strings
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $strmissingstrings";
|
||||
$title = $strmissingstrings;
|
||||
$button = '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<div>'.
|
||||
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<input type="hidden" name="mode" value="compare" />'.
|
||||
'<input type="submit" value="'.$streditstrings.'" /></div></form>';
|
||||
'<input type="submit" value="'.$streditstrings.'" /></form>';
|
||||
break;
|
||||
case "compare":
|
||||
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $streditstrings";
|
||||
$title = $streditstrings;
|
||||
$button = '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<div>'.
|
||||
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<input type="hidden" name="mode" value="missing" />'.
|
||||
'<input type="submit" value="'.$strmissingstrings.'" /></div></form>';
|
||||
'<input type="submit" value="'.$strmissingstrings.'" /></form>';
|
||||
break;
|
||||
default:
|
||||
$title = $strlanguage;
|
||||
@@ -80,14 +115,21 @@
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (!$mode) {
|
||||
print_box_start();
|
||||
print_simple_box_start('center','80%');
|
||||
echo '<div align="center">';
|
||||
print_string('editlang','admin');
|
||||
echo '<br />';
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages(false, true);
|
||||
popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", false, 'self', $strcurrentlanguage.':');
|
||||
$langs = get_list_of_languages();
|
||||
echo "<b>$strcurrentlanguage:</b>";
|
||||
echo '<br />';
|
||||
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
$options["lang"] = $currentlang;
|
||||
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
|
||||
print_heading("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
|
||||
print_heading("<a href=\"langdoc.php\">$stredithelpdocs</a>");
|
||||
print_box_end();
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
}
|
||||
@@ -141,7 +183,7 @@
|
||||
} else {
|
||||
$fileismissing = 1;
|
||||
// notify(get_string("filemissing", "", "$langdir/$file"));
|
||||
$o .= '<div class="notifyproblem">'.get_string("filemissing", "", "$langdir/$file").'</div><br />';
|
||||
$o .= '<div class="notifyproblem" align="center">'.get_string("filemissing", "", "$langdir/$file").'</div><br />';
|
||||
$string = array();
|
||||
}
|
||||
|
||||
@@ -169,9 +211,6 @@
|
||||
$missinglinkstart = '';
|
||||
$missinglinkend = '';
|
||||
}
|
||||
if (strlen($value) > LANG_MISSING_TEXT_MAX_LEN) {
|
||||
$value = lang_xhtml_save_substr($value, 0, LANG_MISSING_TEXT_MAX_LEN) . ' ...'; // MDL-8852
|
||||
}
|
||||
$o .= "$"."string['".$missinglinkstart.$key.$missinglinkend."'] = \"$value\";<br />";
|
||||
}
|
||||
}
|
||||
@@ -181,7 +220,12 @@
|
||||
}
|
||||
|
||||
if ($m <> '') {
|
||||
print_box($m, 'filenames');
|
||||
echo '<br />';
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center><font size="2">';
|
||||
echo $m;
|
||||
echo '</font></center>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
echo $o;
|
||||
|
||||
@@ -211,7 +255,7 @@
|
||||
if (!empty($somethingfound)) {
|
||||
print_continue("lang.php");
|
||||
} else {
|
||||
notice(get_string("languagegood"), "lang.php", '', $adminroot);
|
||||
notice(get_string("languagegood"), "lang.php");
|
||||
}
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
@@ -220,7 +264,7 @@
|
||||
if (!lang_make_directory($langbase) ){
|
||||
error('ERROR: Could not create base lang directory ' . $langbase);
|
||||
} else {
|
||||
echo '<div class="notifysuccess">Created directory '.
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$langbase .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
@@ -228,17 +272,17 @@
|
||||
if (!lang_make_directory($langdir)) {
|
||||
error('ERROR: Could not create directory '.$langdir);
|
||||
} else {
|
||||
echo '<div class="notifysuccess">Created directory '.
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$langdir .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
if ($uselocal && !file_exists($locallangdir)) {
|
||||
if (!lang_make_directory($locallangdir)) {
|
||||
echo '<div class="notifyproblem">ERROR: Could not create directory '.
|
||||
echo '<div class="notifyproblem" align="center">ERROR: Could not create directory '.
|
||||
$locallangdir .'</div>'."<br />\n";
|
||||
$uselocal = 0;
|
||||
} else {
|
||||
echo '<div class="notifysuccess">Created directory '.
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$locallangdir .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
@@ -281,7 +325,8 @@
|
||||
|
||||
print_heading_with_help($streditstrings, "langedit");
|
||||
|
||||
print_box_start('generalbox editstrings');
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center><font size="2">';
|
||||
foreach ($stringfiles as $file) {
|
||||
if ($file == $currentfile) {
|
||||
echo "<b>$file</b> ";
|
||||
@@ -289,37 +334,37 @@
|
||||
echo "<a href=\"lang.php?mode=compare&currentfile=$file\">$file</a> ";
|
||||
}
|
||||
}
|
||||
print_box_end();
|
||||
echo '</font></center>';
|
||||
print_simple_box_end();
|
||||
|
||||
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>", "center", 4); // one-click way back
|
||||
|
||||
print_box_start();
|
||||
echo $strfilestoredin;
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center>'.$strfilestoredin.' <strong>';
|
||||
echo $uselocal ? "{$currentlang}_local" : $currentlang;
|
||||
echo '</strong> ';
|
||||
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
|
||||
|
||||
echo '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<div>'.
|
||||
echo '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<input type="hidden" name="mode" value="compare" />'.
|
||||
'<input type="hidden" name="currentfile" value="'.$currentfile.'" />'.
|
||||
'<input type="hidden" name="uselocal" value="'.(1 - $uselocal % 2).'" />'.
|
||||
'<input type="submit" value="'.$strswitchlang.'" />'.
|
||||
'</div></form>';
|
||||
print_box_end();
|
||||
'<input type="submit" value="'.$strswitchlangdirbtn.'" />'.
|
||||
'</form></center>';
|
||||
print_simple_box_end();
|
||||
|
||||
if ($currentfile <> '') {
|
||||
$saveto = $uselocal ? $locallangdir : $langdir;
|
||||
error_reporting(0);
|
||||
if (!file_exists("$saveto/$currentfile")) {
|
||||
if (!@touch("$saveto/$currentfile")) {
|
||||
print_heading(get_string("filemissing", "", "$saveto/$currentfile"), '', 4, 'error');
|
||||
print_heading(get_string("filemissing", "", "$saveto/$currentfile"), "center", 4, "error");
|
||||
} else {
|
||||
print_heading($strfilecreated, '', 4, 'notifysuccess');
|
||||
print_heading($strfilecreated, "center", 4, "notifysuccess");
|
||||
}
|
||||
}
|
||||
if ($currentlang == "en_utf8" && !$uselocal) {
|
||||
$editable = false;
|
||||
print_heading($streditennotallowed, '', 4);
|
||||
print_heading($streditennotallowed, 'center', 4);
|
||||
} elseif ($f = fopen("$saveto/$currentfile","r+")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
@@ -329,9 +374,9 @@
|
||||
}
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
print_heading("$currentfile", "", 4);
|
||||
print_heading("$currentfile", "center", 4);
|
||||
if (LANG_DISPLAY_MISSING_LINKS && $editable) {
|
||||
print_heading('<a href="#missing1">'.$strgotofirst.'</a>', "", 4);
|
||||
print_heading('<a href="#missing1">'.$strgotofirst.'</a>', "center", 4);
|
||||
}
|
||||
|
||||
unset($string);
|
||||
@@ -339,7 +384,7 @@
|
||||
$enstring = $string;
|
||||
if ($currentlang != 'en' and $currentfile == 'moodle.php') {
|
||||
$enstring['thislanguage'] = "<< TRANSLATORS: Specify the name of your language here. If possible use Unicode Numeric Character References >>";
|
||||
$enstring['thischarset'] = "<< TRANSLATORS: Charset encoding - always use utf-8 >>";
|
||||
$enstring['thischarset'] = "<< TRANSLATORS: Specify the character set of your language here. Note that all text created while this language is active will be stored using this character set, so don't change it once you have set it. Example: iso-8859-1 >>";
|
||||
$enstring['thisdirection'] = "<< TRANSLATORS: This string specifies the direction of your text, either left-to-right or right-to-left. Insert either 'ltr' or 'rtl' here. >>";
|
||||
$enstring['parentlanguage'] = "<< TRANSLATORS: If your language has a Parent Language that Moodle should use when strings are missing from your language pack, then specify the code for it here. If you leave this blank then English will be used. Example: nl >>";
|
||||
}
|
||||
@@ -354,16 +399,15 @@
|
||||
@include("$langdir/$currentfile");
|
||||
|
||||
if ($editable) {
|
||||
echo "<form id=\"$currentfile\" action=\"lang.php\" method=\"post\">";
|
||||
echo '<div>';
|
||||
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
|
||||
}
|
||||
echo "<table summary=\"\" width=\"100%\" class=\"translator\">";
|
||||
echo "<table summary=\"\" width=\"100%\" cellpadding=\"2\" cellspacing=\"3\" border=\"0\" class=\"generalbox\">";
|
||||
$linescounter = 0;
|
||||
$missingcounter = 0;
|
||||
foreach ($enstring as $key => $envalue) {
|
||||
$linescounter++ ;
|
||||
if (LANG_SUBMIT_REPEAT && $editable && $linescounter % LANG_SUBMIT_REPEAT_EVERY == 0) {
|
||||
echo '<tr><td> </td><td><br />';
|
||||
echo '<tr><td colspan="2"> <td><br />';
|
||||
echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
|
||||
echo '<br /> </td></tr>';
|
||||
}
|
||||
@@ -372,18 +416,9 @@
|
||||
$envalue = str_replace("%%","%",$envalue);
|
||||
$envalue = str_replace("\\","",$envalue); // Delete all slashes
|
||||
|
||||
echo "\n\n".'<tr class="';
|
||||
if ($linescounter % 2 == 0) {
|
||||
echo 'r0';
|
||||
} else {
|
||||
echo 'r1';
|
||||
}
|
||||
echo '">';
|
||||
echo '<td dir="ltr" lang="en">';
|
||||
echo '<span class="stren">'.$envalue.'</span>';
|
||||
echo '<br />'."\n";
|
||||
echo '<span class="strkey">'.$key.'</span>';
|
||||
echo '</td>'."\n";
|
||||
echo "\n\n".'<tr>';
|
||||
echo '<td dir="ltr" lang="en" width="20%" nowrap="nowrap" valign="top">'.$key.'</td>'."\n";
|
||||
echo '<td dir="ltr" lang="en" width="40%" valign="top">'.$envalue.'</td>'."\n";
|
||||
|
||||
// Missing array keys are not bugs here but missing strings
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
@@ -405,17 +440,17 @@
|
||||
// green #AAFFAA - translation present in both system and local but is different
|
||||
if (!$value) {
|
||||
if (!$value2) {
|
||||
$cellcolour = 'class="bothmissing"';
|
||||
$cellcolour = 'style="background-color: #ef6868"'; // TODO: replace by CSS class
|
||||
} else {
|
||||
$cellcolour = 'class="mastermissing"';
|
||||
$cellcolour = 'style="background-color: #feff7f"'; // TODO: replace by CSS class
|
||||
}
|
||||
$missingcounter++;
|
||||
if (LANG_DISPLAY_MISSING_LINKS) {
|
||||
$missingtarget = '<a name="missing'.$missingcounter.'"></a>';
|
||||
$missingnext = '<a href="#missing'.($missingcounter+1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall" alt="'.$strnext.'" /></a>';
|
||||
'<img src="' . $CFG->pixpath . '/t/down.gif" height="11" width="11" border="0" alt="" /></a>';
|
||||
$missingprev = '<a href="#missing'.($missingcounter-1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/up.gif" class="iconsmall" alt="'.$strprev.'" /></a>';
|
||||
'<img src="' . $CFG->pixpath . '/t/up.gif" height="11" width="11" border="0" alt="" /></a>';
|
||||
} else {
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
@@ -423,7 +458,7 @@
|
||||
}
|
||||
} else {
|
||||
if ($value <> $value2 && $value2 <> '') {
|
||||
$cellcolour = 'class="localdifferent"';
|
||||
$cellcolour = 'style="background-color: #AAFFAA"'; // TODO: replace by CSS class
|
||||
} else {
|
||||
$cellcolour = '';
|
||||
}
|
||||
@@ -433,13 +468,13 @@
|
||||
}
|
||||
|
||||
if ($editable) {
|
||||
echo '<td '.$cellcolour.' valign="top">'. $missingprev . $missingtarget."\n";
|
||||
echo '<td width="40%" '.$cellcolour.' valign="top">'. $missingprev . $missingtarget."\n";
|
||||
if (isset($string[$key])) {
|
||||
$valuelen = strlen($value);
|
||||
} else {
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=40;
|
||||
$cols=50;
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
echo '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
|
||||
@@ -455,12 +490,11 @@
|
||||
echo $missingnext . '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td '.$cellcolour.' valign="top">'.$value.'</td>';
|
||||
echo '<td width="40%" bgcolor="'.$cellcolour.'" valign="top">'.$value.'</td>';
|
||||
}
|
||||
echo '</tr>'."\n";
|
||||
}
|
||||
if ($editable) {
|
||||
echo '<tr><td> </td><td><br />';
|
||||
echo '<tr><td colspan="2"> <td><br />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo ' <input type="hidden" name="currentfile" value="'.$currentfile.'" />';
|
||||
echo ' <input type="hidden" name="mode" value="compare" />';
|
||||
@@ -468,14 +502,11 @@
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
if ($editable) {
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
// no $currentfile specified
|
||||
print_heading($strchoosefiletoedit, "", 4);
|
||||
print_heading($strchoosefiletoedit, "center", 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,18 +531,6 @@
|
||||
*/
|
||||
function lang_save_file($path, $file, $strings, $local, $packstrings) {
|
||||
global $CFG, $USER;
|
||||
if (LANG_KEEP_ORPHANS) {
|
||||
// let us load the current content of the file
|
||||
unset($string);
|
||||
@include("$path/$file");
|
||||
if (isset($string)) {
|
||||
$orphans = $string;
|
||||
unset($string);
|
||||
} else {
|
||||
$orphans = array();
|
||||
}
|
||||
}
|
||||
// let us rewrite the file
|
||||
if (!$f = @fopen("$path/$file","w")) {
|
||||
return false;
|
||||
}
|
||||
@@ -525,22 +544,18 @@ function lang_save_file($path, $file, $strings, $local, $packstrings) {
|
||||
ksort($strings);
|
||||
foreach ($strings as $key => $value) {
|
||||
@list($id, $stringname) = explode('XXX',$key);
|
||||
$value = 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
|
||||
}
|
||||
$value = str_replace("'", "\\'", $value); // Add slashes for '
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
$value = str_replace("\r", "",$value); // Remove linefeed characters
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
if ($id == "string" and $value != ""){
|
||||
if ((!$local) || (lang_fix_value_from_file($packstrings[$stringname]) <> lang_fix_value_from_file($value))) {
|
||||
// Either we are saving the master language pack
|
||||
// or we are saving local language pack and the strings differ.
|
||||
fwrite($f,"\$string['$stringname'] = '$value';\n");
|
||||
}
|
||||
if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
|
||||
unset($orphans[$stringname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LANG_KEEP_ORPHANS) {
|
||||
// let us add orphaned strings, i.e. already translated strings without the English referential source
|
||||
foreach ($orphans as $key => $value) {
|
||||
fwrite($f,"\$string['$key'] = '".lang_fix_value_before_save($value)."'; // ORPHANED\n");
|
||||
}
|
||||
}
|
||||
fwrite($f,"\n?>\n");
|
||||
@@ -549,11 +564,7 @@ function lang_save_file($path, $file, $strings, $local, $packstrings) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix value of the translated string after it is load from the file.
|
||||
*
|
||||
* These modifications are typically necessary to work with the same string coming from two sources.
|
||||
* We need to compare the content of these sources and we want to have e.g. "This string\r\n"
|
||||
* to be the same as " This string\n".
|
||||
* Fix value of string to translate.
|
||||
*
|
||||
* @param string $value Original string from the file
|
||||
* @return string Fixed value
|
||||
@@ -564,33 +575,12 @@ function lang_fix_value_from_file($value='') {
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = str_replace("&","&",$value); // Fixes MDL-9248
|
||||
$value = str_replace("<","<",$value);
|
||||
$value = str_replace(">",">",$value);
|
||||
$value = str_replace('"',""",$value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix value of the translated string before it is saved into the file
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param string $value Raw string to be saved into the lang pack
|
||||
* @return string Fixed value
|
||||
*/
|
||||
function lang_fix_value_before_save($value='') {
|
||||
global $CFG;
|
||||
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
}
|
||||
$value = str_replace("'", "\\'", $value); // Add slashes for '
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
$value = str_replace("\r", "",$value); // Remove linefeed characters
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and create a new language directory.
|
||||
*
|
||||
@@ -610,99 +600,18 @@ function lang_make_directory($dir, $shownotices=true) {
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string key name for use in HTML form.
|
||||
*
|
||||
* Required because '.' in form input names get replaced by '_' by PHP.
|
||||
*
|
||||
* @param string $keyfromfile The key name containing '.'
|
||||
* @return string The key name without '.'
|
||||
*/
|
||||
|
||||
|
||||
/// Following functions are required because '.' in form input names
|
||||
/// get replaced by '_' by PHP.
|
||||
|
||||
function lang_form_string_key($keyfromfile) {
|
||||
return str_replace('.', '##46#', $keyfromfile); /// Derived from ., the ascii value for a period.
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string key name for use in file.
|
||||
*
|
||||
* Required because '.' in form input names get replaced by '_' by PHP.
|
||||
*
|
||||
* @param string $keyfromfile The key name without '.'
|
||||
* @return string The key name containing '.'
|
||||
*/
|
||||
function lang_file_string_key($keyfromform) {
|
||||
return str_replace('##46#', '.', $keyfromform);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the substring of the string and take care of XHTML compliance.
|
||||
*
|
||||
* There was a problem with pure substr() which could possibly produce XHTML parsing error:
|
||||
* substr('Marks & Spencer', 0, 9) -> 'Marks &am' ... is not XHTML compliance
|
||||
* This function takes care of these cases. Fixes MDL-8852.
|
||||
*
|
||||
* Thanks to kovacsendre, the author of the function at http://php.net/substr
|
||||
*
|
||||
* @param string $str The original string
|
||||
* @param int $start Start position in the $value string
|
||||
* @param int $length Optional length of the returned substring
|
||||
* @return string The substring as returned by substr() with XHTML compliance
|
||||
* @todo Seems the function does not work with negative $start together with $length being set
|
||||
*/
|
||||
function lang_xhtml_save_substr($str, $start, $length = NULL) {
|
||||
if ($length === 0) {
|
||||
//stop wasting our time ;)
|
||||
return "";
|
||||
}
|
||||
|
||||
//check if we can simply use the built-in functions
|
||||
if (strpos($str, '&') === false) {
|
||||
// No entities. Use built-in functions
|
||||
if ($length === NULL) {
|
||||
return substr($str, $start);
|
||||
} else {
|
||||
return substr($str, $start, $length);
|
||||
}
|
||||
}
|
||||
|
||||
// create our array of characters and html entities
|
||||
$chars = preg_split('/(&[^;\s]+;)|/', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE);
|
||||
$html_length = count($chars);
|
||||
|
||||
// check if we can predict the return value and save some processing time, i.e.:
|
||||
// input string was empty OR
|
||||
// $start is longer than the input string OR
|
||||
// all characters would be omitted
|
||||
if (($html_length === 0) or ($start >= $html_length) or (isset($length) and ($length <= -$html_length))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
//calculate start position
|
||||
if ($start >= 0) {
|
||||
$real_start = $chars[$start][1];
|
||||
} else {
|
||||
//start'th character from the end of string
|
||||
$start = max($start,-$html_length);
|
||||
$real_start = $chars[$html_length+$start][1];
|
||||
}
|
||||
|
||||
if (!isset($length)) {
|
||||
// no $length argument passed, return all remaining characters
|
||||
return substr($str, $real_start);
|
||||
} elseif ($length > 0) {
|
||||
// copy $length chars
|
||||
if ($start+$length >= $html_length) {
|
||||
// return all remaining characters
|
||||
return substr($str, $real_start);
|
||||
} else {
|
||||
//return $length characters
|
||||
return substr($str, $real_start, $chars[max($start,0)+$length][1] - $real_start);
|
||||
}
|
||||
} else {
|
||||
//negative $length. Omit $length characters from end
|
||||
return substr($str, $real_start, $chars[$html_length+$length][1] - $real_start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+5
-5
@@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang','',$adminroot);
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
// Shall I save POSTed data?
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey", $adminroot);
|
||||
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@
|
||||
// Get all files from /docs directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
error("Could not find English language docs files!",'',$adminroot);
|
||||
error("Could not find English language docs files!");
|
||||
}
|
||||
|
||||
$options = array();
|
||||
@@ -81,7 +81,7 @@
|
||||
// Get all files from /help directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
error("Could not find English language help files!",'',$adminroot);
|
||||
error("Could not find English language help files!");
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
@@ -169,7 +169,7 @@ $langdir/$currentfile")."</font></p>";
|
||||
echo "<td align=\"center\">\n";
|
||||
|
||||
if ($editable) {
|
||||
echo "<form id=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
|
||||
echo "<form name=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
|
||||
|
||||
|
||||
+75
-62
@@ -20,40 +20,34 @@
|
||||
define('CHANGE_SITE_LANG', 3);
|
||||
define('DELETION_OF_SELECTED_LANG', 4);
|
||||
define('UPDATE_ALL_LANG', 5);
|
||||
|
||||
|
||||
$strlang = get_string('langimport','admin');
|
||||
|
||||
|
||||
$strlanguage = get_string("language");
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$title = $strlang;
|
||||
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
//reset and diagnose lang cache permissions
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
notify('Language cache can not be deleted, please check permissions in dataroot.');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
|
||||
|
||||
switch ($mode){
|
||||
|
||||
|
||||
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
|
||||
|
||||
|
||||
if (confirm_sesskey()) {
|
||||
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
|
||||
@mkdir ($CFG->dataroot.'/lang/');
|
||||
|
||||
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
|
||||
case ERROR:
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
@@ -62,8 +56,8 @@
|
||||
break;
|
||||
|
||||
case INSTALLED:
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1, $adminroot);
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack));
|
||||
break;
|
||||
|
||||
case UPTODATE:
|
||||
@@ -92,7 +86,7 @@
|
||||
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
|
||||
|
||||
if (!$confirm && confirm_sesskey()) {
|
||||
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
|
||||
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
|
||||
'langimport.php?mode=4&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php');
|
||||
} else if (confirm_sesskey()) {
|
||||
@@ -109,16 +103,16 @@
|
||||
if (file_exists($dest2)){
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'), 3, $adminroot);
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'));
|
||||
} else { //nothing deleted, possibly due to permission error
|
||||
error('An error has occurred, language pack is not completely uninstalled, please check file permissions');
|
||||
}
|
||||
}
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
break;
|
||||
|
||||
|
||||
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
|
||||
|
||||
//0th pull a list from download.moodle.org,
|
||||
@@ -126,7 +120,8 @@
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
unset($CFG->langlist); // ignore admin's langlist
|
||||
$alllangs = array_keys(get_list_of_languages());
|
||||
$lang16 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
@@ -190,7 +185,7 @@
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
@@ -213,13 +208,13 @@
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
notice(get_string('langupdatecomplete','admin'), 'langimport.php', NULL, $adminroot);
|
||||
notice(get_string('langupdatecomplete','admin'), 'langimport.php');
|
||||
} else {
|
||||
notice(get_string('nolangupdateneeded','admin'), 'langimport.php', NULL, $adminroot);
|
||||
notice(get_string('nolangupdateneeded','admin'), 'langimport.php');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default: //display choice mode
|
||||
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
@@ -241,52 +236,72 @@
|
||||
}
|
||||
*/
|
||||
if (!$remote) {
|
||||
print_box_start();
|
||||
print_simple_box_start('center','60%');
|
||||
echo '<div align="center">';
|
||||
print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/');
|
||||
print_box_end();
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
print_box_start();
|
||||
echo '<table summary="">';
|
||||
|
||||
print_simple_box_start('center','60%');
|
||||
echo '<table width="100%"><tr><td align="center">';
|
||||
echo get_string('installedlangs','admin');
|
||||
echo '</td><td align="center">';
|
||||
echo get_string('availablelangs','admin');
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td align="center" valign="top">';
|
||||
echo '<form id="uninstallform" action="langimport.php?mode=4" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<form name="uninstallform" action="langimport.php?mode=4" method="POST">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
$installedlangs = get_list_of_languages(false, true);
|
||||
unset($CFG->langlist); // ignore admin's langlist
|
||||
$installedlangs = get_list_of_languages();
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
|
||||
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
|
||||
echo '<select name="uninstalllang" size="15">';
|
||||
foreach ($installedlangs as $clang =>$ilang){
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
echo '<form id="updateform" action="langimport.php?mode=5" method="post">';
|
||||
echo '<div>';
|
||||
echo '<form name="updateform" action="langimport.php?mode=5" method="POST">';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<p />';
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// Erm... this doesn't seem to work. Plus it's redundant. -vinkmar
|
||||
|
||||
// print_string('changesitelang','admin');
|
||||
// $sitelanguage = get_record('config','name','lang');
|
||||
// echo '<form name="changelangform" action="langimport.php?mode=3" method="POST">';
|
||||
// echo '<select name="sitelangconfig">';
|
||||
//
|
||||
// foreach ($installedlangs as $clang =>$ilang) {
|
||||
// if ($clang == $sitelanguage->value){
|
||||
// echo '<option value="'.$clang.'" selected="selected">'.$ilang.'</option>';
|
||||
// } else {
|
||||
// echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
// }
|
||||
// }
|
||||
// echo '</select>';
|
||||
// echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
// echo '<input type="submit" value="'.get_string('change','admin').'" />';
|
||||
// echo '</form>';
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
echo '</td><td align="center" valign="top">';
|
||||
//availabe langs table
|
||||
echo '<table><tr><td valign="top" align="center">'; //availabe langs table
|
||||
$empty = 1; //something to pring
|
||||
|
||||
/// if this language pack is not already installed, then we allow installation
|
||||
|
||||
echo '<form id="installform" method="post" action="langimport.php?mode=2">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<form name="installform" method="POST" action="langimport.php?mode=2">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
|
||||
if ($remote) {
|
||||
echo '<select name="pack" id="pack" size="15">';
|
||||
echo '<select name="pack" size="15">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
@@ -301,24 +316,25 @@
|
||||
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
|
||||
}
|
||||
} else { //print list in local format, and instruction to install
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="← '.get_string('install','admin').'" />';
|
||||
echo '<br/ ><input type="submit" value="<-- '.get_string('install','admin').'">';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<br />';
|
||||
echo '<tr><td align="center">';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
//close available langs table
|
||||
echo '</td><tr></table>'; //close available langs table
|
||||
echo '<form>';
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
|
||||
@@ -327,7 +343,7 @@
|
||||
} //close of main switch
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
/* returns a list of available language packs from a
|
||||
* local copy shipped with standard moodle distro
|
||||
* this is for site that can't perform fopen
|
||||
@@ -344,8 +360,8 @@
|
||||
}
|
||||
return $availablelangs;
|
||||
}
|
||||
|
||||
/* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
|
||||
/* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
* against the md5 of the local language file from last update
|
||||
* @param string $lang
|
||||
* @param string $md5check
|
||||
@@ -359,7 +375,7 @@
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//returns an array of languages, or false if can not read from source
|
||||
//uses a socket if proxy is set as a config variable
|
||||
function proxy_url($url) {
|
||||
@@ -372,16 +388,13 @@
|
||||
return false; //failed
|
||||
}
|
||||
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
|
||||
|
||||
$headers_done = false;
|
||||
while(!feof($proxy_fp)) {
|
||||
$i = 0;
|
||||
while(!feof($proxy_fp)) {
|
||||
$string = fgets($proxy_fp, 1024);
|
||||
if(!$headers_done){
|
||||
// A new line indicates end of HTTP headers
|
||||
$headers_done = ("\r\n" == $string);
|
||||
} else {
|
||||
if ($i > 11) { //12 lines of info skipped
|
||||
$availablelangs[] = split(',', $string);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fclose($proxy_fp);
|
||||
|
||||
|
||||
+10
-12
@@ -37,29 +37,27 @@
|
||||
/// Print the appropriate form
|
||||
|
||||
if (file_exists($filename)) { // We are in maintenance mode
|
||||
echo '<div style="margin-left:auto;margin-right:auto">';
|
||||
echo '<center>';
|
||||
echo '<form action="maintenance.php" method="post">';
|
||||
echo '<input type="hidden" name="action" value="disable" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<p><input type="submit" value="'.get_string('disable').'" /></p>';
|
||||
echo '<input type="hidden" name="action" value="disable">';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
|
||||
echo '<p><input type="submit" value="'.get_string('disable').'"></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</center>';
|
||||
} else { // We are not in maintenance mode
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
echo '<div style="text-align:center;margin-left:auto;margin-right:auto">';
|
||||
echo '<center>';
|
||||
echo '<form action="maintenance.php" method="post">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="action" value="enable" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<p><input type="submit" value="'.get_string('enable').'" /></p>';
|
||||
echo '<input type="hidden" name="action" value="enable">';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
|
||||
echo '<p><input type="submit" value="'.get_string('enable').'"></p>';
|
||||
echo '<p>'.get_string('optionalmaintenancemessage', 'admin').':</p>';
|
||||
echo '<table><tr><td>';
|
||||
print_textarea($usehtmleditor, 20, 50, 600, 400, "text");
|
||||
echo '</td></tr></table>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</center>';
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor();
|
||||
|
||||
@@ -1,583 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Adapted for Moodle from the AMFPHP Project at http://www.amfphp.org/
|
||||
* Creates the methodTable for a service class.
|
||||
*
|
||||
* @usage $this->methodTable = MethodTable::create($this);
|
||||
* @author Christophe Herreman
|
||||
* @since 05/01/2005
|
||||
* @version $id$
|
||||
*
|
||||
* Special contributions by Allessandro Crugnola and Ted Milker
|
||||
*/
|
||||
|
||||
if (!defined('T_ML_COMMENT')) {
|
||||
define('T_ML_COMMENT', T_COMMENT);
|
||||
} else {
|
||||
define('T_DOC_COMMENT', T_ML_COMMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string from start of haystack to first occurance of needle, or whole
|
||||
* haystack, if needle does not occur
|
||||
*
|
||||
* @access public
|
||||
* @param $haystack(String) Haystack to search in
|
||||
* @param $needle(String) Needle to look for
|
||||
*/
|
||||
function strrstr($haystack, $needle)
|
||||
{
|
||||
return substr($haystack, 0, strpos($haystack.$needle,$needle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return substring of haystack from end of needle onwards, or FALSE
|
||||
*
|
||||
* @access public
|
||||
* @param $haystack(String) Haystack to search in
|
||||
* @param $needle(String) Needle to look for
|
||||
*/
|
||||
function strstrafter($haystack, $needle)
|
||||
{
|
||||
return substr(strstr($haystack, $needle), strlen($needle));
|
||||
}
|
||||
|
||||
class MethodTable
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Since this class should only be accessed through the static create() method
|
||||
* this constructor should be made private. Unfortunately, this is not possible
|
||||
* in PHP4.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function MethodTable(){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the methodTable for a passed class.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param $sourcePath(String) The path to the file you want to parse
|
||||
* @param $containsClass(Bool) True if the file is a class definition (optional)
|
||||
*/
|
||||
function create($sourcePath, $containsClass = false){
|
||||
|
||||
$methodTable = array();
|
||||
if(!file_exists($sourcePath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$source = file_get_contents($sourcePath);
|
||||
$tokens = (array)token_get_all($source);
|
||||
|
||||
$waitingForOpenParenthesis = false;
|
||||
$waitingForFunction = false;
|
||||
$waitingForClassName = false;
|
||||
$bufferingArgs = false;
|
||||
$argBuffer = "";
|
||||
$lastFunction = "";
|
||||
$lastFunctionComment = "";
|
||||
$lastComment = "";
|
||||
$classMethods = array();
|
||||
$realClassName = "";
|
||||
|
||||
if($containsClass) {
|
||||
$openBraces = -10000;
|
||||
}
|
||||
else
|
||||
{
|
||||
$openBraces = 1;
|
||||
}
|
||||
|
||||
$waitingForEndEncapsedString = false;
|
||||
foreach($tokens as $token)
|
||||
{
|
||||
if (is_string($token)) {
|
||||
if($token == '{')
|
||||
{
|
||||
$openBraces++;
|
||||
}
|
||||
if($token == '}')
|
||||
{
|
||||
if($waitingForEndEncapsedString)
|
||||
{
|
||||
$waitingForEndEncapsedString = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastComment = '';
|
||||
$openBraces--;
|
||||
|
||||
if($openBraces == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($waitingForOpenParenthesis && $token == '(')
|
||||
{
|
||||
$bufferingArgs = true;
|
||||
$argBuffer = "";
|
||||
$waitingForOpenParenthesis = false;
|
||||
}
|
||||
elseif($bufferingArgs)
|
||||
{
|
||||
if($token != ')')
|
||||
{
|
||||
$argBuffer .= $token;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($lastFunction != $realClassName)
|
||||
{
|
||||
$classMethods[] = array("name" => $lastFunction,
|
||||
"comment" => $lastFunctionComment,
|
||||
"args" => $argBuffer);
|
||||
|
||||
$bufferingArgs = false;
|
||||
$argBuffer = "";
|
||||
$lastFunction = "";
|
||||
$lastFunctionComment = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// token array
|
||||
list($id, $text) = $token;
|
||||
|
||||
if($bufferingArgs)
|
||||
{
|
||||
$argBuffer .= $text;
|
||||
}
|
||||
switch ($id)
|
||||
{
|
||||
|
||||
case T_COMMENT:
|
||||
case T_ML_COMMENT: // we've defined this
|
||||
case T_DOC_COMMENT: // and this
|
||||
// no action on comments
|
||||
$lastComment = $text;
|
||||
break;
|
||||
case T_FUNCTION:
|
||||
if($openBraces >= 1)
|
||||
{
|
||||
$waitingForFunction = true;
|
||||
}
|
||||
break;
|
||||
case T_STRING:
|
||||
if($waitingForFunction)
|
||||
{
|
||||
$waitingForFunction = false;
|
||||
$waitingForOpenParenthesis = true;
|
||||
$lastFunction = $text;
|
||||
$lastFunctionComment = $lastComment;
|
||||
$lastComment = "";
|
||||
}
|
||||
if($waitingForClassName)
|
||||
{
|
||||
$waitingForClassName = false;
|
||||
$realClassName = $text;
|
||||
}
|
||||
break;
|
||||
case T_CLASS:
|
||||
$openBraces = 0;
|
||||
$waitingForClassName = true;
|
||||
break;
|
||||
case T_CURLY_OPEN:
|
||||
case T_DOLLAR_OPEN_CURLY_BRACES:
|
||||
$waitingForEndEncapsedString = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($classMethods as $key => $value) {
|
||||
$methodSignature = $value['args'];
|
||||
$methodName = $value['name'];
|
||||
$methodComment = $value['comment'];
|
||||
|
||||
$description = MethodTable::getMethodDescription($methodComment) . " " . MethodTable::getMethodCommentAttribute($methodComment, "desc");
|
||||
$description = trim($description);
|
||||
$access = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "access");
|
||||
$roles = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "roles");
|
||||
$instance = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "instance");
|
||||
$returns = MethodTable::getMethodReturnValue($methodComment);
|
||||
$pagesize = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "pagesize");
|
||||
$params = MethodTable::getMethodCommentArguments($methodComment);
|
||||
|
||||
|
||||
//description, arguments, access, [roles, [instance, [returns, [pagesize]]]]
|
||||
$methodTable[$methodName] = array();
|
||||
//$methodTable[$methodName]["signature"] = $methodSignature; //debug purposes
|
||||
$methodTable[$methodName]["description"] = ($description == "") ? "No description given." : $description;
|
||||
$methodTable[$methodName]["arguments"] = MethodTable::getMethodArguments($methodSignature, $params);
|
||||
$methodTable[$methodName]["access"] = ($access == "") ? "private" : $access;
|
||||
|
||||
if($roles != "") $methodTable[$methodName]["roles"] = $roles;
|
||||
if($instance != "") $methodTable[$methodName]["instance"] = $instance;
|
||||
if($returns != "") $methodTable[$methodName]["returns"] = $returns;
|
||||
if($pagesize != "") $methodTable[$methodName]["pagesize"] = $pagesize;
|
||||
}
|
||||
|
||||
return $methodTable;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function getMethodCommentServices($comment)
|
||||
{
|
||||
$pieces = explode('@service', $comment);
|
||||
$args = array();
|
||||
if(is_array($pieces) && count($pieces) > 1)
|
||||
{
|
||||
for($i = 0; $i < count($pieces) - 1; $i++)
|
||||
{
|
||||
$ps = strrstr($pieces[$i + 1], '@');
|
||||
$ps = strrstr($ps, '*/');
|
||||
$args[] = MethodTable::cleanComment($ps);
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function getMethodCommentArguments($comment)
|
||||
{
|
||||
$pieces = explode('@param', $comment);
|
||||
$args = array();
|
||||
if(is_array($pieces) && count($pieces) > 1)
|
||||
{
|
||||
for($i = 0; $i < count($pieces) - 1; $i++)
|
||||
{
|
||||
$ps = strrstr($pieces[$i + 1], '@');
|
||||
$ps = strrstr($ps, '*/');
|
||||
$args[] = MethodTable::cleanComment($ps);
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the description from the comment.
|
||||
* The description is(are) the first line(s) in the comment.
|
||||
*
|
||||
* @static
|
||||
* @private
|
||||
* @param $comment(String) The method's comment.
|
||||
*/
|
||||
function getMethodDescription($comment){
|
||||
$comment = MethodTable::cleanComment(strrstr($comment, "@"));
|
||||
return trim($comment);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value of a comment attribute.
|
||||
*
|
||||
* @static
|
||||
* @private
|
||||
* @param $comment(String) The method's comment.
|
||||
* @param $attribute(String) The name of the attribute to get its value from.
|
||||
*/
|
||||
function getMethodCommentAttribute($comment, $attribute){
|
||||
$pieces = strstrafter($comment, '@' . $attribute);
|
||||
if($pieces !== FALSE)
|
||||
{
|
||||
$pieces = strrstr($pieces, '@');
|
||||
$pieces = strrstr($pieces, '*/');
|
||||
return MethodTable::cleanComment($pieces);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a comment attribute.
|
||||
*
|
||||
* @static
|
||||
* @private
|
||||
* @param $comment(String) The method's comment.
|
||||
* @param $attribute(String) The name of the attribute to get its value from.
|
||||
*/
|
||||
function getMethodCommentAttributeFirstLine($comment, $attribute){
|
||||
$pieces = strstrafter($comment, '@' . $attribute);
|
||||
if($pieces !== FALSE)
|
||||
{
|
||||
$pieces = strrstr($pieces, '@');
|
||||
$pieces = strrstr($pieces, "*");
|
||||
$pieces = strrstr($pieces, "/");
|
||||
$pieces = strrstr($pieces, "-");
|
||||
$pieces = strrstr($pieces, "\n");
|
||||
$pieces = strrstr($pieces, "\r");
|
||||
$pieces = strrstr($pieces, '*/');
|
||||
return MethodTable::cleanComment($pieces);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a comment attribute.
|
||||
*
|
||||
* @static
|
||||
* @private
|
||||
* @param $comment(String) The method's comment.
|
||||
* @param $attribute(String) The name of the attribute to get its value from.
|
||||
*/
|
||||
function getMethodReturnValue($comment){
|
||||
$result = array('type' => 'void', 'description' => '');
|
||||
$pieces = strstrafter($comment, '@returns');
|
||||
if(FALSE == $pieces) $pieces = strstrafter($comment, '@return');
|
||||
if($pieces !== FALSE)
|
||||
{
|
||||
$pieces = strrstr($pieces, '@');
|
||||
$pieces = strrstr($pieces, "*");
|
||||
$pieces = strrstr($pieces, "/");
|
||||
$pieces = strrstr($pieces, "-");
|
||||
$pieces = strrstr($pieces, "\n");
|
||||
$pieces = strrstr($pieces, "\r");
|
||||
$pieces = strrstr($pieces, '*/');
|
||||
$pieces = trim(MethodTable::cleanComment($pieces));
|
||||
@list($result['type'], $result['description']) = explode(' ', $pieces, 2);
|
||||
$result['type'] = MethodTable::standardizeType($result['type']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getMethodCommentAttributeFirstWord($comment, $attribute){
|
||||
$pieces = strstrafter($comment, '@' . $attribute);
|
||||
if($pieces !== FALSE)
|
||||
{
|
||||
$val = MethodTable::cleanComment($pieces);
|
||||
return trim(strrstr($val, ' '));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with the arguments of a method.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @param $methodSignature(String) The method's signature;
|
||||
*/
|
||||
function getMethodArguments($methodSignature, $commentParams){
|
||||
if(strlen($methodSignature) == 0){
|
||||
//no arguments, return an empty array
|
||||
$result = array();
|
||||
}else{
|
||||
//clean the arguments before returning them
|
||||
$result = MethodTable::cleanArguments(explode(",", $methodSignature), $commentParams);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the function or method's return value.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @param $value(String) The "dirty" value.
|
||||
*/
|
||||
function cleanReturnValue($value){
|
||||
$result = array();
|
||||
$value = trim($value);
|
||||
|
||||
list($result['type'], $result['description']) = explode(' ', $value, 2);
|
||||
|
||||
$result['type'] = MethodTable::standardizeType($result['type']);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Takes a string and returns the XMLRPC type that most closely matches it.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @param $type(String) The given type string.
|
||||
*/
|
||||
function standardizeType($type) {
|
||||
$type = strtolower($type);
|
||||
if('str' == $type || 'string' == $type) return 'string';
|
||||
if('int' == $type || 'integer' == $type) return 'int';
|
||||
if('bool' == $type || 'boolean' == $type) return 'boolean';
|
||||
|
||||
// Note that object is not a valid XMLRPC type
|
||||
if('object' == $type || 'class' == $type) return 'object';
|
||||
if('float' == $type || 'dbl' == $type || 'double' == $type || 'flt' == $type) return 'double';
|
||||
|
||||
// Note that null is not a valid XMLRPC type. The null type can have
|
||||
// only one value - null.
|
||||
if('null' == $type) return 'null';
|
||||
|
||||
// Note that mixed is not a valid XMLRPC type
|
||||
if('mixed' == $type) return 'mixed';
|
||||
if('array' == $type || 'arr' == $type) return 'array';
|
||||
if('assoc' == $type || 'struct' == $type) return 'struct';
|
||||
|
||||
// Note that this is not a valid XMLRPC type. As references cannot be
|
||||
// serialized or exported, there is no way this could be XML-RPCed.
|
||||
if('reference' == $type || 'ref' == $type) return 'reference';
|
||||
return 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the arguments array.
|
||||
* This method removes all whitespaces and the leading "$" sign from each argument
|
||||
* in the array.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @param $args(Array) The "dirty" array with arguments.
|
||||
*/
|
||||
function cleanArguments($args, $commentParams){
|
||||
$result = array();
|
||||
|
||||
if(!is_array($args)) return array();
|
||||
|
||||
foreach($args as $index => $arg){
|
||||
$arg = strrstr(str_replace(array('$','&$'), array('','&'), $arg), '=');
|
||||
if(!isset($commentParams[$index]))
|
||||
{
|
||||
$result[] = trim($arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = trim($arg);
|
||||
$end = trim(str_replace('$', '', $commentParams[$index]));
|
||||
|
||||
// Suppress Notice of 'Undefined offset' with @
|
||||
@list($word0, $word1, $tail) = preg_split("/[\s]+/", $end, 3);
|
||||
$word0 = strtolower($word0);
|
||||
$word1 = strtolower($word1);
|
||||
|
||||
$wordBase0 = ereg_replace('^[&$]+','',$word0);
|
||||
$wordBase1 = ereg_replace('^[&$]+','',$word1);
|
||||
$startBase = strtolower(ereg_replace('^[&$]+','',$start));
|
||||
|
||||
if ($wordBase0 == $startBase) {
|
||||
$type = str_replace(array('(',')'),'', $word1);
|
||||
} elseif($wordBase1 == $startBase) {
|
||||
$type = str_replace(array('(',')'),'', $word0);
|
||||
} elseif( ereg('(^[&$]+)|(\()([a-z0-9]+)(\)$)', $word0, $regs) ) {
|
||||
$tail = str_ireplace($word0, '', $end);
|
||||
$type = $regs[3];
|
||||
} else {
|
||||
// default to string
|
||||
$type = 'string';
|
||||
}
|
||||
|
||||
$type = MethodTable::standardizeType($type);
|
||||
/*
|
||||
if($type == 'str') {
|
||||
$type = 'string';
|
||||
} elseif($type == 'int' || $type == 'integer') {
|
||||
$type = 'int';
|
||||
} elseif($type == 'bool' || $type == 'boolean') {
|
||||
$type = 'boolean';
|
||||
} elseif($type == 'object' || $type == 'class') {
|
||||
// Note that this is not a valid XMLRPC type
|
||||
$type = 'object';
|
||||
} elseif($type == 'float' || $type == 'dbl' || $type == 'double' || $type == 'flt') {
|
||||
$type = 'double';
|
||||
} elseif($type == 'null') {
|
||||
// Note that this is not a valid XMLRPC type
|
||||
// The null type can have only one value - null. Why would
|
||||
// that be an argument to a function? Just in case:
|
||||
$type = 'null';
|
||||
} elseif($type == 'mixed') {
|
||||
// Note that this is not a valid XMLRPC type
|
||||
$type = 'mixed';
|
||||
} elseif($type == 'array' || $type == 'arr') {
|
||||
$type = 'array';
|
||||
} elseif($type == 'assoc') {
|
||||
$type = 'struct';
|
||||
} elseif($type == 'reference' || $type == 'ref') {
|
||||
// Note that this is not a valid XMLRPC type
|
||||
// As references cannot be serialized or exported, there is
|
||||
// no way this could be XML-RPCed.
|
||||
$type = 'reference';
|
||||
} else {
|
||||
$type = 'string';
|
||||
}
|
||||
*/
|
||||
$result[] = array('type' => $type, 'description' => $start . ' - ' . $tail);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cleans the comment string by removing all comment start and end characters.
|
||||
*
|
||||
* @static
|
||||
* @private
|
||||
* @param $comment(String) The method's comment.
|
||||
*/
|
||||
function cleanComment($comment){
|
||||
$comment = str_replace("/**", "", $comment);
|
||||
$comment = str_replace("*/", "", $comment);
|
||||
$comment = str_replace("*", "", $comment);
|
||||
$comment = str_replace("\n", "\\n", trim($comment));
|
||||
$comment = eregi_replace("[\r\t\n ]+", " ", trim($comment));
|
||||
$comment = str_replace("\"", "\\\"", $comment);
|
||||
return $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function showCode($methodTable){
|
||||
|
||||
if(!is_array($methodTable)) $methodTable = array();
|
||||
|
||||
foreach($methodTable as $methodName=>$methodProps){
|
||||
$result .= "\n\t\"" . $methodName . "\" => array(";
|
||||
|
||||
foreach($methodProps as $key=>$value){
|
||||
$result .= "\n\t\t\"" . $key . "\" => ";
|
||||
|
||||
if($key=="arguments"){
|
||||
$result .= "array(";
|
||||
for($i=0; $i<count($value); $i++){
|
||||
$result .= "\"" . addslashes($value[$i]) . "\"";
|
||||
if($i<count($value)-1){
|
||||
$result .= ", ";
|
||||
}
|
||||
}
|
||||
$result .= ")";
|
||||
}else{
|
||||
$result .= "\"" . $value . "\"";
|
||||
}
|
||||
|
||||
$result .= ",";
|
||||
}
|
||||
|
||||
$result = substr($result, 0, -1);
|
||||
$result .= "\n\t),";
|
||||
}
|
||||
|
||||
$result = substr($result, 0, -1);
|
||||
$result = "\$this->methodTable = array(" . $result;
|
||||
$result .= "\n);";
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,239 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
// Allows the admin to control user logins from remote moodles.
|
||||
|
||||
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
$sort = optional_param('sort', 'username', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 30, PARAM_INT);
|
||||
$action = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
|
||||
admin_externalpage_setup('ssoaccesscontrol', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sesskey = sesskey();
|
||||
$formerror = array();
|
||||
|
||||
// grab the mnet hosts and remove the localhost
|
||||
$mnethosts = get_records_menu('mnet_host', '', '', 'name', 'id, name');
|
||||
if (array_key_exists($CFG->mnet_localhost_id, $mnethosts)) {
|
||||
unset($mnethosts[$CFG->mnet_localhost_id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// process actions
|
||||
if (!empty($action) and confirm_sesskey()) {
|
||||
|
||||
// boot if insufficient permission
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error(get_string('nomodifyacl','mnet'));
|
||||
}
|
||||
|
||||
// fetch the record in question
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
|
||||
error(get_string('recordnoexists','mnet'), '/admin/mnet/access_control.php');
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case "delete":
|
||||
delete_records('mnet_sso_access_control', 'id', $id);
|
||||
redirect('access_control.php', get_string('deleteuserrecord', 'mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
|
||||
break;
|
||||
|
||||
case "acl":
|
||||
|
||||
// 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');
|
||||
}
|
||||
|
||||
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
|
||||
if ($accessctrl == 'allow') {
|
||||
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
|
||||
} elseif ($accessctrl == 'deny') {
|
||||
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
print_error('invalidactionparam', 'mnet', '/admin/mnet/access_control.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// process the form results
|
||||
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');
|
||||
}
|
||||
if (empty($form->username)) {
|
||||
$formerror['username'] = get_string('enterausername','mnet');
|
||||
}
|
||||
if (empty($form->mnet_host_id)) {
|
||||
$formerror['mnet_host_id'] = get_string('selectahost','mnet');
|
||||
}
|
||||
if (empty($form->accessctrl)) {
|
||||
$formerror['accessctrl'] = get_string('selectaccesslevel','mnet'); ;
|
||||
}
|
||||
|
||||
// process if there are no errors
|
||||
if (count($formerror) == 0) {
|
||||
|
||||
// username can be a comma separated list
|
||||
$usernames = explode(',', $form->username);
|
||||
|
||||
foreach ($usernames as $username) {
|
||||
$username = trim(moodle_strtolower($username));
|
||||
if (!empty($username)) {
|
||||
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
|
||||
if ($form->accessctrl == 'allow') {
|
||||
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($username, $mnethosts[$form->mnet_host_id])));
|
||||
} elseif ($form->accessctrl == 'deny') {
|
||||
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($username, $mnethosts[$form->mnet_host_id])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// Explain
|
||||
print_box(get_string('ssoacldescr','mnet'));
|
||||
// Are the needed bits enabled?
|
||||
$warn = '';
|
||||
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
|
||||
$warn = '<p>' . get_string('mnetdisabled','mnet') .'</p>';
|
||||
}
|
||||
|
||||
if (!is_enabled_auth('mnet')) {
|
||||
$warn .= '<p>' . get_string('authmnetdisabled','mnet').'</p>';
|
||||
}
|
||||
|
||||
if (get_config('auth/mnet', 'auto_add_remote_users') != true) {
|
||||
$warn .= '<p>' . get_string('authmnetautoadddisabled','mnet').'</p>';
|
||||
}
|
||||
if (!empty($warn)) {
|
||||
$warn = '<p>' . get_string('ssoaclneeds','mnet').'</p>' . $warn;
|
||||
print_box($warn);
|
||||
}
|
||||
// output the ACL table
|
||||
$columns = array("username", "mnet_host_id", "access", "delete");
|
||||
$headings = array();
|
||||
$string = array('username' => get_string('username'),
|
||||
'mnet_host_id' => get_string('remotehost', 'mnet'),
|
||||
'access' => get_string('accesslevel', 'mnet'),
|
||||
'delete' => get_string('delete'));
|
||||
foreach ($columns as $column) {
|
||||
if ($sort != $column) {
|
||||
$columnicon = "";
|
||||
$columndir = "ASC";
|
||||
} else {
|
||||
$columndir = $dir == "ASC" ? "DESC" : "ASC";
|
||||
$columnicon = $dir == "ASC" ? "down" : "up";
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
|
||||
}
|
||||
$headings[$column] = "<a href=\"?sort=$column&dir=$columndir&\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
$headings['delete'] = '';
|
||||
$acl = get_records('mnet_sso_access_control', '', '', "$sort $dir", '*'); //, $page * $perpage, $perpage);
|
||||
$aclcount = count_records('mnet_sso_access_control');
|
||||
|
||||
if (!$acl) {
|
||||
print_heading(get_string('noaclentries','mnet'));
|
||||
$table = NULL;
|
||||
} else {
|
||||
$table->head = $headings;
|
||||
$table->align = array('left', 'left', 'center');
|
||||
$table->width = "95%";
|
||||
foreach ($acl as $aclrecord) {
|
||||
if ($aclrecord->accessctrl == 'allow') {
|
||||
$accesscolumn = get_string('allow', 'mnet')
|
||||
. " (<a href=\"?id={$aclrecord->id}&action=acl&accessctrl=deny&sesskey={$USER->sesskey}\">"
|
||||
. get_string('deny', 'mnet') . "</a>)";
|
||||
} else {
|
||||
$accesscolumn = get_string('deny', 'mnet')
|
||||
. " (<a href=\"?id={$aclrecord->id}&action=acl&accessctrl=allow&sesskey={$USER->sesskey}\">"
|
||||
. get_string('allow', 'mnet') . "</a>)";
|
||||
}
|
||||
$deletecolumn = "<a href=\"?id={$aclrecord->id}&action=delete&sesskey={$USER->sesskey}\">"
|
||||
. get_string('delete') . "</a>";
|
||||
$table->data[] = array ($aclrecord->username, $aclrecord->mnet_host_id, $accesscolumn, $deletecolumn);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
echo '<p> </p>';
|
||||
print_paging_bar($aclcount, $page, $perpage, "?sort=$sort&dir=$dir&perpage=$perpage&");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// output the add form
|
||||
print_simple_box_start('center','90%','','20');
|
||||
|
||||
?>
|
||||
<div class="mnetaddtoaclform">
|
||||
<form id="mnetaddtoacl" method="post">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>" />
|
||||
<?php
|
||||
|
||||
// enter a username
|
||||
echo get_string('username') . ":\n";
|
||||
if (!empty($formerror['username'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
echo '<input type="text" name="username" size="20" maxlength="100" />';
|
||||
|
||||
// choose a remote host
|
||||
echo " " . get_string('remotehost', 'mnet') . ":\n";
|
||||
if (!empty($formerror['mnet_host_id'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
choose_from_menu($mnethosts, 'mnet_host_id');
|
||||
|
||||
// choose an access level
|
||||
echo " " . get_string('accesslevel', 'mnet') . ":\n";
|
||||
if (!empty($formerror['accessctrl'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
$accessmenu['allow'] = get_string('allow', 'mnet');
|
||||
$accessmenu['deny'] = get_string('deny', 'mnet');
|
||||
choose_from_menu($accessmenu, 'accessctrl');
|
||||
|
||||
// submit button
|
||||
echo '<input type="submit" value="' . get_string('addtoacl', 'mnet') . '" />';
|
||||
echo "</form></div>\n";
|
||||
|
||||
// print errors
|
||||
foreach ($formerror as $error) {
|
||||
echo "<br><span class=\"error\">$error<span>";
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Library functions for mnet
|
||||
*
|
||||
* @author Donal McMullan donal@catalyst.net.nz
|
||||
* @version 0.0.1
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package mnet
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse a file to find out what functions/methods exist in it, and add entries
|
||||
* for the remote-call-enabled functions to the database.
|
||||
*
|
||||
* The path to a file, e.g. auth/mnet/auth.php can be thought of as
|
||||
* type/parentname/docname
|
||||
*
|
||||
* @param string $type mod, auth or enrol
|
||||
* @param string $parentname Implementation of type, e.g. 'mnet' in the
|
||||
* case of auth/mnet/auth.php
|
||||
* @return bool True on success, else false
|
||||
*/
|
||||
function mnet_get_functions($type, $parentname) {
|
||||
global $CFG;
|
||||
$dataobject = new stdClass();
|
||||
$docname = $type.'.php';
|
||||
$publishes = array();
|
||||
if ('mod' == $type) {
|
||||
$docname = 'rpclib.php';
|
||||
$relname = '/mod/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
$mnet_publishes = $parentname.'_mnet_publishes';
|
||||
if (function_exists($mnet_publishes)) {
|
||||
(array)$publishes = $mnet_publishes();
|
||||
}
|
||||
} else {
|
||||
// auth or enrol
|
||||
$relname = '/'.$type.'/'.$parentname.'/'.$docname;
|
||||
$filename = $CFG->dirroot.$relname;
|
||||
if (file_exists($filename)) include $filename;
|
||||
$class = $type.($type=='enrol'? 'ment':'').'_plugin_'.$parentname;
|
||||
if (class_exists($class)) {
|
||||
$object = new $class();
|
||||
if (method_exists($object, 'mnet_publishes')) {
|
||||
(array)$publishes = $object->mnet_publishes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$methodServiceArray = array();
|
||||
foreach($publishes as $service) {
|
||||
if (is_array($service['methods'])) {
|
||||
foreach($service['methods'] as $methodname) {
|
||||
$methodServiceArray[$methodname][] = $service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disable functions that don't exist (any more) in the source
|
||||
// Should these be deleted? What about their permissions records?
|
||||
$rpcrecords = get_records_select('mnet_rpc', ' parent=\''.$parentname.'\' AND parent_type=\''.$type.'\' ', 'function_name ASC ');
|
||||
if (!empty($rpcrecords)) {
|
||||
foreach($rpcrecords as $rpc) {
|
||||
if (!array_key_exists($rpc->function_name, $methodServiceArray)) {
|
||||
$rpc->enabled = 0;
|
||||
update_record('mnet_rpc', $rpc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($filename)) return false;
|
||||
|
||||
if (extension_loaded('tokenizer')) {
|
||||
include_once $CFG->dirroot.'/admin/mnet/MethodTable.php';
|
||||
$functions = (array)MethodTable::create($filename,false);
|
||||
}
|
||||
|
||||
foreach($methodServiceArray as $method => $servicearray) {
|
||||
if (!empty($functions[$method])) {
|
||||
$details = $functions[$method];
|
||||
$profile = $details['arguments'];
|
||||
if (!isset($details['returns'])) {
|
||||
array_unshift($profile, array('type' => 'void', 'description' => 'No return value'));
|
||||
} else {
|
||||
array_unshift($profile, $details['returns']);
|
||||
}
|
||||
$dataobject->profile = serialize($profile);
|
||||
$dataobject->help = addslashes($details['description']);
|
||||
} else {
|
||||
$dataobject->profile = serialize(array(array('type' => 'void', 'description' => 'No return value')));
|
||||
$dataobject->help = '';
|
||||
}
|
||||
|
||||
$dataobject->function_name = $method;
|
||||
$dataobject->xmlrpc_path = $type.'/'.$parentname.'/'.$docname.'/'.$method;
|
||||
$dataobject->parent_type = $type;
|
||||
$dataobject->parent = $parentname;
|
||||
$dataobject->enabled = '0';
|
||||
|
||||
if ($record_exists = get_record('mnet_rpc', 'xmlrpc_path', $dataobject->xmlrpc_path)) {
|
||||
$dataobject->id = $record_exists->id;
|
||||
$dataobject->enabled = $record_exists->enabled;
|
||||
update_record('mnet_rpc', $dataobject);
|
||||
} else {
|
||||
$dataobject->id = insert_record('mnet_rpc', $dataobject, true);
|
||||
}
|
||||
|
||||
foreach($servicearray as $service) {
|
||||
$serviceobj = get_record('mnet_service', 'name', $service['name']);
|
||||
if (false == $serviceobj) {
|
||||
$serviceobj = new stdClass();
|
||||
$serviceobj->name = $service['name'];
|
||||
$serviceobj->apiversion = $service['apiversion'];
|
||||
$serviceobj->offer = 1;
|
||||
$serviceobj->id = insert_record('mnet_service', $serviceobj, true);
|
||||
}
|
||||
|
||||
if (false == get_record('mnet_service2rpc', 'rpcid', $dataobject->id, 'serviceid', $serviceobj->id)) {
|
||||
$obj = new stdClass();
|
||||
$obj->rpcid = $dataobject->id;
|
||||
$obj->serviceid = $serviceobj->id;
|
||||
insert_record('mnet_service2rpc', $obj, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function upgrade_RPC_functions($returnurl) {
|
||||
global $CFG;
|
||||
|
||||
$basedir = $CFG->dirroot.'/mod';
|
||||
if (file_exists($basedir) && filetype($basedir) == 'dir') {
|
||||
$dirhandle = opendir($basedir);
|
||||
while (false !== ($dir = readdir($dirhandle))) {
|
||||
$firstchar = substr($dir, 0, 1);
|
||||
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
|
||||
continue;
|
||||
}
|
||||
if (filetype($basedir .'/'. $dir) != 'dir') {
|
||||
continue;
|
||||
}
|
||||
|
||||
mnet_get_functions('mod', $dir);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$basedir = $CFG->dirroot.'/auth';
|
||||
if (file_exists($basedir) && filetype($basedir) == 'dir') {
|
||||
$dirhandle = opendir($basedir);
|
||||
while (false !== ($dir = readdir($dirhandle))) {
|
||||
$firstchar = substr($dir, 0, 1);
|
||||
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
|
||||
continue;
|
||||
}
|
||||
if (filetype($basedir .'/'. $dir) != 'dir') {
|
||||
continue;
|
||||
}
|
||||
|
||||
mnet_get_functions('auth', $dir);
|
||||
}
|
||||
}
|
||||
|
||||
$basedir = $CFG->dirroot.'/enrol';
|
||||
if (file_exists($basedir) && filetype($basedir) == 'dir') {
|
||||
$dirhandle = opendir($basedir);
|
||||
while (false !== ($dir = readdir($dirhandle))) {
|
||||
$firstchar = substr($dir, 0, 1);
|
||||
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
|
||||
continue;
|
||||
}
|
||||
if (filetype($basedir .'/'. $dir) != 'dir') {
|
||||
continue;
|
||||
}
|
||||
|
||||
mnet_get_functions('enrol', $dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,52 +0,0 @@
|
||||
<?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');
|
||||
|
||||
print_heading(get_string('mnetsettings', 'mnet'));
|
||||
?>
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<table class="generalbox standard" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="generalboxcontent">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<tr valign="top">
|
||||
<td colspan="2" class="header" cellpadding="0"><span><?php print_string('deleteaserver', 'mnet'); ?>Deleting a Server</span></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (count($warn) > 0){
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right" colspan="2"><?php print_string('receivedwarnings','mnet'); ?>:<br />
|
||||
<?php foreach($warn as $warning) echo $warning .'<br />'; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td colspan="2"><?php print_string('reallydeleteserver','mnet'); ?>: "<?php echo $mnet_peer->name; ?>"?</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td width="80">
|
||||
<form method="post" action="delete.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="hostid" value="<?php echo $mnet_peer->id; ?>" />
|
||||
<input type="hidden" name="step" value="delete" />
|
||||
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form method="get" action="index.php">
|
||||
<input type="submit" name="ignore" value="<?php print_string('cancel'); ?>"/>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
$stradministration = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strmnetsettings = get_string('mnetsettings', 'mnet');
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
require_login();
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
|
||||
// Step must be one of:
|
||||
// input Parse the details of a new host and fetch its public key
|
||||
// commit Save our changes (to a new OR existing host)
|
||||
$step = optional_param('step', 'verify', PARAM_ALPHA);
|
||||
$hostid = required_param('hostid', PARAM_INT);
|
||||
$warn = array();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
redirect('index.php', get_string('postrequired','mnet') ,7);
|
||||
}
|
||||
|
||||
if ('verify' == $step) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$live_users = $mnet_peer->count_live_sessions();
|
||||
if ($live_users > 0) {
|
||||
$warn[] = get_string('usersareonline', 'mnet', $live_users);
|
||||
}
|
||||
include('delete.html');
|
||||
} elseif ('delete' == $step) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$mnet_peer->delete();
|
||||
redirect('peers.php', get_string('hostdeleted', 'mnet'), 5);
|
||||
}
|
||||
?>
|
||||
@@ -1,104 +0,0 @@
|
||||
|
||||
<form id="assignform" method="post" action="">
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
|
||||
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
||||
<input type="hidden" name="host" value="<?php p($mnet_peer->id) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<table class="generaltable" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<?php print_string('existingusers', 'role', count($mnetenrolledusers)); ?>
|
||||
</td>
|
||||
<td></td>
|
||||
<td valign="top">
|
||||
<?php print_string('potentialusers', 'role', $availableusers->_numOfRows); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
|
||||
onfocus="getElementById('assignform').add.disabled=true;
|
||||
getElementById('assignform').remove.disabled=false;
|
||||
getElementById('assignform').addselect.selectedIndex=-1;">
|
||||
<?php
|
||||
foreach ($mnetenrolledusers as $enrolleduser) {
|
||||
$fullname = fullname($enrolleduser, true);
|
||||
echo "<option value=\"$enrolleduser->id\">".s($fullname)." (".s($enrolleduser->rolename).")</option>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
</select></td>
|
||||
<td valign="top">
|
||||
<br />
|
||||
<input name="add" type="submit" id="add" value="←" />
|
||||
<br />
|
||||
<input name="remove" type="submit" id="remove" value="→" />
|
||||
<br />
|
||||
</td>
|
||||
<td valign="top">
|
||||
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
|
||||
onfocus="getElementById('assignform').add.disabled=false;
|
||||
getElementById('assignform').remove.disabled=true;
|
||||
getElementById('assignform').removeselect.selectedIndex=-1;">
|
||||
<?php
|
||||
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
if (!isset($enrolledusers[$user->id])) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
} else {
|
||||
if ($availableusers->_numOfRows > MAX_USERS_PER_PAGE) {
|
||||
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
|
||||
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
|
||||
} else {
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
|
||||
onfocus ="getElementById('assignform').add.disabled=true;
|
||||
getElementById('assignform').remove.disabled=true;
|
||||
getElementById('assignform').removeselect.selectedIndex=-1;
|
||||
getElementById('assignform').addselect.selectedIndex=-1;"
|
||||
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
|
||||
if (keyCode == 13) {
|
||||
getElementById('assignform').previoussearch.value=1;
|
||||
getElementById('assignform').submit();
|
||||
} " />
|
||||
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
|
||||
<?php
|
||||
if (!empty($searchusers)) {
|
||||
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><?php print_string('otherenrolledusers', 'mnet'); ?>:<br />
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($remtenrolledusers as $enrolleduser) {
|
||||
$fullname = fullname($enrolleduser, true);
|
||||
print '<li>'
|
||||
. s($fullname) . ' (' . s($enrolleduser->rolename) . ') '
|
||||
. s($enrolleduser->enroltype)."</li>\n";
|
||||
}
|
||||
?></ul></td>
|
||||
<td valign="top"></td>
|
||||
<td valign="top"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,281 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// enrol_config.php - allows admin to edit all enrollment variables
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once(dirname(__FILE__) . "/../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
$enrolment = enrolment_factory::factory('mnet');
|
||||
|
||||
$mnethostid = required_param('host', PARAM_INT);
|
||||
$courseid = required_param('courseid', PARAM_INT);
|
||||
|
||||
$mnet_peer = new mnet_peer();
|
||||
if (!$mnet_peer->set_id($mnethostid)) {
|
||||
print_error('hostcoursenotfound','mnet');
|
||||
}
|
||||
|
||||
$course = get_record('mnet_enrol_course', 'id', $courseid, 'hostid', $mnet_peer->id);
|
||||
|
||||
if (empty($course)) {
|
||||
print_error('hostcoursenotfound','mnet');
|
||||
}
|
||||
|
||||
define("MAX_USERS_PER_PAGE", 5000);
|
||||
|
||||
$add = optional_param('add', 0, PARAM_BOOL);
|
||||
$remove = optional_param('remove', 0, PARAM_BOOL);
|
||||
$showall = optional_param('showall', 0, PARAM_BOOL);
|
||||
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
|
||||
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
|
||||
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
|
||||
|
||||
$errors = array();
|
||||
|
||||
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
|
||||
|
||||
$baseurl = "remote_enrolment.php?courseid={$course->id}&host={$mnet_peer->id}";
|
||||
if (!empty($userid)) {
|
||||
$baseurl .= '&userid='.$userid;
|
||||
}
|
||||
|
||||
/// Process incoming role assignment
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
|
||||
$timemodified = time();
|
||||
|
||||
foreach ($frm->addselect as $adduser) {
|
||||
if (!$adduser = clean_param($adduser, PARAM_INT)) {
|
||||
continue;
|
||||
}
|
||||
if (! $enrolment->req_enrol_user($adduser, $course->id)) {
|
||||
$errors[] = "Could not add user with id $adduser to course {$course->id}!";
|
||||
}
|
||||
}
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
foreach ($frm->removeselect as $removeuser) {
|
||||
$removeuser = clean_param($removeuser, PARAM_INT);
|
||||
if (! $enrolment->req_unenrol_user($removeuser, $course->id)) {
|
||||
$errors[] = "Could not remove user with id $removeuser from course {$course->id}!";
|
||||
}
|
||||
}
|
||||
} else if ($showall) {
|
||||
$searchtext = '';
|
||||
$previoussearch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare data for users / enrolled users panes
|
||||
|
||||
|
||||
/// Create a new request object
|
||||
$mnet_request = new mnet_xmlrpc_client();
|
||||
|
||||
/// Pass it the path to the method that we want to execute
|
||||
$mnet_request->set_method('enrol/mnet/enrol.php/course_enrolments');
|
||||
$mnet_request->add_param($course->remoteid, 'int');
|
||||
$mnet_request->send($mnet_peer);
|
||||
$all_enrolled_users = $mnet_request->response;
|
||||
|
||||
unset($mnet_request);
|
||||
|
||||
$select = '';
|
||||
$all_enrolled_usernames = '';
|
||||
$timemodified = array();
|
||||
/// List all the users (homed on this server) who are enrolled on the course
|
||||
/// This will include mnet-enrolled users, and those who have enrolled
|
||||
/// themselves, etc.
|
||||
if (is_array($all_enrolled_users) && count($all_enrolled_users)) {
|
||||
foreach($all_enrolled_users as $username => $data) {
|
||||
$all_enrolled_usernames .= "'$username', ";
|
||||
}
|
||||
$select = ' u.username IN (' .substr($all_enrolled_usernames, 0, -2) .') AND ';
|
||||
} else {
|
||||
$all_enrolled_users = array();
|
||||
}
|
||||
|
||||
/// Synch our mnet_enrol_assignments with remote server
|
||||
$sql = "
|
||||
SELECT
|
||||
u.id,
|
||||
u.firstname,
|
||||
u.lastname,
|
||||
u.username,
|
||||
u.email,
|
||||
a.enroltype,
|
||||
a.id as enrolid,
|
||||
COALESCE(a.hostid, 0) as wehaverecord,
|
||||
a.courseid
|
||||
FROM
|
||||
{$CFG->prefix}user u
|
||||
LEFT JOIN
|
||||
{$CFG->prefix}mnet_enrol_assignments a
|
||||
ON
|
||||
a.userid = u.id AND a.courseid={$courseid}
|
||||
WHERE
|
||||
$select
|
||||
u.deleted = 0 AND
|
||||
u.confirmed = 1 AND
|
||||
u.mnethostid = {$CFG->mnet_localhost_id}
|
||||
ORDER BY
|
||||
u.firstname ASC,
|
||||
u.lastname ASC";
|
||||
|
||||
if (!$enrolledusers = get_records_sql($sql)) {
|
||||
$enrolledusers = array();
|
||||
}
|
||||
|
||||
foreach($enrolledusers as $user) {
|
||||
|
||||
$dataobj = new stdClass();
|
||||
$dataobj->userid = $user->id;
|
||||
$dataobj->hostid = $mnet_peer->id;
|
||||
$dataobj->courseid = $courseid;
|
||||
$dataobj->rolename = $all_enrolled_users[$user->username]['name'];
|
||||
$dataobj->enroltype = $all_enrolled_users[$user->username]['enrol'];
|
||||
|
||||
if ($user->wehaverecord == 0) {
|
||||
$dataobj->enroltime = $all_enrolled_users[$user->username]['timemodified'];
|
||||
$dataobj->id = insert_record('mnet_enrol_assignments', $dataobj);
|
||||
} elseif (array_key_exists($user->username, $all_enrolled_users)) {
|
||||
$dataobj->id = $user->enrolid;
|
||||
update_record('mnet_enrol_assignments', $dataobj);
|
||||
} elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
|
||||
delete_record('mnet_enrol_assignments', 'id', $user->enrolid);
|
||||
}
|
||||
}
|
||||
unset($enrolledusers);
|
||||
|
||||
// Read about our remote enrolments in 2 sets
|
||||
// first, get the remote enrolments done via enrol/mnet $mnetenrolledusers
|
||||
// second, get the remote enrolments done with other plugins $remtenrolledusers
|
||||
// NOTE: both arrays are keyed on the userid!
|
||||
$sql = "
|
||||
SELECT
|
||||
u.id,
|
||||
u.firstname,
|
||||
u.lastname,
|
||||
a.rolename,
|
||||
a.enroltype,
|
||||
a.courseid
|
||||
FROM
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}mnet_enrol_assignments a
|
||||
WHERE
|
||||
a.userid = u.id AND
|
||||
a.courseid={$courseid} AND
|
||||
a.enroltype = 'mnet' AND
|
||||
u.deleted = 0 AND
|
||||
u.confirmed = 1 AND
|
||||
u.mnethostid = {$CFG->mnet_localhost_id}
|
||||
ORDER BY
|
||||
u.firstname ASC,
|
||||
u.lastname ASC";
|
||||
|
||||
if (!$mnetenrolledusers = get_records_sql($sql)) {
|
||||
$mnetenrolledusers = array();
|
||||
}
|
||||
$sql = "
|
||||
SELECT
|
||||
u.id,
|
||||
u.firstname,
|
||||
u.lastname,
|
||||
a.rolename,
|
||||
a.enroltype,
|
||||
a.courseid
|
||||
FROM
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}mnet_enrol_assignments a
|
||||
WHERE
|
||||
a.userid = u.id AND
|
||||
a.courseid={$courseid} AND
|
||||
a.enroltype != 'mnet' AND
|
||||
u.deleted = 0 AND
|
||||
u.confirmed = 1 AND
|
||||
u.mnethostid = {$CFG->mnet_localhost_id}
|
||||
ORDER BY
|
||||
u.firstname ASC,
|
||||
u.lastname ASC";
|
||||
|
||||
if (!$remtenrolledusers = get_records_sql($sql)) {
|
||||
$remtenrolledusers = array();
|
||||
}
|
||||
|
||||
$select = '';
|
||||
$exclude = array_merge(array_keys($mnetenrolledusers), array_keys($remtenrolledusers));
|
||||
$exclude[] = 0;
|
||||
$select = 'AND u.username!=\'guest\' AND u.id NOT IN ('. join(',',$exclude) .') ';
|
||||
unset($exclude);
|
||||
|
||||
$searchtext = trim($searchtext);
|
||||
|
||||
if ($searchtext !== '') { // Search for a subset of remaining users
|
||||
$LIKE = sql_ilike();
|
||||
$FULLNAME = sql_fullname();
|
||||
|
||||
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
}
|
||||
|
||||
$sql = ('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user u
|
||||
WHERE deleted = 0 AND confirmed = 1
|
||||
AND mnethostid = '.$CFG->mnet_localhost_id.' '
|
||||
.$select
|
||||
.'ORDER BY lastname ASC, firstname ASC');
|
||||
|
||||
$availableusers = get_recordset_sql($sql, 0, MAX_USERS_PER_PAGE);
|
||||
|
||||
|
||||
|
||||
/// Print the page
|
||||
|
||||
/// get language strings
|
||||
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
|
||||
/// Get some language strings
|
||||
|
||||
$strassignusers = get_string('assignusers', 'role');
|
||||
$strpotentialusers = get_string('potentialusers', 'role');
|
||||
$strexistingusers = get_string('existingusers', 'role');
|
||||
$straction = get_string('assignroles', 'role');
|
||||
$strroletoassign = get_string('roletoassign', 'role');
|
||||
$strcurrentcontext = get_string('currentcontext', 'role');
|
||||
$strsearch = get_string('search');
|
||||
$strshowall = get_string('showall');
|
||||
$strparticipants = get_string('participants');
|
||||
$strsearchresults = get_string('searchresults');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box('<strong>' . s($mnet_peer->name) . ' : '
|
||||
. format_string($course->shortname) .' '. format_string($course->fullname)
|
||||
. '</strong><br />'
|
||||
. get_string("enrolcourseenrol_desc", "mnet"));
|
||||
|
||||
echo "<hr />";
|
||||
|
||||
include(dirname(__FILE__).'/enr_course_enrol.html');
|
||||
|
||||
if (!empty($errors)) {
|
||||
$msg = '<p>';
|
||||
foreach ($errors as $e) {
|
||||
$msg .= $e.'<br />';
|
||||
}
|
||||
$msg .= '</p>';
|
||||
notify($msg);
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -1,58 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// enrol_config.php - allows admin to edit all enrollment variables
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once(dirname(__FILE__) . "/../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
$enrolment = enrolment_factory::factory('mnet');
|
||||
|
||||
$mnethost = required_param('host', PARAM_INT);
|
||||
$host = get_record('mnet_host', 'id', $mnethost);
|
||||
|
||||
$courses = $enrolment->fetch_remote_courses($mnethost);
|
||||
|
||||
/// Print the page
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box('<strong>' . s($host->name) . ' </strong><br />'
|
||||
. get_string("enrolcourses_desc", "mnet"));
|
||||
|
||||
echo '<hr />';
|
||||
|
||||
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
|
||||
. '<table class="generaltable">';
|
||||
|
||||
$icon = "<img src=\"$CFG->pixpath/i/course.gif\"".
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$link = $CFG->wwwroot . '/admin/mnet/enr_course_enrol.php?'
|
||||
. "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}";
|
||||
echo '<tr>'
|
||||
. "<td>$icon</td>"
|
||||
. "<td><a href=\"$link\">".format_string($course->fullname). "</a></td>"
|
||||
. '</tr><tr>'
|
||||
. '<td></td>'
|
||||
. '<td>'.format_string($course->shortname). ' - ' .format_string($course->cat_name).'</td>'
|
||||
. '</tr><tr>'
|
||||
. '<td></td>'
|
||||
. "<td align=\"left\" >{$course->summary}</td>"
|
||||
. '</tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -1,62 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// enrol_config.php - allows admin to edit all enrollment variables
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once(dirname(__FILE__) . "/../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetenrol', $adminroot);
|
||||
$CFG->pagepath = 'admin/mnet';
|
||||
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
|
||||
$enrolment = enrolment_factory::factory('mnet');
|
||||
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
/// get language strings
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_box(get_string("remoteenrolhosts_desc", "mnet"));
|
||||
|
||||
echo '<hr />';
|
||||
|
||||
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
|
||||
print_box(get_string('mnetdisabled','mnet'));
|
||||
}
|
||||
|
||||
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
|
||||
. '<table cellspacing="0" cellpadding="5" id="hosts" class="generaltable generalbox" >'
|
||||
. '<tr>'
|
||||
. '<th class="header c0"> '.get_string('host', 'mnet').' </th>'
|
||||
. '<th class="header c1"> '.get_string('enrolments', 'mnet').' </th>'
|
||||
. '<th class="header c2"> '.get_string('courses', 'mnet').' </th>'
|
||||
// . '<th class="header c3"> </th>'
|
||||
. '</tr>';
|
||||
$hosts = $enrolment->list_remote_servers();
|
||||
foreach ($hosts as $host) {
|
||||
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
|
||||
if (empty($coursecount)) {
|
||||
$coursecount = '?';
|
||||
}
|
||||
$enrolcount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_assignments WHERE hostid={$host->id}");
|
||||
|
||||
echo '<tr>'
|
||||
. "<td><a href=\"{$coursesurl}\">{$host->name}</a></td>"
|
||||
. "<td align=\"center\" >$enrolcount</td>"
|
||||
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
|
||||
// TODO: teach report/log/index.php to show per-host-logs
|
||||
// . '<td align="center" ><a href="{$CFG->wwwroot}/admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . get_string('logs', 'mnet').'</a> </td>'
|
||||
. '</tr>';
|
||||
}
|
||||
echo '</table>'
|
||||
. '</div>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
@@ -1,152 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
// Allows the admin to configure mnet stuff
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('net', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!isset($CFG->mnet_dispatcher_mode)) {
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
}
|
||||
|
||||
/// 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 (set_config('mnet_dispatcher_mode', $form->mode)) {
|
||||
redirect('index.php', get_string('changessaved'));
|
||||
} else {
|
||||
error('Invalid action parameter.', 'index.php');
|
||||
}
|
||||
}
|
||||
} elseif (!empty($form->submit) && $form->submit == get_string('delete')) {
|
||||
$MNET->get_private_key();
|
||||
$_SESSION['mnet_confirm_delete_key'] = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time();
|
||||
notice_yesno(get_string("deletekeycheck", "mnet"),
|
||||
"index.php?sesskey=$USER->sesskey&confirm=".md5($MNET->public_key),
|
||||
"index.php",
|
||||
array('sesskey' => $USER->sesskey),
|
||||
NULL,
|
||||
'post',
|
||||
'get');
|
||||
exit;
|
||||
} else {
|
||||
// We're deleting
|
||||
|
||||
|
||||
if (!isset($_SESSION['mnet_confirm_delete_key'])) {
|
||||
// fail - you're being attacked?
|
||||
}
|
||||
|
||||
$key = '';
|
||||
$time = '';
|
||||
@list($key, $time) = explode(':',$_SESSION['mnet_confirm_delete_key']);
|
||||
$MNET->get_private_key();
|
||||
|
||||
if($time < time() - 60) {
|
||||
// fail - you're out of time.
|
||||
print_error ('deleteoutoftime', 'mnet', 'index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($key != md5(sha1($MNET->keypair['keypair_PEM']))) {
|
||||
// fail - you're being attacked?
|
||||
print_error ('deletewrongkeyvalue', 'mnet', 'index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$MNET->replace_keys();
|
||||
redirect('index.php', get_string('keydeleted','mnet'));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
?>
|
||||
<center>
|
||||
<form method="post" action="index.php">
|
||||
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="generalboxcontent">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<tr valign="top">
|
||||
<td colspan="2" class="header" cellpadding="0"><?php print_string('aboutyourhost', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('publickey', 'mnet'); ?>:</td>
|
||||
<td><pre><?php echo $MNET->public_key; ?></pre></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('expires', 'mnet'); ?>:</td>
|
||||
<td><?php echo userdate($MNET->public_key_expires); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('net', 'mnet'); ?>:</td>
|
||||
<td><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
|
||||
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<form method="post" action="index.php">
|
||||
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="generalboxcontent">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<tr valign="top">
|
||||
<td colspan="2" class="header" cellpadding="0"><?php print_string('expireyourkey', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td colspan="2" cellpadding="0"><?php print_string('expireyourkeyexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="left" width="10" nowrap="nowrap"><?php print_string('expireyourkey', 'mnet'); ?></td>
|
||||
<td align="left"><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="deleteKey" value="" />
|
||||
<input type="submit" name="submit" value="<?php print_string('delete'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</center>
|
||||
|
||||
<?php
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
$logurl = $CFG->wwwroot.
|
||||
'/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
|
||||
'%2F1&user='.'0'.
|
||||
'&date=0'.
|
||||
'&modid=&modaction=0&logformat=showashtml';
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
} else {
|
||||
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
|
||||
}
|
||||
print_tabs(array($tabs), 'mnetdetails');
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
?>
|
||||
<form method="post" action="peers.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="commit" />
|
||||
<input type="hidden" name="last_connect_time" value="<?php echo $mnet_peer->last_connect_time; ?>" />
|
||||
<input type="hidden" name="id" value="<?php echo isset($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
|
||||
<table cellpadding="9" cellspacing="0" width="635">
|
||||
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
|
||||
<td valign="top"><input type="text" name="name" size="30" value="<?php echo $mnet_peer->name; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('hostname', 'mnet'); ?>:</td>
|
||||
<td valign="top"><input type="text" name="wwwroot" size="30" value="<?php echo $mnet_peer->wwwroot; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (empty($mnet_peer->public_key)) $mnet_peer->public_key = '';
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php
|
||||
print_string('publickey', 'mnet');
|
||||
echo ': <br />';
|
||||
helpbutton("publickey", get_string('publickey', 'mnet'), "mnet", true, true);
|
||||
?></td>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0) {
|
||||
$key = mnet_get_public_key($mnet_peer->wwwroot);
|
||||
$mnet_peer->public_key = clean_param($key, PARAM_PEM);
|
||||
}
|
||||
?>
|
||||
<td valign="top">
|
||||
<?php
|
||||
if (empty($mnet_peer->public_key)) {
|
||||
print_string('nopubkey', 'mnet');
|
||||
}
|
||||
?><br />
|
||||
<textarea rows="17" cols="65" name="public_key" style="font-size: 8px;"><?php echo $mnet_peer->public_key; ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('expires', 'mnet'); ?>:</td>
|
||||
<td valign="top">
|
||||
<?php
|
||||
if($mnet_peer->public_key_expires < time()) {
|
||||
print_string('expired', 'mnet');
|
||||
echo ' ';
|
||||
}
|
||||
echo userdate($mnet_peer->public_key_expires);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if(!empty($currentkey)) {
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"></td>
|
||||
<td valign="top"><?php print_string('keymismatch', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('currentkey', 'mnet'); ?>:</td>
|
||||
<td valign="top"><pre style="font-size: 8px;"><?php echo $currentkey;?></pre></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('last_connect_time', 'mnet'); ?>:</td>
|
||||
<td valign="top"><?php echo ($mnet_peer->last_connect_time == 0)? get_string('never','mnet') : date('H:i:s d/m/Y',$mnet_peer->last_connect_time);?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0){
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('deleted'); ?>:</td>
|
||||
<td valign="top">
|
||||
<input type="radio" name="deleted" value="0" checked="checked" /> <?php print_string('reenableserver','mnet'); ?><br />
|
||||
<input type="radio" name="deleted" value="1" /> <?php print_string('yes'); ?><br />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
|
||||
echo ': <br />';
|
||||
helpbutton("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true, true);
|
||||
?>:</td>
|
||||
<td valign="top"><?php echo $mnet_peer->ip_address; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges"); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
print_tabs(array($tabs), 'mnetdetails');
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
?>
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
|
||||
<td valign="top"><?php echo $mnet_peer->name; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top" colspan="2"><?php print_string('allhosts_no_options'); ?>:</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,100 +0,0 @@
|
||||
<?php
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
$logurl = $CFG->wwwroot.
|
||||
'/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
|
||||
'%2F1&user='.'0'.
|
||||
'&date=0'.
|
||||
'&modid=&modaction=0&logformat=showashtml';
|
||||
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
if ($mnet_peer->id != $CFG->mnet_all_hosts_id) $tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
print_tabs(array($tabs), 'mnetservices');
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" action="mnet_services.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="<?php echo $mnet_peer->nextstep; ?>" />
|
||||
<input type="hidden" name="hostid" value="<?php echo ($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<?php
|
||||
foreach($myservices as $name => $versions) {
|
||||
$version = current($versions);
|
||||
?>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
<h3><?php echo get_string($name.'_name', $version['parent_type'].'_'.$version['parent'] , $mnet_peer->name); ?></h3>
|
||||
<?php echo get_string($name.'_description', $version['parent_type'].'_'.$version['parent'], $mnet_peer->name); ?>
|
||||
<?php
|
||||
$breakstring = '';
|
||||
foreach($versions as $version){
|
||||
if (count($versions) > 1) {
|
||||
$versionstring = '('.get_string('version','mnet') .' '.$version['apiversion'].')';
|
||||
} else {
|
||||
$versionstring = '';
|
||||
}
|
||||
|
||||
echo $breakstring;
|
||||
?>
|
||||
<input type="hidden" name="exists[<?php echo $version['serviceid']; ?>]" value="1" />
|
||||
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked="checked" ': '' ; ?>/>
|
||||
<?php
|
||||
print_string('publish','mnet');
|
||||
echo $versionstring;
|
||||
if (!empty($version['hostsubscribes'])) {
|
||||
echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">√</a> ';
|
||||
}
|
||||
if (!empty($version['allhosts_publish'])) {
|
||||
print_string("enabled_for_all",'mnet',!empty($version['I_publish']));
|
||||
}
|
||||
echo '<br />';
|
||||
?>
|
||||
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked="checked" ': '' ; ?>/>
|
||||
<?php
|
||||
print_string('subscribe','mnet');
|
||||
echo $versionstring;
|
||||
if (!empty($version['hostpublishes'])) {
|
||||
echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">√</a> ';
|
||||
}
|
||||
if (!empty($version['allhosts_subscribe'])) {
|
||||
print_string("enabled_for_all",'mnet',!empty($version['I_subscribe']));
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
$breakstring = '. . . . . . . . . . . . . . . . . . . . . . . . <br>';
|
||||
} // end foreach
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end foreach
|
||||
?>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
<div id="pubTreeLoc"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
<div id="subTreeLoc"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
<div id="formElements"><input type="hidden" name="outer" value="4" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
// Allows the admin to configure services for remote hosts
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetpeers', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
|
||||
// Step must be one of:
|
||||
// input Parse the details of a new host and fetch its public key
|
||||
// commit Save our changes (to a new OR existing host)
|
||||
// force Go ahead with something we've been warned is strange
|
||||
$step = optional_param('step', NULL, PARAM_ALPHA);
|
||||
$hostid = optional_param('hostid', NULL, PARAM_INT);
|
||||
$nocertstring = '';
|
||||
$nocertmatch = '';
|
||||
$badcert = '';
|
||||
$certerror = '';
|
||||
$noipmatch = '';
|
||||
$stradministration = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strmnetsettings = get_string('mnetsettings', 'mnet');
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
$strmneteditservices = get_string('reviewhostservices', 'mnet');
|
||||
|
||||
$mnet_peer = new mnet_peer();
|
||||
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$mnet_peer->set_id($hostid);
|
||||
$treevals = array();
|
||||
foreach($_POST['exists'] as $key => $value) {
|
||||
$host2service = get_record('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
|
||||
$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)) {
|
||||
$host2service = new stdClass();
|
||||
$host2service->hostid = $_POST['hostid'];
|
||||
$host2service->serviceid = $key;
|
||||
|
||||
$host2service->publish = $publish;
|
||||
$host2service->subscribe = $subscribe;
|
||||
|
||||
$host2service->id = insert_record('mnet_host2service', $host2service);
|
||||
} elseif ($host2service->publish != $publish || $host2service->subscribe != $subscribe) {
|
||||
$host2service->publish = $publish;
|
||||
$host2service->subscribe = $subscribe;
|
||||
$tf = update_record('mnet_host2service', $host2service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_int($hostid)) {
|
||||
if (0 == $mnet_peer->id) $mnet_peer->set_id($hostid);
|
||||
$mnet_peer->nextstep = 'verify';
|
||||
|
||||
$id_list = $mnet_peer->id;
|
||||
if (!empty($CFG->mnet_all_hosts_id)) {
|
||||
$id_list .= ', '.$CFG->mnet_all_hosts_id;
|
||||
}
|
||||
|
||||
$concat = sql_concat('COALESCE(h2s.id,0) ', ' \'-\' ', ' svc.id');
|
||||
|
||||
$query = "
|
||||
SELECT DISTINCT
|
||||
$concat as id,
|
||||
svc.id as serviceid,
|
||||
svc.name,
|
||||
svc.offer,
|
||||
svc.apiversion,
|
||||
r.parent_type,
|
||||
r.parent,
|
||||
h2s.hostid,
|
||||
h2s.publish,
|
||||
h2s.subscribe
|
||||
FROM
|
||||
{$CFG->prefix}mnet_service2rpc s2r,
|
||||
{$CFG->prefix}mnet_rpc r,
|
||||
{$CFG->prefix}mnet_service svc
|
||||
LEFT JOIN
|
||||
{$CFG->prefix}mnet_host2service h2s
|
||||
ON
|
||||
h2s.hostid in ($id_list) AND
|
||||
h2s.serviceid = svc.id
|
||||
WHERE
|
||||
svc.offer = '1' AND
|
||||
s2r.serviceid = svc.id AND
|
||||
s2r.rpcid = r.id
|
||||
ORDER BY
|
||||
svc.name ASC";
|
||||
|
||||
$resultset = get_records_sql($query);
|
||||
|
||||
if (is_array($resultset)) {
|
||||
$resultset = array_values($resultset);
|
||||
} else {
|
||||
$resultset = array();
|
||||
}
|
||||
|
||||
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
|
||||
|
||||
$remoteservices = array();
|
||||
if ($hostid != $CFG->mnet_all_hosts_id) {
|
||||
// Create a new request object
|
||||
$mnet_request = new mnet_xmlrpc_client();
|
||||
|
||||
// Tell it the path to the method that we want to execute
|
||||
$mnet_request->set_method('system/listServices');
|
||||
$mnet_request->send($mnet_peer);
|
||||
if (is_array($mnet_request->response)) {
|
||||
foreach($mnet_request->response as $service) {
|
||||
$remoteservices[$service['name']][$service['apiversion']] = $service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$myservices = array();
|
||||
foreach($resultset as $result) {
|
||||
$result->hostpublishes = false;
|
||||
$result->hostsubscribes = false;
|
||||
if (isset($remoteservices[$result->name][$result->apiversion])) {
|
||||
if ($remoteservices[$result->name][$result->apiversion]['publish'] == 1) {
|
||||
$result->hostpublishes = true;
|
||||
}
|
||||
if ($remoteservices[$result->name][$result->apiversion]['subscribe'] == 1) {
|
||||
$result->hostsubscribes = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($myservices[$result->name][$result->apiversion])) {
|
||||
$myservices[$result->name][$result->apiversion] = array('serviceid' => $result->serviceid,
|
||||
'name' => $result->name,
|
||||
'offer' => $result->offer,
|
||||
'apiversion' => $result->apiversion,
|
||||
'parent_type' => $result->parent_type,
|
||||
'parent' => $result->parent,
|
||||
'hostsubscribes' => $result->hostsubscribes,
|
||||
'hostpublishes' => $result->hostpublishes
|
||||
);
|
||||
}
|
||||
|
||||
// allhosts_publish allows us to tell the admin that even though he
|
||||
// is disabling a service, it's still available to the host because
|
||||
// he's also publishing it to 'all hosts'
|
||||
if ($result->hostid == $CFG->mnet_all_hosts_id && $CFG->mnet_all_hosts_id != $mnet_peer->id) {
|
||||
$myservices[$result->name][$result->apiversion]['allhosts_publish'] = $result->publish;
|
||||
$myservices[$result->name][$result->apiversion]['allhosts_subscribe'] = $result->subscribe;
|
||||
} elseif (!empty($result->hostid)) {
|
||||
$myservices[$result->name][$result->apiversion]['I_publish'] = $result->publish;
|
||||
$myservices[$result->name][$result->apiversion]['I_subscribe'] = $result->subscribe;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
redirect('peers.php', get_string('nohostid','mnet'), '5');
|
||||
exit;
|
||||
}
|
||||
|
||||
include('./mnet_services.html');
|
||||
?>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
|
||||
print_box(get_string('mnetdisabled','mnet'));
|
||||
}
|
||||
?>
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<form method="post" action="peers.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="updateregisterall" value="1" />
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" colspan="2"><?php print_string('registerallhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('registerallhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1"><input type="checkbox" name="registerallhosts" <?php if (!empty($CFG->mnet_register_allhosts)) echo 'checked="checked" '; ?>/></td>
|
||||
<td class="cell c1"> <?php print_string('registerallhosts', 'mnet'); ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2"><input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
|
||||
<tr>
|
||||
<th class="header c0"><?php print_string('site'); ?></th>
|
||||
<th class="header c1"><?php print_string('system','mnet'); ?></th>
|
||||
<th class="header c2"><?php print_string('last_connect_time', 'mnet'); ?></th>
|
||||
<th class="header c3"></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
foreach($hosts as $host) {
|
||||
|
||||
if ($host->last_connect_time == 0) {
|
||||
$last_connect = get_string('never');
|
||||
} else {
|
||||
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c0"><a href="peers.php?step=update&hostid=<?php echo $host->id; ?>"><?php echo $host->name; ?></a></td>
|
||||
<td class="cell c1"><a href="peers.php?step=update&hostid=<?php echo $host->id; ?>"><?php echo $host->wwwroot; ?></a></td>
|
||||
<td class="cell c2"><?php if ($host->id != $CFG->mnet_all_hosts_id) echo $last_connect; ?></td>
|
||||
<td class="cell c3">
|
||||
<?php if ($host->id != $CFG->mnet_all_hosts_id){ ?>
|
||||
<form method="post" action="delete.php">
|
||||
<div>
|
||||
<input type="hidden" name="hostid" value="<?php echo $host->id; ?>" />
|
||||
<input type="hidden" name="step" value="verify" />
|
||||
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
|
||||
</div>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<form method="post" action="peers.php">
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
|
||||
|
||||
<tr>
|
||||
<th class="header c4" colspan="4">
|
||||
<?php print_string('addnewhost', 'mnet'); ?>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="input" />
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c4" align="right" colspan="4"><input type="submit" value="<?php print_string('addhost','mnet'); ?>" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,151 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
// Allows the admin to configure other Moodle hosts info
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetpeers', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
|
||||
// Step must be one of:
|
||||
// input Parse the details of a new host and fetch its public key
|
||||
// commit Save our changes (to a new OR existing host)
|
||||
$step = optional_param('step', NULL, PARAM_ALPHA);
|
||||
$hostid = optional_param('hostid', NULL, PARAM_INT);
|
||||
|
||||
// Fetch some strings for the HTML templates
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
|
||||
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
|
||||
|
||||
/// If data submitted, process and store
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
if (!empty($form->wwwroot)) {
|
||||
// ensure we remove trailing slashes
|
||||
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
|
||||
}
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
|
||||
error(get_string('xmlrpc-missing', 'mnet'),'peers.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($form->updateregisterall)) {
|
||||
if (!empty($form->registerallhosts)) {
|
||||
set_config('mnet_register_allhosts',1);
|
||||
} else {
|
||||
set_config('mnet_register_allhosts',0);
|
||||
}
|
||||
redirect('peers.php', get_string('changessaved'));
|
||||
} else {
|
||||
|
||||
$mnet_peer = new mnet_peer();
|
||||
|
||||
if (!empty($form->id)) {
|
||||
$form->id = clean_param($form->id, PARAM_INT);
|
||||
$mnet_peer->set_id($form->id);
|
||||
} else {
|
||||
// PARAM_URL requires a genuine TLD (I think) This breaks my testing
|
||||
$temp_wwwroot = clean_param($form->wwwroot, PARAM_URL);
|
||||
if ($temp_wwwroot !== $form->wwwroot) {
|
||||
trigger_error("We now parse the wwwroot with PARAM_URL. Your URL will need to have a valid TLD, etc.");
|
||||
error(get_string("invalidurl", 'mnet'),'peers.php');
|
||||
exit;
|
||||
}
|
||||
unset($temp_wwwroot);
|
||||
$mnet_peer->bootstrap($form->wwwroot);
|
||||
}
|
||||
|
||||
if (isset($form->name) && $form->name != $mnet_peer->name) {
|
||||
$form->name = clean_param($form->name, PARAM_NOTAGS);
|
||||
$mnet_peer->set_name($form->name);
|
||||
}
|
||||
|
||||
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
|
||||
$mnet_peer->deleted = $form->deleted;
|
||||
}
|
||||
|
||||
if (isset($form->public_key)) {
|
||||
$form->public_key = clean_param($form->public_key, PARAM_PEM);
|
||||
if (empty($form->public_key)) {
|
||||
error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
exit;
|
||||
} 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);
|
||||
if ($mnet_peer->public_key_expires == false) {
|
||||
$mnet_peer->public_key == $oldkey;
|
||||
$errmsg = '<br />';
|
||||
foreach ($mnet_peer->error as $err) {
|
||||
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
|
||||
}
|
||||
error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
|
||||
if ('input' == $form->step) {
|
||||
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
|
||||
error(get_string("hostexists", 'mnet', $mnet_peer->id),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
if ('input' == $form->step) {
|
||||
include('./mnet_review.html');
|
||||
} elseif ('commit' == $form->step) {
|
||||
$bool = $mnet_peer->commit();
|
||||
if ($bool) {
|
||||
redirect('peers.php?step=update&hostid='.$mnet_peer->id, get_string('changessaved'));
|
||||
} else {
|
||||
error('Invalid action parameter.', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (is_int($hostid)) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$currentkey = mnet_get_public_key($mnet_peer->wwwroot);
|
||||
if($currentkey == $mnet_peer->public_key) unset($currentkey);
|
||||
$form = new stdClass();
|
||||
if ($hostid != $CFG->mnet_all_hosts_id) {
|
||||
include('./mnet_review.html');
|
||||
} else {
|
||||
include('./mnet_review_allhosts.html');
|
||||
}
|
||||
} else {
|
||||
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
|
||||
if (empty($hosts)) $hosts = array();
|
||||
include('./peers.html');
|
||||
}
|
||||
?>
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
admin_externalpage_print_header($adminroot);
|
||||
?>
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" colspan="2"><?php print_string('trustedhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('trustedhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2">
|
||||
<form method="post" action="trustedhosts.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<textarea name="hostlist" cols="40" rows="20"><?php echo $trusted_hosts; ?></textarea><br />
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" colspan="2"><?php print_string('testtrustedhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
if (!empty($test_ip_address)){
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2">
|
||||
<?php
|
||||
if ($in_range) {
|
||||
print_string('is_in_range', 'mnet', $test_ip_address);
|
||||
echo '<br />';
|
||||
print_string('validated_by', 'mnet', $validated_by);
|
||||
} else {
|
||||
print_string('not_in_range', 'mnet', $test_ip_address);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('testtrustedhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2">
|
||||
<form method="get" action="trustedhosts.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="text" name="testipaddress" value="<?php echo $test_ip_address; ?>" />
|
||||
<input type="submit" value="<?php print_string('go'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
// Allows the admin to configure services for remote hosts
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('trustedhosts', $adminroot);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
$trusted_hosts = '';//array();
|
||||
$old_trusted_hosts = get_config('mnet', 'mnet_trusted_hosts');
|
||||
if (!empty($old_trusted_hosts)) {
|
||||
$old_trusted_hosts = explode(',', $old_trusted_hosts);
|
||||
} else {
|
||||
$old_trusted_hosts = array();
|
||||
}
|
||||
|
||||
$test_ip_address = optional_param('testipaddress', NULL, PARAM_HOST);
|
||||
$in_range = false;
|
||||
if (!empty($test_ip_address)) {
|
||||
foreach($old_trusted_hosts as $host) {
|
||||
list($network, $mask) = explode('/', $host.'/');
|
||||
if (empty($network)) continue;
|
||||
if (strlen($mask) == 0) $mask = 32;
|
||||
|
||||
if (ip_in_range($test_ip_address, $network, $mask)) {
|
||||
$in_range = true;
|
||||
$validated_by = $network.'/'.$mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If data submitted, process and store
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$hostlist = preg_split("/[\s,]+/", $form->hostlist);
|
||||
foreach($hostlist as $host) {
|
||||
list($address, $mask) = explode('/', $host.'/');
|
||||
if (empty($address)) continue;
|
||||
if (strlen($mask) == 0) $mask = 32;
|
||||
$trusted_hosts .= trim($address).'/'.trim($mask)."\n";
|
||||
unset($address, $mask);
|
||||
}
|
||||
set_config('mnet_trusted_hosts', str_replace("\n", ',', $trusted_hosts), 'mnet');
|
||||
} elseif (!empty($old_trusted_hosts)) {
|
||||
foreach($old_trusted_hosts as $host) {
|
||||
list($address, $mask) = explode('/', $host.'/');
|
||||
if (empty($address)) continue;
|
||||
if (strlen($mask) == 0) $mask = 32;
|
||||
$trusted_hosts .= trim($address).'/'.trim($mask)."\n";
|
||||
unset($address, $mask);
|
||||
}
|
||||
}
|
||||
|
||||
include('./trustedhosts.html');
|
||||
?>
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
|
||||
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
+14
-37
@@ -2,15 +2,10 @@
|
||||
// Allows the admin to manage activity modules
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('../course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
// defines
|
||||
define('MODULE_TABLE','module_administration_table');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('managemodules', $adminroot);
|
||||
require_once('../course/lib.php');
|
||||
|
||||
$show = optional_param('show', '', PARAM_SAFEDIR);
|
||||
$hide = optional_param('hide', '', PARAM_SAFEDIR);
|
||||
@@ -28,7 +23,6 @@
|
||||
$strsettings = get_string("settings");
|
||||
$stractivities = get_string("activities");
|
||||
$stractivitymodule = get_string("activitymodule");
|
||||
$strshowmodulecourse = get_string('showmodulecourse');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
@@ -155,19 +149,16 @@
|
||||
ksort($modulebyname);
|
||||
|
||||
/// Print the table of all modules
|
||||
// construct the flexible table ready to display
|
||||
$table = new flexible_table(MODULE_TABLE);
|
||||
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
|
||||
$table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings));
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
|
||||
$table->set_attribute('id', 'modules');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
$table->head = array ($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings);
|
||||
$table->align = array ("left", "right", "left", "center", "center", "center");
|
||||
$table->wrap = array ("nowrap", "", "", "", "","");
|
||||
$table->size = array ("100%", "10", "10", "10", "10","12");
|
||||
$table->width = "100";
|
||||
|
||||
foreach ($modulebyname as $modulename => $module) {
|
||||
|
||||
// took out hspace="\10\", because it does not validate. don't know what to replace with.
|
||||
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" class=\"icon\" alt=\"\" />";
|
||||
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" hspace=\"10\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" />";
|
||||
|
||||
$delete = "<a href=\"modules.php?delete=$module->name&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
|
||||
@@ -178,40 +169,26 @@
|
||||
}
|
||||
|
||||
$count = count_records_select("$module->name",'course<>0');
|
||||
if ($count>0) {
|
||||
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
|
||||
"&sesskey={$USER->sesskey}\" title=\"$strshowmodulecourse\">$count</a>";
|
||||
}
|
||||
else {
|
||||
$countlink = "$count";
|
||||
}
|
||||
|
||||
if ($module->visible) {
|
||||
$visible = "<a href=\"modules.php?hide=$module->name&sesskey=$USER->sesskey\" title=\"$strhide\">".
|
||||
"<img src=\"$CFG->pixpath/i/hide.gif\" class=\"icon\" alt=\"$strhide\" /></a>";
|
||||
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
|
||||
$class = "";
|
||||
} else {
|
||||
$visible = "<a href=\"modules.php?show=$module->name&sesskey=$USER->sesskey\" title=\"$strshow\">".
|
||||
"<img src=\"$CFG->pixpath/i/show.gif\" class=\"icon\" alt=\"$strshow\" /></a>";
|
||||
$class = " class=\"dimmed_text\"";
|
||||
"<img src=\"$CFG->pixpath/i/show.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
|
||||
$class = "class=\"dimmed_text\"";
|
||||
}
|
||||
if ($module->name == "forum") {
|
||||
$delete = "";
|
||||
$visible = "";
|
||||
$class = "";
|
||||
}
|
||||
|
||||
$table->add_data(array(
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
$settings
|
||||
));
|
||||
$table->data[] = array ("<span $class>$icon $modulename</span>", $count, $module->version, $visible, $delete, $settings);
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
$table->print_html();
|
||||
echo "<br /><br />";
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php /// $Id$
|
||||
/// Search and replace strings throughout all texts in the whole database
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('multilangupgrade', $adminroot);
|
||||
|
||||
$go = optional_param('go', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
###################################################################
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_heading(get_string('multilangupgrade', 'admin'));
|
||||
|
||||
$strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
|
||||
|
||||
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
|
||||
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
|
||||
notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get');
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
if (!$tables = $db->Metatables() ) { // No tables yet at all.
|
||||
error("no tables");
|
||||
}
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
/// Turn off time limits, sometimes upgrades can be slow.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
while(@ob_end_flush());
|
||||
|
||||
echo '<strong>Progress:</strong>';
|
||||
$i = 0;
|
||||
$skiptables = array($CFG->prefix.'config', $CFG->prefix.'user_students', $CFG->prefix.'user_teachers');//, $CFG->prefix.'sessions2');
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if (($CFG->prefix && strpos($table, $CFG->prefix) !== 0)
|
||||
or strpos($table, $CFG->prefix.'pma') === 0) { // Not our tables
|
||||
continue;
|
||||
}
|
||||
if (in_array($table, $skiptables)) { // Don't process these
|
||||
continue;
|
||||
}
|
||||
if ($columns = $db->MetaColumns($table, false)) {
|
||||
if (!array_key_exists('id', $columns) and !array_key_exists('ID', $columns)) {
|
||||
continue; // moodle tables have id
|
||||
}
|
||||
foreach ($columns as $column => $data) {
|
||||
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
|
||||
// first find candidate records
|
||||
$rs = get_recordset_sql("SELECT id, $column FROM $table WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'");
|
||||
if ($rs and $rs->RecordCount() > 0) {
|
||||
while (!$rs->EOF) {
|
||||
$text = $rs->fields[$column];
|
||||
$id = $rs->fields['id'];
|
||||
|
||||
if ($i % 600 == 0) {
|
||||
echo '<br />';
|
||||
}
|
||||
if ($i % 10 == 0) {
|
||||
echo '.';
|
||||
}
|
||||
$i++;
|
||||
$rs->MoveNext();
|
||||
|
||||
if (empty($text) or is_numeric($text)) {
|
||||
continue; // nothing to do
|
||||
}
|
||||
|
||||
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
|
||||
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
|
||||
|
||||
if (is_null($newtext)) {
|
||||
continue; // regex error
|
||||
}
|
||||
|
||||
if ($newtext != $text) {
|
||||
$newtext = addslashes($newtext);
|
||||
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set conversion flag - switches to new plugin automatically
|
||||
set_config('filter_multilang_converted', 1);
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
/// Rebuild course cache which might be incorrect now
|
||||
notify('Rebuilding course cache...', 'notifysuccess');
|
||||
rebuild_course_cache();
|
||||
notify('...finished', 'notifysuccess');
|
||||
|
||||
print_continue('index.php');
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
|
||||
|
||||
function multilangupgrade_impl($langblock) {
|
||||
$searchtosplit = '/<(?:lang|span) lang="([a-zA-Z0-9_-]*)".*?>(.+?)<\/(?:lang|span)>/is';
|
||||
preg_match_all($searchtosplit, $langblock[0], $rawlanglist);
|
||||
$return = '';
|
||||
foreach ($rawlanglist[1] as $index=>$lang) {
|
||||
$return .= '<span lang="'.$lang.'" class="multilang">'.$rawlanglist[2][$index].'</span>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
?>
|
||||
+1
-1
@@ -99,7 +99,7 @@ function online_assignment_cleanup($output=false) {
|
||||
|
||||
/// grab the section record
|
||||
if (!($section = get_record('course_sections', 'id', $newsection))) {
|
||||
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'<br />';
|
||||
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '.$course->fullname.'<br />';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+9
-16
@@ -4,18 +4,11 @@ require_once($CFG->libdir.'/pagelib.php');
|
||||
|
||||
define('PAGE_ADMIN', 'admin');
|
||||
|
||||
// Bounds for block widths
|
||||
// more flexible for theme designers taken from theme config.php
|
||||
$lmin = (empty($THEME->block_l_min_width)) ? 0 : $THEME->block_l_min_width;
|
||||
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
|
||||
$rmin = (empty($THEME->block_r_min_width)) ? 0 : $THEME->block_r_min_width;
|
||||
$rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width;
|
||||
define('BLOCK_L_MIN_WIDTH',0);
|
||||
define('BLOCK_L_MAX_WIDTH',210);
|
||||
define('BLOCK_R_MIN_WIDTH',0);
|
||||
define('BLOCK_R_MAX_WIDTH',210);
|
||||
|
||||
define('BLOCK_L_MIN_WIDTH', $lmin);
|
||||
define('BLOCK_L_MAX_WIDTH', $lmax);
|
||||
define('BLOCK_R_MIN_WIDTH', $rmin);
|
||||
define('BLOCK_R_MAX_WIDTH', $rmax);
|
||||
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
class page_admin extends page_base {
|
||||
@@ -116,12 +109,12 @@ class page_admin extends page_base {
|
||||
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
|
||||
// if not, print_header() has to be called with a $section parameter
|
||||
|
||||
// The search page currently doesn't handle block editing
|
||||
if ($this->section != 'search' and $this->user_allowed_editing()) {
|
||||
$buttons = '<div><form '.$CFG->frametarget.' method="get" action="' . $this->url_get_path() . '">'.
|
||||
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
if ($this->user_allowed_editing()) {
|
||||
$buttons = '<table><tr><td><form target="' . $CFG->framename . '" method="get" action="' . $this->url_get_path() . '">'.
|
||||
'<input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
'<input type="hidden" name="section" value="'.$this->section.'" />'.
|
||||
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></div>';
|
||||
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></form></td>' .
|
||||
'</tr></table>';
|
||||
} else {
|
||||
$buttons = ' ';
|
||||
}
|
||||
|
||||
@@ -20,14 +20,8 @@
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
/// Delete styles from output
|
||||
$html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
|
||||
$html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
|
||||
/// Delete DOCTYPE from output
|
||||
$html = preg_replace('/<!DOCTYPE html PUBLIC.*?>/is', '', $html);
|
||||
/// Delete body and html tags
|
||||
$html = preg_replace('/<html.*?>.*?<body.*?>/is', '', $html);
|
||||
$html = preg_replace('/<\/body><\/html>/is', '', $html);
|
||||
|
||||
echo $html;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
$subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname));
|
||||
$body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n";
|
||||
$subject = get_string('noreplybouncesubject','moodle',$site->fullname);
|
||||
$body = get_string('noreplybouncemessage','moodle',$site->fullname)."\n\n";
|
||||
|
||||
$fd = fopen('php://stdin','r');
|
||||
if ($fd) {
|
||||
|
||||
+87
-74
@@ -34,94 +34,98 @@
|
||||
$strregistration = get_string("registration");
|
||||
$strregistrationinfo = get_string("registrationinfo");
|
||||
|
||||
print_header("$site->shortname: $strregistration", $site->fullname,
|
||||
print_header("$site->shortname: $strregistration", "$site->fullname",
|
||||
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
|
||||
|
||||
print_heading($strregistration);
|
||||
|
||||
print_simple_box($strregistrationinfo, "center", "70%");
|
||||
echo "<br />";
|
||||
|
||||
|
||||
/// Print the form
|
||||
|
||||
echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
|
||||
echo '<fieldset id="registration">';
|
||||
echo '<legend>Registration Information</legend>';
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
echo "<form name=\"form\" action=\"http://moodle.org/register/\" method=\"post\">\n";
|
||||
echo "<table cellpadding=\"9\" border=\"0\">\n";
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"center\" colspan=\"2\">".get_string("location")."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">Moodle URL:</td>\n";
|
||||
echo "<td>$CFG->wwwroot</td>\n";
|
||||
echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
|
||||
echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
|
||||
echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
|
||||
echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\" />\n";
|
||||
|
||||
echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\">\n";
|
||||
echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\">\n";
|
||||
echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\">\n";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\" />\n";
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("currentversion").":</td>\n";
|
||||
echo "<td>$CFG->release ($CFG->version)</td>\n";
|
||||
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\">\n";
|
||||
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\">\n";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label>URL</label></div>';
|
||||
echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
|
||||
echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo '<input size="50" id="sitename" type="text" name="sitename" value="'.format_string($site->fullname).'" />';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("fullsitename").":</td>\n";
|
||||
echo "<td><input size=\"50\" type=\"text\" name=\"sitename\" value=\"$site->fullname\"></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="menucountry">'.get_string("country").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("country").":</td>\n";
|
||||
echo "<td>";
|
||||
choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="menupublic">'."<a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"".get_string("publicdirectorytitle")."\">".get_string("publicdirectory")."</a>".'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\"><a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"See the current list of sites\" target=_blank>".get_string("publicdirectory")."</a>:</td>\n";
|
||||
echo "<td>";
|
||||
$options[0] = get_string("publicdirectory0");
|
||||
$options[1] = get_string("publicdirectory1");
|
||||
$options[2] = get_string("publicdirectory2");
|
||||
choose_from_menu ($options, "public", "2", "", "", "");
|
||||
unset($options);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="menucontact">'.get_string("registrationcontact").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("registrationcontact")."</a>:</td>\n";
|
||||
echo "<td>\n";
|
||||
$options[0] = get_string("registrationcontactno");
|
||||
$options[1] = get_string("registrationcontactyes");
|
||||
choose_from_menu ($options, "contact", "1", "", "", "");
|
||||
unset($options);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("statistics").":";
|
||||
echo "<br />(".get_string("notpublic").')';
|
||||
echo "</td>\n";
|
||||
echo "<td>";
|
||||
|
||||
$count = count_records('course')-1;
|
||||
echo get_string("courses").": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"courses\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"courses\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
$count = count_records('user', 'deleted', 0);
|
||||
echo get_string("users").": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"users\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
// total number of role assignments
|
||||
$count = count_records('role_assignments');
|
||||
echo get_string('roleassignments', 'role').": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
// first find all distinct roles with mod/course:update
|
||||
@@ -136,55 +140,64 @@
|
||||
|
||||
$count = count_records_sql($sql);
|
||||
echo get_string("teachers").": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
$count = count_records('forum_posts');
|
||||
echo get_string("posts", 'forum').": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
$count = count_records('question');
|
||||
echo get_string("questions", 'quiz').": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
$count = count_records('resource');
|
||||
echo get_string("modulenameplural", "resource").": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<input size=\"50\" type=\"text\" id=\"adminname\" name=\"adminname\" value=\"".fullname($admin, true)."\" />";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="adminemail">'.get_string("email").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<input size=\"50\" type=\"text\" id=\"adminemail\" name=\"adminemail\" value=\"$admin->email\" />";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle"><label for="menumailme">'.get_string("registrationemail").'</label></div>';
|
||||
echo '<div class="felement ftext">';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"center\" colspan=\"2\"><hr size=\"1\" noshade>".get_string("administrator")."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("administrator").":</td>\n";
|
||||
echo "<td><input size=\"50\" type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("email").":</td>\n";
|
||||
echo "<td><input size=\"50\" type=\"text\" name=\"adminemail\" value=\"$admin->email\"></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\">".get_string("registrationemail")."</a>:</td>\n";
|
||||
echo "<td>\n";
|
||||
$options[0] = get_string("registrationno");
|
||||
$options[1] = get_string("registrationyes");
|
||||
choose_from_menu ($options, "mailme", "1", "", "", "");
|
||||
unset($options);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td align=\"right\"> </td>\n";
|
||||
echo "<td><input type=\"submit\" value=\"".get_string("registrationsend")."\"></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</fieldset>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
echo "<br />\n";
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+4
-4
@@ -25,10 +25,10 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr
|
||||
print_simple_box_start('center');
|
||||
echo '<div align="center">';
|
||||
echo '<form action="replace.php" method="post">';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo 'Search whole database for: <input type="text" name="search" /><br />';
|
||||
echo 'Replace with this string: <input type="text" name="replace" /><br />';
|
||||
echo '<input type="submit" value="Yes, do it now" /><br />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">';
|
||||
echo 'Search whole database for: <input type="text" name="search"><br />';
|
||||
echo 'Replace with this string: <input type="text" name="replace"><br /></br />';
|
||||
echo '<input type="submit" value="Yes, do it now"><br />';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed?
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
if (empty($timeoptions)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id, $adminroot);
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
echo '<form action="index.php" method="post">'."\n";
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
|
||||
$table->width = '*';
|
||||
|
||||
$table->align = array('left','left','left','left','left','left');
|
||||
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
|
||||
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
|
||||
@@ -60,7 +60,6 @@
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
print_table($table);
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
@@ -80,13 +79,13 @@
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
notify(get_string('statsnodata'));echo '</td></tr></table>';echo '<p>after notify</p>';
|
||||
notify(get_string('statsnodata'));
|
||||
|
||||
} else {
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo '<div class="boxaligncenter">(' . get_string("gdneed") .')</div>';
|
||||
echo '<div align="center">(' . get_string("gdneed") .')</div>';
|
||||
} else {
|
||||
echo '<div class="boxaligncenter"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
echo '<div align="center"><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
}
|
||||
|
||||
$table = new StdClass;
|
||||
@@ -115,6 +114,7 @@
|
||||
print_table($table);
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -16,18 +16,16 @@
|
||||
|
||||
print_heading(get_string('chooselogs') .':');
|
||||
|
||||
print_mnet_log_selector_form($CFG->mnet_localhost_id, $course);
|
||||
print_log_selector_form($course);
|
||||
|
||||
echo '<br />';
|
||||
print_heading(get_string('chooselivelogs') .':');
|
||||
|
||||
$heading = link_to_popup_window('/course/report/log/live.php?id='. $course->id,
|
||||
'livelog', get_string('livelogs'),
|
||||
500, 800, '', 'none', true);
|
||||
|
||||
print_heading($heading, 'center', 3);
|
||||
echo '<center><h3>';
|
||||
link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
|
||||
echo '</h3></center>';
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -38,14 +38,14 @@ class ExHtmlReporter extends HtmlReporter {
|
||||
* @param bool $showpasses Whether this reporter should output anything for passes.
|
||||
*/
|
||||
function ExHtmlReporter($showpasses) {
|
||||
global $CFG, $THEME;
|
||||
global $CFG;
|
||||
|
||||
$this->HtmlReporter();
|
||||
$this->showpasses = $showpasses;
|
||||
|
||||
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
|
||||
$this->strrunonlyfile = $this->get_string('runonlyfile');
|
||||
$this->strseparator = get_separator();
|
||||
$this->strseparator = ' <img src="' . $CFG->pixpath . '/a/r_breadcrumb.gif" class="resize" alt="" /> ';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,18 +90,16 @@ if (!is_null($path)) {
|
||||
}
|
||||
// Print the form for adjusting options.
|
||||
print_simple_box_start('center', '70%');
|
||||
echo '<form method="get" action="index.php">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<form method="GET" action="index.php">';
|
||||
print_heading($formheader);
|
||||
echo '<p>'; print_checkbox('showpasses', 1, $showpasses, get_string('showpasses', $langfile)); echo '</p>';
|
||||
echo '<p>'; print_checkbox('showsearch', 1, $showsearch, get_string('showsearch', $langfile)); echo '</p>';
|
||||
echo '<p>'; print_checkbox('thorough', 1, $thorough, get_string('thorough', $langfile)); echo '</p>';
|
||||
echo '<p>';
|
||||
echo '<label for="path">', get_string('onlytest', $langfile), '</label> ';
|
||||
echo '<input type="text" id="path" name="path" value="', $displaypath, '" size="40" />';
|
||||
echo '<input type="text" id="path" name="path" value="', $displaypath, '" size="60" />';
|
||||
echo '</p>';
|
||||
echo '<input type="submit" value="' . get_string('runtests', $langfile) . '" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
if ($mode == STATS_MODE_RANKED) {
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3, $adminroot);
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time);
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
@@ -46,7 +46,7 @@
|
||||
require_login();
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'));
|
||||
}
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
@@ -59,7 +59,7 @@
|
||||
// $strreports = get_string("reports");
|
||||
// $strstats = get_string('stats');
|
||||
//
|
||||
// $menu = report_stats_mode_menu($course, $mode, $time); // add 4th $url parameter if uncommented!
|
||||
// $menu = report_stats_mode_menu($course, $mode, $time);
|
||||
//
|
||||
//
|
||||
// $crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
|
||||
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
echo '<form action="allowassign.php" method="post">';
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<div class="singlebutton"><input type="submit" value="'.get_string('savechanges').'"/></div>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</div></form>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@
|
||||
|
||||
echo '<form action="allowoverride.php" method="post">';
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<div class="singlebutton"><input type="submit" value="'.get_string('savechanges').'"/></div>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</div></form>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
+58
-63
@@ -1,21 +1,27 @@
|
||||
<form id="assignform" method="post" action="">
|
||||
<div>
|
||||
|
||||
<form name="assignform" id="assignform" method="post" action="">
|
||||
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
|
||||
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
|
||||
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
|
||||
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
|
||||
<table summary="" style="margin-left:auto;margin-right:auto" border="0" cellpadding="5" cellspacing="0">
|
||||
<table align="center" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<label for="removeselect"><?php print_string('existingusers', 'role', count($contextusers)); ?></label>
|
||||
<br />
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
|
||||
onfocus="getElementById('assignform').add.disabled=true;
|
||||
getElementById('assignform').remove.disabled=false;
|
||||
getElementById('assignform').addselect.selectedIndex=-1;">
|
||||
|
||||
<?php print_string('existingusers', 'role', count($contextusers)); ?>
|
||||
</td>
|
||||
<td></td>
|
||||
<td valign="top">
|
||||
<?php print_string('potentialusers', 'role', $usercount); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple
|
||||
onFocus="document.assignform.add.disabled=true;
|
||||
document.assignform.remove.disabled=false;
|
||||
document.assignform.addselect.selectedIndex=-1;" />
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($contextusers as $contextuser) {
|
||||
@@ -32,83 +38,72 @@
|
||||
echo '<option/>'; // empty select breaks xhtml strict
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</select></td>
|
||||
<td valign="top">
|
||||
<br />
|
||||
<label title="<?php print_string('hiddenassign') ?>">
|
||||
<input type="checkbox" name="hidden" value="1" />
|
||||
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" />
|
||||
<?php helpbutton('hiddenassign', get_string('hiddenassign')); ?>
|
||||
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" /> <?
|
||||
helpbutton ('hiddenassign', get_string('hiddenassign'));
|
||||
?>
|
||||
</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'); ?>" />
|
||||
</p>
|
||||
<br />
|
||||
<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'); ?>" />
|
||||
<br />
|
||||
</td>
|
||||
<td valign="top">
|
||||
<label for="addselect"><?php print_string('potentialusers', 'role', $usercount); ?></label>
|
||||
<br />
|
||||
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
|
||||
onfocus="getElementById('assignform').add.disabled=false;
|
||||
getElementById('assignform').remove.disabled=true;
|
||||
getElementById('assignform').removeselect.selectedIndex=-1;">
|
||||
<select name="addselect[]" size="20" id="addselect" multiple
|
||||
onFocus="document.assignform.add.disabled=false;
|
||||
document.assignform.remove.disabled=true;
|
||||
document.assignform.removeselect.selectedIndex=-1;">
|
||||
<?php
|
||||
$i=0;
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\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++;
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
} else {
|
||||
if ($usercount > MAX_USERS_PER_PAGE) {
|
||||
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\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";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
|
||||
} else {
|
||||
if ($usercount > MAX_USERS_PER_PAGE) {
|
||||
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
|
||||
.'<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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($i==0) {
|
||||
echo '<option/>'; // empty select breaks xhtml strict
|
||||
}
|
||||
} 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<label for="searchtext" class="accesshide"><?php p($strsearch) ?></label>
|
||||
<input type="text" name="searchtext" id="searchtext" size="30" value="<?php p($searchtext, true) ?>"
|
||||
onfocus ="getElementById('assignform').add.disabled=true;
|
||||
getElementById('assignform').remove.disabled=true;
|
||||
getElementById('assignform').removeselect.selectedIndex=-1;
|
||||
getElementById('assignform').addselect.selectedIndex=-1;"
|
||||
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
|
||||
onFocus ="document.assignform.add.disabled=true;
|
||||
document.assignform.remove.disabled=true;
|
||||
document.assignform.removeselect.selectedIndex=-1;
|
||||
document.assignform.addselect.selectedIndex=-1;"
|
||||
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
|
||||
if (keyCode == 13) {
|
||||
getElementById('assignform').previoussearch.value=1;
|
||||
getElementById('assignform').submit();
|
||||
document.assignform.previoussearch.value=1;
|
||||
document.assignform.submit();
|
||||
} " />
|
||||
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
|
||||
<?php
|
||||
if (!empty($searchtext)) {
|
||||
if (!empty($searchusers)) {
|
||||
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
+28
-36
@@ -36,6 +36,7 @@
|
||||
error("Context ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
|
||||
$inmeta = 0;
|
||||
if ($context->contextlevel == CONTEXT_COURSE) {
|
||||
$courseid = $context->instanceid;
|
||||
@@ -50,11 +51,9 @@
|
||||
}
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
$course = clone($SITE);
|
||||
$course = get_site();
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_COURSE) {
|
||||
require_login($context->instanceid);
|
||||
} else {
|
||||
@@ -63,9 +62,7 @@
|
||||
|
||||
require_capability('moodle/role:assign', $context);
|
||||
|
||||
/// needed for tabs.php
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
@@ -103,13 +100,13 @@
|
||||
if ($courseid != SITEID) {
|
||||
print_header("$fullname", "$fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> ->".$straction,
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> ->".$straction,
|
||||
"", "", true, " ", navmenu($course));
|
||||
|
||||
/// site header
|
||||
} else {
|
||||
print_header("$course->fullname: $fullname", $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> -> $straction", "", "", true, " ", navmenu($course));
|
||||
print_header("$course->fullname: $fullname", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname</a> -> $straction", "", "", true, " ", navmenu($course));
|
||||
}
|
||||
|
||||
$showroles = 1;
|
||||
@@ -119,19 +116,13 @@
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('assignroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('frontpageroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
|
||||
/// Process incoming role assignment
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
@@ -168,7 +159,7 @@
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$topleveladmin = false;
|
||||
|
||||
|
||||
// we only worry about this if the role has doanything capability at site level
|
||||
if ($context->id == $sitecontext->id && $adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext)) {
|
||||
foreach ($adminroles as $adminrole) {
|
||||
@@ -177,7 +168,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($frm->removeselect as $removeuser) {
|
||||
$removeuser = clean_param($removeuser, PARAM_INT);
|
||||
|
||||
@@ -204,16 +195,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
|
||||
} else {
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
}
|
||||
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
|
||||
if ($context->contextlevel==CONTEXT_SYSTEM) {
|
||||
print_box(get_string('globalroleswarning', 'role'));
|
||||
print_simple_box(get_string('globalroleswarning', 'role'));
|
||||
}
|
||||
|
||||
|
||||
if ($roleid) { /// prints a form to swap roles
|
||||
|
||||
/// Get all existing participants in this context.
|
||||
@@ -223,8 +211,8 @@
|
||||
$contextusers = array();
|
||||
}
|
||||
|
||||
$select = "username <> 'guest' AND deleted = 0 AND confirmed = 1";
|
||||
|
||||
$select = "username <> 'guest' AND username <> 'changeme' AND deleted = 0 AND confirmed = 1";
|
||||
|
||||
$usercount = count_records_select('user', $select) - count($contextusers);
|
||||
|
||||
$searchtext = trim($searchtext);
|
||||
@@ -236,18 +224,22 @@
|
||||
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
|
||||
}
|
||||
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
|
||||
FROM '.$CFG->prefix.'user
|
||||
WHERE '.$select.'
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
|
||||
/// In the .html file below we loop through these results and exclude any in $contextusers
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$assignableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletoassign);
|
||||
echo '</div>';
|
||||
|
||||
echo '<form name="rolesform" action="assign.php" method="post">';
|
||||
echo '<div align="center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
if ($userid) {
|
||||
echo '<input type="hidden" name="userid" value="'.$userid.'" />';
|
||||
}
|
||||
echo '<input type="hidden" name="courseid" value="'.$courseid.'" />';
|
||||
echo '<input type="hidden" name="contextid" value="'.$context->id.'" />'.$strroletoassign.': ';
|
||||
choose_from_menu ($assignableroles, 'roleid', $roleid, get_string('listallroles', 'role').'...', $script='rolesform.submit()');
|
||||
echo '</div></form>';
|
||||
|
||||
print_simple_box_start('center');
|
||||
include('assign.html');
|
||||
@@ -288,7 +280,7 @@
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
} else {
|
||||
print_footer($course);
|
||||
|
||||
+60
-120
@@ -4,106 +4,72 @@
|
||||
case 'add':
|
||||
$submitlabel = get_string('addrole', 'role');
|
||||
break;
|
||||
case 'view':
|
||||
$submitlabel = get_string('listallroles', 'role');
|
||||
break;
|
||||
case 'edit':
|
||||
default:
|
||||
$submitlabel = get_string('savechanges');
|
||||
}
|
||||
?>
|
||||
|
||||
if ($action == 'view') {
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<form id="rolesform" action="manage.php" method="post">
|
||||
<fieldset class="invisiblefieldset">
|
||||
|
||||
<form name="rolesform" action="manage.php" method="post">
|
||||
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<input type="hidden" name="action" value="<?php if ($action != 'view') { echo p($action); } ?>" />
|
||||
</fieldset>
|
||||
<table class="roledesc" cellpadding="9" cellspacing="0">
|
||||
<?php if ($action == 'view') { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('name') ?>:</td>
|
||||
<td><?php p($role->name); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('shortname') ?>:</td>
|
||||
<td><?php p($role->shortname); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('description') ?>:</td>
|
||||
<td><?php p($role->description); $usehtmleditor = false; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('legacytype', 'role') ?>:</td>
|
||||
<td><?php
|
||||
$usehtmleditor = false;
|
||||
if (empty($role->legacytype)) {
|
||||
print_string('none');
|
||||
} else {
|
||||
print_string('legacy:'.$role->legacytype, 'role');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="name"><?php print_string('name') ?></label></td>
|
||||
<td><?php
|
||||
echo '<input type="text" id="name" name="name" maxlength="254" size="50" value="'.s($role->name).'" />';
|
||||
if (isset($errors["name"])) formerr($errors["name"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="shortname"><?php print_string('shortname') ?></label></td>
|
||||
<td><?php
|
||||
echo '<input type="text" id="shortname" name="shortname" maxlength="20" size="15" value="'.s($role->shortname).'" />';
|
||||
if (isset($errors["shortname"])) formerr($errors["shortname"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="edit-description"><?php print_string('description') ?></label></td>
|
||||
<td><?php
|
||||
print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', $role->description);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="menulegacytype"><?php print_string('legacytype', 'role') ?></label></td>
|
||||
<td><?php
|
||||
$options = array();
|
||||
$options[''] = get_string('none');
|
||||
$legacyroles = get_legacy_roles();
|
||||
foreach($legacyroles as $ltype=>$lcap) {
|
||||
$options[$ltype] = get_string('legacy:'.$ltype, 'role');
|
||||
}
|
||||
choose_from_menu($options, 'legacytype', $role->legacytype, '');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<table cellpadding="9" cellspacing="0" align="center">
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('name') ?>:</td>
|
||||
<td><?php
|
||||
if ($action == 'view') {
|
||||
p($role->name);
|
||||
} else {
|
||||
echo '<input type="text" name="name" maxlength="254" size="50" value="'.s($role->name).'" />';
|
||||
if (isset($errors["name"])) formerr($errors["name"]);
|
||||
} ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('shortname') ?>:</td>
|
||||
<td><?php
|
||||
if ($action == 'view') {
|
||||
p($role->shortname);
|
||||
} else {
|
||||
echo '<input type="text" name="shortname" maxlength="20" size="15" value="'.s($role->shortname).'" />';
|
||||
if (isset($errors["shortname"])) formerr($errors["shortname"]);
|
||||
} ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('description') ?>:</td>
|
||||
<td><?php
|
||||
if ($action == 'view') {
|
||||
p($role->description);
|
||||
$usehtmleditor = false;
|
||||
} else {
|
||||
print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', $role->description);
|
||||
} ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
print_heading_with_help(get_string('permissions','role'), 'permissions');
|
||||
|
||||
$strinherit = get_string('notset','role');
|
||||
$strinherit = get_string('inherit','role');
|
||||
$strallow = get_string('allow','role');
|
||||
$strprevent = get_string('prevent','role');
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
?>
|
||||
|
||||
<table class="rolecap">
|
||||
<table class="rolecap" align="center">
|
||||
|
||||
<tr>
|
||||
<th class="name" align="left" scope="col"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit" scope="col"><?php p($strinherit); ?></th>
|
||||
<th class="allow" scope="col"><?php p($strallow); ?></th>
|
||||
<th class="prevent" scope="col"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit" scope="col"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5" scope="col"><?php print_string('risks','role') ?></th>
|
||||
<th class="name" align="left"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit"><?php p($strinherit); ?></th>
|
||||
<th class="allow"><?php p($strallow); ?></th>
|
||||
<th class="prevent"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5"><?php print_string('risks','role') ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
@@ -115,20 +81,7 @@ $component = '';
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
// prepare legacy defaults
|
||||
if (!empty($role->legacytype)) {
|
||||
$defaultcaps = get_default_capabilities($role->legacytype);
|
||||
} else {
|
||||
$defaultcaps = false;
|
||||
}
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
//legacy caps have their own selector
|
||||
if (islegacy($capability->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// prints a breaker if component or name or context level
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.
|
||||
@@ -141,6 +94,7 @@ foreach ($capabilities as $capability) {
|
||||
|
||||
if (empty($errors)) {
|
||||
// check the capability override for this cap, this role in this context
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$localoverride = get_local_override($roleid, $sitecontext->id, $capability->name);
|
||||
} else {
|
||||
$localoverride = new object();
|
||||
@@ -152,53 +106,39 @@ foreach ($capabilities as $capability) {
|
||||
$riskinfo = '<td class="risk managetrust">';
|
||||
$rowclasses = '';
|
||||
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">T</a>';
|
||||
$rowclasses .= ' riskmanagetrust';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk config">';
|
||||
if (RISK_CONFIG & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">C</a>';
|
||||
$rowclasses .= ' riskconfig';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk xss">';
|
||||
if (RISK_XSS & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">X</a>';
|
||||
$rowclasses .= ' riskxss';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk personal">';
|
||||
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">P</a>';
|
||||
$rowclasses .= ' riskpersonal';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk spam">';
|
||||
if (RISK_SPAM & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">S</a>';
|
||||
$rowclasses .= ' riskspam';
|
||||
}
|
||||
$riskinfo .= '</td>';
|
||||
|
||||
$isinherit = (!isset($defaultcaps[$capability->name]) or $defaultcaps[$capability->name] == CAP_INHERIT) ? 'capdefault' : '';
|
||||
$isallow = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_ALLOW) ? 'capdefault' : '';
|
||||
$isprevent = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_PREVENT) ? 'capdefault' : '';
|
||||
$isprohibit = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_PROHIBIT) ? 'capdefault' : '';
|
||||
|
||||
?>
|
||||
|
||||
<tr class="rolecap <?php echo $rowclasses; ?>">
|
||||
<td class="name"><span class="cap-desc"><a onclick="this.target='docspopup'" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></span></td>
|
||||
<td class="inherit <?php echo $isinherit ?>">
|
||||
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_INHERIT ?>" <?php if (!isset($localoverride->permission) || $localoverride->permission==CAP_INHERIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="allow <?php echo $isallow ?>">
|
||||
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_ALLOW ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_ALLOW){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prevent <?php echo $isprevent ?>" >
|
||||
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PREVENT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PREVENT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prohibit <?php echo $isprohibit ?>" >
|
||||
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PROHIBIT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PROHIBIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="name"><span class="cap-desc"><a target="docspopup" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></label></td>
|
||||
<td class="inherit"><input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_INHERIT ?>" <?php if (!isset($localoverride->permission) || $localoverride->permission==CAP_INHERIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="allow"><input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_ALLOW ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_ALLOW){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prevent" ><input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PREVENT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PREVENT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
<td class="prohibit" ><input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PROHIBIT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PROHIBIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
|
||||
|
||||
<?php echo $riskinfo; ?>
|
||||
|
||||
@@ -207,11 +147,11 @@ foreach ($capabilities as $capability) {
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
<?php if ($action != 'view') { ?>
|
||||
<div class="submit buttons">
|
||||
<div class="submit" align="center">
|
||||
<input type="submit" value="<?php p($submitlabel) ?>" />
|
||||
<?php if ($action != 'view') { ?>
|
||||
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
+32
-203
@@ -15,8 +15,7 @@
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
if ($cancel) {
|
||||
@@ -44,12 +43,6 @@
|
||||
$i++;
|
||||
}
|
||||
|
||||
// do not delete these default system roles
|
||||
$defaultroles = array();
|
||||
$defaultroles[] = $CFG->notloggedinroleid;
|
||||
$defaultroles[] = $CFG->guestroleid;
|
||||
$defaultroles[] = $CFG->defaultuserroleid;
|
||||
$defaultroles[] = $CFG->defaultcourseroleid;
|
||||
|
||||
/// form processing, editing a role, adding a role, deleting a role etc.
|
||||
switch ($action) {
|
||||
@@ -57,12 +50,6 @@
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
$shortname = moodle_strtolower(clean_param(clean_filename($shortname), PARAM_SAFEDIR)); // only lowercase safe ASCII characters
|
||||
$legacytype = required_param('legacytype', PARAM_RAW);
|
||||
|
||||
$legacyroles = get_legacy_roles();
|
||||
if (!array_key_exists($legacytype, $legacyroles)) {
|
||||
$legacytype = '';
|
||||
}
|
||||
|
||||
if (empty($name)) {
|
||||
$errors['name'] = get_string('errorbadrolename', 'role');
|
||||
@@ -77,19 +64,12 @@
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$newroleid = create_role($name, $shortname, $description);
|
||||
|
||||
// set proper legacy type
|
||||
if (!empty($legacytype)) {
|
||||
assign_capability($legacyroles[$legacytype], CAP_ALLOW, $newroleid, $sitecontext->id);
|
||||
}
|
||||
|
||||
$newrole = create_role($name, $shortname, $description);
|
||||
} else {
|
||||
$newrole = new object();
|
||||
$newrole->name = $name;
|
||||
$newrole->shortname = $shortname;
|
||||
$newrole->name = $name;
|
||||
$newrole->shortname = $shortname;
|
||||
$newrole->description = $description;
|
||||
$newrole->legacytype = $legacytype;
|
||||
}
|
||||
|
||||
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
|
||||
@@ -99,12 +79,6 @@
|
||||
if (!isset($data->{$cap->name})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// legacy caps have their own selector
|
||||
if (islegacy($data->{$cap->name})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$capname = $cap->name;
|
||||
$value = clean_param($data->{$cap->name}, PARAM_INT);
|
||||
if (!in_array($value, $allowed_values)) {
|
||||
@@ -112,12 +86,11 @@
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
assign_capability($capname, $value, $newroleid, $sitecontext->id);
|
||||
assign_capability($capname, $value, $newrole, $sitecontext->id);
|
||||
} else {
|
||||
$newrole->$capname = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
redirect('manage.php');
|
||||
}
|
||||
@@ -128,12 +101,6 @@
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
$shortname = moodle_strtolower(clean_param(clean_filename($shortname), PARAM_SAFEDIR)); // only lowercase safe ASCII characters
|
||||
$legacytype = required_param('legacytype', PARAM_RAW);
|
||||
|
||||
$legacyroles = get_legacy_roles();
|
||||
if (!array_key_exists($legacytype, $legacyroles)) {
|
||||
$legacytype = '';
|
||||
}
|
||||
|
||||
if (empty($name)) {
|
||||
$errors['name'] = get_string('errorbadrolename', 'role');
|
||||
@@ -154,10 +121,9 @@
|
||||
}
|
||||
if (!empty($errors)) {
|
||||
$newrole = new object();
|
||||
$newrole->name = $name;
|
||||
$newrole->shortname = $shortname;
|
||||
$newrole->name = $name;
|
||||
$newrole->shortname = $shortname;
|
||||
$newrole->description = $description;
|
||||
$newrole->legacytype = $legacytype;
|
||||
}
|
||||
|
||||
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
|
||||
@@ -167,12 +133,6 @@
|
||||
if (!isset($data->{$cap->name})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// legacy caps have their own selector
|
||||
if (islegacy($data->{$cap->name}) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$capname = $cap->name;
|
||||
$value = clean_param($data->{$cap->name}, PARAM_INT);
|
||||
if (!in_array($value, $allowed_values)) {
|
||||
@@ -206,7 +166,6 @@
|
||||
assign_capability($capname, $value, $roleid, $sitecontext->id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
@@ -219,25 +178,12 @@
|
||||
if (!update_record('role', $role)) {
|
||||
error('Could not update role!');
|
||||
}
|
||||
|
||||
// set proper legacy type
|
||||
foreach($legacyroles as $ltype=>$lcap) {
|
||||
if ($ltype == $legacytype) {
|
||||
assign_capability($lcap, CAP_ALLOW, $roleid, $sitecontext->id);
|
||||
} else {
|
||||
unassign_capability($lcap, $roleid);
|
||||
}
|
||||
}
|
||||
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
if (in_array($roleid, $defaultroles)) {
|
||||
error('This role is used as one of the default system roles, it can not be deleted');
|
||||
}
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
if (!delete_role($roleid)) {
|
||||
error('Could not delete role with ID '.$roleid);
|
||||
@@ -290,94 +236,9 @@
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
case 'duplicate':
|
||||
if (!array_key_exists($roleid, $roles)) {
|
||||
redirect('manage.php');
|
||||
}
|
||||
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
//ok - lets duplicate!
|
||||
} else {
|
||||
// show confirmation
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$optionsyes = array('action'=>'duplicate', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
|
||||
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
|
||||
$a = new object();
|
||||
$a->id = $roleid;
|
||||
$a->name = $roles[$roleid]->name;
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
notice_yesno(get_string('duplicaterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
// duplicate current role
|
||||
$sourcerole = get_record('role','id',$roleid);
|
||||
|
||||
$fullname = $sourcerole->name;
|
||||
$shortname = $sourcerole->shortname;
|
||||
$currentfullname = "";
|
||||
$currentshortname = "";
|
||||
$counter = 0;
|
||||
|
||||
// find a name for the duplicated role
|
||||
do {
|
||||
if ($counter) {
|
||||
$suffixfull = " ".get_string("copyasnoun")." ".$counter;
|
||||
$suffixshort = "_".$counter;
|
||||
} else {
|
||||
$suffixfull = "";
|
||||
$suffixshort = "";
|
||||
}
|
||||
$currentfullname = $fullname.$suffixfull;
|
||||
// Limit the size of shortname - database column accepts <= 15 chars
|
||||
$currentshortname = substr($shortname, 0, 15 - strlen($suffixshort)).$suffixshort;
|
||||
$coursefull = get_record("role","name",addslashes($currentfullname));
|
||||
$courseshort = get_record("role","shortname",addslashes($currentshortname));
|
||||
$counter++;
|
||||
} while ($coursefull || $courseshort);
|
||||
|
||||
$description = 'duplicate of '.$fullname;
|
||||
if ($newrole = create_role($currentfullname, $currentshortname, $description)) {
|
||||
// dupilcate all the capabilities
|
||||
role_cap_duplicate($sourcerole, $newrole);
|
||||
}
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
case 'reset':
|
||||
if (!array_key_exists($roleid, $roles)) {
|
||||
redirect('manage.php');
|
||||
}
|
||||
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
reset_role_capabilities($roleid);
|
||||
redirect('manage.php?action=view&roleid='.$roleid);
|
||||
|
||||
} else {
|
||||
// show confirmation
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$optionsyes = array('action'=>'reset', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
|
||||
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
|
||||
$a = new object();
|
||||
$a->id = $roleid;
|
||||
$a->name = $roles[$roleid]->name;
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
$a->legacytype = get_legacy_type($roleid);
|
||||
if (empty($a->legacytype)) {
|
||||
$warning = get_string('resetrolesurenolegacy', 'role', $a);
|
||||
} else {
|
||||
$warning = get_string('resetrolesure', 'role', $a);
|
||||
}
|
||||
notice_yesno($warning, 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/// print UI now
|
||||
@@ -393,10 +254,9 @@
|
||||
$roleid = 0;
|
||||
if (empty($errors) or empty($newrole)) {
|
||||
$role = new object();
|
||||
$role->name = '';
|
||||
$role->shortname = '';
|
||||
$role->description = '';
|
||||
$role->legacytype = '';
|
||||
$role->name='';
|
||||
$role->shortname='';
|
||||
$role->description='';
|
||||
} else {
|
||||
$role = stripslashes_safe($newrole);
|
||||
}
|
||||
@@ -406,7 +266,6 @@
|
||||
if(!$role = get_record('role', 'id', $roleid)) {
|
||||
error('Incorrect role ID!');
|
||||
}
|
||||
$role->legacytype = get_legacy_type($role->id);
|
||||
}
|
||||
|
||||
foreach ($roles as $rolex) {
|
||||
@@ -433,28 +292,18 @@
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<div class="selector">';
|
||||
echo '<div align="center" class="selector">';
|
||||
if ($action == 'view') {
|
||||
popup_form('manage.php?action=view&roleid=', $roleoptions, 'switchrole', $roleid, '', '', '',
|
||||
false, 'self', get_string('selectrole', 'role'));
|
||||
|
||||
echo '<div class="buttons">';
|
||||
|
||||
$legacytype = get_legacy_type($roleid);
|
||||
$options = array();
|
||||
$options['roleid'] = $roleid;
|
||||
$options['action'] = 'edit';
|
||||
print_single_button('manage.php', $options, get_string('edit'));
|
||||
$options['action'] = 'reset';
|
||||
if (empty($legacytype)) {
|
||||
print_single_button('manage.php', $options, get_string('resetrolenolegacy', 'role'));
|
||||
} else {
|
||||
print_single_button('manage.php', $options, get_string('resetrole', 'role'));
|
||||
}
|
||||
$options['action'] = 'duplicate';
|
||||
print_single_button('manage.php', $options, get_string('duplicaterole', 'role'));
|
||||
print_single_button('manage.php', null, get_string('listallroles', 'role'));
|
||||
echo '</div>';
|
||||
echo get_string('selectrole', 'role').': ';
|
||||
echo '<form style="display:inline;" name="switchrole" action="manage.php" method="get">';
|
||||
echo '<input type="hidden" name="action" value="view" />';
|
||||
choose_from_menu ($roleoptions, 'roleid', $roleid, get_string('listallroles', 'role').'...', $script='switchrole.submit()');
|
||||
echo '</form>';
|
||||
echo '<form style="display:inline;" name="editrole" action="manage.php" method="get">';
|
||||
echo '<input type="hidden" name="roleid" value="'.$roleid.'" />';
|
||||
echo '<input type="hidden" name="action" value="edit" />';
|
||||
echo '<input type="submit" value="'.get_string('edit').'" />';
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
@@ -502,25 +351,21 @@
|
||||
$row[0] = '<a href="manage.php?roleid='.$role->id.'&action=view">'.format_string($role->name).'</a>';
|
||||
$row[1] = format_text($role->description, FORMAT_HTML);
|
||||
$row[2] = s($role->shortname);
|
||||
$row[3] = '<a title="'.$stredit.'" href="manage.php?action=edit&roleid='.$role->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" /></a> ';
|
||||
if (in_array($role->id, $defaultroles)) {
|
||||
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
|
||||
} else {
|
||||
$row[3] .= '<a title="'.$strdelete.'" href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$strdelete.'" /></a> ';
|
||||
}
|
||||
$row[3] = '<a title="'.$stredit.'" href="manage.php?action=edit&roleid='.$role->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$stredit.'" /></a> ';
|
||||
$row[3] .= '<a title="'.$strdelete.'" href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.$strdelete.'" /></a> ';
|
||||
if ($role->sortorder != 0) {
|
||||
$row[3] .= '<a title="'.$strmoveup.'" href="manage.php?action=moveup&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/up.gif" class="iconsmall" alt="'.$strmoveup.'" /></a> ';
|
||||
$row[3] .= '<a title="'.$strmoveup.'" href="manage.php?action=moveup&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/up.gif" height="11" width="11" border="0" alt="'.$strmoveup.'" /></a> ';
|
||||
} else {
|
||||
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
|
||||
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" height="11" width="11" border="0" alt="" /> ';
|
||||
}
|
||||
if ($role->sortorder+1 < $rolescount) {
|
||||
$row[3] .= '<a title="'.$strmovedown.'" href="manage.php?action=movedown&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/down.gif" class="iconsmall" alt="'.$strmovedown.'" /></a> ';
|
||||
$row[3] .= '<a title="'.$strmovedown.'" href="manage.php?action=movedown&roleid='.$role->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/down.gif" height="11" width="11" border="0" alt="'.$strmovedown.'" /></a> ';
|
||||
} else {
|
||||
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
|
||||
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" height="11" width="11" border="0" alt="" /> ';
|
||||
}
|
||||
|
||||
$table->data[] = $row;
|
||||
@@ -530,9 +375,7 @@
|
||||
|
||||
$options = new object();
|
||||
$options->action = 'add';
|
||||
echo '<div class="buttons">';
|
||||
print_single_button('manage.php', $options, get_string('addrole', 'role'), 'get');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
@@ -575,18 +418,4 @@ function switch_roles($first, $second) {
|
||||
return $status;
|
||||
}
|
||||
|
||||
// duplicates all the base definitions of a role
|
||||
function role_cap_duplicate($sourcerole, $targetrole) {
|
||||
global $CFG;
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$caps = get_records_sql("SELECT * FROM {$CFG->prefix}role_capabilities
|
||||
WHERE roleid = $sourcerole->id
|
||||
AND contextid = $systemcontext->id");
|
||||
// adding capabilities
|
||||
foreach ($caps as $cap) {
|
||||
unset($cap->id);
|
||||
$cap->roleid = $targetrole;
|
||||
insert_record('role_capabilities', $cap);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
<?php
|
||||
// this page deals with the 2 tabs for manage.php and grant.php
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
$toprow = array();
|
||||
|
||||
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'),'', true);
|
||||
|
||||
$toprow[] = new tabobject('allowassign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/allowassign.php', get_string('allowassign', 'role'));
|
||||
|
||||
+22
-34
@@ -5,23 +5,21 @@
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
?>
|
||||
|
||||
<form id="overrideform" action="override.php" method="post">
|
||||
<fieldset class="invisiblefieldset">
|
||||
<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
|
||||
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
|
||||
<form name="overrideform" action="override.php" method="post">
|
||||
<input type="hidden" name="contextid" value="<?php p($contextid) ?>">
|
||||
<input type="hidden" name="roleid" value="<?php p($roleid) ?>">
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
|
||||
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
||||
</fieldset>
|
||||
|
||||
<table class="rolecap">
|
||||
<tr>
|
||||
<th class="name" align="left" scope="col"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit" scope="col"><?php p($strinherit); ?></th>
|
||||
<th class="allow" scope="col"><?php p($strallow); ?></th>
|
||||
<th class="prevent" scope="col"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit" scope="col"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5" scope="col"><?php print_string('risks','role') ?></th>
|
||||
<th class="name" align="left"><?php print_string('capability','role') ?></th>
|
||||
<th class="inherit"><?php p($strinherit); ?></th>
|
||||
<th class="allow"><?php p($strallow); ?></th>
|
||||
<th class="prevent"><?php p($strprevent); ?></th>
|
||||
<th class="prohibit"><?php p($strprohibit); ?></th>
|
||||
<th class="risk" colspan="5"><?php print_string('risks','role') ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@@ -33,12 +31,6 @@
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
// legacy caps should not be overriden - we must use proper capabilities if needed
|
||||
if (islegacy($capability->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// prints a breaker if component or name or context level
|
||||
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
||||
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
||||
@@ -65,37 +57,32 @@
|
||||
$isprohibit = 0;
|
||||
}
|
||||
|
||||
$isdisabled = $isprohibit;
|
||||
$isdisabled = $isprohibit || islegacy($capability->name);
|
||||
|
||||
$riskinfo = '<td class="risk managetrust">';
|
||||
$rowclasses = '';
|
||||
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">T</a>';
|
||||
$rowclasses .= ' riskmanagetrust';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk config">';
|
||||
if (RISK_CONFIG & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">C</a>';
|
||||
$rowclasses .= ' riskconfig';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk xss">';
|
||||
if (RISK_XSS & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">X</a>';
|
||||
$rowclasses .= ' riskxss';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk personal">';
|
||||
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">P</a>';
|
||||
$rowclasses .= ' riskpersonal';
|
||||
}
|
||||
$riskinfo .= '</td><td class="risk spam">';
|
||||
if (RISK_SPAM & (int)$capability->riskbitmask) {
|
||||
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
|
||||
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
|
||||
$riskinfo .= '<a target="docspopup" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">S</a>';
|
||||
$rowclasses .= ' riskspam';
|
||||
}
|
||||
$riskinfo .= '</td>';
|
||||
@@ -104,33 +91,33 @@
|
||||
?>
|
||||
|
||||
<tr class="rolecap <?php echo $rowclasses; ?>">
|
||||
<td class="name"><span class="cap-desc"><a onclick="this.target='docspopup'" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></span></td>
|
||||
<td class="name"><span class="cap-desc"><a target="docspopup" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></label></td>
|
||||
|
||||
<td class="inherit">
|
||||
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="0"
|
||||
<?php
|
||||
if ($localpermission == CAP_INHERIT) {echo 'checked="checked" ';}
|
||||
if ($localpermission == CAP_INHERIT) {echo 'checked="checked"';}
|
||||
if ($isdisabled) {echo 'disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="allow <?php if ($isallow) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_ALLOW.'"';
|
||||
if ($localpermission == CAP_ALLOW) {echo ' checked="checked" ';}
|
||||
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_PREVENT.'"';
|
||||
if ($localpermission == CAP_PREVENT) {echo ' checked="checked" ';}
|
||||
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
|
||||
<td class="prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
|
||||
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>"
|
||||
<?php echo ' value="'.CAP_PROHIBIT.'"';
|
||||
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked" ';}
|
||||
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
|
||||
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
||||
</td>
|
||||
<?php echo $riskinfo; ?>
|
||||
@@ -138,7 +125,8 @@
|
||||
|
||||
<?php } ?>
|
||||
</table>
|
||||
<div class="submit buttons">
|
||||
<br />
|
||||
<div align="center">
|
||||
<input type="submit" value="<?php print_string('savechanges') ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
|
||||
</div>
|
||||
|
||||
+24
-48
@@ -2,7 +2,7 @@
|
||||
|
||||
require_once('../../config.php');
|
||||
|
||||
$contextid = required_param('contextid', PARAM_INT); // context id
|
||||
$contextid = required_param('contextid',PARAM_INT); // context id
|
||||
$roleid = optional_param('roleid', 0, PARAM_INT); // requested role id
|
||||
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
|
||||
@@ -12,34 +12,29 @@
|
||||
error('Bad context ID');
|
||||
}
|
||||
|
||||
if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM)) {
|
||||
if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID)) {
|
||||
error('No site ID');
|
||||
}
|
||||
|
||||
if ($context->id == $sitecontext->id) {
|
||||
error('Can not override base role capabilities');
|
||||
error ('Can not override base role capabilities');
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/role:override', $context)) {
|
||||
error('You do not have permission to change overrides in this context!');
|
||||
}
|
||||
require_capability('moodle/role:override', $context); // Just to make sure
|
||||
|
||||
if ($courseid) {
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Bad course ID');
|
||||
}
|
||||
} else {
|
||||
$course = clone($SITE);
|
||||
$courseid = SITEID;
|
||||
$course = $SITE;
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
$baseurl = 'override.php?contextid='.$context->id;
|
||||
if (!empty($userid)) {
|
||||
$baseurl .= '&userid='.$userid;
|
||||
}
|
||||
if ($courseid != SITEID) {
|
||||
if (!empty($courseid)) {
|
||||
$baseurl .= '&courseid='.$courseid;
|
||||
}
|
||||
|
||||
@@ -47,9 +42,6 @@
|
||||
redirect($baseurl);
|
||||
}
|
||||
|
||||
/// needed for tabs.php
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
@@ -61,7 +53,6 @@
|
||||
$strparticipants = get_string('participants');
|
||||
|
||||
/// Make sure this user can override that role
|
||||
|
||||
if ($roleid) {
|
||||
if (!user_can_override($context, $roleid)) {
|
||||
error ('you can not override this role in this context');
|
||||
@@ -73,27 +64,18 @@
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
}
|
||||
|
||||
/// get all cababilities
|
||||
$capabilities = fetch_context_capabilities($context);
|
||||
|
||||
/// Process incoming role override
|
||||
if ($data = data_submitted() and $roleid and confirm_sesskey()) {
|
||||
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
|
||||
$capabilities = fetch_context_capabilities($context); // capabilities applicable in this context
|
||||
|
||||
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
|
||||
'', 'capability, permission, id');
|
||||
|
||||
foreach ($capabilities as $cap) {
|
||||
|
||||
if (!isset($data->{$cap->name})) {
|
||||
//cap not specified in form
|
||||
continue;
|
||||
}
|
||||
|
||||
if (islegacy($data->{$cap->name})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$capname = $cap->name;
|
||||
$value = clean_param($data->{$cap->name}, PARAM_INT);
|
||||
if (!in_array($value, $allowed_values)) {
|
||||
@@ -147,20 +129,12 @@
|
||||
|
||||
/// site header
|
||||
} else {
|
||||
print_header("$course->fullname: $fullname", $course->fullname,
|
||||
print_header("$course->fullname: $fullname", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$course->id\">$fullname</a> -> $straction", "", "", true, " ", navmenu($course));
|
||||
}
|
||||
$showroles = 1;
|
||||
$currenttab = 'override';
|
||||
include_once($CFG->dirroot.'/user/tabs.php');
|
||||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('frontpageroles', $adminroot);
|
||||
admin_externalpage_print_header($adminroot);
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
@@ -169,14 +143,21 @@
|
||||
|
||||
print_heading_with_help(get_string('overrides', 'role'), 'overrides');
|
||||
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
|
||||
if ($roleid) {
|
||||
/// prints a form to swap roles
|
||||
echo '<div class="selector">';
|
||||
echo $strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$overridableroles = array('0'=>get_string('listallroles', 'role').'...') + $overridableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/override.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride);
|
||||
echo '</div>';
|
||||
echo '<form name="rolesform" action="override.php" method="get">';
|
||||
echo '<div align="center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
if ($userid) {
|
||||
echo '<input type="hidden" name="userid" value="'.$userid.'" />';
|
||||
}
|
||||
if ($courseid) {
|
||||
echo '<input type="hidden" name="courseid" value="'.$courseid.'" />';
|
||||
}
|
||||
echo '<input type="hidden" name="contextid" value="'.$context->id.'" />'.$strroletooverride.': ';
|
||||
choose_from_menu ($overridableroles, 'roleid', $roleid, get_string('listallroles', 'role').'...', $script='rolesform.submit()');
|
||||
echo '</div></form>';
|
||||
|
||||
$parentcontexts = get_parent_contexts($context);
|
||||
if (!empty($parentcontexts)) {
|
||||
@@ -193,12 +174,11 @@
|
||||
|
||||
$lang = str_replace('_utf8', '', current_language());
|
||||
|
||||
if (!empty($capabilities)) {
|
||||
// Print the capabilities overrideable in this context
|
||||
// Get the capabilities overrideable in this context
|
||||
if ($capabilities = fetch_context_capabilities($context)) {
|
||||
print_simple_box_start('center');
|
||||
include_once('override.html');
|
||||
print_simple_box_end();
|
||||
|
||||
} else {
|
||||
notice(get_string('nocapabilitiesincontext', 'role'),
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/'.$baseurl);
|
||||
@@ -224,10 +204,6 @@
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
} else {
|
||||
print_footer($course);
|
||||
}
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
||||
+22
-46
@@ -1,11 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
// Handles headers and tabs for the roles control at any level apart from SYSTEM level
|
||||
// We also assume that $currenttab, $assignableroles and $overridableroles are defined
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
if ($currenttab != 'update') {
|
||||
switch ($context->contextlevel) {
|
||||
@@ -32,16 +27,11 @@ if ($currenttab != 'update') {
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSE:
|
||||
if ($context->instanceid != SITEID) {
|
||||
$streditcoursesettings = get_string("editcoursesettings");
|
||||
$streditcoursesettings = get_string("editcoursesettings");
|
||||
|
||||
$course = get_record('course', 'id', $context->instanceid);
|
||||
|
||||
require_login($course);
|
||||
|
||||
print_header($streditcoursesettings, $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
|
||||
}
|
||||
$course = get_record('course', 'id', $context->instanceid);
|
||||
print_header($streditcoursesettings, "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
|
||||
break;
|
||||
|
||||
case CONTEXT_GROUP:
|
||||
@@ -62,8 +52,6 @@ if ($currenttab != 'update') {
|
||||
error("The required instance of this module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
$strnav = "<a href=\"$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id\">$instance->name</a> ->";
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
@@ -75,9 +63,10 @@ if ($currenttab != 'update') {
|
||||
$focuscursor = "form.name";
|
||||
}
|
||||
|
||||
$COURSE = $course;
|
||||
print_header_simple($streditinga, '',
|
||||
"<a href=\"$CFG->wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural</a> ->
|
||||
$strnav <a href=\"$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga</a> -> $straction", $focuscursor, "", false);
|
||||
$strnav <a href=\"$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga</a> -> $straction", $focuscursor, "", false);
|
||||
|
||||
break;
|
||||
|
||||
@@ -90,9 +79,6 @@ if ($currenttab != 'update') {
|
||||
switch ($blockinstance->pagetype) {
|
||||
case 'course-view':
|
||||
if ($course = get_record('course', 'id', $blockinstance->pageid)) {
|
||||
|
||||
require_login($course);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
@@ -116,7 +102,7 @@ if ($currenttab != 'update') {
|
||||
break;
|
||||
|
||||
default:
|
||||
error ('This is an unknown context (' . $context->contextlevel . ') in admin/roles/tabs.php!');
|
||||
error ('This is an unknown context!');
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -135,8 +121,16 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
|
||||
$context->id, get_string('roles'));
|
||||
|
||||
if (!empty($tabsmode)) {
|
||||
if (isset($tabsmode)) {
|
||||
|
||||
if (!isset($assignableroles)) {
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
}
|
||||
if (!isset($overridableroles)) {
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
}
|
||||
|
||||
$inactive[] = 'roles';
|
||||
if (!empty($assignableroles)) {
|
||||
$secondrow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
@@ -153,32 +147,14 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
true);
|
||||
}
|
||||
|
||||
$inactive[] = 'roles';
|
||||
$activetwo = array('roles');
|
||||
$currenttab = $tabsmode;
|
||||
if ($tabsmode == 'override') {
|
||||
$currenttab = 'override';
|
||||
} elseif ($tabsmode == 'assign') {
|
||||
$currenttab = 'assign';
|
||||
}
|
||||
|
||||
} else {
|
||||
$inactive[] = '';
|
||||
$activetwo = array();
|
||||
}
|
||||
|
||||
/// Here other core tabs should go (always calling tabs.php files)
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
/// ej.:
|
||||
/// include_once($CFG->dirroot . '/grades/tabs.php');
|
||||
|
||||
/// Finally, we support adding some 'on-the-fly' tabs here
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
if (isset($CFG->extratabs) && !empty($CFG->extratabs)) {
|
||||
if ($extratabs = explode(',', $CFG->extratabs)) {
|
||||
asort($extratabs);
|
||||
foreach($extratabs as $extratab) {
|
||||
/// Each extra tab mus be one $CFG->dirroot relative file
|
||||
if (file_exists($CFG->dirroot . '/' . $extratab)) {
|
||||
include_once($CFG->dirroot . '/' . $extratab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($secondrow)) {
|
||||
@@ -187,7 +163,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
$tabs = array($toprow);
|
||||
}
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive, $activetwo);
|
||||
print_tabs($tabs, $currenttab, $inactive);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+1
-8
@@ -58,11 +58,9 @@ if ($statusmsg != '') {
|
||||
|
||||
$resultshtml = search_settings_html(admin_get_root(), $query);
|
||||
|
||||
echo '<form action="search.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<form action="search.php" method="post" name="adminsettings" id="adminsettings">';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<input type="hidden" name="query" value="' . s($query) . '" />';
|
||||
echo '</div>';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
if ($resultshtml != '') {
|
||||
@@ -114,11 +112,6 @@ function search_settings(&$node, $query) {
|
||||
function search_settings_html(&$node, $query) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($query == ''){
|
||||
return '';
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$entries = array_keys($node->children);
|
||||
$return = '';
|
||||
|
||||
+22
-82
@@ -87,32 +87,6 @@ if ($data = data_submitted()) {
|
||||
|
||||
/// print header stuff ------------------------------------------------------------
|
||||
// header must be printed after the redirects and require_logout
|
||||
|
||||
if (empty($SITE->fullname)) {
|
||||
print_header();
|
||||
print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
|
||||
echo $root->output_html();
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
if (!empty($SITE->fullname)) {
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
@@ -124,74 +98,40 @@ if (!empty($SITE->fullname)) {
|
||||
$PAGE->print_header();
|
||||
|
||||
echo '<table id="layout-table"><tr>';
|
||||
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
|
||||
foreach ($lt as $column) {
|
||||
switch ($column) {
|
||||
case 'left':
|
||||
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'middle':
|
||||
echo '<td id="middle-column">';
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
echo '<a name="startofcontent"></a>';
|
||||
} else {
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
print_header();
|
||||
print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
}
|
||||
|
||||
echo $root->output_html();
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '<form action="settings.php" method="post" name="adminsettings" id="adminsettings">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo $root->output_html();
|
||||
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($SITE->fullname)) {
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'right':
|
||||
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
|
||||
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '<div class="bt"><div></div></div>';
|
||||
echo '<div class="i1"><div class="i2"><div class="i3">';
|
||||
}
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
if (!empty($THEME->roundcorners)) {
|
||||
echo '</div></div></div>';
|
||||
echo '<div class="bb"><div></div></div>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo '</tr></table>';
|
||||
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
|
||||
if (!empty($CFG->adminusehtmleditor)) {
|
||||
|
||||
@@ -10,20 +10,39 @@ $temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allow
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('tabselectedtofront', get_string('tabselectedtofronttext', 'admin'), get_string('tabselectedtofront', 'admin'), 0));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
|
||||
# for CALENDAR_TF_12 and CALENDAR_TF_24 ...
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpage', get_string('frontpage','admin'));
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'),
|
||||
get_string('sitesectionhelp','admin'), 1));
|
||||
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'),
|
||||
'', 3,
|
||||
array('0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6',
|
||||
'7' => '7',
|
||||
'8' => '8',
|
||||
'9' => '9',
|
||||
'10' => '10')));
|
||||
$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// calendar
|
||||
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
|
||||
$temp->add(new admin_setting_special_adminseesall());
|
||||
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'), get_string('explain_site_timeformat', 'calendar'), '0',
|
||||
array( 0 => get_string('default', 'calendar'),
|
||||
CALENDAR_TF_12 => get_string('timeformat_12', 'calendar'),
|
||||
CALENDAR_TF_24 => get_string('timeformat_24', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('sunday', 'calendar'),
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
// This file defines everything related to frontpage
|
||||
|
||||
if (get_site()) { //do not use during installation
|
||||
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
$frontpagecontextid = $frontpagecontext->id;
|
||||
} else {
|
||||
$frontpagecontext = NULL;
|
||||
$frontpagecontextid = 0;
|
||||
}
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
|
||||
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
|
||||
array('0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6',
|
||||
'7' => '7',
|
||||
'8' => '8',
|
||||
'9' => '9',
|
||||
'10' => '10')));
|
||||
$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
|
||||
$ADMIN->add('frontpage', $temp);
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontextid, 'moodle/role:assign', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
|
||||
|
||||
?>
|
||||
@@ -6,16 +6,13 @@
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configtext('langlist', get_string('langlist', 'admin'), get_string('configlanglist', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
|
||||
// new CFG variable for excel encoding
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
|
||||
|
||||
$ADMIN->add('language', $temp);
|
||||
|
||||
|
||||
|
||||
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php"));
|
||||
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
// XMLDB editor
|
||||
@@ -17,6 +16,5 @@ $ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbedito
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
// 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',
|
||||
'moodle/site:config'));
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/peers.php',
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', get_string('ssoaccesscontrol', 'mnet'),
|
||||
$CFG->wwwroot . '/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',
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/trustedhosts.php',
|
||||
'moodle/site:config'));
|
||||
?>
|
||||
@@ -25,7 +25,7 @@ $temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnam
|
||||
'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_URL));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
@@ -33,9 +33,6 @@ $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('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));
|
||||
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
@@ -44,6 +41,7 @@ $ADMIN->add('security', $temp);
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', get_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('secureforms', get_string('secureforms', 'admin'), get_string('configsecureforms', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
+12
-30
@@ -47,13 +47,15 @@ $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestma
|
||||
'21' => '21',
|
||||
'22' => '22',
|
||||
'23' => '23')));
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // not needed here
|
||||
$options = array();
|
||||
$options['0'] = get_string('none');
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
|
||||
if (!empty($CFG->unicodedb)) { // These options are only available if running under unicodedb
|
||||
unset($options);
|
||||
unset($charsets);
|
||||
$charsets = get_list_of_charsets();
|
||||
$options['0'] = get_string('none');
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
|
||||
}
|
||||
$ADMIN->add('server', $temp, 100);
|
||||
|
||||
|
||||
@@ -85,8 +87,6 @@ $ADMIN->add('server', $temp);
|
||||
// "debugging" settingpage
|
||||
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
|
||||
$temp->add(new admin_setting_special_debug());
|
||||
$temp->add(new admin_setting_special_debugdisplay());
|
||||
$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_perfdebug());
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
@@ -127,6 +127,8 @@ $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'ad
|
||||
$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
$ADMIN->add('server', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID));
|
||||
|
||||
$ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
|
||||
|
||||
|
||||
@@ -175,27 +177,7 @@ $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "
|
||||
|
||||
// "performance" settingpage
|
||||
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
|
||||
get_string('configcachetype', 'admin'), false,
|
||||
array( '' => 'none',
|
||||
'internal' => 'internal',
|
||||
'memcached' => 'memcached',
|
||||
'eaccelerator' => 'eaccelerator')));
|
||||
// NOTE: $CFG->rcache is forced to bool in lib/setup.php
|
||||
$temp->add(new admin_setting_configselect('rcache', get_string('rcache', 'admin'),
|
||||
get_string('configrcache', 'admin'), false,
|
||||
array( '0' => 'false',
|
||||
'1' => 'true')));
|
||||
$temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
|
||||
get_string('configrcachettl', 'admin'), 10));
|
||||
$temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
|
||||
get_string('configintcachemax', 'admin'), 10));
|
||||
$temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
|
||||
get_string('configmemcachedhosts', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
|
||||
get_string('configmemcachedpconn', 'admin'), false,
|
||||
array( '0' => 'false',
|
||||
'1' => 'true')));
|
||||
$temp->add(new admin_setting_configcheckbox('enablerecordcache', get_string('enablerecordcache', 'admin'), get_string('configenablerecordcache', 'admin'), 1));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
|
||||
|
||||
@@ -25,14 +25,12 @@ $ADMIN->add('modules', new admin_externalpage('managefilters', get_string('manag
|
||||
|
||||
$ADMIN->add('root', new admin_category('security', get_string('security','admin')));
|
||||
$ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin')));
|
||||
$ADMIN->add('root', new admin_category('frontpage', get_string('frontpage','admin')));
|
||||
$ADMIN->add('root', new admin_category('server', get_string('server','admin')));
|
||||
$ADMIN->add('root', new admin_category('mnet', get_string('net','mnet')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
|
||||
foreach (get_list_of_plugins('admin/report') as $plugin) {
|
||||
/// This snippet is temporary until simpletest can be fixed to use xmldb. See MDL-7377 XXX TODO
|
||||
if ($plugin == 'simpletest' && $CFG->dbfamily != 'mysql' && $CFG->dbfamily != 'postgres') {
|
||||
if ($plugin == 'simpletest' && $CFG->dbtype != 'mysql' && $CFG->dbtype != 'postgres7') {
|
||||
continue;
|
||||
}
|
||||
/// End of removable snippet
|
||||
|
||||
@@ -6,17 +6,11 @@
|
||||
$ADMIN->add('users', new admin_externalpage('userauthentication', get_string('authentication','admin'), "$CFG->wwwroot/$CFG->admin/auth.php"));
|
||||
|
||||
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$CFG->wwwroot/$CFG->admin/user.php?newuser=true", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
|
||||
|
||||
// stuff under the "roles" subcategory
|
||||
@@ -29,7 +23,7 @@ $ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglo
|
||||
// "userpolicies" settingpage
|
||||
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (!$guestrole = get_guest_role()) {
|
||||
$guestrole->id = 0;
|
||||
}
|
||||
@@ -38,45 +32,16 @@ if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW
|
||||
} else {
|
||||
$studentrole->id = 0;
|
||||
}
|
||||
if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
|
||||
$userrole = array_shift($userroles); /// Take the first one
|
||||
} else {
|
||||
$userrole->id = 0;
|
||||
}
|
||||
if (empty($CFG->creatornewroleid)) {
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
set_config('creatornewroleid', $teachereditrole->id);
|
||||
} else {
|
||||
set_config('creatornewroleid', 0);
|
||||
}
|
||||
}
|
||||
// we must not use assignable roles here:
|
||||
// 1/ unsetting roles as assignable for admin might bork the settings!
|
||||
// 2/ default user role should not be assignable anyway
|
||||
$allroles = array();
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$allroles[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
|
||||
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
|
||||
$temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
|
||||
get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $assignableroles ));
|
||||
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
|
||||
get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles));
|
||||
get_string('configdefaultuserroleid', 'admin'), $guestrole->id, $assignableroles));
|
||||
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
|
||||
get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $assignableroles));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
|
||||
get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
|
||||
|
||||
//$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
|
||||
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
|
||||
get_string('confighiddenuserfields', 'admin'), array(),
|
||||
|
||||
@@ -63,11 +63,14 @@
|
||||
}
|
||||
|
||||
|
||||
print_box_start();
|
||||
print_simple_box_start('center');
|
||||
print_heading($strheading);
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/stickyblocks.php?pt=", $options, 'selecttype', $pt, 'choose', '', '', false, 'self', get_string('stickyblockspagetype','admin').': ');
|
||||
echo '<p>'.get_string('stickyblocksduplicatenotice','admin').'</p>';
|
||||
print_box_end();
|
||||
echo '<form method="post" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/stickyblocks.php">'
|
||||
.'<p align="center">'.get_string('stickyblockspagetype','admin').': ';
|
||||
choose_from_menu($options,'pt',$pt,'choose','this.form.submit();');
|
||||
echo '</p></form>';
|
||||
echo get_string('stickyblocksduplicatenotice','admin');
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@
|
||||
echo '<center><form action="timezone.php" method="get">';
|
||||
echo "$strusers ($strall): ";
|
||||
choose_from_menu ($timezones, "zone", 99, get_string("serverlocaltime"), "", "99");
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsavechanges\" />";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
|
||||
echo "<input type=\"submit\" value=\"$strsavechanges\">";
|
||||
echo "</form></center>";
|
||||
|
||||
print_footer();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
/// Print headings
|
||||
|
||||
$strcalendarsettings = get_string('calendarsettings', 'admin');
|
||||
$strimporttimezones = get_string('importtimezones', 'admin');
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
@@ -22,16 +23,16 @@
|
||||
print_heading($strimporttimezones);
|
||||
|
||||
if (!$ok or !confirm_sesskey()) {
|
||||
$message = '<br /><br />';
|
||||
$message = '<p>';
|
||||
$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 .= '<br />';
|
||||
$message .= '</p>';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
|
||||
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'index.php');
|
||||
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'index.php');
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
exit;
|
||||
|
||||
@@ -52,7 +52,11 @@
|
||||
$starttime = time();
|
||||
$sleeptime = 0;
|
||||
|
||||
$LIKE = sql_ilike();
|
||||
if ($CFG->dbtype == "mysql") {
|
||||
$LIKE = "LIKE";
|
||||
} else {
|
||||
$LIKE = "ILIKE";
|
||||
}
|
||||
|
||||
if ($cmcount > 10) {
|
||||
print_simple_box('This process may take a very long time ... please be patient and let it finish.',
|
||||
|
||||
@@ -58,12 +58,11 @@ admin_externalpage_print_header($adminroot);
|
||||
|
||||
print_simple_box(get_string('upgradesettingsintro','admin'),'','100%','',5,'generalbox','');
|
||||
|
||||
echo '<form action="upgradesettings.php" method="post" id="adminsettings">';
|
||||
echo '<form action="upgradesettings.php" method="post" name="adminsettings" id="adminsettings">';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
echo $newsettingshtml;
|
||||
echo '</fieldset>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '</form>';
|
||||
|
||||
|
||||
+25
-24
@@ -62,16 +62,13 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
// that we'll take longer, and that the process should be recycled soon
|
||||
// to free up memory.
|
||||
@set_time_limit(0);
|
||||
@raise_memory_limit("192M");
|
||||
@raise_memory_limit("128M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
@apache_child_terminate();
|
||||
}
|
||||
|
||||
$text = my_file_get_contents($filename);
|
||||
//trim utf-8 bom
|
||||
$textlib = new textlib();
|
||||
$text = $textlib->trim_utf8_bom($text);
|
||||
//Fix mac/dos newlines
|
||||
$text = my_file_get_contents($filename);
|
||||
$text = preg_replace('!\r\n?!',"\n",$text);
|
||||
$fp = fopen($filename, "w");
|
||||
fwrite($fp,$text);
|
||||
@@ -85,8 +82,7 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
"firstname" => 1,
|
||||
"lastname" => 1,
|
||||
"email" => 1);
|
||||
$optionalDefaults = array("mnethostid" => 1,
|
||||
"institution" => 1,
|
||||
$optionalDefaults = array("institution" => 1,
|
||||
"department" => 1,
|
||||
"city" => 1,
|
||||
"country" => 1,
|
||||
@@ -134,10 +130,10 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
// check for valid field names
|
||||
foreach ($header as $i => $h) {
|
||||
$h = trim($h); $header[$i] = $h; // remove whitespace
|
||||
if (!(isset($required[$h]) or isset($optionalDefaults[$h]) or isset($optional[$h]))) {
|
||||
if (!($required[$h] or $optionalDefaults[$h] or $optional[$h])) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
if (isset($required[$h])) {
|
||||
if ($required[$h]) {
|
||||
$required[$h] = 0;
|
||||
}
|
||||
}
|
||||
@@ -176,7 +172,7 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
// add fields to object $user
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if (isset($required[$name]) and !$value) {
|
||||
if ($required[$name] and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum) .". ".
|
||||
get_string('processingstops', 'error'),
|
||||
@@ -230,11 +226,17 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->username === 'changeme') {
|
||||
notify(get_string('invaliduserchangeme', 'admin'));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// before insert/update, check whether we should be updating
|
||||
// an old record instead
|
||||
if ($allowrenames && !empty($user->oldusername) ) {
|
||||
$user->oldusername = moodle_strtolower($user->oldusername);
|
||||
if ($olduser = get_record('user', 'username', $user->oldusername, 'mnethostid', $user->mnethostid)) {
|
||||
if ($olduser = get_record('user','username',$user->oldusername)) {
|
||||
if (set_field('user', 'username', $user->username, 'username', $user->oldusername)) {
|
||||
notify(get_string('userrenamed', 'admin') . " : $user->oldusername $user->username");
|
||||
$renames++;
|
||||
@@ -250,7 +252,7 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($olduser = get_record("user", "username", $username, "mnethostid", $user->mnethostid)) {
|
||||
if ($olduser = get_record("user","username",$username)) {
|
||||
if ($updateaccounts) {
|
||||
// Record is being updated
|
||||
$user->id = $olduser->id;
|
||||
@@ -301,8 +303,8 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
if (!$course[$i]) {
|
||||
notify(get_string('coursegroupunknown','error',$addgroup[$i]));
|
||||
} else {
|
||||
if ($gid = groups_get_group_by_name($course[$i]->id, $addgroup[$i])) {
|
||||
$groupid[$i] = $gid;
|
||||
if ($group = get_record("groups","courseid",$course[$i]->id,"name",$addgroup[$i])) {
|
||||
$groupid[$i] = $group->id;
|
||||
} else {
|
||||
notify(get_string('groupunknown','error',$addgroup[$i]));
|
||||
}
|
||||
@@ -376,13 +378,13 @@ print_heading_with_help($struploadusers, 'uploadusers');
|
||||
$noyesoptions = array( get_string('no'), get_string('yes') );
|
||||
|
||||
$maxuploadsize = get_max_upload_file_size();
|
||||
echo '<div style="text-align:center">';
|
||||
echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php"><div>'.
|
||||
$strfile.' <input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'" />'.
|
||||
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
|
||||
'<input type="file" name="userfile" size="30" />';
|
||||
echo '<center>';
|
||||
echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php">'.
|
||||
$strfile.' <input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'">'.
|
||||
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">'.
|
||||
'<input type="file" name="userfile" size="30">';
|
||||
print_heading(get_string('settings'));
|
||||
echo '<table style="margin-left:auto;margin-right:auto">';
|
||||
echo '<table>';
|
||||
echo '<tr><td>' . get_string('passwordhandling', 'auth') . '</td><td>';
|
||||
$passwordopts = array( 0 => get_string('infilefield', 'auth'),
|
||||
1 => get_string('createpasswordifneeded', 'auth'),
|
||||
@@ -398,9 +400,9 @@ echo '<tr><td>' . get_string('allowrenames', 'admin') . '</td><td>';
|
||||
choose_from_menu($noyesoptions, 'allowrenames', $allowrenames);
|
||||
echo '</td></tr>';
|
||||
echo '</table><br />';
|
||||
echo '<input type="submit" value="'.$struploadusers.'" />';
|
||||
echo '</div></form><br />';
|
||||
echo '</div>';
|
||||
echo '<input type="submit" value="'.$struploadusers.'">';
|
||||
echo '</form><br />';
|
||||
echo '</center>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
@@ -421,4 +423,3 @@ function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+332
-361
@@ -3,6 +3,7 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$newuser = optional_param('newuser', 0, PARAM_BOOL);
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', '', PARAM_ALPHANUM); //md5 confirmation hash
|
||||
$confirmuser = optional_param('confirmuser', 0, PARAM_INT);
|
||||
@@ -13,55 +14,77 @@
|
||||
$search = trim(optional_param('search', '', PARAM_RAW));
|
||||
$lastinitial = optional_param('lastinitial', '', PARAM_CLEAN); // only show students with this last initial
|
||||
$firstinitial = optional_param('firstinitial', '', PARAM_CLEAN); // only show students with this first initial
|
||||
$ru = optional_param('ru', '2', PARAM_INT); // show remote users
|
||||
$lu = optional_param('lu', '2', PARAM_INT); // show local users
|
||||
$acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access)
|
||||
|
||||
if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID)) { // Should never happen
|
||||
redirect('index.php');
|
||||
}
|
||||
|
||||
if (empty($CFG->rolesactive)) { // No admin user yet.
|
||||
|
||||
$user = new object();
|
||||
$user->firstname = get_string('admin');
|
||||
$user->lastname = get_string('user');
|
||||
$user->username = 'admin';
|
||||
$user->password = hash_internal_user_password('admin');
|
||||
$user->email = 'root@localhost';
|
||||
$user->confirmed = 1;
|
||||
$user->lang = $CFG->lang;
|
||||
$user->maildisplay = 1;
|
||||
$user->timemodified = time();
|
||||
|
||||
if (! $user->id = insert_record('user', $user)) {
|
||||
error("SERIOUS ERROR: Could not create admin user record !!!");
|
||||
}
|
||||
|
||||
if (! $user = get_record('user', 'id', $user->id)) { // Double check.
|
||||
error("User ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
|
||||
// Assign the default admin role to the new user.
|
||||
if (!$adminroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW)) {
|
||||
error('No admin role could be found');
|
||||
}
|
||||
foreach ($adminroles as $adminrole) {
|
||||
role_assign($adminrole->id, $user->id, 0, $sitecontext->id);
|
||||
}
|
||||
set_config('rolesactive', 1);
|
||||
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
// Log the user in.
|
||||
$USER = $user;
|
||||
$USER->loggedin = true;
|
||||
$USER->sessionIP = md5(getremoteaddr()); // Store the current IP in the session
|
||||
$USER->site = $CFG->wwwroot;
|
||||
$USER->admin = true;
|
||||
$USER->newadminuser = true;
|
||||
|
||||
sesskey(); // For added security, used to check script parameters
|
||||
|
||||
load_all_capabilities();
|
||||
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id"); // Edit thyself
|
||||
exit;
|
||||
|
||||
} else {
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('editusers', $adminroot);
|
||||
|
||||
// Let's see if we have *any* mnet users. Just ask for a single record
|
||||
$mnet_users = get_records_select('user', " auth='mnet' AND mnethostid != '{$CFG->mnet_localhost_id}' ", '', '*', '0', '1');
|
||||
if(is_array($mnet_users) && count($mnet_users) > 0) {
|
||||
$mnet_auth_users = true;
|
||||
if ($newuser) {
|
||||
admin_externalpage_setup('addnewuser', $adminroot);
|
||||
} else {
|
||||
$mnet_auth_users = false;
|
||||
admin_externalpage_setup('editusers', $adminroot);
|
||||
}
|
||||
|
||||
if($mnet_auth_users) {
|
||||
// Determine which users we are looking at (local, remote, or both). Start with both.
|
||||
if (!isset($_SESSION['admin-user-remoteusers'])) {
|
||||
$_SESSION['admin-user-remoteusers'] = 1;
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
}
|
||||
if ($ru == 0 or $ru == 1) {
|
||||
$_SESSION['admin-user-remoteusers'] = $ru;
|
||||
}
|
||||
if ($lu == 0 or $lu == 1) {
|
||||
$_SESSION['admin-user-localusers'] = $lu;
|
||||
}
|
||||
$remoteusers = $_SESSION['admin-user-remoteusers'];
|
||||
$localusers = $_SESSION['admin-user-localusers'];
|
||||
|
||||
// if neither remote nor local, set to sensible local only
|
||||
if (!$remoteusers and !$localusers) {
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
$localusers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$site = get_site();
|
||||
|
||||
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to edit/delete users.');
|
||||
}
|
||||
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$strdeletecheck = get_string('deletecheck');
|
||||
$strsearch = get_string('search');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
@@ -69,359 +92,307 @@
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
if ($newuser) { // Create a new user
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record('user', 'id', $confirmuser)) {
|
||||
error("No such user!", '', true);
|
||||
if (!has_capability('moodle/user:create', $sitecontext)) {
|
||||
error('You do not have the required permission to create new users.');
|
||||
}
|
||||
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
if (!$user = get_record('user', 'username', 'changeme')) { // half finished user from another time
|
||||
|
||||
$result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
|
||||
$user = new object();
|
||||
$user->auth = 'manual';
|
||||
$user->firstname = '';
|
||||
$user->lastname = '';
|
||||
$user->username = 'changeme';
|
||||
$user->password = '';
|
||||
$user->email = '';
|
||||
$user->lang = $CFG->lang;
|
||||
$user->confirmed = 1;
|
||||
$user->timemodified = time();
|
||||
|
||||
if ($result == AUTH_CONFIRM_OK or $result == AUTH_CONFIRM_ALREADY) {
|
||||
notify(get_string('userconfirmed', '', fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
if (! $user->id = insert_record('user', $user)) {
|
||||
error('Could not start a new user!');
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
|
||||
redirect("$securewwwroot/user/edit.php?id=$user->id&course=$site->id");
|
||||
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to delete a user.');
|
||||
} else { // List all users for editing
|
||||
|
||||
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to edit/delete users.');
|
||||
}
|
||||
|
||||
if (!$user = get_record('user', 'id', $delete)) {
|
||||
error("No such user!", '', true);
|
||||
}
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$strdeletecheck = get_string('deletecheck');
|
||||
$strsearch = get_string('search');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
|
||||
$primaryadmin = get_admin();
|
||||
if ($user->id == $primaryadmin->id) {
|
||||
error("You are not allowed to delete the primary admin user!", '', true);
|
||||
}
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if ($confirm != md5($delete)) {
|
||||
$fullname = fullname($user, true);
|
||||
print_heading(get_string('deleteuser', 'admin'));
|
||||
$optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey());
|
||||
notice_yesno(get_string('deletecheckfull', '', "'$fullname'"), 'user.php', 'user.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
} else if (data_submitted() and !$user->deleted) {
|
||||
//following code is also used in auth sync scripts
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time()); // Remember it just in case
|
||||
$updateuser->email = ''; // Clear this field to free it up
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
// not sure if this is needed. unenrol_student($user->id); // From all courses
|
||||
delete_records('role_assignments', 'userid', $user->id); // unassign all roles
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record('user', 'id', $confirmuser)) {
|
||||
error("No such user!");
|
||||
}
|
||||
|
||||
$confirmeduser = new object();
|
||||
$confirmeduser->id = $confirmuser;
|
||||
$confirmeduser->confirmed = 1;
|
||||
$confirmeduser->timemodified = time();
|
||||
|
||||
if (update_record('user', $confirmeduser)) {
|
||||
notify(get_string('userconfirmed', '', fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
}
|
||||
|
||||
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
|
||||
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to delete a user.');
|
||||
}
|
||||
|
||||
if (!$user = get_record('user', 'id', $delete)) {
|
||||
error("No such user!");
|
||||
}
|
||||
|
||||
$primaryadmin = get_admin();
|
||||
if ($user->id == $primaryadmin->id) {
|
||||
error("You are not allowed to delete the primary admin user!");
|
||||
}
|
||||
|
||||
if ($confirm != md5($delete)) {
|
||||
$fullname = fullname($user, true);
|
||||
print_heading(get_string('deleteuser', 'admin'));
|
||||
$optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey());
|
||||
notice_yesno(get_string('deletecheckfull', '', "'$fullname'"), 'user.php', 'user.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
die;
|
||||
} else if (data_submitted() and !$user->deleted) {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time()); // Remember it just in case
|
||||
$updateuser->email = ''; // Clear this field to free it up
|
||||
$updateuser->idnumber = ''; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
// not sure if this is needed. unenrol_student($user->id); // From all courses
|
||||
delete_records('role_assignments', 'userid', $user->id); // unassign all roles
|
||||
// remove all context assigned on this user?
|
||||
notify(get_string('deletedactivity', '', fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($acl and confirm_sesskey()) {
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
// TODO: this should be under a separate capability
|
||||
error('You are not permitted to modify the MNET access control list.');
|
||||
}
|
||||
if (!$user = get_record('user', 'id', $acl)) {
|
||||
error("No such user.", '', true);
|
||||
}
|
||||
if (!is_mnet_remote_user($user)) {
|
||||
error('Users in the MNET access control list must be remote MNET users.');
|
||||
}
|
||||
$accessctrl = strtolower(required_param('accessctrl', PARAM_ALPHA));
|
||||
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
|
||||
error('Invalid access parameter.');
|
||||
}
|
||||
$aclrecord = get_record('mnet_sso_access_control', 'username', $user->username, 'mnet_host_id', $user->mnethostid);
|
||||
if (empty($aclrecord)) {
|
||||
$aclrecord = new object();
|
||||
$aclrecord->mnet_host_id = $user->mnethostid;
|
||||
$aclrecord->username = $user->username;
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!insert_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
}
|
||||
} else {
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!update_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
}
|
||||
}
|
||||
$mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
|
||||
notify("MNET access control list updated: username '$user->username' from host '"
|
||||
. $mnethosts[$user->mnethostid]->name
|
||||
. "' access now set to '$accessctrl'.");
|
||||
}
|
||||
|
||||
// Carry on with the user listing
|
||||
// Carry on with the user listing
|
||||
|
||||
$columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
|
||||
$columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
|
||||
|
||||
foreach ($columns as $column) {
|
||||
$string[$column] = get_string("$column");
|
||||
if ($sort != $column) {
|
||||
$columnicon = "";
|
||||
if ($column == "lastaccess") {
|
||||
$columndir = "DESC";
|
||||
foreach ($columns as $column) {
|
||||
$string[$column] = get_string("$column");
|
||||
if ($sort != $column) {
|
||||
$columnicon = "";
|
||||
if ($column == "lastaccess") {
|
||||
$columndir = "DESC";
|
||||
} else {
|
||||
$columndir = "ASC";
|
||||
}
|
||||
} else {
|
||||
$columndir = "ASC";
|
||||
$columndir = $dir == "ASC" ? "DESC":"ASC";
|
||||
if ($column == "lastaccess") {
|
||||
$columnicon = $dir == "ASC" ? "up":"down";
|
||||
} else {
|
||||
$columnicon = $dir == "ASC" ? "down":"up";
|
||||
}
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
|
||||
|
||||
}
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=".urlencode(stripslashes($search))."&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
if ($search or $firstinitial or $lastinitial) {
|
||||
print_heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
$usercount = $usersearchcount;
|
||||
} else {
|
||||
$columndir = $dir == "ASC" ? "DESC":"ASC";
|
||||
if ($column == "lastaccess") {
|
||||
$columnicon = $dir == "ASC" ? "up":"down";
|
||||
} else {
|
||||
$columnicon = $dir == "ASC" ? "down":"up";
|
||||
}
|
||||
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
|
||||
|
||||
print_heading("$usercount ".get_string('users'));
|
||||
}
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=".urlencode(stripslashes($search))."&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
// tell the query which users we are looking at (local, remote, or both)
|
||||
$remotewhere = '';
|
||||
if($mnet_auth_users && ($localusers XOR $remoteusers)) {
|
||||
if ($localusers) {
|
||||
$remotewhere .= " and mnethostid = {$CFG->mnet_localhost_id} ";
|
||||
} else {
|
||||
$remotewhere .= " and mnethostid <> {$CFG->mnet_localhost_id} ";
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
if ($search or $firstinitial or $lastinitial) {
|
||||
print_heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
$usercount = $usersearchcount;
|
||||
} else {
|
||||
print_heading("$usercount ".get_string('users'));
|
||||
}
|
||||
|
||||
$alphabet = explode(',', get_string('alphabet'));
|
||||
$strall = get_string('all');
|
||||
$alphabet = explode(',', get_string('alphabet'));
|
||||
$strall = get_string('all');
|
||||
|
||||
|
||||
/// Bar of first initials
|
||||
/// Bar of first initials
|
||||
|
||||
echo "<p style=\"text-align:center\">";
|
||||
echo get_string("firstname")." : ";
|
||||
if ($firstinitial) {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $firstinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
/// Bar of last initials
|
||||
|
||||
echo get_string("lastname")." : ";
|
||||
if ($lastinitial) {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $lastinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
|
||||
flush();
|
||||
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
if ($search !== '') {
|
||||
$match[] = s($search);
|
||||
}
|
||||
echo "<center><p align=\"center\">";
|
||||
echo get_string("firstname")." : ";
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string('firstname').": $firstinitial"."___";
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $firstinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
/// Bar of last initials
|
||||
|
||||
echo get_string("lastname")." : ";
|
||||
if ($lastinitial) {
|
||||
$match[] = get_string('lastname').": $lastinitial"."___";
|
||||
}
|
||||
$matchstring = implode(", ", $match);
|
||||
print_heading(get_string('nousersmatching', '', $matchstring));
|
||||
|
||||
$table = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
$countries = get_list_of_countries();
|
||||
if (empty($mnethosts)) {
|
||||
$mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
|
||||
}
|
||||
|
||||
foreach ($users as $key => $user) {
|
||||
if (!empty($user->country)) {
|
||||
$users[$key]->country = $countries[$user->country];
|
||||
}
|
||||
}
|
||||
if ($sort == "country") { // Need to resort by full country name, not code
|
||||
foreach ($users as $user) {
|
||||
$susers[$user->id] = $user->country;
|
||||
}
|
||||
asort($susers);
|
||||
foreach ($susers as $key => $value) {
|
||||
$nusers[] = $users[$key];
|
||||
}
|
||||
$users = $nusers;
|
||||
}
|
||||
|
||||
$mainadmin = get_admin();
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
if ($user->username == 'guest') {
|
||||
continue; // do not dispaly dummy new user and guest here
|
||||
}
|
||||
|
||||
if ($user->id == $USER->id) {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
} else {
|
||||
$deletebutton ="";
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/user:update', $sitecontext) and ($user->id==$USER->id or $user->id != $mainadmin->id) and !is_mnet_remote_user($user)) {
|
||||
$editbutton = "<a href=\"$securewwwroot/user/editadvanced.php?id=$user->id&course=$site->id\">$stredit</a>";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=$USER->sesskey\">" . get_string('confirm') . "</a>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
} else {
|
||||
$editbutton ="";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
}
|
||||
|
||||
// for remote users, shuffle columns around and display MNET stuff
|
||||
if (is_mnet_remote_user($user)) {
|
||||
$accessctrl = 'allow';
|
||||
if ($acl = get_record('mnet_sso_access_control', 'username', $user->username, 'mnet_host_id', $user->mnethostid)) {
|
||||
$accessctrl = $acl->accessctrl;
|
||||
}
|
||||
$changeaccessto = ($accessctrl == 'deny' ? 'allow' : 'deny');
|
||||
// delete button in confirm column - remote users should already be confirmed
|
||||
// TODO: no delete for remote users, for now. new userid, delete flag, unique on username/host...
|
||||
$confirmbutton = "";
|
||||
// ACL in delete column
|
||||
$deletebutton = get_string($accessctrl, 'mnet');
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
// TODO: this should be under a separate capability
|
||||
$deletebutton .= " (<a href=\"?acl={$user->id}&accessctrl=$changeaccessto&sesskey={$USER->sesskey}\">"
|
||||
. get_string($changeaccessto, 'mnet') . " access</a>)";
|
||||
}
|
||||
// mnet info in edit column
|
||||
if (isset($mnethosts[$user->mnethostid])) {
|
||||
$editbutton = $mnethosts[$user->mnethostid]->name;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->lastaccess) {
|
||||
$strlastaccess = format_time(time() - $user->lastaccess);
|
||||
} else {
|
||||
$strlastaccess = get_string('never');
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
|
||||
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
|
||||
"$user->email",
|
||||
"$user->city",
|
||||
"$user->country",
|
||||
$strlastaccess,
|
||||
$editbutton,
|
||||
$deletebutton,
|
||||
$confirmbutton);
|
||||
}
|
||||
}
|
||||
|
||||
if($mnet_auth_users) {
|
||||
echo "<p style=\"text-align:center\">";
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?lu=0">'.get_string('hidelocal','mnet').'</a> | ';
|
||||
} elseif ($localusers == 0) {
|
||||
echo '<a href="?lu=1">'.get_string('showlocal','mnet').'</a> | ';
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo get_string('hidelocal','mnet').' | ';
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?ru=0">'.get_string('hideremote','mnet').'</a>';
|
||||
} elseif ($remoteusers == 0) {
|
||||
echo '<a href="?ru=1">'.get_string('showremote','mnet').'</a>';
|
||||
} else {
|
||||
echo get_string('hideremote','mnet');
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $lastinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
}
|
||||
echo "</center>";
|
||||
|
||||
echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
|
||||
echo "<form action=\"user.php\" method=\"get\"><fieldset class=\"invisiblefieldset\">";
|
||||
echo "<input type=\"text\" name=\"search\" value=\"".s($search, true)."\" size=\"20\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsearch\" />";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
|
||||
}
|
||||
echo "</fieldset></form>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
}
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
|
||||
flush();
|
||||
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
if ($search !== '') {
|
||||
$match[] = s($search);
|
||||
}
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string('firstname').": $firstinitial"."___";
|
||||
}
|
||||
if ($lastinitial) {
|
||||
$match[] = get_string('lastname').": $lastinitial"."___";
|
||||
}
|
||||
$matchstring = implode(", ", $match);
|
||||
print_heading(get_string('nousersmatching', '', $matchstring));
|
||||
|
||||
$table = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
$countries = get_list_of_countries();
|
||||
|
||||
foreach ($users as $key => $user) {
|
||||
if (!empty($user->country)) {
|
||||
$users[$key]->country = $countries[$user->country];
|
||||
}
|
||||
}
|
||||
if ($sort == "country") { // Need to resort by full country name, not code
|
||||
foreach ($users as $user) {
|
||||
$susers[$user->id] = $user->country;
|
||||
}
|
||||
asort($susers);
|
||||
foreach ($susers as $key => $value) {
|
||||
$nusers[] = $users[$key];
|
||||
}
|
||||
$users = $nusers;
|
||||
}
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
$table->width = "95%";
|
||||
foreach ($users as $user) {
|
||||
if ($user->username == 'changeme' or $user->username == 'guest') {
|
||||
continue; // do not dispaly dummy new user and guest here
|
||||
}
|
||||
|
||||
if ($user->id == $USER->id) {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
if (has_capability('moodle/user:delete', $sitecontext)) {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
} else {
|
||||
$deletebutton ="";
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('moodle/user:update', $sitecontext)) {
|
||||
$editbutton = "<a href=\"$securewwwroot/user/edit.php?id=$user->id&course=$site->id\">$stredit</a>";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=$USER->sesskey\">" . get_string('confirm') . "</a>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
} else {
|
||||
$editbutton ="";
|
||||
if ($user->confirmed == 0) {
|
||||
$confirmbutton = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
|
||||
} else {
|
||||
$confirmbutton = "";
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->lastaccess) {
|
||||
$strlastaccess = format_time(time() - $user->lastaccess);
|
||||
} else {
|
||||
$strlastaccess = get_string('never');
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
|
||||
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
|
||||
"$user->email",
|
||||
"$user->city",
|
||||
"$user->country",
|
||||
$strlastaccess,
|
||||
$editbutton,
|
||||
$deletebutton,
|
||||
$confirmbutton);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<table class=\"searchbox\" align=\"center\" cellpadding=\"10\"><tr><td>";
|
||||
echo "<form action=\"user.php\" method=\"get\">";
|
||||
echo "<input type=\"text\" name=\"search\" value=\"".s($search, true)."\" size=\"20\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsearch\" />";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
|
||||
}
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string('addnewuser')."</a>");
|
||||
}
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
if (!isset($form->dbhost)) {
|
||||
$form->dbhost = '';
|
||||
}
|
||||
if (!isset($form->dbname)) {
|
||||
$form->dbname = '';
|
||||
}
|
||||
if (!isset($form->dbuser)) {
|
||||
$form->dbuser = '';
|
||||
}
|
||||
if (!isset($form->dbpass)) {
|
||||
$form->dbpass = '';
|
||||
}
|
||||
if (!isset($form->dbcluster)) {
|
||||
$form->dbcluster = '';
|
||||
}
|
||||
if (!isset($form->pathtopgdump)) {
|
||||
$form->pathtopgdump = '';
|
||||
}
|
||||
if (!isset($form->pathtopsql)) {
|
||||
$form->pathtopsql = '';
|
||||
}
|
||||
?>
|
||||
<form name="migratefrom" action="utfdbmigrate.php" method="POST">
|
||||
<input name="migrate" type="hidden" value="1" />
|
||||
<input name="sesskey" type="hidden" value="<?php echo sesskey() ?>" />
|
||||
<?php if (isset($err["dbconnect"])) formerr($err["dbconnect"]); ?>
|
||||
<?php if (isset($err["pathtopgdump"])) formerr($err["pathtopgdump"]); ?>
|
||||
<?php if (isset($err["pathtopsql"])) formerr($err["pathtopsql"]); ?>
|
||||
<table cellpadding="9" cellspacing="0" width="500">
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("dbhost", "install") ?>:</td>
|
||||
<td><input type="text" name="dbhost" value="<?php p($form->dbhost) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("database", "install") ?>:</td>
|
||||
<td><input type="text" name="dbname" value="<?php p($form->dbname) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("user") ?>:</td>
|
||||
<td><input type="text" name="dbuser" value="<?php p($form->dbuser) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("password") ?>:</td>
|
||||
<td><input type="text" name="dbpass" value="<?php p($form->dbpass) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("pgcluster", "admin") ?>:</td>
|
||||
<td><input type="text" name="dbcluster" value="<?php p($form->dbcluster) ?>" />
|
||||
<td><?php print_string("pgclusterdescription", "admin") ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap="nowrap"><?php print_string("pathtopgdump","admin") ?>:</td>
|
||||
<td><input type="text" name="pathtopgdump" value="<?php p($form->pathtopgdump) ?>" />
|
||||
<td><?php print_string("pathtopgdumpdesc","admin"); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap="nowrap"><?php print_string("pathtopsql","admin") ?>:</td>
|
||||
<td><input type="text" name="pathtopsql" value="<?php p($form->pathtopsql) ?>" />
|
||||
<td><?php print_string("pathtopsqldesc","admin"); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<center>
|
||||
<input type="submit" value="<?php print_string('continue') ?>"/>
|
||||
<input type="button" value="<?php print_string('cancel') ?>" onclick="javascript:history.go(-1)" />
|
||||
</center>
|
||||
Executable
+1238
File diff suppressed because it is too large
Load Diff
@@ -72,17 +72,17 @@ class delete_field extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletefield'] . '<br /><br />' . $fieldparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletefield'] . '<br /><br />' . $fieldparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_field&confirmed=yes&postaction=edit_table&field=' . $fieldparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_field&confirmed=yes&postaction=edit_table&field=' . $fieldparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></div></form></fieldset>';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -72,17 +72,17 @@ class delete_index extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeleteindex'] . '<br /><br />' . $indexparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeleteindex'] . '<br /><br />' . $indexparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_index&confirmed=yes&postaction=edit_table&index=' . $indexparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_index&confirmed=yes&postaction=edit_table&index=' . $indexparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -72,17 +72,17 @@ class delete_key extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletekey'] . '<br /><br />' . $keyparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletekey'] . '<br /><br />' . $keyparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_key&confirmed=yes&postaction=edit_table&key=' . $keyparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_key&confirmed=yes&postaction=edit_table&key=' . $keyparam . '&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -72,17 +72,17 @@ class delete_sentence extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletesentence'] . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletesentence'] . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_sentence&confirmed=yes&postaction=edit_statement&sentence=' . $sentenceparam . '&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_sentence&confirmed=yes&postaction=edit_statement&sentence=' . $sentenceparam . '&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_statement&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=edit_statement&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -71,17 +71,17 @@ class delete_statement extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_statement&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_statement&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -71,17 +71,17 @@ class delete_table extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletetable'] . '<br /><br />' . $tableparam . '</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletetable'] . '<br /><br />' . $tableparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_table&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_table&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -70,17 +70,17 @@ class delete_xml_file extends XMLDBAction {
|
||||
|
||||
/// If not confirmed, show confirmation box
|
||||
if (!$confirmed) {
|
||||
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
|
||||
$o.= ' <tr><td class="generalboxcontent">';
|
||||
$o.= ' <p class="centerpara">' . $this->str['confirmdeletexmlfile'] . '<br /><br />' . $dirpath . '/install.php</p>';
|
||||
$o.= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletexmlfile'] . '<br /><br />' . $dirpath . '/install.php</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_xml_file&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=delete_xml_file&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
|
||||
$o.= ' </td><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></fieldset></form></div>';
|
||||
$o.= ' <form action="index.php?action=main_view#lastused" method="post">';
|
||||
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
|
||||
$o.= ' </td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= ' </td></tr>';
|
||||
|
||||
@@ -98,14 +98,13 @@ class edit_field extends XMLDBAction {
|
||||
$origstructure =& $dbdir->xml_file->getStructure();
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= ' <div>';
|
||||
$o = '<form name="form" id="form" action="index.php" method="post">';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="field" value="' . $fieldparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_field_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
/// XMLDB field name
|
||||
/// If the field has dependencies, we cannot change its name
|
||||
$disabled = '';
|
||||
@@ -171,18 +170,18 @@ class edit_field extends XMLDBAction {
|
||||
/// Change button
|
||||
$o.= ' <tr valign="top"><td> </td><td colspan="2"><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getField($fieldparam)) {
|
||||
$b .= ' <a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&field=' . $fieldparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&field=' . $fieldparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($field->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&field=' . $fieldparam . '">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&field=' . $fieldparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
|
||||
@@ -98,21 +98,20 @@ class edit_index extends XMLDBAction {
|
||||
$origstructure =& $dbdir->xml_file->getStructure();
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= '<div>';
|
||||
$o = '<form name="form" id="form" action="index.php" method="post">';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="index" value="' . $indexparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_index_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
/// XMLDB index name
|
||||
/// If the index has dependencies, we cannot change its name
|
||||
$disabled = '';
|
||||
if ($structure->getIndexUses($table->getName(), $index->getName())) {
|
||||
$disabled = ' disabled="disabled " ';
|
||||
}
|
||||
$o.= ' <tr valign="top"><td><label for="name" accesskey="n">Name:</label></td><td colspan="2"><input name="name" type="text" size="30" id="name"' . $disabled . ' value="' . s($index->getName()) . '" /></td></tr>';
|
||||
$o.= ' <tr valign="top"><td><label for="name" accesskey="n">Name:</label></td><td colspan="2"><input name="name" type="text" size="30" id="name"' . $disabled . 'value="' . s($index->getName()) . '" /></td></tr>';
|
||||
/// XMLDB key comment
|
||||
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td colspan="2"><textarea name="comment" rows="3" cols="80" id="comment">' . s($index->getComment()) . '</textarea></td></tr>';
|
||||
/// XMLDBIndex Type
|
||||
@@ -126,18 +125,18 @@ class edit_index extends XMLDBAction {
|
||||
/// Change button
|
||||
$o.= ' <tr valign="top"><td> </td><td colspan="2"><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getIndex($indexparam)) {
|
||||
$b .= ' <a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&index=' . $indexparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&index=' . $indexparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($index->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&index=' . $indexparam . '">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&index=' . $indexparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
|
||||
@@ -98,21 +98,20 @@ class edit_key extends XMLDBAction {
|
||||
$origstructure =& $dbdir->xml_file->getStructure();
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= '<div>';
|
||||
$o = '<form name="form" id="form" action="index.php" method="post">';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="key" value="' . $keyparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_key_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
/// XMLDB key name
|
||||
/// If the key has dependencies, we cannot change its name
|
||||
$disabled = '';
|
||||
if ($structure->getKeyUses($table->getName(), $key->getName())) {
|
||||
$disabled = ' disabled="disabled " ';
|
||||
}
|
||||
$o.= ' <tr valign="top"><td><label for="name" accesskey="n">Name:</label></td><td colspan="2"><input name="name" type="text" size="30" id="name"' . $disabled . ' value="' . s($key->getName()) . '" /></td></tr>';
|
||||
$o.= ' <tr valign="top"><td><label for="name" accesskey="n">Name:</label></td><td colspan="2"><input name="name" type="text" size="30" id="name"' . $disabled . 'value="' . s($key->getName()) . '" /></td></tr>';
|
||||
/// XMLDB key comment
|
||||
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td colspan="2"><textarea name="comment" rows="3" cols="80" id="comment">' . s($key->getComment()) . '</textarea></td></tr>';
|
||||
/// XMLDBKey Type
|
||||
@@ -138,18 +137,18 @@ class edit_key extends XMLDBAction {
|
||||
/// Change button
|
||||
$o.= ' <tr valign="top"><td> </td><td colspan="2"><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getKey($keyparam)) {
|
||||
$b .= ' <a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&key=' . $keyparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&key=' . $keyparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($key->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&key=' . $keyparam . '">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '&key=' . $keyparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
|
||||
@@ -114,14 +114,13 @@ class edit_sentence extends XMLDBAction {
|
||||
$values = $statement->getValuesFromInsertSentence($sentence);
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= '<div>';
|
||||
$o = '<form name="form" id="form" action="index.php" method="post">';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="sentence" value="' . $sentenceparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_sentence_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
/// The fields box
|
||||
$o.= ' <tr><td>INSERT INTO ' . s($statement->getTable()) . '</td></tr>';
|
||||
$o.= ' <tr><td><textarea name="fields" rows="2" cols="70" id="fields">' . s(implode(', ', $fields)) . '</textarea></td></tr>';
|
||||
@@ -131,9 +130,9 @@ class edit_sentence extends XMLDBAction {
|
||||
/// The submit button
|
||||
$o.= ' <tr valign="top"><td><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The back to edit statement button
|
||||
$b .= ' <a href="index.php?action=edit_statement&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
|
||||
@@ -103,28 +103,27 @@ class edit_statement extends XMLDBAction {
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= '<div>';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_statement_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
$o.= ' <tr valign="top"><td>Name:</td><td><input type="hidden" name ="name" value="' . s($statement->getName()) . '" />' . s($statement->getName()) .'</td></tr>';
|
||||
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td><textarea name="comment" rows="3" cols="80" id="comment">' . s($statement->getComment()) . '</textarea></td></tr>';
|
||||
$o.= ' <tr valign="top"><td> </td><td><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($origstructure->getStatement($statementparam)) {
|
||||
$b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&statement=' . $statementparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&statement=' . $statementparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($statement->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&statement=' . $statementparam . '">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&statement=' . $statementparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
@@ -142,7 +141,7 @@ class edit_statement extends XMLDBAction {
|
||||
$sentences =& $statement->getSentences();
|
||||
if (!empty($sentences)) {
|
||||
$o .= '<h3 class="main">' . $this->str['sentences'] . '</h3>';
|
||||
$o .= '<table id="listfields" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="listfields" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($sentences as $key => $sentence) {
|
||||
/// Prepend some SQL
|
||||
|
||||
@@ -103,12 +103,11 @@ class edit_table extends XMLDBAction {
|
||||
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o.= '<div>';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_table_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
/// If the table is being used, we cannot rename it
|
||||
if ($structure->getTableUses($table->getName())) {
|
||||
$o.= ' <tr valign="top"><td>Name:</td><td><input type="hidden" name ="name" value="' . s($table->getName()) . '" />' . s($table->getName()) .'</td></tr>';
|
||||
@@ -118,18 +117,18 @@ class edit_table extends XMLDBAction {
|
||||
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td><textarea name="comment" rows="3" cols="80" id="comment">' . s($table->getComment()) . '</textarea></td></tr>';
|
||||
$o.= ' <tr valign="top"><td> </td><td><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($origstructure->getTable($tableparam)) {
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($table->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
@@ -142,7 +141,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The back to edit xml file button
|
||||
$b .= ' <a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
$b .= ' <p class="centerpara buttons">';
|
||||
$b .= ' <p align="center" class="buttons">';
|
||||
/// The view sql code button
|
||||
$b .= '<a href="index.php?action=view_table_sql&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' .$this->str['viewsqlcode'] . ']</a>';
|
||||
/// The view php code button
|
||||
@@ -171,7 +170,7 @@ class edit_table extends XMLDBAction {
|
||||
$fields =& $table->getFields();
|
||||
if (!empty($fields)) {
|
||||
$o .= '<h3 class="main">' . $this->str['fields'] . '</h3>';
|
||||
$o .= '<table id="listfields" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="listfields" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($fields as $field) {
|
||||
/// Calculate buttons
|
||||
@@ -211,7 +210,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $field->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&field=' . $field->getName() . '&table=' . $table->getName() . '&select=edited">' . $field->getName() . '</a>' . $b . $r . '</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&field=' . $field->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $field->getName() . '</a>' . $b . $r . '</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
@@ -220,7 +219,7 @@ class edit_table extends XMLDBAction {
|
||||
$keys =& $table->getKeys();
|
||||
if (!empty($keys)) {
|
||||
$o .= '<h3 class="main">' . $this->str['keys'] . '</h3>';
|
||||
$o .= '<table id="listkeys" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="listkeys" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($keys as $key) {
|
||||
/// Calculate buttons
|
||||
@@ -255,7 +254,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $key->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&key=' . $key->getName() . '&table=' . $table->getName() . '&select=edited">' . $key->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&key=' . $key->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $key->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
@@ -264,7 +263,7 @@ class edit_table extends XMLDBAction {
|
||||
$indexes =& $table->getIndexes();
|
||||
if (!empty($indexes)) {
|
||||
$o .= '<h3 class="main">' . $this->str['indexes'] . '</h3>';
|
||||
$o .= '<table id="listindexes" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="listindexes" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($indexes as $index) {
|
||||
/// Calculate buttons
|
||||
@@ -291,7 +290,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $index->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&index=' . $index->getName() . '&table=' . $table->getName() . '&select=edited">' . $index->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&index=' . $index->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $index->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
|
||||
@@ -107,7 +107,7 @@ class edit_table_save extends XMLDBAction {
|
||||
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
|
||||
notice ('<p>' .implode(', ', $errors) . '</p>
|
||||
<p>' . $temptable->readableInfo(),
|
||||
'index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
|
||||
'index.php?action=edit_table&table=' . $tableparam . '&dir=' . str_replace($CFG->dirroot, '', urlencode($dirpath)));
|
||||
die; /// re-die :-P
|
||||
}
|
||||
|
||||
|
||||
@@ -101,33 +101,32 @@ class edit_xml_file extends XMLDBAction {
|
||||
$structure =& $editeddir->xml_file->getStructure();
|
||||
/// Add the main form
|
||||
$o = '<form id="form" action="index.php" method="post">';
|
||||
$o .= '<div>';
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_xml_file_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_xml_file" />';
|
||||
$o.= ' <input type="hidden" name ="path" value="' . s($structure->getPath()) .'" />';
|
||||
$o.= ' <input type="hidden" name ="version" value="' . s($structure->getVersion()) .'" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter">';
|
||||
$o.= ' <table id="formelements" align="center">';
|
||||
$o.= ' <tr valign="top"><td>Path:</td><td>' . s($structure->getPath()) . '</td></tr>';
|
||||
$o.= ' <tr valign="top"><td>Version:</td><td>' . s($structure->getVersion()) . '</td></tr>';
|
||||
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td><textarea name="comment" rows="3" cols="80" id="comment">' . $structure->getComment() . '</textarea></td></tr>';
|
||||
$o.= ' <tr><td> </td><td><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
$o.= '</form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
/// The view edited XML button
|
||||
if ($structure->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
/// The new table button
|
||||
$b .= ' <a href="index.php?action=new_table&postaction=edit_table&table=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
|
||||
/// The new from MySQL button
|
||||
if ($CFG->dbfamily == 'mysql') {
|
||||
if ($CFG->dbtype == 'mysql') {
|
||||
$b .= ' <a href="index.php?action=new_table_from_mysql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['newtablefrommysql'] . ']';
|
||||
@@ -137,7 +136,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
/// The back to main menu button
|
||||
$b .= ' <a href="index.php?action=main_view#lastused">[' . $this->str['backtomainview'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
$b .= ' <p class="centerpara buttons">';
|
||||
$b .= ' <p align="center" class="buttons">';
|
||||
/// The view sql code button
|
||||
$b .= '<a href="index.php?action=view_structure_sql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' .$this->str['viewsqlcode'] . ']</a>';
|
||||
/// The view php code button
|
||||
@@ -159,7 +158,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
$tables =& $structure->getTables();
|
||||
if ($tables) {
|
||||
$o .= '<h3 class="main">' . $this->str['tables'] . '</h3>';
|
||||
$o .= '<table id="listtables" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="listtables" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($tables as $table) {
|
||||
/// Calculate buttons
|
||||
@@ -195,7 +194,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
}
|
||||
$b .= '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&table=' . $table->getName() . '&select=edited">' . $table->getName() . '</a>' . $b . '</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $table->getName() . '</a>' . $b . '</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
@@ -204,7 +203,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
$statements =& $structure->getStatements();
|
||||
if ($statements) {
|
||||
$o .= '<h3 class="main">' . $this->str['statements'] . '</h3>';
|
||||
$o .= '<table id="liststatements" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
|
||||
$o .= '<table id="liststatements" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
|
||||
$row = 0;
|
||||
foreach ($statements as $statement) {
|
||||
/// Calculate buttons
|
||||
@@ -230,7 +229,7 @@ class edit_xml_file extends XMLDBAction {
|
||||
$b .= '<a href="index.php?action=delete_statement&statement=' . $statement->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '</td>';
|
||||
/// Print statement row
|
||||
$o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&statement=' . $statement->getName() . '&select=edited">' . $statement->getName() . '</a>' . $b . '</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&statement=' . $statement->getName() . '&select=edited" target="_blank">' . $statement->getName() . '</a>' . $b . '</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user