Compare commits
1775 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c54b5d6ebc | |||
| 9851f4d091 | |||
| b2a1bc9fc9 | |||
| 630d7b7b4d | |||
| 25c741d659 | |||
| 50d7a3a52e | |||
| 38271961ae | |||
| 4a2aeccb2b | |||
| c5431f8858 | |||
| 4ac66d6105 | |||
| 901ba3c01d | |||
| 7a12269386 | |||
| 8dc163f571 | |||
| 5609431181 | |||
| 9661a67c66 | |||
| 0582eb58c8 | |||
| 2055e78fe2 | |||
| c635c9c087 | |||
| d50bb68692 | |||
| 498ef90f7b | |||
| ace9977578 | |||
| c8a38c86ce | |||
| 9c9d5ae18f | |||
| 8df570f284 | |||
| 23eb2bbc57 | |||
| 83fa1948c2 | |||
| feb3dff674 | |||
| 61da36a863 | |||
| ebb8f1b45c | |||
| 580427eb72 | |||
| 952b4986c4 | |||
| 220dfe69ad | |||
| 5f7baedd19 | |||
| bab2c5b8ce | |||
| 51028ee868 | |||
| 83cd002a8e | |||
| 8de0b6879e | |||
| def35d35d7 | |||
| a7db9eb28e | |||
| ed2de86926 | |||
| 6c7bfbc7af | |||
| 122b18f02f | |||
| 953727c4c8 | |||
| f54b9b94de | |||
| 2ac8f379c3 | |||
| a945eab2c2 | |||
| 14c3063dcc | |||
| aa910f60b0 | |||
| 2193242b48 | |||
| c10ac049cc | |||
| 9ee129e4dd | |||
| 0e3a277b02 | |||
| 6c10695f24 | |||
| 26a6d6db3e | |||
| 8ab4f3001f | |||
| b5ec2ec12f | |||
| afb39ad0c4 | |||
| 53ec9ce362 | |||
| 932e5b4a69 | |||
| 722d5c0378 | |||
| 4caea37161 | |||
| 749de1c140 | |||
| 259502e542 | |||
| ab68c36639 | |||
| 3e403b7950 | |||
| 977f038738 | |||
| 18320d9331 | |||
| 41e5c5abc5 | |||
| 9a75e63326 | |||
| 8993348790 | |||
| 2917dfb9dc | |||
| a68d660a45 | |||
| ae93996398 | |||
| 186288dea5 | |||
| e7cfc5325f | |||
| f5d2ef9543 | |||
| 8bb94c53eb | |||
| c2d8cd210f | |||
| b60d39b96e | |||
| d9ac8ca2e0 | |||
| b87c2adc76 | |||
| 4483596d79 | |||
| 7d255d1602 | |||
| 2eb607bedb | |||
| 15422ee0c2 | |||
| b17e29b38e | |||
| 5ee8a752c4 | |||
| 38cdb67293 | |||
| 912127a158 | |||
| 42521dbff4 | |||
| f7d818d5c5 | |||
| 11889a8466 | |||
| e0dbbecedb | |||
| bc7e72c9b3 | |||
| f253e2575f | |||
| 71deda82fe | |||
| f6ce611ce4 | |||
| 682a3999d7 | |||
| 393abfad48 | |||
| 78a2e3d249 | |||
| 398f365cb8 | |||
| 985cd79efa | |||
| 6d306766c9 | |||
| 164099fd14 | |||
| df7f761f53 | |||
| 25340ceab1 | |||
| 46dc437f66 | |||
| 80fc4f88be | |||
| f0a73113d5 | |||
| 3fca3da072 | |||
| 239f82915a | |||
| c637903591 | |||
| e85a6623a1 | |||
| f25f387188 | |||
| c56218c8ce | |||
| 4d64df82cb | |||
| 5ec4333086 | |||
| e89b542b1b | |||
| 88fb90e9b4 | |||
| 5ed1a6d692 | |||
| 8b68aaf1f6 | |||
| b7535a6e23 | |||
| bf617f07a6 | |||
| 34225def25 | |||
| faf8922009 | |||
| 0232fdd58c | |||
| 5e41163054 | |||
| 070515ce42 | |||
| f77efbe3be | |||
| 74d60e20ba | |||
| 7770beee55 | |||
| 96bf2d385f | |||
| 9a94d087a8 | |||
| 1ff64b7f60 | |||
| e72c81ab82 | |||
| abcd6d503e | |||
| f784666c93 | |||
| 44de4fd8a8 | |||
| cd60a00cf9 | |||
| 2382dae103 | |||
| e5df73c53e | |||
| 3cd3c343ea | |||
| 8dfbb77f3c | |||
| 282f2e5b22 | |||
| 04c9c465f9 | |||
| 763f3766a8 | |||
| 4bcb6f1043 | |||
| 82329ca01e | |||
| ae4f432615 | |||
| 8e5cde5461 | |||
| cb5c5a1bfe | |||
| 70156ee3d4 | |||
| 0715864e36 | |||
| 2cf2079188 | |||
| 67149b4d2c | |||
| 01ce0aa3a8 | |||
| 50c9c95ea6 | |||
| 60f08f5ccc | |||
| a55a4c8c31 | |||
| dde5cbbdfd | |||
| 38f78e158c | |||
| 24f9eb47b1 | |||
| dd7a3aaedf | |||
| b483d8c81e | |||
| 1eff1e081c | |||
| 1d9b22c497 | |||
| 38453bb238 | |||
| 70f6f8b708 | |||
| 98f052303f | |||
| 66fd3fb7ff | |||
| 7b838d2a97 | |||
| 1f508431dd | |||
| 85508791a6 | |||
| 494b416d7b | |||
| e56820d225 | |||
| 1d44f3a5d7 | |||
| 0b32d159da | |||
| 0674d7ba48 | |||
| 9ee425fa14 | |||
| 73ec9fb26e | |||
| db504824f8 | |||
| 8bcbac0126 | |||
| b4d2ebf952 | |||
| f9bec1f2e7 | |||
| 72d09c0a5a | |||
| 254fdebbc9 | |||
| b5ee139f78 | |||
| 184e03b294 | |||
| 76c4cabbfe | |||
| 681d95c495 | |||
| a6349a6d1f | |||
| 4a9f162f17 | |||
| 03f6e19c61 | |||
| 577bd6a9f2 | |||
| cbb0dd34d9 | |||
| 7fc7e9645f | |||
| d27162c0cd | |||
| b455078417 | |||
| d994263946 | |||
| 290c1e61cc | |||
| f89c3674bb | |||
| e8ca86ffb7 | |||
| 8b0d0c1756 | |||
| 9111a763bd | |||
| d00c2e2310 | |||
| 085366cfa0 | |||
| e2823d208a | |||
| 1a87ac6a6c | |||
| d40177d7a2 | |||
| a9a26d5a45 | |||
| 89aa5d49ee | |||
| a4df55c815 | |||
| a67c2e0a33 | |||
| 435241d385 | |||
| 7de8f45ae9 | |||
| 9086a17e15 | |||
| 60bdcfa990 | |||
| efd7fc31b9 | |||
| 14be3fe259 | |||
| cdf5d7b047 | |||
| 5d8323d57c | |||
| 1122563591 | |||
| d0491a1fef | |||
| e687c5421c | |||
| 6ae7fca715 | |||
| 919a058edb | |||
| 65b2ea05b1 | |||
| 4a75fb028c | |||
| bcfdf5f0e6 | |||
| 84fdfffb13 | |||
| 7b9f8f652b | |||
| 43ea696c77 | |||
| 1ba6745de0 | |||
| 2d1880e449 | |||
| 1817713a44 | |||
| 3679ac38b7 | |||
| 29a71fa1d0 | |||
| ec22a2b3bb | |||
| c6188b29ef | |||
| 0be47a3364 | |||
| 7d0b581589 | |||
| 6a5ef2899e | |||
| 710f3399df | |||
| 0cf2d8903d | |||
| 93bcfb18a8 | |||
| c99e2d2c66 | |||
| 6549d34a38 | |||
| 4498b48aee | |||
| 769ffdfdca | |||
| d16b5bb763 | |||
| fddbea82ac | |||
| 17e941b48a | |||
| 7aaabae78e | |||
| e0a53b4d0a | |||
| 59b5352b51 | |||
| 1068ba8d27 | |||
| d9ab06ca32 | |||
| 7ece83dec6 | |||
| 68dfdae36e | |||
| fce45181d7 | |||
| 4e9cc4842f | |||
| a072684a96 | |||
| 7505cd1cd2 | |||
| b12e186c04 | |||
| 9fe710159f | |||
| 74971fdad9 | |||
| 62ade7827c | |||
| 9d7dde3c97 | |||
| 73292a8393 | |||
| 637c9cd330 | |||
| 2b4090c4fe | |||
| dc2a68b4d7 | |||
| 0aff0bf622 | |||
| 72ed1089dd | |||
| e1fede4e63 | |||
| fe18e430f7 | |||
| 6cd6568f84 | |||
| 6fcc3fab2c | |||
| fa1ce50ec8 | |||
| 67ba380ec9 | |||
| e42b787931 | |||
| f21b4c1c2b | |||
| 235089d15f | |||
| fa27bb7c22 | |||
| 926a759c71 | |||
| c11d468cc1 | |||
| 9e525f53b3 | |||
| 2099bab6a0 | |||
| 57a1c1af6a | |||
| a705afc7da | |||
| f159f93bc7 | |||
| 8ade954b60 | |||
| e1a3a68059 | |||
| 63b8c597f6 | |||
| c6a37a3185 | |||
| 73d68a033d | |||
| 18c26f97ef | |||
| e2629fc12d | |||
| d5e5544448 | |||
| c3a70f83b1 | |||
| f2179d4688 | |||
| 0ba7a5cab6 | |||
| 8d351c3e92 | |||
| b109aa6efa | |||
| f40cc4a843 | |||
| 0be62652d1 | |||
| 71c47913a0 | |||
| 66fbb3b10f | |||
| 5578e1bd26 | |||
| 9122a1e62d | |||
| 26996407cb | |||
| 55fdf029ab | |||
| e45b5f24d4 | |||
| c5c3568d89 | |||
| 8e0b42fb88 | |||
| 8ba12d576a | |||
| 9f65fc2b27 | |||
| 12c40a2f66 | |||
| 9595bf588a | |||
| 8a9e5ac327 | |||
| 4d20567f61 | |||
| 399d7b3acb | |||
| 2a069aa1f2 | |||
| 289cf90737 | |||
| cef4a0e828 | |||
| bd22fdfbdb | |||
| dc9ec4e135 | |||
| 4dde75c7d7 | |||
| 65ebc47636 | |||
| 5747bf91e5 | |||
| 398b3a2b83 | |||
| 514c862489 | |||
| c8ef1ce0f6 | |||
| 7e61008580 | |||
| e2d7747f10 | |||
| 05746e64f2 | |||
| c53889ff42 | |||
| 1a6649ec70 | |||
| 69c0d07455 | |||
| d205e11ef2 | |||
| 301d3a4509 | |||
| 7f45789999 | |||
| 84c0444376 | |||
| 9547937448 | |||
| bbeffa6ff8 | |||
| 64fdd835fb | |||
| 6a239dbe87 | |||
| d67775e55a | |||
| 42fd23bc3a | |||
| 29ad8bfe68 | |||
| 8b7291eff5 | |||
| a3c092c96d | |||
| 0b7c884132 | |||
| cf0371143c | |||
| d3a126d9c0 | |||
| 9bb1bdbc9c | |||
| 744da696ef | |||
| 347b01bcd9 | |||
| 9c23c88ee6 | |||
| 812fe4c5fc | |||
| fe1acc35e7 | |||
| 83847ae5b1 | |||
| 4fd1373c7e | |||
| 44944d8466 | |||
| 04f1658794 | |||
| e14b9cd27c | |||
| 6412c0b872 | |||
| d3af23581d | |||
| 80729b01d0 | |||
| 8bc776ba4f | |||
| 4eb27d4a74 | |||
| 494538afb3 | |||
| eab678f193 | |||
| 40c61f1f01 | |||
| 14f03b6f8b | |||
| d65d9f925d | |||
| 623b5e548d | |||
| 8585ef8726 | |||
| 14f872baec | |||
| 84325f54bd | |||
| c735b8fe65 | |||
| f358efc1f4 | |||
| f899b4a6d3 | |||
| 5cdb11e46f | |||
| f82b708d08 | |||
| f9e95ccfbc | |||
| 088e28666f | |||
| 29d550cc82 | |||
| 43ba708ecc | |||
| 553ba0a568 | |||
| 28dee4658e | |||
| 4681fd95fe | |||
| bf4a11dd4b | |||
| 303117213e | |||
| e23430c180 | |||
| 87e29596d5 | |||
| c82f9b36bf | |||
| 4967ac0df4 | |||
| 78d5bf65c8 | |||
| 572ac6f799 | |||
| fffc5d6351 | |||
| 12801f73f7 | |||
| 97a305e3b2 | |||
| d9ef8ddef6 | |||
| a8181107eb | |||
| 68bdb2856a | |||
| 1fa4ec0345 | |||
| f7da20c95c | |||
| 3bd148acbc | |||
| e55407bfd4 | |||
| 81013d9eff | |||
| bba72664cc | |||
| c34efb3b8c | |||
| 890a6a5be3 | |||
| 3b80afab63 | |||
| aef6766f3f | |||
| 3793147e59 | |||
| 128660712b | |||
| ffd834a5c2 | |||
| d7387d3c3f | |||
| c2960fa279 | |||
| 3c4b7700e5 | |||
| a3071d58ac | |||
| a6c9107b45 | |||
| a698ecd735 | |||
| 015eeaaccb | |||
| 744d60e6bb | |||
| 691a3375a2 | |||
| ade1548ded | |||
| d928302750 | |||
| 9bb3bc4e98 | |||
| 6be6289f54 | |||
| 0f7f8271ba | |||
| ac00624f97 | |||
| 96157e7986 | |||
| b586f7cda2 | |||
| 7c109f7b2c | |||
| 18e4e2d5c7 | |||
| c94bf7e55a | |||
| 486ca471fb | |||
| 1c36cd23bd | |||
| 4452e1ace9 | |||
| 309ed997b3 | |||
| 5c15bd839f | |||
| 9021f8168a | |||
| 1cfdb3c2c9 | |||
| 6b8fdfd03e | |||
| 4b4f3038e1 | |||
| 6a9c9a090b | |||
| d4a87bc0a1 | |||
| 5617a70288 | |||
| 08bdd05d61 | |||
| 73b60981af | |||
| 9f02856794 | |||
| 64a129a4f6 | |||
| 7e6bc94ad2 | |||
| b498108933 | |||
| 472a880aac | |||
| d0f6d395cf | |||
| 5beaf7799d | |||
| 23d27ffd09 | |||
| 6a0ecb49b9 | |||
| 1989dfae9c | |||
| 1ef5fb3886 | |||
| 78275891b4 | |||
| 036110e055 | |||
| b7ab75c6bf | |||
| 8886ee0942 | |||
| 5d789427fe | |||
| c11e28959d | |||
| 87d7fdc584 | |||
| 0e48704206 | |||
| a4e53fb1f4 | |||
| 5e7012bc32 | |||
| 8fdba9a133 | |||
| 7facd141a8 | |||
| 9c87a260b6 | |||
| 8ae05f2387 | |||
| 4de514f468 | |||
| 5d87b5d826 | |||
| c6dd61eb2d | |||
| b70ba1648d | |||
| 83ba3e7007 | |||
| 172d47a14c | |||
| c54473ea39 | |||
| 191e4336d1 | |||
| 2a0bb0af92 | |||
| 208af78ccd | |||
| 11cbf773ea | |||
| 1ae1e84ec5 | |||
| 4714df2e67 | |||
| 97d8cdf4f6 | |||
| f7a669d89c | |||
| f8a6a83698 | |||
| 28a774b13e | |||
| 901d0f94a8 | |||
| e80ca6fb8d | |||
| b8b0f6dbe9 | |||
| 687a4c0557 | |||
| c322b22437 | |||
| be66bb9645 | |||
| b6c8102625 | |||
| 9aca363c1a | |||
| 6bb0231b7b | |||
| acef19a1e7 | |||
| 42dc0e903b | |||
| 14637fc14f | |||
| 0b4362228b | |||
| 9abb5a2390 | |||
| 003991588b | |||
| 7f8337032d | |||
| c41a30806a | |||
| 54902ff056 | |||
| 854e6f0b2c | |||
| 641649b051 | |||
| bc6c0782e9 | |||
| 0ef1487687 | |||
| e1ace7dd20 | |||
| 7e78d96097 | |||
| 27619c6598 | |||
| 6ba567ac63 | |||
| 5bccb31ec7 | |||
| efed457566 | |||
| f20d4d22e9 | |||
| e92893695d | |||
| fa19bf31ea | |||
| 5e816a727e | |||
| ae89234a65 | |||
| 65c8ff4d85 | |||
| 8a699d416d | |||
| c1bf1d81a9 | |||
| 0c2a8be918 | |||
| 0e5947dc2f | |||
| 231765c8ba | |||
| fe97411051 | |||
| cdb21087da | |||
| a74f39abcb | |||
| 82ff36e758 | |||
| 1d68b9b631 | |||
| 0c51f82bba | |||
| eaf0b2d89f | |||
| 47bd45c3f7 | |||
| 0ab0450f92 | |||
| de59c77a9b | |||
| 9e6091197b | |||
| ca478f374d | |||
| fe859633e8 | |||
| 6e66067f5f | |||
| 2c5ed3d234 | |||
| 58314eeec4 | |||
| 7c789e82c1 | |||
| 75f8ac4310 | |||
| efda10c098 | |||
| 86756eef37 | |||
| 9ccba19a12 | |||
| b26eb35a28 | |||
| 42c19f0e8d | |||
| c1b6ab8118 | |||
| 4027500f9d | |||
| 52bc379ce5 | |||
| 11fe3a4d74 | |||
| 5f2099b846 | |||
| df1cbe9f48 | |||
| a26a0e25dd | |||
| 1ab72c8499 | |||
| 4fad07671c | |||
| 2e6e9b8bdb | |||
| ec96bbc3e9 | |||
| 1e41ee920e | |||
| 1ede1981b8 | |||
| 437a4bf65b | |||
| 2f495119f9 | |||
| d00727cc52 | |||
| f0c3da1e7e | |||
| 798488d5ff | |||
| 16c346df93 | |||
| f29752571b | |||
| 73f25e0fca | |||
| d404868d2b | |||
| b974afac9c | |||
| c9ab45220c | |||
| e9bd42a226 | |||
| c3e7db99f9 | |||
| 83fade0c0a | |||
| 004b18ddb1 | |||
| c5a48a8908 | |||
| 8264da3c50 | |||
| 5cbc7a8b67 | |||
| f022a9ba9c | |||
| ecf0c6af79 | |||
| c6dba19212 | |||
| db83128e9d | |||
| 8d3b909251 | |||
| c01706d2d9 | |||
| c550d531b9 | |||
| 1c63afd97e | |||
| e86ac958ef | |||
| 89a44c34ba | |||
| 50bdf52662 | |||
| 694df151b4 | |||
| 445ec0d7e5 | |||
| 033cc8a223 | |||
| f497c755aa | |||
| 9182889ff9 | |||
| 851ae37718 | |||
| 82aac29073 | |||
| 09d4003426 | |||
| 75129c58b5 | |||
| f2f438ac79 | |||
| 4830bb4c53 | |||
| dca2e99977 | |||
| 98774fcb6b | |||
| 75108389bc | |||
| 677c077839 | |||
| 3719d2e2ec | |||
| e0b6f1b499 | |||
| 6ac4900f6c | |||
| ab4f0d249b | |||
| e13b1d135f | |||
| d994661015 | |||
| 561216b9c5 | |||
| 7b78a84785 | |||
| 44af81f7a7 | |||
| 0ec5a6d1f8 | |||
| 4eaf7d4cb2 | |||
| d5567f7328 | |||
| d63eab1287 | |||
| ecf7b75f77 | |||
| a6e2a2300a | |||
| 85b6606215 | |||
| e012c1f164 | |||
| 7a6b6d5f19 | |||
| 6049058f5e | |||
| 88cfea17a9 | |||
| 3cb97ea9fb | |||
| 1cd5223e73 | |||
| f8f2157fa1 | |||
| e07fcc6ef8 | |||
| bec56a397f | |||
| e940f40580 | |||
| 3fa1abaa40 | |||
| 69731e2cc5 | |||
| 6cd4abdac1 | |||
| 11b1927bd4 | |||
| c8aec2b7bb | |||
| a73917523e | |||
| aa31415e59 | |||
| 1c4bcba381 | |||
| a7d9cb49e0 | |||
| 5e99e6706d | |||
| 11d03ce9ab | |||
| 4d7bf254fc | |||
| 55d79da54f | |||
| a00e29d60a | |||
| 06114e7b15 | |||
| bd97afd006 | |||
| 8fe324726c | |||
| 4ece33a9a2 | |||
| 6e1af255df | |||
| c008505902 | |||
| babcb224b4 | |||
| 4fbdff9cde | |||
| 1e563d8e1e | |||
| afb96b0d7f | |||
| 79bf17b640 | |||
| cbac6369e3 | |||
| 0365831211 | |||
| 85cedef306 | |||
| 6bf829136a | |||
| 602174a3dc | |||
| 9a62345785 | |||
| b36185320d | |||
| 6c2ba19cdd | |||
| 356f30227a | |||
| 4689a3cd66 | |||
| 4aa8faabdb | |||
| e9ea8708b6 | |||
| b3faa81ad1 | |||
| f2760822ab | |||
| 727ad2124d | |||
| 56459ea6e1 | |||
| a328acd2f2 | |||
| 6f095c04a9 | |||
| 0591a08cf1 | |||
| dd05085802 | |||
| 8d8c444f9d | |||
| 9f0b60ed6f | |||
| 603a35322a | |||
| 9160e17321 | |||
| 6deece3386 | |||
| 7992d2032c | |||
| fb2371cea7 | |||
| 08f89eca4d | |||
| cfb1b6cc26 | |||
| f90015cf76 | |||
| 4b37b038ca | |||
| 096da37850 | |||
| 6f738c12bd | |||
| dc7ebee343 | |||
| 57d3f3d924 | |||
| f50c21e36a | |||
| c3633061ff | |||
| c1f0c0b5fa | |||
| 20c2b54542 | |||
| 8e0508945c | |||
| f2a26e4d66 | |||
| e895355a17 | |||
| 1941ca6586 | |||
| d64da4713d | |||
| 2b5f8fd827 | |||
| ea76c04ee9 | |||
| c63db8b61d | |||
| a92af1e3ad | |||
| 2c5b0f8154 | |||
| 1d4392b33f | |||
| 44501b674c | |||
| ca02fba3e5 | |||
| 25d21f0821 | |||
| 91cbd9b2ab | |||
| 54c5330c1a | |||
| aa004b4cfe | |||
| 7fd73b41ed | |||
| 4eb4ad04db | |||
| 3fc29386af | |||
| b38c5f2aaf | |||
| 29a698998b | |||
| 01c47c874b | |||
| e19f672835 | |||
| c7ac64d2db | |||
| 346dd8ca80 | |||
| ec60a0d59a | |||
| 398d4a8db2 | |||
| b514da01a0 | |||
| 5c0375b658 | |||
| 12d4023e43 | |||
| dee7fd6048 | |||
| e685ded405 | |||
| 20f32ed028 | |||
| 671d4819bc | |||
| 65b95660c0 | |||
| c8d01fb2e3 | |||
| 0168d3c716 | |||
| c991030e0a | |||
| 1dcef80b9f | |||
| a6c50876a3 | |||
| ed103c1a63 | |||
| 8982c7d343 | |||
| 63e9fa8bdb | |||
| e1f41e2260 | |||
| d928959877 | |||
| 0507e988a6 | |||
| e12cda81ef | |||
| 5c07ac6a7a | |||
| 8b3943e0b5 | |||
| da64b6a98e | |||
| e2c77dd01f | |||
| 6c94871c56 | |||
| e61fd9ab16 | |||
| 3471fa7ba0 | |||
| 7f80097841 | |||
| 20c4d467b8 | |||
| 6d26b502ae | |||
| 989b4dd302 | |||
| 9ee9f0bb08 | |||
| 03f91c22c6 | |||
| b79eee4520 | |||
| 566b2664e2 | |||
| bcb91f2abd | |||
| c529fcdbe1 | |||
| 1de5a75c8c | |||
| 251514b4bb | |||
| 8e815df623 | |||
| 0aeb823dc4 | |||
| c3ee28c440 | |||
| 893345b32b | |||
| b7119d1440 | |||
| f046c91c6e | |||
| a8c8fbf706 | |||
| 91c21f2b1b | |||
| 44bb2a6e0e | |||
| 9c11d36fe9 | |||
| 6a7aa3f9c0 | |||
| 1cc24851a2 | |||
| ff19ce674d | |||
| e1b434b129 | |||
| 76adec164b | |||
| 6eff731b3c | |||
| c196b29413 | |||
| 2e390fcb96 | |||
| b6cec9e900 | |||
| ead1951a57 | |||
| a0680c868b | |||
| 73e5412854 | |||
| 2affe0355e | |||
| 727a216d59 | |||
| 829f54d594 | |||
| eb707720f1 | |||
| 2cdcb56958 | |||
| b1192638c2 | |||
| 1e4ffe8752 | |||
| 43bee0ad7e | |||
| f4d8478a9d | |||
| b70ea3c680 | |||
| 3eb93697aa | |||
| 3d6fb28178 | |||
| 0c6e298228 | |||
| e2d7af8412 | |||
| 6482f073ac | |||
| 425e7df6ee | |||
| 79cc5ce839 | |||
| 43079e1883 | |||
| 1edb6e3555 | |||
| 3693b82020 | |||
| e80ad3b374 | |||
| a00cd5ad53 | |||
| a23b767ebb | |||
| d79aa15c71 | |||
| 07a40e5714 | |||
| b4ddf27cdd | |||
| 32855b4019 | |||
| e26aaed2a4 | |||
| 5fe35ab0e3 | |||
| 6add2dbfc7 | |||
| aadb24e091 | |||
| 88170baf19 | |||
| 0d6254cd8d | |||
| 0719af8aac | |||
| 1a08f75e50 | |||
| 9ef1ef1869 | |||
| 447a482619 | |||
| 1058cca34c | |||
| 1a750b6307 | |||
| 1d05050c6c | |||
| 2ffa17100e | |||
| 881075b287 | |||
| 2a386c0d74 | |||
| e546494f92 | |||
| c273a2f31f | |||
| dffc320511 | |||
| 2852f047aa | |||
| e0a9d6b93a | |||
| 32abe3255a | |||
| c2533292f0 | |||
| 7b82fe3699 | |||
| ab4333e1c9 | |||
| b2326e175a | |||
| 12fcbb1fab | |||
| 7a8a43763d | |||
| df677142d9 | |||
| ecc0c8b802 | |||
| fc823bf378 | |||
| 524b4ec865 | |||
| 06a56158a6 | |||
| 89394c8d6f | |||
| 0757dc7cec | |||
| d10b0ae93e | |||
| f0ee6c7b0b | |||
| 9d7b35c73c | |||
| 32321469bc | |||
| 33c895943e | |||
| fd466ef02d | |||
| b92e44c50d | |||
| 80fec54702 | |||
| d4d9b7adbe | |||
| 233993afd3 | |||
| f27efbf4b2 | |||
| c952ea8d4b | |||
| 221f65b6c3 | |||
| d437835d78 | |||
| cf2b886d4d | |||
| 4031b89e9b | |||
| 39952eee06 | |||
| c5d569c6af | |||
| 327df50025 | |||
| de311acd1d | |||
| 3408a01243 | |||
| 3b5271f34f | |||
| bf87cc5594 | |||
| 3da5aee8ab | |||
| 13ff917186 | |||
| 79aa2098a5 | |||
| 83d86ba626 | |||
| a5c0415580 | |||
| 770d88ced5 | |||
| 96393dd450 | |||
| a0c2d453c7 | |||
| 965d344017 | |||
| 02948ab08b | |||
| abcb2346b7 | |||
| 4809b5ea1d | |||
| fd2beb3383 | |||
| 86ea9f3820 | |||
| 92d7d849e9 | |||
| 01a661a5b2 | |||
| 23b6f32087 | |||
| bb8a86d2a7 | |||
| fa498fc83b | |||
| 0b16c0de19 | |||
| 29d263f26d | |||
| d630d32338 | |||
| 07799f187b | |||
| d072f34f5a | |||
| bf2dc956fa | |||
| 9fb48afe1a | |||
| cf4f33c352 | |||
| a554e7c33c | |||
| 40ea07e4d0 | |||
| 6f96b83473 | |||
| 88639aa1c8 | |||
| 829dc9522c | |||
| 1ee838b5ee | |||
| 226b5a8e12 | |||
| 4c023bf561 | |||
| 319f61e0d2 | |||
| 54b02a56a7 | |||
| 6b20b6587a | |||
| cbcee839e2 | |||
| 17f2f65a05 | |||
| 579a6b8ff8 | |||
| c6fab7af24 | |||
| 29b46bfc99 | |||
| 76c8cbd44e | |||
| b5e241a788 | |||
| 1fc6bb6ee3 | |||
| 45bcdfa9db | |||
| ee74d5e92a | |||
| df256b30e0 | |||
| c0f988a1e5 | |||
| 61cf7b168b | |||
| 61fd69b8ae | |||
| 49d7755163 | |||
| 49b2930b8d | |||
| cf5b77cd85 | |||
| 34853e7bc5 | |||
| 5a1ca11989 | |||
| 8f3e3695e3 | |||
| 7070d53107 | |||
| d673f73a37 | |||
| 1687749a16 | |||
| dfc6579e1e | |||
| d27c760508 | |||
| 9629cc6d78 | |||
| 0eed750d84 | |||
| 5f87491394 | |||
| 9b8a859781 | |||
| d031cf09b0 | |||
| 70057cf44f | |||
| d36fc3561d | |||
| 276ce5fb85 | |||
| 1a26550217 | |||
| 964556fdb6 | |||
| 4fb6abdd28 | |||
| cbe80a54c1 | |||
| d48f9fcfda | |||
| ba2e6a32ea | |||
| cc7d926e11 | |||
| aec645efcd | |||
| f5897334fb | |||
| 33fefcb567 | |||
| 85ad80a03f | |||
| 9b1e8d728a | |||
| 230783ba85 | |||
| fa62ca18e8 | |||
| 51f4d70284 | |||
| 575ba2443d | |||
| 9a7af7f0c9 | |||
| 3104265b51 | |||
| abb7e59d46 | |||
| d7083e8737 | |||
| e03ec5ca2a | |||
| 84d3c29dad | |||
| 37de8a3494 | |||
| b89ad2fc1e | |||
| 89a660aaba | |||
| 60b482f67f | |||
| 3a60417d9d | |||
| d96c4f3aa9 | |||
| 8dbd402a97 | |||
| c8b383e37a | |||
| 903d01ccb4 | |||
| 3ed1ef582f | |||
| eceda4634f | |||
| becc6bfc56 | |||
| 25618ea469 | |||
| fe1c4e6d89 | |||
| e0675c474f | |||
| 0f49980a0e | |||
| e74466b0a0 | |||
| cb0b4be6b7 | |||
| a2b2a68587 | |||
| 65a4df9d55 | |||
| 84ea026b4c | |||
| f608db22a8 | |||
| c9abc270f2 | |||
| 8a2e373a63 | |||
| c803207669 | |||
| 2b9c339fe6 | |||
| bceea57e1d | |||
| b05de5d96a | |||
| 849e4bf620 | |||
| c596036229 | |||
| 07f7a76fb7 | |||
| ea8acc1cdc | |||
| 907d3d2ef7 | |||
| e1ee24102f | |||
| 5957cbb539 | |||
| ef907c4840 | |||
| 7d748cfae1 | |||
| 5f8d3a3664 | |||
| fbed5b62ee | |||
| dc8c752c5d | |||
| 0b286cf21e | |||
| 76f24be0a5 | |||
| 1b1b729eb9 | |||
| f532678fe2 | |||
| e301c30ae8 | |||
| 4f310cd444 | |||
| 86e44d10ee | |||
| 92262dcb59 | |||
| 7ee5671e18 | |||
| c179fe2aa7 | |||
| 53363a8365 | |||
| 42bc1ad5fe | |||
| ce62d03091 | |||
| e187b9391d | |||
| c5c9ef2004 | |||
| c3d609a3f2 | |||
| 7024225764 | |||
| ca52c559a3 | |||
| 22da13bd0a | |||
| 29fe9e516e | |||
| f2e652004f | |||
| 1d660f65e4 | |||
| 357532c491 | |||
| 24cf7e4dc5 | |||
| ef3064ee84 | |||
| 0bcf2a3561 | |||
| 806e50b3c7 | |||
| de488ea4dd | |||
| 0971a70695 | |||
| 1fdb043504 | |||
| 649333df15 | |||
| fac088a544 | |||
| 4f667d4209 | |||
| 1404dd0e18 | |||
| 50033d9128 | |||
| 469b28034b | |||
| 38238a83da | |||
| 40b145b1aa | |||
| f70e4ac4b0 | |||
| 2c95341c64 | |||
| a4fa13ef70 | |||
| 0fdef6bcdf | |||
| 5ef7459355 | |||
| ea41487667 | |||
| 76a0d881b9 | |||
| 5d0fa584ca | |||
| 8c43043fdc | |||
| 6b47cfd866 | |||
| 468e60dda3 | |||
| 7d7b5a6a66 | |||
| 101ff90760 | |||
| 9df3490a99 | |||
| 938cd0f631 | |||
| 4e712f7bd6 | |||
| 6228beb135 | |||
| 8e1314c7a2 | |||
| 52fd07555f | |||
| 01e87a4673 | |||
| fd9329e7f7 | |||
| c1db910dda | |||
| 14249f8441 | |||
| 06469948a7 | |||
| 478ca9a9e2 | |||
| b9f436c930 | |||
| 5a644bd7d3 | |||
| 0de476e235 | |||
| b2b719935f | |||
| 5f6c0b1e98 | |||
| 937d7b52c5 | |||
| a1b3c3e4cf | |||
| 168873c341 | |||
| 782aa08eaa | |||
| d517d25943 | |||
| 7251542cd8 | |||
| 7b41d89fe4 | |||
| d361e66afc | |||
| 48753e1a1f | |||
| 88637d4c73 | |||
| f4acdcc176 | |||
| deea1d84d9 | |||
| b7f278fe1d | |||
| dcfd0dff70 | |||
| 3be1259eb9 | |||
| 88d295948d | |||
| 981ceefdf7 | |||
| adad4fd9f0 | |||
| c2f03bc722 | |||
| bd6b9530ef | |||
| 964d6dc73d | |||
| 96b39e79bb | |||
| 969bf35c2f | |||
| f39917d8d9 | |||
| 6d1e31c34b | |||
| 2bb01a4e58 | |||
| 824816e06f | |||
| 5a2658ca41 | |||
| eac6bc964d | |||
| 4f68b47504 | |||
| 7341e97c93 | |||
| 98227d36e1 | |||
| 4d48860e68 | |||
| be9e88091a | |||
| 8b0aa6ffb3 | |||
| 40f0a960f7 | |||
| 16975e3616 | |||
| 4e6f474a58 | |||
| 6532f6b856 | |||
| a1357fc970 | |||
| 1feaffe800 | |||
| 5b645d1016 | |||
| 91d602fb1a | |||
| dcefa09e57 | |||
| 2b429140e8 | |||
| 5e3d6406e9 | |||
| 9ce6c24791 | |||
| 25aeb72573 | |||
| 80a147e820 | |||
| 09dac5eebb | |||
| 3f6ae60106 | |||
| 8b8b5f43ee | |||
| 32741d16c0 | |||
| b10dc2d6ba | |||
| 2aa6346fa9 | |||
| 301ff2fe75 | |||
| 9c45d35790 | |||
| 18bb2e0325 | |||
| c8c6addcac | |||
| dd4bba5a50 | |||
| 4aecfad306 | |||
| f3fb3a2b2d | |||
| 088a5e5e12 | |||
| 1dd72d43c3 | |||
| 35ca4ed7ee | |||
| 323f1e49e2 | |||
| de20d6f610 | |||
| c3258231df | |||
| 917cc0fca4 | |||
| 5c64d1cdd3 | |||
| 1aed3e931b | |||
| 1636626882 | |||
| dbfb58b629 | |||
| b09e69a0b0 | |||
| 3c09aeec29 | |||
| 7bc7f28148 | |||
| 5f32625c01 | |||
| 2c329933cc | |||
| 6f4f6fe13c | |||
| d15b1bd91e | |||
| 57efcbc6dd | |||
| 7f407d1f3f | |||
| 4996d3d28c | |||
| 6128c50b39 | |||
| e167032c03 | |||
| 89a8b837ed | |||
| eb7b88ea9d | |||
| b357805a0d | |||
| 8d48260f84 | |||
| b0846bc19a | |||
| e36af790df | |||
| 740d5f70d7 | |||
| e9d0bcbcfd | |||
| 73a1ee602a | |||
| aa1b2fcd73 | |||
| 2c0717e001 | |||
| fb283cda43 | |||
| 901e6b6e6b | |||
| 9aaaed344c | |||
| 34648c65c3 | |||
| 8d87913195 | |||
| 6216697b79 | |||
| e510af822e | |||
| 9ee255715d | |||
| 1161f96fb1 | |||
| 16124ac3f5 | |||
| 490e05c698 | |||
| 5e69cf407f | |||
| 579769bded | |||
| d0f1967418 | |||
| d3332366f1 | |||
| dac4e79866 | |||
| f353928ad3 | |||
| 07f2bb581e | |||
| 0cc653c3a7 | |||
| 0607dc743c | |||
| 075433aef3 | |||
| 96ba4407f6 | |||
| 407c22a76f | |||
| b18baa0c89 | |||
| 8f5bc35905 | |||
| bb1b4b4784 | |||
| 52a40768b2 | |||
| a597bebb84 | |||
| 6066fdd301 | |||
| 1324f3c6af | |||
| d7f7862841 | |||
| 725200b03a | |||
| c40bd6ac20 | |||
| b2d5b92b96 | |||
| f2bb550ac0 | |||
| 58ed94fd9c | |||
| ea858dd7a0 | |||
| 5821db186e | |||
| 14e02c54ef | |||
| 4226f24829 | |||
| ebe63af223 | |||
| 24fc7d266f | |||
| f04eda06be | |||
| 957f001f04 | |||
| 716111f60e | |||
| 58c28f0269 | |||
| 382c50809b | |||
| 3608b0f6f5 | |||
| 014d8a9ab8 | |||
| 377c6fa437 | |||
| 2535c5777d | |||
| 2fbfbcdd7b | |||
| d3753d4c37 | |||
| ab8734e816 | |||
| 9c855ec4f0 | |||
| b7e133298d | |||
| 2e0a1774b9 | |||
| cf885520e7 | |||
| 36c83a5057 | |||
| ba98e4b6b1 | |||
| 478625d186 | |||
| d19a3b1fe2 | |||
| c313f211c0 | |||
| a0c477deef | |||
| 5b0f288d95 | |||
| 441c87bcb9 | |||
| ce111128d3 | |||
| b22f9bac31 | |||
| 13c9933c8f | |||
| b9b203357e | |||
| 499ac00af3 | |||
| d4268066cb | |||
| a9da346030 | |||
| 7fdd558af0 | |||
| c90930bf10 | |||
| c53755d7c4 | |||
| 4249a9a8d0 | |||
| bc55fae7b9 | |||
| 5f0ea84bbb | |||
| 9f8d9231fe | |||
| edf1c2d30d | |||
| 81bfee2947 | |||
| 8df6f37dc0 | |||
| 58cfbd4a84 | |||
| 7530078651 | |||
| 6406c48cd8 | |||
| 58f33bd7cd | |||
| 317311d645 | |||
| b4e2cde355 | |||
| cb5e71a635 | |||
| c8b589bb29 | |||
| 9fd70b1ac3 | |||
| 6eabcba137 | |||
| 530b8335f1 | |||
| 699c28ff92 | |||
| 257f67470b | |||
| 2876a137d8 | |||
| 52c1134dd4 | |||
| ffb7b55ea4 | |||
| 09206b48f2 | |||
| 2fea1d8480 | |||
| 30cb9ab4b5 | |||
| da84ec2f77 | |||
| 615824e242 | |||
| f08cbc787f | |||
| 69ae7d08af | |||
| 25a9851943 | |||
| 73afb49262 | |||
| 22d2a0fdc4 | |||
| f24e18ee85 | |||
| b20337b888 | |||
| e35720ef02 | |||
| 472b380522 | |||
| 094f41207b | |||
| d1c56c3939 | |||
| c156eef71e | |||
| 7e022f9345 | |||
| edab76787e | |||
| 815a82746b | |||
| 354673e358 | |||
| e135be2639 | |||
| 67353f95ef | |||
| 460f06f2a5 | |||
| 65b4efb096 | |||
| 1f93813304 | |||
| 95f0d3d486 | |||
| 7ba1e94556 | |||
| a7a97c933c | |||
| e29ed82aee | |||
| eba970bffc | |||
| 05786bc6fd | |||
| 357d789540 | |||
| 855aa8f8d6 | |||
| 42d3772a3f | |||
| 3d1f6ce525 | |||
| 1244ed75d2 | |||
| ac757a9fad | |||
| 194726468d | |||
| ecbf88d217 | |||
| bc9cec3cd6 | |||
| f9cff66906 | |||
| 5450baa28a | |||
| 422eaecc13 | |||
| e10ed4e667 | |||
| ecfbaad4b4 | |||
| e4cedd797a | |||
| 9dadc1a89e | |||
| 5b0ae9d41c | |||
| 2ac3cee674 | |||
| f3bb54f36f | |||
| e8edd40064 | |||
| b1120b07c9 | |||
| 00fcb704d3 | |||
| 2b1ebff73c | |||
| 26549e7692 | |||
| efd780a339 | |||
| 0c4a965346 | |||
| 7371dc44d0 | |||
| 16a8215aa1 | |||
| 6d0ea08227 | |||
| 85a6b27786 | |||
| db7f11c3d7 | |||
| 98133a3eec | |||
| 52de50d2d5 | |||
| 122299654f | |||
| 52fa982eba | |||
| 5eab4b5c43 | |||
| e68e7af8ed | |||
| 2e52e3c14b | |||
| 2be7e8b347 | |||
| b8187e5ae0 | |||
| 74be4f9a8d | |||
| cb21e292fa | |||
| 3a8e6b5f4b | |||
| cdd11103b7 | |||
| dab41ccfdc | |||
| 49e8438753 | |||
| 12c3f08cb0 | |||
| 2f6b3b1966 | |||
| 9d39272ded | |||
| 14bc8df569 | |||
| 6dca5725ea | |||
| bf3932fc42 | |||
| 2c8a7e32db | |||
| 3c76674f76 | |||
| fba559da7a | |||
| 468f3c1cc4 | |||
| fe0df5f546 | |||
| 370454c947 | |||
| 3010db0e48 | |||
| ae6a28706b | |||
| 63fd025955 | |||
| f5e2a57092 | |||
| 1edf4fcaa6 | |||
| 191ac5e692 | |||
| ad50e44876 | |||
| 1a833b187a | |||
| 5983511872 | |||
| df644c8811 | |||
| 52183b89b1 | |||
| cfe70c4f90 | |||
| 98a68126ed | |||
| 39538ed31a | |||
| 42bdd31e68 | |||
| d0fa39395c | |||
| 737d922645 | |||
| 5e3b40221a | |||
| fd91ea6371 | |||
| cee15d365b | |||
| c29cc45005 | |||
| 2db4405ca0 | |||
| 2e3d0ff372 | |||
| fe2c9820e8 | |||
| 72df247c50 | |||
| d35f4bcabd | |||
| a46eb2ee08 | |||
| 18ac802f51 | |||
| d520a0a173 | |||
| e264c29fa1 | |||
| 406d542d00 | |||
| a02176516b | |||
| 27b0d869e6 | |||
| 21971c4ed0 | |||
| e1c24a9dba | |||
| dcb1b0cbdf | |||
| 9c94bb15aa | |||
| bec8a5ca4b | |||
| cee8d7fb63 | |||
| 5a67edcc09 | |||
| c5f0945604 | |||
| ff642e93ba | |||
| 5ebe26c7d0 | |||
| a616b09790 | |||
| e64dfa80dd | |||
| 4a4d46cade | |||
| 905746771f | |||
| 82a838920f | |||
| d913dc4244 | |||
| 4aa3ac1609 | |||
| 775d4dd817 | |||
| e0b0ef395f | |||
| a21fc2b7c9 | |||
| aee2784751 | |||
| 3e41bf36a3 | |||
| cf26a12c62 | |||
| 90abc87934 | |||
| 8c040068ca | |||
| 67a8ef4235 | |||
| c17f91905a | |||
| 1b2457c312 | |||
| 2fbd81b02d | |||
| e729020eda | |||
| 6e296332ca | |||
| 94640580f3 | |||
| 113130bd32 | |||
| 1443433431 | |||
| 4fd2dff9fe | |||
| 680da3b4af | |||
| dc0d77760a | |||
| c700b6c43b | |||
| adb2f6e2fc | |||
| def727dc7d | |||
| c5d16299de | |||
| 93b2625047 | |||
| b769175004 | |||
| 816f68c8aa | |||
| c3f0763f7b | |||
| e0dcb5734f | |||
| 321aae1d8b | |||
| 9bb32eb744 | |||
| 2c20f70dca | |||
| a3247baa3a | |||
| c0624b017b | |||
| 81b1951adf | |||
| 73c1140d6a | |||
| 20fe7276ff | |||
| dd8fb6e848 | |||
| 1ece975598 | |||
| 4308feffbd | |||
| 66674833f6 | |||
| 578462059e | |||
| bd8b6c6f0e | |||
| e5e43b42ec | |||
| f309507a9f | |||
| 5c3cf81dfb | |||
| 5bf11225c4 | |||
| c10f0b5df7 | |||
| abac5c2107 | |||
| d6c5e20610 | |||
| b9b4610906 | |||
| 03231ca0b3 | |||
| 6d53e3b77d | |||
| a0b22b3218 | |||
| 0db7057a78 | |||
| 7bc02fa10a | |||
| 01737697a4 | |||
| 2eb6412ef8 | |||
| 4fad751ed9 | |||
| e32e7ca09c | |||
| da7d308c32 | |||
| 4a625f17af | |||
| 9fa1dad004 | |||
| 651dfa878e | |||
| 50da41e264 | |||
| 6406bef13e | |||
| 5a2cfa7efb | |||
| 0bb30298d0 | |||
| 37553f8493 | |||
| 1761c44531 | |||
| d1869b995e | |||
| 5e01a18606 | |||
| 1ef00c891f | |||
| 2d910a2d08 | |||
| 3b61c3c5d6 | |||
| 17dec907b9 | |||
| c90daf0b4b | |||
| a69f876e76 | |||
| a960f39fbb | |||
| 474ce18912 | |||
| 6c8f0ed5a8 | |||
| 5ace54167e | |||
| d981f1b6e3 | |||
| 0810574be1 | |||
| ee5b1788f7 | |||
| 9a6222dd38 | |||
| 46cc45f293 | |||
| 8e8380fb97 | |||
| 5aef10640e | |||
| b34d0917a6 | |||
| 1067cb28f1 | |||
| f94e02f057 | |||
| fec8049d34 | |||
| a111b749fc | |||
| f42449f77e | |||
| cc13541244 | |||
| d67ad45602 | |||
| 0ef063825f | |||
| 09be6630de | |||
| 26b9be1d7a | |||
| 10692d97e6 | |||
| f327821e4e | |||
| b9fc85815e | |||
| 312f8b5410 | |||
| 6d163e8a59 | |||
| 888faa0559 | |||
| 62dec3d6b5 | |||
| 06979a542b | |||
| 2f4ae7848b | |||
| 9199bfc986 | |||
| 3fde815636 | |||
| ea6787cb2f | |||
| 4f0f9f52c6 | |||
| e628acf30d | |||
| 97d94ab7f2 | |||
| 675522cb1b | |||
| 69f2570655 | |||
| 9206c92895 | |||
| d3f8a394bc | |||
| de735d30a8 | |||
| 8afa0586cc | |||
| 72a054b9f9 | |||
| 643f215f0a | |||
| 6acfcce9a8 | |||
| 6be3c99802 | |||
| 20101a6092 | |||
| 4d044e6e84 | |||
| d08c400d31 | |||
| 770764f392 | |||
| 4f6af1254b | |||
| e3cd7f35b9 | |||
| 2ba609cc8c | |||
| 3d7a1cbf2b | |||
| b50eee807b | |||
| 6b64601101 | |||
| 28d21ce79e | |||
| 07387b3124 | |||
| df699778c4 | |||
| 2d7915885a | |||
| 9d24e151bc | |||
| 9fbed4dc26 | |||
| 9896fa3de5 | |||
| ea5cb3bbde | |||
| 732216d72a | |||
| b08068e829 | |||
| 1622a2d06f | |||
| 0d4a213943 | |||
| 98823d2ac0 | |||
| facf76eede | |||
| 41591a4a17 | |||
| cd22423ceb | |||
| 479c8e5958 | |||
| 271228d527 | |||
| d592dc462d | |||
| bfaf3c876b | |||
| 3954fbf809 | |||
| c63bcbf27c | |||
| 0242dc70f3 | |||
| 25957101a8 | |||
| 6d079b698f | |||
| 0456f1c62a | |||
| 5c6c7224eb | |||
| a40014f758 | |||
| 53b9b145ab | |||
| ded3459821 | |||
| 331b64ac3f | |||
| b89246267b | |||
| cdbba24134 | |||
| fa84313875 | |||
| e2d02f322e | |||
| 2b545bff3b | |||
| ec0e8976e9 | |||
| 24ad970192 | |||
| 83bf0c7ac3 | |||
| 2a55ad8736 | |||
| 25b68ad11e | |||
| d347fbefd6 | |||
| 6124af76ab | |||
| 893e4ecc77 | |||
| f5925fe29a | |||
| d07e7183e6 | |||
| c82589c6b5 | |||
| 2c0436b1a6 | |||
| a1e04405ff | |||
| 0516af71ef | |||
| 8f459f900b | |||
| 866885022f | |||
| 350ad0ef85 | |||
| 6b73dbaa20 | |||
| 291f7bd8ba | |||
| 40fb06a8d0 | |||
| c4563fe0fb | |||
| 17c9ed588d | |||
| 9480b8f1f4 | |||
| 6c45d66129 | |||
| ae29b65979 | |||
| e43dd3defa | |||
| 02c71b5a1e | |||
| b6f1f29147 | |||
| 6b9ab9e4fc | |||
| cffd20cede | |||
| 3372fd30ff | |||
| 8353441838 | |||
| 5d213075c3 | |||
| 5da1448d69 | |||
| cc082cb176 | |||
| 53e1d700bf | |||
| b9441c6e63 | |||
| 98aa5c1e21 | |||
| fa43dc51f8 | |||
| ef405b2a1b | |||
| 58c4dc24c7 | |||
| 741ee69fad | |||
| 754e6ee60b | |||
| 780d107619 | |||
| 61842c3a01 | |||
| 8c28ed7838 | |||
| 8bfac5b93d | |||
| 6d64a7091d | |||
| 22ad0a2e45 | |||
| e8eaff0171 | |||
| f3bfb270af | |||
| 260d699c17 | |||
| bb25fc1bca | |||
| 7bc4158521 | |||
| a0028106e3 | |||
| fc0ee03121 | |||
| 987d846223 | |||
| e7c83f42ef | |||
| c8198e1311 | |||
| 17620a4193 | |||
| 61b7abf279 | |||
| 4be10f9c9d | |||
| 606f29ff1d | |||
| 6a43c2aae4 | |||
| 29a4e4e556 | |||
| c65086aab0 | |||
| 6d85897f87 | |||
| 83c5e8f6b1 | |||
| 3d8a508910 | |||
| cb9b40a576 | |||
| e21964e8b0 | |||
| d15938ce5f | |||
| 22f52e2bf3 | |||
| b6f8c22bc3 | |||
| c89d8d7636 | |||
| a17794496c | |||
| e545ae1876 | |||
| 236ec5b9b6 | |||
| bae75cb826 | |||
| 89552fc789 | |||
| 3684c9f4e2 | |||
| db3a8b8a59 | |||
| 2b82654492 | |||
| bb4e105b49 | |||
| 1819221450 | |||
| 4ac7b06a76 | |||
| 379298d6ae | |||
| 49307babf5 | |||
| ac6e8f1133 | |||
| ce34811cdd | |||
| 51f2f92ca5 | |||
| 3bcee5d4c7 | |||
| 07a5d7cb3e | |||
| 7adc79d42c | |||
| 069577e929 | |||
| cffe2e51bd | |||
| 317dbb6f67 | |||
| 0c06ed4263 | |||
| abb8d37084 | |||
| f0cffb1e49 | |||
| 16b96bf3c9 | |||
| e47e30a11f | |||
| 4431f7188f | |||
| 7f6d1637d0 | |||
| 7e01657166 | |||
| 51cb63459b | |||
| 5992f232aa | |||
| 688d2f7d5b | |||
| b5cb37d9ea | |||
| e892f04d05 | |||
| 01c784002a | |||
| 267a7811fc | |||
| 0ac29d7f60 | |||
| c975e6afad | |||
| 80118a25eb | |||
| 13bc6270d6 | |||
| 85b2ee359b | |||
| 9cd2e8b3d4 | |||
| 2dcc168e63 | |||
| 05f64e893d | |||
| f40c81f9b7 | |||
| fac82b6f2a | |||
| d55bcca3a5 | |||
| bbc338767a | |||
| e88d8a3aa4 | |||
| bb0ceba26d | |||
| 2b63e793a2 | |||
| e0514c228d | |||
| 8f92195276 | |||
| 4a21ecc113 | |||
| 3217988a86 | |||
| 65497822b9 | |||
| 5bd1036974 | |||
| 01d08c35d6 | |||
| 8415a420df | |||
| fa614c0451 | |||
| 532231e9e8 | |||
| 98dba5cea6 | |||
| d29f2368de | |||
| 234c4e5276 | |||
| f5e5206c00 | |||
| d19c7d4459 | |||
| 50e20544b7 | |||
| a4f3ee5b1e | |||
| 192d6a6ea9 | |||
| 705e3a7f76 | |||
| d716e12ac4 | |||
| e8b9d71f03 | |||
| aabfe78ed5 | |||
| e41e727022 | |||
| fcee2e9780 | |||
| 94acf297c6 | |||
| b94257273c | |||
| fc071f0cfc | |||
| 6680874953 | |||
| dbf8f55057 | |||
| 477647c885 | |||
| 8fe1a6a72f | |||
| 6f1a4d5f55 | |||
| f96e334571 | |||
| 14b7da1527 | |||
| 101415b202 | |||
| 11e9ca5af1 | |||
| a4369a6ac4 | |||
| f0eda67f46 | |||
| 3ea6ab6652 | |||
| 4597517cf5 | |||
| d7a8d13cb4 | |||
| 289d8f834b | |||
| cb219861eb | |||
| 206f13e19a | |||
| 141f2eb969 | |||
| 54c362fdaf | |||
| b7f3681c1d | |||
| c71b977964 | |||
| f86849b8e5 | |||
| 0d07ff6170 | |||
| cf1db6bad7 | |||
| 7e85d1188a | |||
| 76de166ee1 | |||
| 76e2cb0a9b | |||
| 1b0649d558 | |||
| 05ac097e4c | |||
| 4c21136a5b | |||
| d38835ab1b | |||
| b0fe38fc78 | |||
| ce2e784b47 | |||
| 9114cce39b | |||
| 0d00dc375f | |||
| 27437410f4 |
+35
-36
@@ -1,36 +1,35 @@
|
||||
README $Id$
|
||||
------
|
||||
|
||||
QUICK INSTALL
|
||||
=============
|
||||
|
||||
For the impatient, here is a basic outline of the
|
||||
installation process, which normally takes me only
|
||||
a few minutes:
|
||||
|
||||
1) Move the Moodle files into your web directory.
|
||||
|
||||
2) Create a single database for Moodle to store all
|
||||
it's tables in (or choose an existing database).
|
||||
|
||||
3) Visit your Moodle site with a browser, you should
|
||||
be taken to the install.php script, which will lead
|
||||
you through creating a config.php file and then
|
||||
setting up Moodle, creating an admin account etc.
|
||||
|
||||
4) Set up a cron task to call the file admin/cron.php
|
||||
every five minutes or so.
|
||||
|
||||
|
||||
For more information, see the INSTALL DOCUMENTATION:
|
||||
|
||||
http://docs.moodle.org/en/Installing_Moodle
|
||||
|
||||
A local copy can also be found in
|
||||
|
||||
lang/en_utf8/help/install.html (or your language)
|
||||
|
||||
|
||||
Good luck and have fun!
|
||||
Martin Dougiamas, Lead Developer
|
||||
|
||||
README $Id$
|
||||
------
|
||||
|
||||
QUICK INSTALL
|
||||
=============
|
||||
|
||||
For the impatient, here is a basic outline of the
|
||||
installation process, which normally takes me only
|
||||
a few minutes:
|
||||
|
||||
1) Move the Moodle files into your web directory.
|
||||
|
||||
2) Create a single database for Moodle to store all
|
||||
it's tables in (or choose an existing database).
|
||||
|
||||
3) Visit your Moodle site with a browser, you should
|
||||
be taken to the install.php script, which will lead
|
||||
you through creating a config.php file and then
|
||||
setting up Moodle, creating an admin account etc.
|
||||
|
||||
4) Set up a cron task to call the file admin/cron.php
|
||||
every five minutes or so.
|
||||
|
||||
|
||||
For more information, see the INSTALL DOCUMENTATION:
|
||||
|
||||
http://moodle.org/doc
|
||||
|
||||
If you have real trouble, please visit the Moodle course
|
||||
"Using Moodle" on moodle.org.
|
||||
|
||||
|
||||
Good luck and have fun!
|
||||
Martin Dougiamas, Lead Developer
|
||||
|
||||
|
||||
+6
-12
@@ -62,23 +62,17 @@
|
||||
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 {
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
$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) ?>"
|
||||
<input type="text" name="searchtext" size="30" value="<?php echo $searchtext ?>"
|
||||
onFocus ="document.adminform.add.disabled=true;
|
||||
document.adminform.remove.disabled=true;
|
||||
document.adminform.removeselect.selectedIndex=-1;
|
||||
|
||||
+10
-13
@@ -1,10 +1,14 @@
|
||||
<?PHP // $Id$
|
||||
// Admin-only script to assign administrative rights to users
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.php");
|
||||
|
||||
define("MAX_USERS_PER_PAGE", 50);
|
||||
|
||||
optional_variable($add, "");
|
||||
optional_variable($remove, "");
|
||||
optional_variable($search, "");
|
||||
|
||||
if (! $site = get_site()) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
}
|
||||
@@ -77,7 +81,7 @@
|
||||
}
|
||||
|
||||
/// Is there a current search?
|
||||
$previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) and $frm->previoussearch == 1)) ;
|
||||
$previoussearch = (!empty($frm->search) or ($frm->previoussearch == 1)) ;
|
||||
|
||||
/// Get all existing admins
|
||||
$admins = get_admins();
|
||||
@@ -101,18 +105,11 @@
|
||||
|
||||
/// If no search results then get potential users excluding current admins
|
||||
if (empty($searchusers)) {
|
||||
|
||||
$usercount = get_users(false, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
|
||||
0, 99999, 'id, firstname, lastname, email');
|
||||
|
||||
$users = array();
|
||||
|
||||
if ($usercount <= MAX_USERS_PER_PAGE) {
|
||||
if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
|
||||
0, 99999, 'id, firstname, lastname, email') ) {
|
||||
$users = array();
|
||||
}
|
||||
if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
|
||||
0, 99999, 'id, firstname, lastname, email') ) {
|
||||
$users = array();
|
||||
}
|
||||
$usercount = count($users);
|
||||
}
|
||||
|
||||
$searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";
|
||||
|
||||
+14
-57
@@ -1,10 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
// config.php - allows admin to edit all configuration variables
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
|
||||
include("../config.php");
|
||||
require_login();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
@@ -19,8 +16,6 @@
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$focus = '';
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
@@ -67,25 +62,16 @@
|
||||
}
|
||||
|
||||
$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)) {
|
||||
if (isset($_GET['auth']) && in_array($_GET['auth'], $modules)) {
|
||||
$auth = $_GET['auth'];
|
||||
} else {
|
||||
$auth = $config->auth;
|
||||
}
|
||||
|
||||
// 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','');
|
||||
}
|
||||
|
||||
$auth = clean_param($auth,PARAM_SAFEDIR);
|
||||
$auth = clean_filename($auth);
|
||||
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;
|
||||
@@ -99,14 +85,12 @@
|
||||
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");
|
||||
|
||||
if (empty($focus)) {
|
||||
$focus = "";
|
||||
}
|
||||
|
||||
$guestoptions[0] = get_string("hide");
|
||||
$guestoptions[1] = get_string("show");
|
||||
|
||||
@@ -145,39 +129,20 @@
|
||||
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 "<input type=\"text\" name=\"changepassword\" size=\"40\" value=\"$config->changepassword\" />";
|
||||
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);
|
||||
print_string("changepasswordhelp","auth");
|
||||
echo "</td></tr>";
|
||||
|
||||
}
|
||||
@@ -274,18 +239,10 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
|
||||
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"} = '';
|
||||
}
|
||||
optional_variable($pluginconfig->{"field_map_$field"}, '');
|
||||
optional_variable($pluginconfig->{"field_updatelocal_$field"}, '');
|
||||
optional_variable($pluginconfig->{"field_updateremote_$field"}, '');
|
||||
optional_variable($pluginconfig->{"field_lock_$field"}, '');
|
||||
|
||||
// define the fieldname we display to the user
|
||||
$fieldname = $field;
|
||||
|
||||
+2
-6
@@ -14,7 +14,7 @@
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
$blockid = required_param( 'block',PARAM_INT );
|
||||
|
||||
if(($blockrecord = blocks_get_record($blockid)) === false) {
|
||||
error('This block does not exist');
|
||||
@@ -57,11 +57,7 @@
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strmanageblocks = get_string('manageblocks');
|
||||
$strblockname = $block->get_title();
|
||||
|
||||
// $CFG->pagepath is used to generate the body and id attributes for the body tag
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'block/' . $block->name() . '/config';
|
||||
|
||||
|
||||
print_header($site->shortname.': '.$strblockname.": $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT);
|
||||
$hide = optional_param('hide', 0, PARAM_INT);
|
||||
$show = optional_param('show', 0, PARAM_INT);
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
<form method="post" action="calendar.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
||||
<table class="formtable">
|
||||
<tr>
|
||||
<th>adminseesall:</th>
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
}
|
||||
if(isset($form->forcetimezone)) {
|
||||
// To protect from SQL injections ...
|
||||
$form->timezone = clean_param($form->timezone, PARAM_PATH); //not a path, but it looks like it anyway
|
||||
$form->forcetimezone = str_replace(';', '', $form->forcetimezone);
|
||||
$form->forcetimezone = str_replace('\'', '', $form->forcetimezone);
|
||||
set_config('forcetimezone', $form->forcetimezone);
|
||||
}
|
||||
if(isset($form->startwday)) {
|
||||
|
||||
+7
-14
@@ -3,8 +3,6 @@
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$focus = '';
|
||||
|
||||
if ($site = get_site()) { // If false then this is a new installation
|
||||
require_login();
|
||||
if (!isadmin()) {
|
||||
@@ -34,17 +32,7 @@
|
||||
if (count($err) == 0) {
|
||||
foreach ($config as $name => $value) {
|
||||
if ($name == "sessioncookie") {
|
||||
$value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
|
||||
}
|
||||
if ($name == "defaultallowedmodules") {
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
if ($name == 'hiddenuserfields') {
|
||||
if (in_array('none', $value)) {
|
||||
$value = '';
|
||||
} else {
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
$value = eregi_replace("[^a-zA-Z]", "", $value);
|
||||
}
|
||||
unset($conf);
|
||||
$conf->name = $name;
|
||||
@@ -78,6 +66,9 @@
|
||||
$config->locale = $CFG->lang;
|
||||
}
|
||||
}
|
||||
if (empty($focus)) {
|
||||
$focus = '';
|
||||
}
|
||||
|
||||
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
|
||||
@@ -101,7 +92,7 @@
|
||||
|
||||
|
||||
/// Get all the configuration fields and helptext
|
||||
require('configvars.php');
|
||||
include('configvars.php');
|
||||
|
||||
/// Cycle through the sections to get the sectionnames
|
||||
$linktext = '';
|
||||
@@ -114,6 +105,7 @@
|
||||
|
||||
echo "<center>$linktext</center>\n";
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
echo '<form method="post" action="config.php" name="form">';
|
||||
echo '<center><input type="submit" value="'.get_string('savechanges').'" /></center>';
|
||||
@@ -149,6 +141,7 @@
|
||||
|
||||
echo '</form>';
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php // $Id$
|
||||
// Shane Elliott
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
/// Add new sitewide configuration variables to this file.
|
||||
|
||||
@@ -89,19 +88,8 @@ class configvarrss extends configvar {
|
||||
choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
|
||||
'<font color="red"> You need to add XML support to your PHP installation.</font>' );
|
||||
|
||||
$misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
|
||||
choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
|
||||
|
||||
unset($options);
|
||||
$options[5] = get_string('worldblogs','blog');
|
||||
$options[4] = get_string('siteblogs','blog');
|
||||
$options[3] = get_string('courseblogs','blog');
|
||||
$options[2] = get_string('groupblogs','blog');
|
||||
$options[1] = get_string('personalblogs','blog');
|
||||
$options[0] = get_string('disableblogs','blog');
|
||||
|
||||
$misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'),
|
||||
choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true));
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// OPERATING SYSTEM config variables
|
||||
@@ -141,8 +129,6 @@ class configvarrss extends configvar {
|
||||
/// sessioncookie
|
||||
$operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
|
||||
'<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
|
||||
$operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'),
|
||||
'<input name="sessioncookiepath" type="text" size="10" value="'.s($config->sessioncookiepath).'" alt="sessioncookiepath" />' );
|
||||
|
||||
/// zip
|
||||
$operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
|
||||
@@ -226,71 +212,6 @@ class configvarrss extends configvar {
|
||||
choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
|
||||
|
||||
|
||||
unset($options);
|
||||
$options['none'] = 'No courses';
|
||||
$options['all'] = 'All courses';
|
||||
$options['requested'] = 'Requested courses';
|
||||
|
||||
$permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
|
||||
' <script language="JavaScript">
|
||||
function togglemodules(index) {
|
||||
if (index == 0) {
|
||||
document.getElementById(\'allowedmodules\').disabled=true;
|
||||
}
|
||||
else {
|
||||
document.getElementById(\'allowedmodules\').disabled=false;
|
||||
}
|
||||
}
|
||||
</script>'.
|
||||
choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
|
||||
|
||||
$permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
|
||||
choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
|
||||
|
||||
$allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
|
||||
|
||||
$allowedmodules = array();
|
||||
if (!empty($config->defaultallowedmodules)) {
|
||||
$allowedmodules = explode(',',$config->defaultallowedmodules);
|
||||
}
|
||||
|
||||
// On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
|
||||
if (!$mods = get_records("modules")) {
|
||||
$mods = array();
|
||||
}
|
||||
$s = "selected=\"selected\"";
|
||||
$allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
|
||||
foreach ($mods as $mod) {
|
||||
$selected = "";
|
||||
if (in_array($mod->id,$allowedmodules))
|
||||
$selected = $s;
|
||||
$allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
|
||||
}
|
||||
$allowstr .= '</select>';
|
||||
|
||||
$permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
|
||||
|
||||
|
||||
/// course requests
|
||||
$reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
|
||||
choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
|
||||
|
||||
/// default category for course requests
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
$reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
|
||||
choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
|
||||
|
||||
$reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
|
||||
'<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
|
||||
|
||||
$reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
|
||||
'<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
|
||||
'<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
|
||||
'<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// INTERFACE config variables
|
||||
@@ -312,15 +233,10 @@ class configvarrss extends configvar {
|
||||
/// language menu
|
||||
$interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
|
||||
|
||||
/// locale
|
||||
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
|
||||
'<input name="locale" type="text" size="10" value="'.s($config->locale).'" alt="locale" />' );
|
||||
|
||||
/// docroot
|
||||
$interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
|
||||
'<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
|
||||
|
||||
/// timezone
|
||||
|
||||
$interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
|
||||
@@ -393,23 +309,6 @@ class configvarrss extends configvar {
|
||||
$user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
|
||||
|
||||
/// hiddenuserfields
|
||||
$fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
|
||||
if (empty($config->hiddenuserfields)) {
|
||||
$config->hiddenuserfields = 'none';
|
||||
}
|
||||
$configfields = array_flip(explode(',', $config->hiddenuserfields));
|
||||
$fieldoptions = '';
|
||||
foreach ($fields as $value) {
|
||||
$fieldoptions .= '<option value="'.$value.'"';
|
||||
if (isset($configfields[$value])) {
|
||||
$fieldoptions .= ' selected="selected"';
|
||||
}
|
||||
$fieldoptions .= '>'.get_string($value).'</option>';
|
||||
}
|
||||
|
||||
$user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
|
||||
'<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
|
||||
|
||||
|
||||
|
||||
@@ -572,68 +471,10 @@ class configvarrss extends configvar {
|
||||
$mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
|
||||
'<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
|
||||
|
||||
if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
|
||||
/// sitemailcharset
|
||||
unset($options);
|
||||
unset($charsets);
|
||||
$charsets = get_list_of_charsets();
|
||||
$options['0'] = get_string('none');
|
||||
$options = array_merge($options, $charsets);
|
||||
$mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
|
||||
choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
|
||||
|
||||
/// allowusermailcharset
|
||||
$mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
|
||||
}
|
||||
|
||||
/// enable stats
|
||||
$stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
|
||||
choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
|
||||
|
||||
unset($options);
|
||||
$options['none'] = get_string('none');
|
||||
$options[60*60*24*7] = get_string('numweeks','moodle',1);
|
||||
$options[60*60*24*14] = get_string('numweeks','moodle',2);
|
||||
$options[60*60*24*21] = get_string('numweeks','moodle',3);
|
||||
$options[60*60*24*28] = get_string('nummonths','moodle',1);
|
||||
$options[60*60*24*56] = get_string('nummonths','moodle',2);
|
||||
$options[60*60*24*84] = get_string('nummonths','moodle',3);
|
||||
$options[60*60*24*112] = get_string('nummonths','moodle',4);
|
||||
$options[60*60*24*140] = get_string('nummonths','moodle',5);
|
||||
$options[60*60*24*168] = get_string('nummonths','moodle',6);
|
||||
$options['all'] = get_string('all');
|
||||
|
||||
$stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
|
||||
choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
|
||||
|
||||
unset($options);
|
||||
$options[0] = get_string('untilcomplete');
|
||||
$options[60*60] = '1 '.get_string('hour');
|
||||
$options[60*60*2] = '2 '.get_string('hours');
|
||||
$options[60*60*3] = '3 '.get_string('hours');
|
||||
$options[60*60*4] = '4 '.get_string('hours');
|
||||
$options[60*60*5] = '5 '.get_string('hours');
|
||||
$options[60*60*6] = '6 '.get_string('hours');
|
||||
$options[60*60*7] = '7 '.get_string('hours');
|
||||
$options[60*60*8] = '8 '.get_string('hours');
|
||||
|
||||
if (empty($config->statsruntimestarthour)) {
|
||||
$config->statsruntimestarthour = 0;
|
||||
}
|
||||
if (empty($config->statsruntimestartminute)) {
|
||||
$config->statsruntimestartminute = 0;
|
||||
}
|
||||
|
||||
$stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
|
||||
choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
|
||||
|
||||
$stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
|
||||
print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
|
||||
|
||||
$stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
|
||||
'<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -644,8 +485,6 @@ class configvarrss extends configvar {
|
||||
$configvars['mail'] = $mail;
|
||||
$configvars['user'] = $user;
|
||||
$configvars['permissions'] = $permissions;
|
||||
$configvars['requestedcourse'] = $reqcourse;
|
||||
$configvars['misc'] = $misc;
|
||||
$configvars['stats'] = $stats;
|
||||
|
||||
?>
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@
|
||||
<script type="text/javascript">
|
||||
function
|
||||
</script>
|
||||
<input type="text" name="searchtext" size="30" value="<?php p($searchtext) ?>"
|
||||
<input type="text" name="searchtext" size="30" value="<?php echo $searchtext ?>"
|
||||
onFocus ="document.creatorsform.add.disabled=true;
|
||||
document.creatorsform.remove.disabled=true;
|
||||
document.creatorsform.removeselect.selectedIndex=-1;
|
||||
|
||||
+6
-3
@@ -1,10 +1,14 @@
|
||||
<?PHP // $Id$
|
||||
// Admin only script to assign course creator rights to users
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.php");
|
||||
|
||||
define("MAX_USERS_PER_PAGE", 50);
|
||||
|
||||
optional_variable($search, "");
|
||||
optional_variable($add, "");
|
||||
optional_variable($remove, "");
|
||||
|
||||
if (! $site = get_site()) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
}
|
||||
@@ -46,7 +50,6 @@
|
||||
|
||||
if (!$frm = data_submitted()) {
|
||||
print_simple_box("<center>".get_string("adminhelpassigncreators")."</center>", "center", "50%");
|
||||
$frm = new object();
|
||||
|
||||
/// A form was submitted so process the input
|
||||
|
||||
@@ -70,7 +73,7 @@
|
||||
}
|
||||
|
||||
/// Is there a current search?
|
||||
$previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) && $frm->previoussearch == 1)) ;
|
||||
$previoussearch = (!empty($frm->search) or ($frm->previoussearch == 1)) ;
|
||||
|
||||
|
||||
/// Get all existing creators
|
||||
|
||||
+10
-138
@@ -26,8 +26,7 @@
|
||||
chdir(dirname($_SERVER['argv'][0]));
|
||||
}
|
||||
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->dirroot.'/lib/adminlib.php');
|
||||
require_once("../config.php");
|
||||
|
||||
if (!$alreadyadmin = isadmin()) {
|
||||
unset($_SESSION['USER']);
|
||||
@@ -35,8 +34,6 @@
|
||||
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
|
||||
@@ -72,31 +69,6 @@
|
||||
}
|
||||
mtrace("Finished activity modules");
|
||||
|
||||
mtrace("Starting blocks");
|
||||
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
// we will need the base class.
|
||||
require_once($CFG->dirroot.'/blocks/moodleblock.class.php');
|
||||
foreach ($blocks as $block) {
|
||||
$blockfile = $CFG->dirroot.'/blocks/'.$block->name.'/block_'.$block->name.'.php';
|
||||
if (file_exists($blockfile)) {
|
||||
require_once($blockfile);
|
||||
$classname = 'block_'.$block->name;
|
||||
$blockobj = new $classname;
|
||||
if (method_exists($blockobj,'cron')) {
|
||||
mtrace("Processing cron function for ".$block->name.'....','');
|
||||
if ($blockobj->cron()) {
|
||||
if (!set_field('block','lastcron',$timenow,'id',$block->id)) {
|
||||
mtrace('Error: could not update timestamp for '.$block->name);
|
||||
}
|
||||
}
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mtrace("Finished blocks");
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages();
|
||||
@@ -132,28 +104,12 @@
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
if (delete_records("user", "id", $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
/// Delete old logs to save space (this might need a timer to slow it down...)
|
||||
|
||||
@@ -166,8 +122,8 @@
|
||||
/// Delete old cached texts
|
||||
|
||||
if (!empty($CFG->cachetext)) { // Defined in config.php
|
||||
$cachelifetime = time() - $CFG->cachetext - 60; // Add an extra minute to allow for really heavy sites
|
||||
delete_records_select('cache_text', "timemodified < '$cachelifetime'");
|
||||
$cachelifetime = time() - $CFG->cachetext;
|
||||
delete_records_select("cache_text", "timemodified < '$cachelifetime'");
|
||||
}
|
||||
flush();
|
||||
|
||||
@@ -178,31 +134,6 @@
|
||||
|
||||
sync_metacourses();
|
||||
|
||||
//
|
||||
// generate new password emails for users
|
||||
//
|
||||
mtrace('checking for create_password');
|
||||
if (count_records('user_preferences', 'name', 'create_password', 'value', '1')) {
|
||||
mtrace('creating passwords for new users');
|
||||
$newusers = get_records_sql("SELECT u.id as id, u.email, u.firstname,
|
||||
u.lastname, u.username,
|
||||
p.id as prefid
|
||||
FROM {$CFG->prefix}user u
|
||||
JOIN {$CFG->prefix}user_preferences p ON u.id=p.userid
|
||||
WHERE p.name='create_password' AND p.value=1 AND u.email !='' ");
|
||||
|
||||
foreach ($newusers as $newuserid => $newuser) {
|
||||
$newuser->emailstop = 0; // send email regardless
|
||||
// email user
|
||||
if (setnew_password_and_mail($newuser)) {
|
||||
// remove user pref
|
||||
delete_records('user_preferences', 'id', $newuser->prefid);
|
||||
} else {
|
||||
trigger_error("Could not create and mail new user password!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of occasional clean-up tasks
|
||||
|
||||
|
||||
@@ -211,12 +142,6 @@
|
||||
//Perhaps a long time and memory could help in large sites
|
||||
@set_time_limit(0);
|
||||
@raise_memory_limit("128M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
// if we are running from Apache, give httpd a hint that
|
||||
// it can recycle the process after it's done. Apache's
|
||||
// memory management is truly awful but we can help it.
|
||||
@apache_child_terminate();
|
||||
}
|
||||
if (file_exists("$CFG->dirroot/backup/backup_scheduled.php") and
|
||||
file_exists("$CFG->dirroot/backup/backuplib.php") and
|
||||
file_exists("$CFG->dirroot/backup/lib.php") and
|
||||
@@ -228,7 +153,7 @@
|
||||
mtrace("Running backups if required...");
|
||||
|
||||
if (! schedule_backup_cron()) {
|
||||
mtrace("ERROR: Something went wrong while performing backup tasks!!!");
|
||||
mtrace("ERORR: Something went wrong while performing backup tasks!!!");
|
||||
} else {
|
||||
mtrace("Backup tasks finished.");
|
||||
}
|
||||
@@ -247,64 +172,11 @@
|
||||
}
|
||||
|
||||
/// Run the enrolment cron, if any
|
||||
if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
|
||||
$plugins = array($CFG->enrol);
|
||||
}
|
||||
require_once($CFG->dirroot .'/enrol/enrol.class.php');
|
||||
foreach ($plugins as $p) {
|
||||
$enrol = enrolment_factory::factory($p);
|
||||
if (method_exists($enrol, 'cron')) {
|
||||
$enrol->cron();
|
||||
}
|
||||
if (!empty($enrol->log)) {
|
||||
mtrace($enrol->log);
|
||||
}
|
||||
unset($enrol);
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
$clobber = true;
|
||||
if (!empty($CFG->statsmaxruntime)) {
|
||||
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour just to make sure (it could take that long to break out of the loop)
|
||||
}
|
||||
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily LIMIT 1')) {
|
||||
// first run, set another lock. we'll check for this in subsequent runs to set the timeout to later for the normal lock.
|
||||
set_cron_lock('statsfirstrunlock',true,$time,true);
|
||||
$firsttime = true;
|
||||
}
|
||||
$time = 60*60*2; // this time set to 2.. (overridden by $CFG)
|
||||
if (!empty($CFG->statsmaxruntime)) {
|
||||
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour to make sure (it could take that long to break out of the loop)
|
||||
}
|
||||
if ($config = get_record('config','name','statsfirstrunlock')) {
|
||||
if (!empty($config->value)) {
|
||||
$clobber = false; // if we're on the first run, just don't clobber it.
|
||||
}
|
||||
}
|
||||
if (set_cron_lock('statsrunning',true,$time, $clobber)) {
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
$return = stats_cron_daily();
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
stats_cron_weekly();
|
||||
}
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
$return = $return && stats_cron_monthly();
|
||||
}
|
||||
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
|
||||
stats_clean_old();
|
||||
}
|
||||
set_cron_lock('statsrunning',false);
|
||||
if (!empty($firsttime)) {
|
||||
set_cron_lock('statsfirstrunlock',false);
|
||||
}
|
||||
}
|
||||
}
|
||||
require_once("$CFG->dirroot/enrol/$CFG->enrol/enrol.php");
|
||||
$enrol = new enrolment_plugin();
|
||||
$enrol->cron();
|
||||
if (!empty($enrol->log)) {
|
||||
mtrace($enrol->log);
|
||||
}
|
||||
|
||||
//Unset session variables and destroy it
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
// dbperformance.php - shows latest ADOdb stats for the current server
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$topframe = optional_param('topframe', 0, PARAM_BOOL);
|
||||
$bottomframe = optional_param('bottomframe', 0, PARAM_BOOL);
|
||||
$do = optional_param('do', '', PARAM_ALPHA);
|
||||
require_once("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -17,13 +13,13 @@
|
||||
$stradministration = get_string("administration");
|
||||
$site = get_site();
|
||||
|
||||
if (!empty($topframe)) {
|
||||
if (isset($topframe)) {
|
||||
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
|
||||
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> Database performance");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($bottomframe) or !empty($do)) {
|
||||
if (isset($bottomframe) or isset($_GET['do'])) {
|
||||
$perf =&NewPerfMonitor($db);
|
||||
$perf->UI($pollsecs=5);
|
||||
exit;
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
|
||||
require_login();
|
||||
|
||||
$sure = optional_param('sure', 0, PARAM_BOOL);
|
||||
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
|
||||
$sure = optional_param('sure', '');
|
||||
$reallysure = optional_param('reallysure', '');
|
||||
|
||||
if (!isadmin()) {
|
||||
error('You must be admin to use this script!');
|
||||
|
||||
+37
-103
@@ -1,6 +1,5 @@
|
||||
<form method="post" action="editor.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="tab" value="<?php p($currentpage) ?>" />
|
||||
<table border="0" cellpadding="4" cellspacing="2">
|
||||
<tr>
|
||||
<td align="right" valign="top">htmleditor:</td>
|
||||
@@ -16,7 +15,6 @@
|
||||
<?php print_string('confightmleditor', 'admin') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( $currenttab == 'htmlarea' ) { ?>
|
||||
<tr>
|
||||
<td align="right" valign="top">editorbackgroundcolor:</td>
|
||||
<td valign="top"><input type="text" name="backgroundcolor" size="10" value="<?php print($CFG->editorbackgroundcolor);?>" /></td>
|
||||
@@ -114,18 +112,18 @@
|
||||
<input type="checkbox" name="buttons[formatblock]"<?php print(in_array("formatblock", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("formatblock","editor");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_bold.gif" width="18" height="18" alt="<?php print_string("bold","editor");?>" title="<?php print_string("bold","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_italic.gif" width="18" height="18" alt="<?php print_string("italic","editor");?>" title="<?php print_string("italic","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_underline.gif" width="18" height="18" alt="<?php print_string("underline","editor");?>" title="<?php print_string("underline","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_strike.gif" width="18" height="18" alt="<?php print_string("strikethrough","editor");?>" title="<?php print_string("strikethrough","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_sub.gif" width="18" height="18" alt="<?php print_string("subscript","editor");?>" title="<?php print_string("subscript","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_sup.gif" width="18" height="18" alt="<?php print_string("superscript","editor");?>" title="<?php print_string("superscript","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_copy.gif" width="18" height="18" alt="<?php print_string("copy","editor");?>" title="<?php print_string("copy","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_cut.gif" width="18" height="18" alt="<?php print_string("cut","editor");?>" title="<?php print_string("cut","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_paste.gif" width="18" height="18" alt="<?php print_string("paste","editor");?>" title="<?php print_string("paste","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_wordclean.gif" width="18" height="18" alt="<?php print_string("wordclean","editor");?>" title="<?php print_string("wordclean","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_undo.gif" width="18" height="18" alt="<?php print_string("undo","editor");?>" title="<?php print_string("undo","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_redo.gif" width="18" height="18" alt="<?php print_string("redo","editor");?>" title="<?php print_string("redo","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_bold.gif" width="18" height="18" alt="<?php print_string("bold","editor");?>" title="<?php print_string("bold","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_italic.gif" width="18" height="18" alt="<?php print_string("italic","editor");?>" title="<?php print_string("italic","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_underline.gif" width="18" height="18" alt="<?php print_string("underline","editor");?>" title="<?php print_string("underline","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_strike.gif" width="18" height="18" alt="<?php print_string("strikethrough","editor");?>" title="<?php print_string("strikethrough","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_sub.gif" width="18" height="18" alt="<?php print_string("subscript","editor");?>" title="<?php print_string("subscript","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_sup.gif" width="18" height="18" alt="<?php print_string("superscript","editor");?>" title="<?php print_string("superscript","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_copy.gif" width="18" height="18" alt="<?php print_string("copy","editor");?>" title="<?php print_string("copy","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_cut.gif" width="18" height="18" alt="<?php print_string("cut","editor");?>" title="<?php print_string("cut","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_paste.gif" width="18" height="18" alt="<?php print_string("paste","editor");?>" title="<?php print_string("paste","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_wordclean.gif" width="18" height="18" alt="<?php print_string("wordclean","editor");?>" title="<?php print_string("wordclean","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_undo.gif" width="18" height="18" alt="<?php print_string("undo","editor");?>" title="<?php print_string("undo","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_redo.gif" width="18" height="18" alt="<?php print_string("redo","editor");?>" title="<?php print_string("redo","editor");?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="buttons[bold]"<?php print(in_array("bold", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
@@ -142,18 +140,18 @@
|
||||
<td><input type="checkbox" name="buttons[redo]"<?php print(in_array("redo", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_left.gif" width="18" height="18" alt="<?php print_string("justifyleft","editor");?>" title="<?php print_string("justifyleft","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_center.gif" width="18" height="18" alt="<?php print_string("justifycenter","editor");?>" title="<?php print_string("justifycenter","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_right.gif" width="18" height="18" alt="<?php print_string("justifyright","editor");?>" title="<?php print_string("justifyright","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_justify.gif" width="18" height="18" alt="<?php print_string("justifyfull","editor");?>" title="<?php print_string("justifyfull","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_left_to_right.gif" width="18" height="18" alt="<?php print_string("lefttoright","editor");?>" title="<?php print_string("lefttoright","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_right_to_left.gif" width="18" height="18" alt="<?php print_string("righttoleft","editor");?>" title="<?php print_string("righttoleft","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_list_num.gif" width="18" height="18" alt="<?php print_string("orderedlist","editor");?>" title="<?php print_string("orderedlist","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_list_bullet.gif" width="18" height="18" alt="<?php print_string("unorderedlist","editor");?>" title="<?php print_string("unorderedlist","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_indent_less.gif" width="18" height="18" alt="<?php print_string("outdent","editor");?>" title="<?php print_string("outdent","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_indent_more.gif" width="18" height="18" alt="<?php print_string("indent","editor");?>" title="<?php print_string("indent","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_color_fg.gif" width="18" height="18" alt="<?php print_string("forecolor","editor");?>" title="<?php print_string("forecolor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_color_bg.gif" width="18" height="18" alt="<?php print_string("hilitecolor","editor");?>" title="<?php print_string("hilitecolor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_left.gif" width="18" height="18" alt="<?php print_string("justifyleft","editor");?>" title="<?php print_string("justifyleft","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_center.gif" width="18" height="18" alt="<?php print_string("justifycenter","editor");?>" title="<?php print_string("justifycenter","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_right.gif" width="18" height="18" alt="<?php print_string("justifyright","editor");?>" title="<?php print_string("justifyright","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_justify.gif" width="18" height="18" alt="<?php print_string("justifyfull","editor");?>" title="<?php print_string("justifyfull","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_left_to_right.gif" width="18" height="18" alt="<?php print_string("lefttoright","editor");?>" title="<?php print_string("lefttoright","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_right_to_left.gif" width="18" height="18" alt="<?php print_string("righttoleft","editor");?>" title="<?php print_string("righttoleft","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_list_num.gif" width="18" height="18" alt="<?php print_string("orderedlist","editor");?>" title="<?php print_string("orderedlist","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_list_bullet.gif" width="18" height="18" alt="<?php print_string("unorderedlist","editor");?>" title="<?php print_string("unorderedlist","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_indent_less.gif" width="18" height="18" alt="<?php print_string("outdent","editor");?>" title="<?php print_string("outdent","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_indent_more.gif" width="18" height="18" alt="<?php print_string("indent","editor");?>" title="<?php print_string("indent","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_color_fg.gif" width="18" height="18" alt="<?php print_string("forecolor","editor");?>" title="<?php print_string("forecolor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_color_bg.gif" width="18" height="18" alt="<?php print_string("hilitecolor","editor");?>" title="<?php print_string("hilitecolor","editor");?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="buttons[justifyleft]"<?php print(in_array("justifyleft", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
@@ -170,18 +168,18 @@
|
||||
<td><input type="checkbox" name="buttons[hilitecolor]"<?php print(in_array("hilitecolor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_hr.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("horizontalrule","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_anchor.gif" width="18" height="18" alt="<?php print_string("createanchor","editor");?>" title="<?php print_string("createanchor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_link.gif" width="18" height="18" alt="<?php print_string("insertlink","editor");?>" title="<?php print_string("insertlink","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_unlink.gif" width="18" height="18" alt="<?php print_string("removelink","editor");?>" title="<?php print_string("removelink","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_image.gif" width="18" height="18" alt="<?php print_string("insertimage","editor");?>" title="<?php print_string("insertimage","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/insert_table.gif" width="18" height="18" alt="<?php print_string("inserttable","editor");?>" title="<?php print_string("inserttable","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/em.icon.smile.gif" width="18" height="18" alt="<?php print_string("insertsmile","editor");?>" title="<?php print_string("insertsmile","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/icon_ins_char.gif" width="18" height="18" alt="<?php print_string("insertchar","editor");?>" title="<?php print_string("insertchar","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/spell-check.gif" width="18" height="18" alt="<?php print_string("spellcheck","editor");?>" title="<?php print_string("spellcheck","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_html.gif" width="18" height="18" alt="<?php print_string("htmlmode","editor");?>" title="<?php print_string("htmlmode","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/fullscreen_maximize.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("popupeditor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_replace.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("searchandreplace","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_hr.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("horizontalrule","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_anchor.gif" width="18" height="18" alt="<?php print_string("createanchor","editor");?>" title="<?php print_string("createanchor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_link.gif" width="18" height="18" alt="<?php print_string("insertlink","editor");?>" title="<?php print_string("insertlink","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_unlink.gif" width="18" height="18" alt="<?php print_string("removelink","editor");?>" title="<?php print_string("removelink","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_image.gif" width="18" height="18" alt="<?php print_string("insertimage","editor");?>" title="<?php print_string("insertimage","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/insert_table.gif" width="18" height="18" alt="<?php print_string("inserttable","editor");?>" title="<?php print_string("inserttable","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/em.icon.smile.gif" width="18" height="18" alt="<?php print_string("insertsmile","editor");?>" title="<?php print_string("insertsmile","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/icon_ins_char.gif" width="18" height="18" alt="<?php print_string("insertchar","editor");?>" title="<?php print_string("insertchar","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/spell-check.gif" width="18" height="18" alt="<?php print_string("spellcheck","editor");?>" title="<?php print_string("spellcheck","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_html.gif" width="18" height="18" alt="<?php print_string("htmlmode","editor");?>" title="<?php print_string("htmlmode","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_maximize.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("popupeditor","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_replace.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("searchandreplace","editor");?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="buttons[inserthorizontalrule]"<?php print(in_array("inserthorizontalrule", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
@@ -198,7 +196,7 @@
|
||||
<td><input type="checkbox" name="buttons[search_replace]"<?php print(in_array("search_replace", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_nolink.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("nolink","editor");?>" /></td>
|
||||
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_nolink.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("nolink","editor");?>" /></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
@@ -228,69 +226,6 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
else if ( $currenttab == 'tinymce' ) {
|
||||
?>
|
||||
<tr>
|
||||
<td>tinymcetheme:</td>
|
||||
<td><?php
|
||||
$options = array('advanced' => 'Advanced','simple' => 'Simple');
|
||||
choose_from_menu ($options, "tinymcetheme", $CFG->tinymcetheme, "", "", "");
|
||||
?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">tinymceplugins:</td>
|
||||
<td nowrap="nowrap"><?php
|
||||
$pluginsdir = $CFG->libdir .'/editor/tinymce/jscripts/tiny_mce/plugins';
|
||||
$plugins = editor_get_tiny_plugins();
|
||||
$pluginsinuse = explode(",", $CFG->tinymceplugins);
|
||||
|
||||
sort($plugins);
|
||||
$cnt = 0;
|
||||
echo '<table border="0" cellpadding="2">';
|
||||
foreach ( $plugins as $plugin ) {
|
||||
$num = ($cnt % 2);
|
||||
if ( $num < 1 ) {
|
||||
echo '<tr>';
|
||||
}
|
||||
echo '<td><input type="checkbox" name="tinymceplugins[]" value="'. s($plugin) .'"';
|
||||
if ( in_array($plugin, $pluginsinuse) ) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' /> '. $plugin .'</td>'."\n";
|
||||
|
||||
if ( $num > 0 ) {
|
||||
echo '</tr>';
|
||||
}
|
||||
$cnt++;
|
||||
}
|
||||
echo '</table>';
|
||||
?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tinymcecontentcss:</td>
|
||||
<td><input type="text" name="tinymcecontentcss" value="<?php
|
||||
!empty($CFG->tinymcecontentcss) ? p($CFG->tinymcecontentcss) : ''; ?>" size="40" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tinymcepopupcss:</td>
|
||||
<td><input type="text" name="tinymcepopupcss" value="<?php
|
||||
!empty($CFG->tinymcepopupcss) ? p($CFG->tinymcepopupcss) : ''; ?>" size="40" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tinymceeditorcss:</td>
|
||||
<td><input type="text" name="tinymceeditorcss" value="<?php
|
||||
!empty($CFG->tinymceeditorcss) ? p($CFG->tinymceeditorcss) : ''; ?>" size="40" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" align="center"><input type="submit" value="<?php print_string("savechanges");?>" /></td>
|
||||
</tr>
|
||||
@@ -299,7 +234,6 @@
|
||||
|
||||
<form method="post" action="<?php print($GLOBALS['ME']);?>">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="tab" value="<?php p($currentpage) ?>" />
|
||||
<center>
|
||||
<input type="submit" name="resettodefaults" value="<?php print_string('editorresettodefaults') ?>" />
|
||||
</center>
|
||||
|
||||
+6
-98
@@ -1,10 +1,7 @@
|
||||
<?php // $Id$
|
||||
/// configuration routines for HTMLArea editor
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$currentpage = optional_param('tab', 1, PARAM_INT);
|
||||
|
||||
require_once("../config.php");
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
@@ -15,38 +12,20 @@
|
||||
|
||||
// do we want default values?
|
||||
if (isset($data->resettodefaults)) {
|
||||
if (!(reset_to_defaults($currentpage))) {
|
||||
if (!(reset_to_defaults())) {
|
||||
error("Editor settings could not be restored!");
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!(editor_update_config($data, $currentpage))) {
|
||||
if (!(editor_update_config($data))) {
|
||||
error("Editor settings could not be updated!");
|
||||
}
|
||||
}
|
||||
redirect("$CFG->wwwroot/$CFG->admin/editor.php?tab=$currentpage", get_string("changessaved"), 1);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/editor.php", get_string("changessaved"), 1);
|
||||
|
||||
} else {
|
||||
// Generate edit form
|
||||
|
||||
$inactive = array();
|
||||
switch ( $currentpage ) {
|
||||
case 1:
|
||||
$currenttab = 'htmlarea';
|
||||
break;
|
||||
case 2:
|
||||
$currenttab = 'tinymce';
|
||||
break;
|
||||
default:
|
||||
error("Unknown currentpage: $currentpage");
|
||||
}
|
||||
|
||||
//$url = 'editor.php?tab=';
|
||||
//$tabrow = array();
|
||||
//$tabrow[] = new tabobject('htmlarea',$url . '1', 'HTMLArea');
|
||||
//$tabrow[] = new tabobject('tinymce',$url . '2', 'TinyMCE');
|
||||
//$tabs = array($tabrow);
|
||||
|
||||
$fontlist = editor_convert_to_array($CFG->editorfontlist);
|
||||
$dicts = editor_get_dictionaries();
|
||||
|
||||
@@ -58,11 +37,8 @@
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $streditorsettings");
|
||||
print_heading($streditorsettings);
|
||||
|
||||
print_simple_box("<center>$streditorsettingshelp</center>","center","50%");
|
||||
print("<br />\n");
|
||||
//print_tabs($tabs, $currenttab, $inactive);
|
||||
|
||||
print_simple_box_start("center");
|
||||
include("editor.html");
|
||||
print_simple_box_end();
|
||||
@@ -91,7 +67,7 @@ function editor_convert_to_array ($string) {
|
||||
return $fonts;
|
||||
}
|
||||
|
||||
function editor_update_config ($data, $editor) {
|
||||
function editor_update_config ($data) {
|
||||
|
||||
/// Updates the editor config values.
|
||||
|
||||
@@ -99,8 +75,6 @@ function editor_update_config ($data, $editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch($editor) {
|
||||
case 1: // HTMLArea.
|
||||
// Make array for unwanted characters.
|
||||
$nochars = array(chr(33),chr(34),chr(35),chr(36),chr(37),
|
||||
chr(38),chr(39),chr(40),chr(41),chr(42),
|
||||
@@ -141,30 +115,6 @@ function editor_update_config ($data, $editor) {
|
||||
}
|
||||
}
|
||||
$updatedata['editorhidebuttons'] = trim($hidebuttons);
|
||||
break;
|
||||
|
||||
case 2: // TinyMCE.
|
||||
$updatedata = array();
|
||||
$updatedata['htmleditor'] = !empty($data->htmleditor) ? $data->htmleditor : 0;
|
||||
|
||||
// Process plugins
|
||||
if ( !empty($data->tinymceplugins) ) {
|
||||
foreach ( $data->tinymceplugins as $key => $value ) {
|
||||
$value = stripslashes(clean_param($value, PARAM_ALPHA));
|
||||
$data->tinymceplugins[$key] = addslashes($value);
|
||||
}
|
||||
}
|
||||
$updatedata['tinymceplugins'] = !empty($data->tinymceplugins) ? implode(",", $data->tinymceplugins) : '';
|
||||
$updatedata['tinymcetheme'] = !empty($data->tinymcetheme) ?
|
||||
clean_param($data->tinymcetheme, PARAM_ALPHA) : '';
|
||||
$updatedata['tinymcecontentcss'] = !empty($data->tinymcecontentcss) ?
|
||||
clean_param($data->tinymcecontentcss, PARAM_URL) : '';
|
||||
$updatedata['tinymcepopupcss'] = !empty($data->tinymcepopupcss) ?
|
||||
clean_param($data->tinymcepopupcss, PARAM_URL) : '';
|
||||
$updatedata['tinymceeditorcss'] = !empty($data->tinymceeditorcss) ?
|
||||
clean_param($data->tinymceeditorcss, PARAM_URL) : '';
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($updatedata as $name => $value) {
|
||||
if (!(set_config($name, $value))) {
|
||||
@@ -175,7 +125,7 @@ function editor_update_config ($data, $editor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function reset_to_defaults ($editor) {
|
||||
function reset_to_defaults () {
|
||||
/// Reset the values to default
|
||||
|
||||
global $CFG;
|
||||
@@ -183,8 +133,6 @@ function reset_to_defaults ($editor) {
|
||||
|
||||
$updatedata = array();
|
||||
|
||||
switch ( $editor ) {
|
||||
case 1: // HTMLArea.
|
||||
$updatedata['editorbackgroundcolor'] = $defaults['editorbackgroundcolor'];
|
||||
$updatedata['editorfontfamily'] = $defaults['editorfontfamily'];
|
||||
$updatedata['editorfontsize'] = $defaults['editorfontsize'];
|
||||
@@ -193,16 +141,6 @@ function reset_to_defaults ($editor) {
|
||||
$updatedata['editorfontlist'] = $defaults['editorfontlist'];
|
||||
$updatedata['editorhidebuttons'] = $defaults['editorhidebuttons'];
|
||||
$updatedata['editordictionary'] = '';
|
||||
break;
|
||||
|
||||
case 2: // TinyMCE.
|
||||
$updatedata['tinymceplugins'] = $defaults['tinymceplugins'];
|
||||
$updatedata['tinymcetheme'] = $defaults['tinymcetheme'];
|
||||
$updatedata['tinymcecontentcss'] = $defaults['tinymcecontentcss'];
|
||||
$updatedata['tinymcepopupcss'] = $defaults['tinymcepopupcss'];
|
||||
$updatedata['tinymceeditorcss'] = $defaults['tinymceeditorcss'];
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($updatedata as $name => $value) {
|
||||
if (!(set_config($name, $value))) {
|
||||
@@ -273,34 +211,4 @@ function editor_get_dictionaries () {
|
||||
|
||||
}
|
||||
|
||||
function editor_get_tiny_plugins() {
|
||||
global $CFG;
|
||||
|
||||
$plugins = array();
|
||||
$plugindir = $CFG->libdir .'/editor/tinymce/jscripts/tiny_mce/plugins';
|
||||
|
||||
if ( !$fp = opendir($plugindir) ) {
|
||||
return $plugins;
|
||||
exit;
|
||||
}
|
||||
|
||||
while ( ($file = readdir($fp)) !== false ) {
|
||||
|
||||
if ( preg_match("/^\.+/", $file) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( is_dir($plugindir .'/'. $file) ) {
|
||||
array_push($plugins, $file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $fp ) {
|
||||
closedir($fp);
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
+41
-64
@@ -2,11 +2,10 @@
|
||||
// enrol.php - allows admin to edit all enrollment variables
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once('../config.php');
|
||||
include("../config.php");
|
||||
|
||||
$enrol = optional_param('enrol', $CFG->enrol, PARAM_ALPHA);
|
||||
|
||||
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
|
||||
$CFG->pagepath = 'enrol';
|
||||
|
||||
require_login();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
@@ -21,91 +20,69 @@
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
require_once("$CFG->dirroot/enrol/$enrol/enrol.php"); /// Open the class
|
||||
|
||||
/// Save settings
|
||||
$enrolment = new enrolment_plugin();
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (empty($frm->enable)) {
|
||||
$frm->enable = array();
|
||||
if ($enrolment->process_config($frm)) {
|
||||
set_config('enrol', $frm->enrol);
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
}
|
||||
if (empty($frm->default)) {
|
||||
$frm->default = '';
|
||||
}
|
||||
if ($frm->default && $frm->default != 'manual' && !in_array($frm->default, $frm->enable)) {
|
||||
$frm->enable[] = $frm->default;
|
||||
}
|
||||
asort($frm->enable);
|
||||
$frm->enable = array_merge(array('manual'), $frm->enable); // make sure manual plugin is called first
|
||||
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
|
||||
set_config('enrol', $frm->default);
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
} else {
|
||||
$frm = $CFG;
|
||||
}
|
||||
|
||||
/// Print the form
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
|
||||
/// get language strings
|
||||
$str = get_strings(array('enrolments', 'users', 'administration', 'settings'));
|
||||
|
||||
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
|
||||
"<a href=\"index.php\">$str->administration</a> ->
|
||||
<a href=\"users.php\">$str->users</a> -> $str->enrolmentplugins");
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
$options = array();
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = get_string("enrolname", "enrol_$module");
|
||||
}
|
||||
asort($options);
|
||||
|
||||
print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
|
||||
print_header("$site->shortname: $str->enrolments", "$site->fullname",
|
||||
"<a href=\"index.php\">$str->administration</a> ->
|
||||
<a href=\"users.php\">$str->users</a> -> $str->enrolments");
|
||||
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
|
||||
echo "<div align=\"center\"><p><b>";
|
||||
|
||||
$table = new stdClass();
|
||||
$table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings);
|
||||
$table->align = array('left', 'center', 'center', 'center');
|
||||
$table->size = array('60%', '', '', '15%');
|
||||
$table->width = '700';
|
||||
$table->data = array();
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
foreach ($modules as $module) {
|
||||
/// Choose an enrolment method
|
||||
echo get_string('chooseenrolmethod').': ';
|
||||
choose_from_menu ($options, "enrol", $enrol, "",
|
||||
"document.location='enrol.php?sesskey=$USER->sesskey&enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
|
||||
|
||||
// skip if directory is empty
|
||||
if (!file_exists("$CFG->dirroot/enrol/$module/enrol.php")) {
|
||||
continue;
|
||||
}
|
||||
echo "</b></p></div>";
|
||||
|
||||
/// Print current enrolment type description
|
||||
print_simple_box_start("center", "80%");
|
||||
print_heading($options[$enrol]);
|
||||
|
||||
$name = get_string("enrolname", "enrol_$module");
|
||||
$plugin = enrolment_factory::factory($module);
|
||||
$enable = '<input type="checkbox" name="enable[]" value="'.$module.'"';
|
||||
if (stristr($CFG->enrol_plugins_enabled, $module) !== false) {
|
||||
$enable .= ' checked="checked"';
|
||||
}
|
||||
if ($module == 'manual') {
|
||||
$enable .= ' disabled="disabled"';
|
||||
}
|
||||
$enable .= ' />';
|
||||
if (method_exists($plugin, 'print_entry')) {
|
||||
$default = '<input type="radio" name="default" value="'.$module.'"';
|
||||
if ($CFG->enrol == $module) {
|
||||
$default .= ' checked="checked"';
|
||||
}
|
||||
$default .= ' />';
|
||||
} else {
|
||||
$default = '';
|
||||
}
|
||||
$table->data[$name] = array($name, $enable, $default,
|
||||
'<a href="enrol_config.php?sesskey='.$USER->sesskey.'&enrol='.$module.'">'.$str->edit.'</a>');
|
||||
}
|
||||
asort($table->data);
|
||||
print_simple_box_start("center", "60%", '', 5, 'informationbox');
|
||||
print_string("description", "enrol_$enrol");
|
||||
print_simple_box_end();
|
||||
|
||||
print_table($table);
|
||||
echo "<hr />";
|
||||
// print_heading($str->settings);
|
||||
|
||||
$enrolment->config_form($frm);
|
||||
|
||||
echo "<center><input type=\"submit\" value=\"".get_string("savechanges")."\"></center>\n";
|
||||
echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
|
||||
echo "</form>";
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
exit;
|
||||
?>
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// enrol_config.php - allows admin to edit all enrollment variables
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
$enrol = required_param('enrol', PARAM_ALPHA);
|
||||
$CFG->pagepath = 'enrol/' . $enrol;
|
||||
|
||||
require_login();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
|
||||
$enrolment = enrolment_factory::factory($enrol);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if ($enrolment->process_config($frm)) {
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
}
|
||||
} else {
|
||||
$frm = $CFG;
|
||||
}
|
||||
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
/// get language strings
|
||||
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
|
||||
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = get_string("enrolname", "enrol_$module");
|
||||
}
|
||||
asort($options);
|
||||
|
||||
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
|
||||
"<a href=\"index.php\">$str->administration</a> ->
|
||||
<a href=\"users.php\">$str->users</a> ->
|
||||
<a href=\"enrol.php?sesskey=$USER->sesskey\">$str->enrolmentplugins</a> ->
|
||||
$str->configuration");
|
||||
|
||||
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?sesskey=$USER->sesskey&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%");
|
||||
print_heading($options[$enrol]);
|
||||
|
||||
print_simple_box_start("center", "60%", '', 5, 'informationbox');
|
||||
print_string("description", "enrol_$enrol");
|
||||
print_simple_box_end();
|
||||
|
||||
echo "<hr />";
|
||||
|
||||
$enrolment->config_form($frm);
|
||||
|
||||
echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
|
||||
echo "</form>";
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
|
||||
exit;
|
||||
?>
|
||||
+19
-40
@@ -31,12 +31,12 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
|
||||
/// Parameters
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$version = optional_param('version', '', PARAM_FILE); //
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$sesskey = optional_param('sesskey');
|
||||
$version = optional_param('version');
|
||||
|
||||
/// Security checks
|
||||
require_login();
|
||||
@@ -55,46 +55,14 @@
|
||||
$strenvironment = get_string('environment', 'admin');
|
||||
$strerror = get_string('error');
|
||||
$strmoodleversion = get_string('moodleversion');
|
||||
$strupdate = get_string('updatecomponent', 'admin');
|
||||
$strupwards = get_string('upwards', 'admin');
|
||||
|
||||
/// Print the header stuff
|
||||
print_header("$SITE->shortname: $strenvironment", $SITE->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".$strenvironment);
|
||||
|
||||
/// Print the component download link
|
||||
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
|
||||
|
||||
print_heading($strenvironment);
|
||||
|
||||
/// Handle the 'updatecomponent' action
|
||||
if ($action == 'updatecomponent' && confirm_sesskey()) {
|
||||
/// Create component installer and execute it
|
||||
if ($cd = new component_installer('http://download.moodle.org',
|
||||
'environment',
|
||||
'environment.zip')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/environment/environment.zip';
|
||||
$a->dest= $CFG->dataroot.'/';
|
||||
print_simple_box(get_string($cd->get_error(), 'error', $a), 'center', '', '', 5, 'errorbox');
|
||||
} else {
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
|
||||
}
|
||||
break;
|
||||
case UPTODATE:
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
|
||||
break;
|
||||
case INSTALLED:
|
||||
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Start of main box
|
||||
print_simple_box_start('center');
|
||||
|
||||
@@ -128,7 +96,7 @@
|
||||
}
|
||||
|
||||
/// Print form and popup menu
|
||||
echo '<center><form method="post" action="environment.php">';
|
||||
echo '<center><form method="post" action="'.$CFG->wwwroot.'/admin/environment.php">';
|
||||
echo $strmoodleversion.' ';
|
||||
choose_from_menu ($versions, 'version', $version, null, 'this.form.submit();' );
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
@@ -139,10 +107,21 @@
|
||||
/// Gather and show results
|
||||
$status = check_moodle_environment($version, $environment_results);
|
||||
|
||||
/// Other links
|
||||
echo '<div align="center">';
|
||||
print_single_button('phpinfo.php', NULL, get_string('phpinfo'));
|
||||
echo '</div>';
|
||||
|
||||
|
||||
/// Process action
|
||||
if ($form = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
if ($form->action == "disable") {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Default action, show explanation and popup menu
|
||||
|
||||
|
||||
/// Print footer
|
||||
print_footer();
|
||||
|
||||
+3
-42
@@ -12,52 +12,13 @@
|
||||
</MOODLE>
|
||||
<MOODLE version="1.6">
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="mysql" version="4.1.12" />
|
||||
<VENDOR name="postgres" version="7.4" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required" />
|
||||
<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>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.7">
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="7.4" />
|
||||
<VENDOR name="mssql" version="8.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required" />
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="iconv" level="optional" />
|
||||
<PHP_EXTENSION name="mbstring" level="optional" />
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
<?php // $Id$
|
||||
// filter.php
|
||||
// Edit text filter settings
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
// check for allowed access
|
||||
require_login();
|
||||
if (!isadmin()) {
|
||||
error( 'Only administrators can use the filters administration page' );
|
||||
}
|
||||
if (!$site = get_site()) {
|
||||
error( 'Site is not defined in filters administration page' );
|
||||
}
|
||||
|
||||
// get parameters
|
||||
$param = new Object;
|
||||
|
||||
$param->filter = required_param('filter', PARAM_PATH);
|
||||
$param->submit = optional_param('submit', 0, PARAM_BOOL);
|
||||
$param->reset = optional_param('reset', 0, PARAM_BOOL);
|
||||
|
||||
$filtername = substr($param->filter, strpos( $param->filter, '/' )+1 ) ;
|
||||
|
||||
// $CFG->pagepath is used to generate the body and id attributes for the body tag
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'filter/' . $filtername . '/config';
|
||||
|
||||
// get translated strings for use on page
|
||||
$txt = new Object;
|
||||
$txt->managefilters = get_string( 'managefilters' );
|
||||
$txt->administration = get_string( 'administration' );
|
||||
$txt->configuration = get_string( 'configuration' );
|
||||
|
||||
//======================
|
||||
// Process Actions
|
||||
//======================
|
||||
|
||||
// if reset pressed let filter config page handle it
|
||||
$forcereset = false;
|
||||
if (!empty($param->reset)) {
|
||||
$forcereset = true;
|
||||
}
|
||||
else
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
// check session key
|
||||
if (!confirm_sesskey()) {
|
||||
error( get_string('confirmsesskeybad', 'error' ) );
|
||||
}
|
||||
|
||||
$configpath = $CFG->dirroot.'/filter/'.$filtername.'/filterconfig.php';
|
||||
if (file_exists($configpath)) {
|
||||
require_once($configpath);
|
||||
$functionname = $filtername.'_process_config';
|
||||
if (function_exists($functionname)) {
|
||||
$functionname($config);
|
||||
$saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($saved)) {
|
||||
// run through submitted data
|
||||
// reject if does not start with filter_
|
||||
foreach ($config as $name => $value) {
|
||||
set_config( $name,$value );
|
||||
}
|
||||
}
|
||||
redirect( "$CFG->wwwroot/$CFG->admin/filters.php", get_string('changessaved'), 1);
|
||||
exit;
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Display logic
|
||||
//==============================
|
||||
|
||||
$filtername = ucfirst($filtername);
|
||||
print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
|
||||
"-> <a href=\"filters.php\">$txt->managefilters</a> -> $filtername" );
|
||||
|
||||
print_heading( $txt->managefilters );
|
||||
|
||||
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">
|
||||
<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'); ?>" />
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php print_simple_box_start("center"); ?>
|
||||
|
||||
<form name="filters" id="filters" method="post" action="filters.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
||||
<table align="center" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><div align="right">
|
||||
<br />
|
||||
<input name="up" type="submit" id="up" value="↑" />
|
||||
<br />
|
||||
<input name="down" type="submit" id="down" value="↓" />
|
||||
<br />
|
||||
</div></td>
|
||||
<td valign="top">
|
||||
<?php p($stractive) ?>
|
||||
<br />
|
||||
|
||||
<select name="iselect" size="20" id="iselect"
|
||||
onclick="document.filters.add.disabled=true;
|
||||
document.filters.remove.disabled=false;
|
||||
document.filters.uselect.selectedIndex=-1;">
|
||||
<?php
|
||||
$runscript = "";
|
||||
foreach ($installedfilters as $filter) {
|
||||
if ($selectedfilter == $filter) {
|
||||
$selected = " selected ";
|
||||
$runscript = "eval(\"document.filters.add.disabled=true\");
|
||||
eval(\"document.filters.remove.disabled=false\");
|
||||
eval(\"document.filters.uselect.selectedIndex=-1\");";
|
||||
} else {
|
||||
$selected = "";
|
||||
}
|
||||
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
|
||||
}
|
||||
?>
|
||||
</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">
|
||||
<?php p($strinactive) ?>
|
||||
<br />
|
||||
<select name="uselect" size="20" id="select"
|
||||
onclick="document.filters.add.disabled=false;
|
||||
document.filters.remove.disabled=true;
|
||||
document.filters.iselect.selectedIndex=-1;">
|
||||
<?php
|
||||
foreach ($uninstalledfilters as $filter) {
|
||||
if ($selectedfilter == $filter) {
|
||||
$selected = " selected ";
|
||||
$runscript = "eval(\"document.filters.add.disabled=false\");
|
||||
eval(\"document.filters.remove.disabled=true\");
|
||||
eval(\"document.filters.iselect.selectedIndex=-1\");";
|
||||
} else {
|
||||
$selected = "";
|
||||
}
|
||||
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script language="Javascript">
|
||||
<!--
|
||||
<?php echo $runscript ?>
|
||||
|
||||
-->
|
||||
</script>
|
||||
<?php print_simple_box_end(); ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
|
||||
<?php print_simple_box_start("center"); ?>
|
||||
|
||||
<form name="options" id="options" method="post" action="filters.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
||||
<input type="hidden" name="options" value="1">
|
||||
<table cellpadding="20">
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php p($strcachetext) ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[604800] = get_string('numdays', '', 7);
|
||||
$options[86400] = get_string('numdays', '', 1);
|
||||
$options[43200] = get_string('numhours', '', 12);
|
||||
$options[10800] = get_string('numhours', '', 3);
|
||||
$options[7200] = get_string('numhours', '', 2);
|
||||
$options[3600] = get_string('numhours', '', 1);
|
||||
$options[2700] = get_string('numminutes', '', 45);
|
||||
$options[1800] = get_string('numminutes', '', 30);
|
||||
$options[900] = get_string('numminutes', '', 15);
|
||||
$options[600] = get_string('numminutes', '', 10);
|
||||
$options[540] = get_string('numminutes', '', 9);
|
||||
$options[480] = get_string('numminutes', '', 8);
|
||||
$options[420] = get_string('numminutes', '', 7);
|
||||
$options[360] = get_string('numminutes', '', 6);
|
||||
$options[300] = get_string('numminutes', '', 5);
|
||||
$options[240] = get_string('numminutes', '', 4);
|
||||
$options[180] = get_string('numminutes', '', 3);
|
||||
$options[120] = get_string('numminutes', '', 2);
|
||||
$options[60] = get_string('numminutes', '', 1);
|
||||
$options[30] = get_string('numseconds', '', 30);
|
||||
$options[0] = get_string('no');
|
||||
|
||||
choose_from_menu ($options, "cachetext", $CFG->cachetext, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php p($strconfigcachetext) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php p($strfilteruploadedfiles) ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string('no');
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, "filteruploadedfiles", $CFG->filteruploadedfiles, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php p($strconfigfilteruploadedfiles) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php p($strfilterall) ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string('no');
|
||||
$options[1] = get_string('yes');
|
||||
|
||||
choose_from_menu ($options, "filterall", $CFG->filterall, "", "", "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php p($strconfigfilterall) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php print_simple_box_end(); ?>
|
||||
+136
-297
@@ -1,333 +1,172 @@
|
||||
<?php // $Id$
|
||||
// filters.php
|
||||
// Edit list of available text filters
|
||||
<?PHP // $Id$
|
||||
// Allows the admin to create, delete and rename course categories
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
require_once("../config.php");
|
||||
|
||||
// defines
|
||||
define('FILTER_TABLE','filter_administration_table');
|
||||
optional_variable($iselect);
|
||||
optional_variable($uselect);
|
||||
optional_variable($add);
|
||||
optional_variable($remove);
|
||||
optional_variable($up);
|
||||
optional_variable($down);
|
||||
|
||||
// check for allowed access
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only administrators can use the filters administration page');
|
||||
error("Only administrators can use this page!");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error('Site is not defined in filters administration page');
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
// get values from page
|
||||
$params = new object();
|
||||
$params->action = optional_param('action', '', PARAM_ACTION);
|
||||
$params->filterpath = optional_param('filterpath', '', PARAM_PATH);
|
||||
$params->cachetext = optional_param('cachetext', 0, PARAM_INT);
|
||||
$params->filterall = optional_param('filterall', 0, PARAM_BOOL);
|
||||
$params->filteruploadedfiles = optional_param('filteruploadedfiles', 0, PARAM_INT);
|
||||
$params->filtermatchoneperpage = optional_param('filtermatchoneperpage', 0, PARAM_BOOL);
|
||||
$params->filtermatchonepertext = optional_param('filtermatchonepertext', 0, PARAM_BOOL);
|
||||
/// Print headings
|
||||
|
||||
// some basic information
|
||||
$url = 'filters.php';
|
||||
$myurl = "$url?sesskey=" . sesskey();
|
||||
$img = "$CFG->pixpath/t";
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strmanagefilters = get_string("managefilters");
|
||||
$strversion = get_string("version");
|
||||
$strsettings = get_string("settings");
|
||||
$strup = get_string("up");
|
||||
$strdown = get_string("down");
|
||||
$stractive = get_string("active");
|
||||
$strinactive = get_string("inactive");
|
||||
$strcachetext = get_string("cachetext", "admin");
|
||||
$strconfigcachetext = get_string("configcachetext", 'admin');
|
||||
$strfilteruploadedfiles = get_string("filteruploadedfiles", "admin");
|
||||
$strfilterall = get_string("filterall", "admin");
|
||||
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles", 'admin');
|
||||
$strconfigfilterall = get_string("configfilterall", "admin");
|
||||
|
||||
// get translated strings for use on page
|
||||
$txt = new object();
|
||||
$txt->managefilters = get_string('managefilters');
|
||||
$txt->administration = get_string('administration');
|
||||
$txt->configuration = get_string('configuration');
|
||||
$txt->name = get_string('name');
|
||||
$txt->hide = get_string('hide');
|
||||
$txt->show = get_string('show');
|
||||
$txt->hideshow = "$txt->hide/$txt->show";
|
||||
$txt->settings = get_string('settings');
|
||||
$txt->up = get_string('up');
|
||||
$txt->down = get_string('down');
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
$txt->cachetext = get_string('cachetext', 'admin');
|
||||
$txt->configcachetext = get_string('configcachetext', 'admin');
|
||||
$txt->filteruploadedfiles = get_string('filteruploadedfiles','admin');
|
||||
$txt->configfilteruploadedfiles = get_string('configfilteruploadedfiles','admin');
|
||||
$txt->filterall = get_string('filterall','admin');
|
||||
$txt->filtermatchoneperpage = get_string('filtermatchoneperpage','admin');
|
||||
$txt->filtermatchonepertext = get_string('filtermatchonepertext','admin');
|
||||
$txt->configfilterall = get_string('configfilterall','admin');
|
||||
$txt->configfiltermatchoneperpage = get_string('configfiltermatchoneperpage','admin');
|
||||
$txt->configfiltermatchonepertext = get_string('configfiltermatchonepertext','admin');
|
||||
$txt->cachecontrols = get_string('cachecontrols');
|
||||
$txt->yes = get_string('yes');
|
||||
$txt->no = get_string('no');
|
||||
$txt->none = get_string('none');
|
||||
$txt->allfiles = get_string('allfiles');
|
||||
$txt->htmlfilesonly = get_string('htmlfilesonly');
|
||||
print_header("$site->shortname: $strmanagefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanagefilters");
|
||||
|
||||
print_heading($strmanagefilters);
|
||||
|
||||
|
||||
/// Make a list of all available filters and the best names for them we can find
|
||||
$allfilters = array();
|
||||
|
||||
$filterlocations = array("mod", "filter");
|
||||
|
||||
// get a list of possible filters (and translate name if possible)
|
||||
// note filters can be in the dedicated filters area OR in their
|
||||
// associated modules
|
||||
$installedfilters = array();
|
||||
$filtersettings = array();
|
||||
$filterlocations = array('mod','filter');
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$plugins = get_list_of_plugins($filterlocation);
|
||||
foreach ($plugins as $plugin) {
|
||||
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
|
||||
$settingspath = "$CFG->dirroot/$filterlocation/$plugin/filterconfig.html";
|
||||
if (is_readable($pluginpath)) {
|
||||
foreach ($plugins as $key => $plugin) {
|
||||
if (is_readable("$CFG->dirroot/$filterlocation/$plugin/filter.php")) {
|
||||
$name = trim(get_string("filtername", $plugin));
|
||||
if (empty($name) or ($name == '[[filtername]]')) {
|
||||
$name = ucfirst($plugin);
|
||||
}
|
||||
$installedfilters["$filterlocation/$plugin"] = $name;
|
||||
if (is_readable($settingspath)) {
|
||||
$filtersettings[] = "$filterlocation/$plugin";
|
||||
if (empty($name) or $name == "[[filtername]]") {
|
||||
$name = $plugin;
|
||||
}
|
||||
$allfilters["$filterlocation/$plugin"] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get all the currently selected filters
|
||||
|
||||
/// Make an array of all the currently installed filters
|
||||
|
||||
$installedfilters = array();
|
||||
if (!empty($CFG->textfilters)) {
|
||||
$oldactivefilters = explode(',', $CFG->textfilters);
|
||||
$oldactivefilters = array_unique($oldactivefilters);
|
||||
} else {
|
||||
$oldactivefilters = array();
|
||||
}
|
||||
$installedfilters = explode(',',$CFG->textfilters);
|
||||
|
||||
// take this opportunity to clean up filters
|
||||
$activefilters = array();
|
||||
foreach ($oldactivefilters as $oldactivefilter) {
|
||||
if (!empty($oldactivefilter) and array_key_exists($oldactivefilter, $installedfilters)) {
|
||||
$activefilters[] = $oldactivefilter;
|
||||
}
|
||||
}
|
||||
|
||||
//======================
|
||||
// Process Actions
|
||||
//======================
|
||||
|
||||
if ($params->action=="") {
|
||||
// store cleaned active filers in db
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
} elseif (($params->action=="hide") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
// ignore it - doubleclick??
|
||||
} else {
|
||||
// just delete it
|
||||
unset($activefilters[$key]);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
} elseif (($params->action=="show") and confirm_sesskey()) {
|
||||
// check filterpath is valid
|
||||
if (!array_key_exists($params->filterpath, $installedfilters)) {
|
||||
error("Filter $params->filterpath is not currently installed", $url);
|
||||
} elseif (array_search($params->filterpath,$activefilters)) {
|
||||
// filterpath is already active - doubleclick??
|
||||
} else {
|
||||
// add it to installed filters
|
||||
$activefilters[] = $params->filterpath;
|
||||
$activefilters = array_unique($activefilters);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
} elseif (($params->action=="down") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
} elseif ($key>=(count($activefilters)-1)) {
|
||||
// cannot be moved any further down - doubleclick??
|
||||
} else {
|
||||
// swap with $key+1
|
||||
$fsave = $activefilters[$key];
|
||||
$activefilters[$key] = $activefilters[$key+1];
|
||||
$activefilters[$key+1] = $fsave;
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
} elseif (($params->action=="up") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
} elseif ($key<1) {
|
||||
//cannot be moved any further up - doubleclick??
|
||||
} else {
|
||||
// swap with $key-1
|
||||
$fsave = $activefilters[$key];
|
||||
$activefilters[$key] = $activefilters[$key-1];
|
||||
$activefilters[$key-1] = $fsave;
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
} elseif (($params->action=="config") and confirm_sesskey()) {
|
||||
set_config('cachetext', $params->cachetext);
|
||||
set_config('filteruploadedfiles', $params->filteruploadedfiles);
|
||||
set_config('filterall', $params->filterall);
|
||||
set_config('filtermatchoneperpage', $params->filtermatchoneperpage);
|
||||
set_config('filtermatchonepertext', $params->filtermatchonepertext);
|
||||
}
|
||||
|
||||
//======================
|
||||
// Build Display Objects
|
||||
//======================
|
||||
|
||||
// construct the display array with installed filters
|
||||
// at the top in the right order
|
||||
$displayfilters = array();
|
||||
foreach ($activefilters as $activefilter) {
|
||||
$name = $installedfilters[$activefilter];
|
||||
$displayfilters[$activefilter] = $name;
|
||||
}
|
||||
foreach ($installedfilters as $key => $filter) {
|
||||
if (!array_key_exists($key, $displayfilters)) {
|
||||
$displayfilters[$key] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
// construct the flexible table ready to display
|
||||
$table = new flexible_table(FILTER_TABLE);
|
||||
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
|
||||
$table->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/admin/filters.php");
|
||||
$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
|
||||
$updowncount = 1;
|
||||
$activefilterscount = count($activefilters);
|
||||
foreach ($displayfilters as $path => $name) {
|
||||
$upath = urlencode($path);
|
||||
// get hide/show link
|
||||
if (in_array($path, $activefilters)) {
|
||||
$hideshow = "<a href=\"$myurl&action=hide&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" 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\" height=\"16\" width=\"16\" alt=\"show\" /></a>";
|
||||
$hidden = true;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
// get up/down link (only if not hidden)
|
||||
$updown = '';
|
||||
if (!$hidden) {
|
||||
if ($updowncount>1) {
|
||||
$updown .= "<a href=\"$myurl&action=up&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/up.gif\" alt=\"up\" /></a> ";
|
||||
// Do a little cleanup for robustness
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if (empty($installedfilter)) {
|
||||
unset($installedfilters[$key]);
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
else {
|
||||
$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=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" />";
|
||||
}
|
||||
++$updowncount;
|
||||
}
|
||||
|
||||
// settings link (if defined)
|
||||
$settings = '';
|
||||
if (in_array($path, $filtersettings)) {
|
||||
$settings = "<a href=\"filter.php?filter=" . urlencode($path) . "\">";
|
||||
$settings .= "{$txt->settings}</a>";
|
||||
}
|
||||
|
||||
// write data into the table object
|
||||
$table->add_data(array($displayname, $hideshow, $updown, $settings));
|
||||
}
|
||||
|
||||
// build options list for cache lifetime
|
||||
$seconds = array(604800,86400,43200,10800,7200,3600,2700,1800,900,600,540,480,420,360,300,240,180,120,60,30,0);
|
||||
unset($lifetimeoptions);
|
||||
foreach ($seconds as $second) {
|
||||
if ($second>=86400) {
|
||||
$options[$second] = get_string('numdays','',$second/86400);
|
||||
}
|
||||
elseif ($second>=3600) {
|
||||
$options[$second] = get_string('numhours','',$second/3600);
|
||||
}
|
||||
elseif ($second>=60) {
|
||||
$options[$second] = get_string('numminutes','',$second/60);
|
||||
}
|
||||
elseif ($second>=1) {
|
||||
$options[$second] = get_string('numseconds','',$second);
|
||||
}
|
||||
else {
|
||||
$options[$second] = get_string('no');
|
||||
}
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Display logic
|
||||
//==============================
|
||||
$selectedfilter = "none";
|
||||
|
||||
print_header("$site->shortname: $txt->managefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
|
||||
"-> $txt->managefilters");
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
print_heading_with_help($txt->managefilters, 'filters');
|
||||
if (!empty($options)) {
|
||||
if (($config = data_submitted()) && confirm_sesskey()) {
|
||||
unset($config->options);
|
||||
unset($config->sesskey);
|
||||
foreach ($config as $name => $value) {
|
||||
set_config($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// print the table of all the filters
|
||||
$table->print_html();
|
||||
if (!empty($add) and !empty($uselect) and confirm_sesskey()) {
|
||||
$selectedfilter = $uselect;
|
||||
if (!in_array($selectedfilter, $installedfilters)) {
|
||||
$installedfilters[] = $selectedfilter;
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
|
||||
// print the table for the cache controls
|
||||
print_heading($txt->cachecontrols);
|
||||
print_simple_box_start('center');
|
||||
?>
|
||||
} else if (!empty($remove) and !empty($iselect) and confirm_sesskey()) {
|
||||
$selectedfilter = $iselect;
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($installedfilter == $selectedfilter) {
|
||||
unset($installedfilters[$key]);
|
||||
}
|
||||
}
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
|
||||
<form name="options" id="options" method="post" action="<?php echo $url; ?>" >
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
<input type="hidden" name="action" value="config" />
|
||||
<table cellpadding="20">
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->cachetext; ?></td>
|
||||
<td><?php choose_from_menu($options, "cachetext", $CFG->cachetext, "", "", ""); ?></td>
|
||||
<td><?php echo $txt->configcachetext; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filteruploadedfiles; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->none,$txt->allfiles,$txt->htmlfilesonly),
|
||||
"filteruploadedfiles", $CFG->filteruploadedfiles,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfilteruploadedfiles; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchoneperpage; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchoneperpage", $CFG->filtermatchoneperpage,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfiltermatchoneperpage; ?></td>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchonepertext; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchonepertext", $CFG->filtermatchonepertext,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfiltermatchonepertext; ?></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filterall; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filterall", $CFG->filterall,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfilterall; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<?php print_string('savechanges'); ?>" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
} else if ((!empty($up) or !empty($down)) and !empty($iselect) and confirm_sesskey()) {
|
||||
|
||||
if (!empty($up)) {
|
||||
if ($allfilters[$iselect]) {
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($installedfilter == $iselect) {
|
||||
$movefilter = $key;
|
||||
break;
|
||||
}
|
||||
$swapfilter = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($down)) {
|
||||
if ($allfilters[$iselect]) {
|
||||
$choosenext = false;
|
||||
foreach ($installedfilters as $key => $installedfilter) {
|
||||
if ($choosenext) {
|
||||
$swapfilter = $key;
|
||||
break;
|
||||
}
|
||||
if ($installedfilter == $iselect) {
|
||||
$movefilter = $key;
|
||||
$choosenext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($swapfilter) and isset($movefilter)) {
|
||||
$tempfilter = $installedfilters[$swapfilter];
|
||||
$installedfilters[$swapfilter] = $installedfilters[$movefilter];
|
||||
$installedfilters[$movefilter] = $tempfilter;
|
||||
set_config("textfilters", implode(',', $installedfilters));
|
||||
}
|
||||
$selectedfilter = $iselect;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Make an array of all the currently uninstalled filters
|
||||
|
||||
$uninstalledfilters = array();
|
||||
foreach ($allfilters as $filter => $name) {
|
||||
$installed = false;
|
||||
foreach ($installedfilters as $installedfilter) {
|
||||
if ($installedfilter == $filter) {
|
||||
$installed = true;
|
||||
}
|
||||
}
|
||||
if (!$installed) {
|
||||
$uninstalledfilters[] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
/// Print the current form
|
||||
|
||||
include("filters.html");
|
||||
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?
|
||||
/** This expects the output from a command like
|
||||
* clamscan -r --infected --no-summary <files> 2>&1 | php -d error_log=/path/to/log thisfile.php
|
||||
* also it's important that the output of clamscan prints the FULL PATH to each infected file, so use absolute paths for area to scan
|
||||
|
||||
+5
-6
@@ -7,9 +7,6 @@
|
||||
define('SEVERITY_SIGNIFICANT', 'significant');
|
||||
define('SEVERITY_CRITICAL', 'critical');
|
||||
|
||||
$resetsesserrorcounter = optional_param('resetsesserrorcounter', 0, PARAM_BOOL);
|
||||
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
|
||||
|
||||
require_login();
|
||||
if (!isadmin()) {
|
||||
error('Only the admin can use this page');
|
||||
@@ -84,7 +81,9 @@ dd.solution li {
|
||||
</style>
|
||||
STYLES;
|
||||
|
||||
if(strpos($solution, 'problem_') === 0 && class_exists($solution)) {
|
||||
$solution = optional_param('solution', NULL);
|
||||
|
||||
if(!empty($solution) && class_exists($solution)) {
|
||||
health_print_solution($solution);
|
||||
}
|
||||
else {
|
||||
@@ -499,7 +498,7 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
if (!empty($resetsesserrorcounter)) {
|
||||
if (isset($_GET['resetsesserrorcounter'])) {
|
||||
if (get_field('config', 'name', 'name', 'session_error_counter')) {
|
||||
delete_records('config', 'name', 'session_error_counter');
|
||||
}
|
||||
@@ -538,4 +537,4 @@ TODO:
|
||||
|
||||
*/
|
||||
|
||||
?>
|
||||
?>
|
||||
+114
-140
@@ -1,25 +1,30 @@
|
||||
<?php // $Id$
|
||||
|
||||
/// Check that config.php exists, if not then call the install script
|
||||
if (!file_exists('../config.php')) {
|
||||
if (!file_exists("../config.php")) {
|
||||
header('Location: ../install.php');
|
||||
die;
|
||||
}
|
||||
|
||||
require_once('../config.php');
|
||||
include_once($CFG->dirroot.'/lib/adminlib.php'); // Contains various admin-only functions
|
||||
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
|
||||
require_once("../config.php");
|
||||
include_once("$CFG->dirroot/lib/adminlib.php"); // Contains various admin-only functions
|
||||
|
||||
|
||||
/// Check that PHP is of a sufficient version
|
||||
|
||||
if (!check_php_version("4.1.0")) { //TODO: should we bump it up to 4.3.0??
|
||||
$phpversion = phpversion();
|
||||
print_heading("Sorry, Moodle requires PHP 4.1.0 or later (currently using version $phpversion)");
|
||||
if (!check_php_version("4.1.0")) {
|
||||
$version = phpversion();
|
||||
print_heading("Sorry, Moodle requires PHP 4.1.0 or later (currently using version $version)");
|
||||
die;
|
||||
}
|
||||
|
||||
/// This is a Moodle 1.5 hack ONLY to fix accidental bad versions from version.php
|
||||
/// Do not copy this code into HEAD
|
||||
|
||||
if ($CFG->version == '2005072100') {
|
||||
set_config('version', 2005060221);
|
||||
}
|
||||
|
||||
|
||||
/// Check some PHP server settings
|
||||
|
||||
@@ -73,7 +78,7 @@
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
@ob_end_flush();
|
||||
|
||||
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
|
||||
@@ -99,12 +104,12 @@
|
||||
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_simple_box_start('center');
|
||||
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?agreelicence=true",
|
||||
"http://docs.moodle.org/en/License");
|
||||
"http://moodle.org/doc/?frame=licence.html");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@
|
||||
$a->newversion = "$release ($version)";
|
||||
$strdatabasechecking = get_string("databasechecking", "", $a);
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
if (empty($_GET['confirmupgrade'])) {
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
|
||||
@@ -179,7 +184,11 @@
|
||||
print_header($strcurrentversion, $stradministration, $strcurrentversion,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
if (!set_config("version", $version)) {
|
||||
if (set_config("version", $version)) {
|
||||
print_heading("Moodle $release ($version)");
|
||||
print_continue("index.php");
|
||||
die;
|
||||
} else {
|
||||
$db->debug=true;
|
||||
if (main_upgrade(0)) {
|
||||
print_continue("index.php");
|
||||
@@ -190,6 +199,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Updated human-readable release version if necessary
|
||||
|
||||
if ($release <> $CFG->release) { // Update the release version
|
||||
@@ -199,10 +209,16 @@
|
||||
if (!set_config("release", $release)) {
|
||||
notify("ERROR: Could not update release version in database!!");
|
||||
}
|
||||
notice(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'index.php');
|
||||
print_continue("index.php");
|
||||
print_simple_box_start("CENTER");
|
||||
include("$CFG->dirroot/lang/en/docs/release.html");
|
||||
print_simple_box_end();
|
||||
print_continue("index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Insert default values for any important configuration variables
|
||||
|
||||
include_once("$CFG->dirroot/lib/defaults.php");
|
||||
@@ -215,22 +231,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// Send $CFG->unicodedb to DB to have it available for next requests
|
||||
set_config('unicodedb', $CFG->unicodedb);
|
||||
|
||||
/// If any new configurations were found then send to the config page to check
|
||||
|
||||
if (!empty($configchange)) {
|
||||
redirect("config.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check all questiontype plugins and upgrade if necessary
|
||||
// It is important that this is done AFTER the quiz module has been upgraded
|
||||
upgrade_plugins('qtype', 'question/type', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Upgrade backup/restore system if necessary
|
||||
require_once("$CFG->dirroot/backup/lib.php");
|
||||
upgrade_backup_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
@@ -243,11 +254,8 @@
|
||||
upgrade_blocks_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check all enrolment plugins and upgrade if necessary
|
||||
upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
upgrade_enrol_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for local database customisations
|
||||
require_once("$CFG->dirroot/lib/locallib.php");
|
||||
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
/// Set up the overall site name etc.
|
||||
@@ -292,8 +300,8 @@
|
||||
|
||||
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
||||
|
||||
if (!empty($id)) {
|
||||
if ($id == $CFG->siteidentifier) {
|
||||
if (!empty($_GET['id'])) {
|
||||
if ($_GET['id'] == $CFG->siteidentifier) {
|
||||
set_config('registered', time());
|
||||
}
|
||||
}
|
||||
@@ -305,40 +313,26 @@
|
||||
print_simple_box_start('center', '100%', '', 20);
|
||||
print_heading($stradministration);
|
||||
|
||||
/// Deprecated database! Warning!!
|
||||
if (!empty($CFG->migrated_to_new_db)) {
|
||||
print_simple_box_start('center','60%');
|
||||
print_string('dbmigrationdeprecateddb','admin');
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
if (!empty($CFG->upgrade)) { // Print notice about extra upgrading that needs to be done
|
||||
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
|
||||
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center", '60%');
|
||||
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center");
|
||||
print_spacer(10,10);
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center', '60%');
|
||||
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center');
|
||||
}
|
||||
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
$strinstallation = get_string('installation', 'install');
|
||||
$helpbutton = helpbutton('install', $strinstallation, 'moodle', true, false, '', true);
|
||||
print_simple_box(get_string('cronwarning', 'admin')." ".$helpbutton, 'center', '60%');
|
||||
print_simple_box(get_string('cronwarning', 'admin') , 'center');
|
||||
}
|
||||
|
||||
/// Alert if we are currently in maintenance mode
|
||||
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
|
||||
print_simple_box(get_string('sitemaintenancewarning', 'admin') , 'center', '60%');
|
||||
}
|
||||
|
||||
/// Alert if we are currently in maintenance mode
|
||||
if (empty($CFG->unicodedb)) {
|
||||
print_simple_box(get_string('unicodeupgradenotice', 'admin') , 'center', '60%');
|
||||
print_simple_box(get_string('sitemaintenancewarning', 'admin') , 'center');
|
||||
}
|
||||
|
||||
/// Print slightly annoying registration button every six months ;-)
|
||||
@@ -347,7 +341,7 @@
|
||||
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_simple_box_start('center','60%');
|
||||
print_simple_box_start('center');
|
||||
echo '<div align="center">';
|
||||
print_string('pleaseregister', 'admin');
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
@@ -355,128 +349,108 @@
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
$table->tablealign = "center";
|
||||
$table->tablealign = "right";
|
||||
$table->align = array ("right", "left");
|
||||
$table->wrap = array ("nowrap", "nowrap");
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '40%';
|
||||
$table->width = "40%";
|
||||
|
||||
$configdata = '<div class="adminlink"><a href="config.php">'.get_string('configvariables', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpconfigvariables').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="site.php">'.get_string('sitesettings').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpsitesettings').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="../theme/index.php">'.get_string('themes').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpthemes').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="lang.php">'.get_string('language').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelplanguage').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="modules.php">'.get_string('managemodules').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpmanagemodules').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="blocks.php">'.get_string('manageblocks').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpmanageblocks').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="filters.php">'.get_string('managefilters').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpmanagefilters').'</span></div>';
|
||||
$configdata = "<font size=\"+1\"> </font><a href=\"config.php\">".get_string("configvariables", 'admin')."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpconfigvariables")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"site.php\">".get_string("sitesettings")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpsitesettings")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"../theme/index.php\">".get_string("themes")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpthemes")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"lang.php\">".get_string("language")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelplanguage")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"modules.php\">".get_string("managemodules")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpmanagemodules")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"blocks.php\">".get_string("manageblocks")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpmanageblocks")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"filters.php\">".get_string("managefilters")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpmanagefilters")."</font><br />";
|
||||
if (!isset($CFG->disablescheduledbackups)) {
|
||||
$configdata .= '<div class="adminlink"><a href="backup.php">'.get_string('backup').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpbackup').'</span></div>';
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"backup.php\">".get_string("backup")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpbackup")."</font><br />";
|
||||
}
|
||||
$configdata .= '<div class="adminlink"><a href="editor.php">'.get_string('editorsettings').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpeditorsettings').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="calendar.php">'.get_string('calendarsettings', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('helpcalendarsettings', 'admin').'</span></div>';
|
||||
$configdata .= '<div class="adminlink"><a href="maintenance.php">'.get_string('sitemaintenancemode', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('helpsitemaintenance', 'admin').'</span></div>';
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"editor.php\">". get_string("editorsettings") ."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpeditorsettings")."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"calendar.php\">". get_string('calendarsettings', 'admin') ."</a> - <font size=\"1\">".
|
||||
get_string('helpcalendarsettings', 'admin')."</font><br />";
|
||||
$configdata .= "<font size=\"+1\"> </font><a href=\"maintenance.php\">". get_string('sitemaintenancemode', 'admin') ."</a> - <font size=\"1\">".
|
||||
get_string('helpsitemaintenance', 'admin')."</font><br />";
|
||||
|
||||
$table->data[] = array('<strong><a href="configure.php">'.get_string('configuration').'</a></strong>', $configdata);
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"configure.php\">".get_string("configuration")."</a></b></font>",
|
||||
$configdata);
|
||||
|
||||
|
||||
$userdata = '<div class="adminlink"><a href="auth.php?sesskey='.$USER->sesskey.'">'.get_string("authentication").
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpauthentication').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="user.php">'.get_string('edituser').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpedituser').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/user.php?newuser=true&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('addnewuser').'</a> - <span class="explanation">'.get_string('adminhelpaddnewuser').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/uploaduser.php?sesskey='.$USER->sesskey.'">'.
|
||||
get_string('uploadusers').'</a> - <span class="explanation">'.get_string('adminhelpuploadusers').'</span></div>';
|
||||
$userdata = "<font size=\"+1\"> </font><a href=\"auth.php?sesskey=$USER->sesskey\">".get_string("authentication")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpauthentication")."</font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"user.php\">".get_string("edituser")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpedituser")."</font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&sesskey=$USER->sesskey\">".
|
||||
get_string("addnewuser")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpaddnewuser")."</font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".
|
||||
get_string("uploadusers")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpuploadusers")."</font><br />";
|
||||
|
||||
$userdata .= '<hr /><div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolmentplugins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="../course/index.php?edit=off&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignstudents').'</a> - <span class="explanation">'.get_string('adminhelpassignstudents').'</span></div>';
|
||||
$userdata .= "<hr /><font size=\"+1\"> </font><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolments")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpenrolments")."</font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpassignstudents")."</font><br />";
|
||||
|
||||
$userdata .= '<div class="adminlink"><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignteachers').'</a> - <span class="explanation">'.get_string('adminhelpassignteachers').
|
||||
' <img src="../pix/t/user.gif" height="11" width="11" alt="" /></span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="creators.php?sesskey='.$USER->sesskey.'">'.get_string('assigncreators').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassigncreators').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="admin.php?sesskey='.$USER->sesskey.'">'.get_string('assignadmins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassignadmins').'</span></div>';
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("assignteachers")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpassignteachers").
|
||||
" <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" /></font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpassigncreators")."</font><br />";
|
||||
$userdata .= "<font size=\"+1\"> </font><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a> - <font size=\"1\">".
|
||||
get_string("adminhelpassignadmins")."</font><br />";
|
||||
|
||||
$table->data[] = array('<strong><a href="users.php">'.get_string('users').'</a></strong>', $userdata);
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"users.php\">".get_string("users")."</a></b></font>", $userdata);
|
||||
|
||||
$table->data[] = array('<strong><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string('courses').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpcourses').'</div>');
|
||||
$table->data[] = array('<strong><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpsitefiles').'</div>');
|
||||
$table->data[] = array('<strong><a href="stickyblocks.php">'.get_string('stickyblocks','admin').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpstickyblocks').'</div>');
|
||||
$table->data[] = array('<strong><a href="report.php">'.get_string('reports').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpreports').'</div>');
|
||||
$table->data[] = array('<strong><a href="environment.php">'.get_string('environment','admin').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpenvironment').'</div>');
|
||||
|
||||
/// Optional stuff
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("courses")."</a></b></font>",
|
||||
"<font size=\"+1\"> </font>".get_string("adminhelpcourses"));
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"../course/log.php?id=$site->id\">".get_string("logs")."</a></b></font>",
|
||||
"<font size=\"+1\"> </font>".get_string("adminhelplogs"));
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"../files/index.php?id=$site->id\">".get_string("sitefiles")."</a></b></font>",
|
||||
"<font size=\"+1\"> </font>".get_string("adminhelpsitefiles"));
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
|
||||
$table->data[] = array("<strong><a href=\"$CFG->dbtype/frame.php\">".get_string('managedatabase').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpmanagedatabase').'</div>');
|
||||
$table->data[] = array("<font size=\"+1\"><b><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></b></font>",
|
||||
"<font size=\"+1\"> </font>".get_string("adminhelpmanagedatabase"));
|
||||
}
|
||||
|
||||
/// Hooks for Matt Oquists contrib code for repositories and portfolio.
|
||||
/// The eventual official versions may not look like this
|
||||
if (isset($CFG->portfolio) && file_exists("$CFG->dirroot/$CFG->portfolio")) {
|
||||
$table->data[] = array("<strong><a href=\"../portfolio/\">".get_string('portfolio','portfolio').'</a></
|
||||
trong>',
|
||||
'<div class="explanation">'.get_string('adminhelpportfolio','portfolio').'</div>');
|
||||
}
|
||||
|
||||
if (isset($CFG->repo) && file_exists("$CFG->dirroot/$CFG->repo")) {
|
||||
$table->data[] = array("<strong><a href=\"../repository/?repoid=1&action=list\">".get_string('repository','
|
||||
epository').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelprepository','repository').'</div>');
|
||||
}
|
||||
|
||||
|
||||
|
||||
print_table($table);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO REMOVE OR MODIFY THE COPYRIGHT NOTICE BELOW ////
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
'<a href="http://docs.moodle.org/en/Release">'.$CFG->release.'</a> ('.$CFG->version.')<br />'.
|
||||
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
||||
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
||||
echo '<p class="copyright">'.$copyrighttext.'</p>';
|
||||
$copyrighttext = "<a href=\"http://moodle.org/\">Moodle</a> ".
|
||||
"<a href=\"../doc/?frame=release.html\">$CFG->release</a> ($CFG->version)<br />".
|
||||
"Copyright © 1999-2005 Martin Dougiamas<br />".
|
||||
"<a href=\"../doc/?frame=licence.html\">GNU Public License</a>";
|
||||
echo "<center><p><font size=\"1\">$copyrighttext</font></p></center>";
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
echo '<div align="center">';
|
||||
echo '<table width="100%" cellspacing="0"><tr>';
|
||||
echo '<td align="center" width="33%">';
|
||||
print_single_button($CFG->wwwroot.'/doc/', NULL, get_string('documentation'));
|
||||
echo '</td>';
|
||||
|
||||
echo '<td align="center" width="33%">';
|
||||
print_single_button('phpinfo.php', NULL, get_string('phpinfo'));
|
||||
echo '</td>';
|
||||
|
||||
echo '<td align="center" width="33%">';
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
echo '</div>';
|
||||
|
||||
echo '</td></tr></table>';
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
if (optional_param('dbmigrate')) { // ??? Is this actually used?
|
||||
print_simple_box_start('center','60%');
|
||||
require_once($CFG->dirroot.'/admin/utfdbmigrate.php');
|
||||
db_migrate2utf8();
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
print_footer($site);
|
||||
|
||||
?>
|
||||
|
||||
+3
-5
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
include('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -14,7 +12,7 @@
|
||||
"Convert all tables from MYISAM to InnoDB");
|
||||
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
if (!empty($confirm) and confirm_sesskey()) {
|
||||
|
||||
print_heading("Please be patient and wait for this to complete...");
|
||||
|
||||
@@ -26,7 +24,7 @@
|
||||
}
|
||||
} else {
|
||||
notice_yesno("Are you sure you want convert all your tables to the InnoDB format?",
|
||||
"innodb.php?confirm=1&sesskey=".sesskey(), "index.php");
|
||||
"innodb.php?confirm=yes&sesskey=".sesskey(), "index.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+14
-60
@@ -1,8 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.php");
|
||||
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
$currentfile = optional_param('currentfile', 'moodle.php', PARAM_FILE);
|
||||
|
||||
require_login();
|
||||
@@ -54,15 +54,6 @@
|
||||
'', '', true, $button);
|
||||
|
||||
if (!$mode) {
|
||||
print_simple_box_start('center','80%');
|
||||
echo '<table align="center" width="100%"><tr><td width="50%" align="center">';
|
||||
print_string('managelang','admin');
|
||||
echo '</td><td align="center" width="50%">';
|
||||
print_string('editlang','admin');
|
||||
echo '</td></tr><tr><td>';
|
||||
print_string('lang16notify','admin');
|
||||
echo '<p /><a href="langimport.php">'.get_string('langimport','admin').'</a>';
|
||||
echo '</td><td>';
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
echo "<table align=\"center\"><tr><td align=\"right\">";
|
||||
@@ -71,41 +62,33 @@
|
||||
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
echo '</td></tr><tr><td colspan="2">';
|
||||
$options["lang"] = $currentlang;
|
||||
//print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack"));
|
||||
print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack"));
|
||||
echo "</td></tr></table>";
|
||||
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>");
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get a list of all the root files in the English directory
|
||||
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en_utf8";
|
||||
$langdir = "$CFG->dirroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en";
|
||||
|
||||
if (! $stringfiles = get_directory_list($enlangdir, "", false)) {
|
||||
error("Could not find English language pack!");
|
||||
}
|
||||
|
||||
foreach ($stringfiles as $key => $file) {
|
||||
if (substr($file, -4) != ".php") { //Avoid non php files to be showed
|
||||
unset($stringfiles[$key]);
|
||||
}
|
||||
if ($file == "langconfig.php") { //Avoid langconfig.php to be showed
|
||||
if (substr($file, -4) != ".php") {
|
||||
unset($stringfiles[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "missing") {
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
|
||||
// For each file, check that a counterpart exists, then check all the strings
|
||||
|
||||
foreach ($stringfiles as $file) {
|
||||
unset($string);
|
||||
include("$enlangdir/$file");
|
||||
@@ -122,7 +105,7 @@
|
||||
|
||||
$first = true;
|
||||
foreach ($enstring as $key => $value) {
|
||||
if (empty($string[$key]) and $string[$key] != "0") { //bug fix 4735 mits
|
||||
if (empty($string[$key])) {
|
||||
$value = htmlspecialchars($value);
|
||||
$value = str_replace("$"."a", "\\$"."a", $value);
|
||||
$value = str_replace("%%","%",$value);
|
||||
@@ -139,7 +122,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
}
|
||||
|
||||
@@ -151,7 +134,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en/docs", "CVS")) {
|
||||
error("Could not find English language docs files!");
|
||||
}
|
||||
foreach ($files as $filekey => $file) { // check all the docs files.
|
||||
@@ -170,23 +153,11 @@
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['currentfile'])){ // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$newstrings = array();
|
||||
|
||||
foreach ($_POST as $postkey => $postval) {
|
||||
$stringkey = lang_file_string_key($postkey);
|
||||
$newstrings[$stringkey] = $postval;
|
||||
}
|
||||
|
||||
$newstrings = $_POST;
|
||||
unset($newstrings['currentfile']);
|
||||
if (lang_save_file($langdir, $currentfile, $newstrings)) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
@@ -220,15 +191,13 @@
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
if ($f = fopen("$langdir/$currentfile","r+") && ($currentlang != "en_utf8")) {
|
||||
if ($f = fopen("$langdir/$currentfile","r+")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
} else {
|
||||
$editable = false;
|
||||
echo "<p><font size=\"1\">".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
|
||||
}
|
||||
///added code here to prevent en_utf8 being edited
|
||||
|
||||
error_reporting(7);
|
||||
|
||||
|
||||
@@ -282,12 +251,12 @@
|
||||
$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";
|
||||
echo '<textarea name="stringXXX'.$key.'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 2;
|
||||
}
|
||||
echo '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
|
||||
echo '<input type="text" name="stringXXX'.$key.'" value="'.$value.'" size="'.$cols.'" />';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
@@ -353,19 +322,4 @@ function lang_save_file($path, $file, $strings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 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.
|
||||
}
|
||||
|
||||
|
||||
function lang_file_string_key($keyfromform) {
|
||||
return str_replace('##46#', '.', $keyfromform);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+14
-35
@@ -9,7 +9,6 @@ Based on: lang.php in 1.4.3+ release
|
||||
Thanks: Jaime Villate for important bug fixing, koen roggemans for his job and all moodlers
|
||||
for intensive testing of this my first contribution
|
||||
*/
|
||||
require_once('../config.php');
|
||||
|
||||
//
|
||||
// Some local configuration
|
||||
@@ -22,6 +21,8 @@ Thanks: Jaime Villate for important bug fixing, koen roggemans for his job a
|
||||
// or to filenames with filesize() == 0
|
||||
$filetemplate = ''; // template for new files, i.e. '$Id$';
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
$currentfile = optional_param('currentfile', 'docs/README.txt', PARAM_PATH);
|
||||
|
||||
require_login();
|
||||
@@ -48,13 +49,9 @@ Thanks: Jaime Villate for important bug fixing, koen roggemans for his job a
|
||||
'choosefile.popup', '', true);
|
||||
|
||||
$currentlang = current_language();
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en_utf8";
|
||||
$langdir = "$CFG->dirroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en";
|
||||
|
||||
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
// Shall I save POSTed data?
|
||||
|
||||
if (isset($_POST['currentfile'])) {
|
||||
@@ -73,7 +70,7 @@ Thanks: Jaime Villate for important bug fixing, koen roggemans for his job a
|
||||
|
||||
// Get all files from /docs directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en/docs", "CVS")) {
|
||||
error("Could not find English language docs files!");
|
||||
}
|
||||
|
||||
@@ -85,7 +82,7 @@ Thanks: Jaime Villate for important bug fixing, koen roggemans for his job a
|
||||
if (( !file_exists("$langdir/docs/$file")) || (filesize("$langdir/docs/$file") == 0)) {
|
||||
$options["docs/$file"] .= "$filemissingmark";
|
||||
} else {
|
||||
if (filemtime("$langdir/docs/$file") < filemtime("$CFG->dirroot/lang/en_utf8/docs/$file")) {
|
||||
if (filemtime("$langdir/docs/$file") < filemtime("$CFG->dirroot/lang/en/docs/$file")) {
|
||||
$options["docs/$file"] .= "$fileoldmark";
|
||||
}
|
||||
}
|
||||
@@ -93,13 +90,13 @@ Thanks: Jaime Villate for important bug fixing, koen roggemans for his job a
|
||||
|
||||
// Get all files from /help directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
$options["help/$file"] = "help/$file";
|
||||
if (( !file_exists("$langdir/help/$file")) || (filesize("$CFG->dirroot/lang/en_utf8/help/$file") == 0)) {
|
||||
if (( !file_exists("$langdir/help/$file")) || (filesize("$CFG->dirroot/lang/en/help/$file") == 0)) {
|
||||
$options["help/$file"] .= "$filemissingmark";
|
||||
} else {
|
||||
if (filemtime("$langdir/help/$file") < filemtime("$langdir/help/$file")) {
|
||||
@@ -161,17 +158,11 @@ $langdir/$currentfile")."</font></p>";
|
||||
."</font></p>";
|
||||
}
|
||||
|
||||
//en_utf8 in dataroot is not editable
|
||||
if ($currentlang == 'en_utf8') {
|
||||
$editable = false;
|
||||
}
|
||||
|
||||
echo "<table align=\"center\"><tr valign=\"center\"><td align=\"center\">\n";
|
||||
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">\n";
|
||||
echo htmlspecialchars(file_get_contents("$enlangdir/$currentfile"));
|
||||
echo "</textarea>\n";
|
||||
//link_to_popup_window("/lang/en_utf8/$currentfile", "popup", get_string("preview"));
|
||||
link_to_popup_window(help_preview_url($currentfile).'&forcelang=en_utf8', 'popup', get_string('preview'));
|
||||
link_to_popup_window("/lang/en/$currentfile", "popup", get_string("preview"));
|
||||
echo "</td>\n";
|
||||
if ($fileeditorinline == 1) {
|
||||
echo "</tr>\n<tr valign=\"center\">\n";
|
||||
@@ -185,13 +176,15 @@ $langdir/$currentfile")."</font></p>";
|
||||
}
|
||||
|
||||
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
|
||||
|
||||
if (file_exists("$langdir/$currentfile")) {
|
||||
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
|
||||
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
|
||||
} else {
|
||||
echo ($filetemplate);
|
||||
}
|
||||
|
||||
echo "</textarea>\n";
|
||||
link_to_popup_window(help_preview_url($currentfile), 'popup', get_string('preview'));
|
||||
link_to_popup_window("/lang/$currentlang/$currentfile", "popup", get_string("preview"));
|
||||
echo "</td>\n</tr>\n</table>";
|
||||
|
||||
if ($editable) {
|
||||
@@ -240,18 +233,4 @@ function langdoc_save_file($path, $file, $content) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function help_preview_url($currentfile) {
|
||||
if (substr($currentfile, 0, 5) == 'help/') {
|
||||
$currentfile = substr($currentfile, 5);
|
||||
}
|
||||
$currentpathexp = explode('/', $currentfile);
|
||||
if (count($currentpathexp) > 1) {
|
||||
$url = '/help.php?module='.$currentpathexp[0].'&file='.$currentpathexp[1];
|
||||
} else {
|
||||
$url = '/help.php?module=moodle&file='.$currentfile;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,424 +0,0 @@
|
||||
<?php //$Id$
|
||||
///This file only manages the installation of 1.6 lang packs.
|
||||
///in downloads.moodle.org, they are store in separate directory /lang16
|
||||
///in local server, they are stored in $CFG->dataroot/lang
|
||||
///This helps to avoid confusion.
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$mode = optional_param('mode', 0, PARAM_INT); //phase
|
||||
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
|
||||
$displaylang = $pack;
|
||||
$uninstalllang = optional_param('uninstalllang', '', PARAM_FILE);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$sitelang = optional_param('sitelangconfig', '', PARAM_FILE);
|
||||
|
||||
define('INSTALLATION_OF_SELECTED_LANG', 2);
|
||||
define('CHANGE_SITE_LANG', 3);
|
||||
define('DELETION_OF_SELECTED_LANG', 4);
|
||||
define('UPDATE_ALL_LANG', 5);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('You must be an admin');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site not defined!");
|
||||
}
|
||||
|
||||
$strlang = get_string('langimport','admin');
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strlanguage = get_string("language");
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$title = $strlang;
|
||||
|
||||
print_header("$site->shortname: $title", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"lang.php\">$strlanguage</a> -> $strlang",
|
||||
'', '', true, '');
|
||||
|
||||
print_heading('');
|
||||
|
||||
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:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
break;
|
||||
|
||||
case INSTALLED:
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack));
|
||||
break;
|
||||
|
||||
case UPTODATE:
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
notify('Had an unspecified error with the component installer, sorry.');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHANGE_SITE_LANG: //change site language
|
||||
|
||||
if (confirm_sesskey()) {
|
||||
$langconfig = get_record('config','name','lang');
|
||||
$langconfig->value = $sitelang;
|
||||
if (!empty($sitelang) && update_record('config',$langconfig)){
|
||||
redirect('langimport.php', get_string('sitelangchanged','admin'));
|
||||
} else {
|
||||
error('Could not update the default site language!');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
|
||||
|
||||
if (!$confirm && confirm_sesskey()) {
|
||||
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
|
||||
'langimport.php?mode=4&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php');
|
||||
} else if (confirm_sesskey()) {
|
||||
if ($uninstalllang == 'en_utf8') {
|
||||
error ('en_utf8 can not be uninstalled!');
|
||||
}
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
|
||||
$rm1 = false;
|
||||
$rm2 = false;
|
||||
if (file_exists($dest1)){
|
||||
$rm1 = remove_dir($dest1);
|
||||
}
|
||||
if (file_exists($dest2)){
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
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,
|
||||
//key = langname, value = md5
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
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
|
||||
|
||||
|
||||
if (!$availablelangs = proxy_url($source)) {
|
||||
error ('can not read from course');
|
||||
}
|
||||
|
||||
//and build an associative array
|
||||
foreach ($availablelangs as $alang) {
|
||||
$md5array[$alang[0]] = $alang[1];
|
||||
}
|
||||
|
||||
//filtering out non-16 packs
|
||||
foreach ($alllangs as $clang) {
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$clang;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$clang;
|
||||
|
||||
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
|
||||
$lang16[] = $clang;
|
||||
}
|
||||
}
|
||||
|
||||
//then filter out packs that have the same md5 key
|
||||
foreach ($lang16 as $clang) {
|
||||
if (!is_installed_lang($clang, $md5array[$clang])){
|
||||
$packs[] = $clang;
|
||||
}
|
||||
}
|
||||
|
||||
@mkdir ($CFG->dataroot.'/temp/');
|
||||
@mkdir ($CFG->dataroot.'/lang/');
|
||||
foreach ($packs as $pack){ //for each of the remaining in the list, we
|
||||
if ($pack == 'en_utf8') { // no update for en_utf8
|
||||
continue;
|
||||
}
|
||||
//1. delete old director(ies)
|
||||
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$pack;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$pack;
|
||||
$rm1 = false;
|
||||
$rm2 = false;
|
||||
if (file_exists($dest1)) {
|
||||
$rm1 = remove_dir($dest1);
|
||||
}
|
||||
if (file_exists($dest2)) {
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
if (!($rm1 || $rm2)) {
|
||||
error ('could not delete old directory, update failed');
|
||||
}
|
||||
|
||||
//2. copy & unzip into new
|
||||
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
switch ($status) {
|
||||
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
}
|
||||
break;
|
||||
case UPTODATE:
|
||||
//Print error string or whatever you want to do
|
||||
break;
|
||||
case INSTALLED:
|
||||
notify(get_string('langpackupdated','admin',$pack), 'notifysuccess');
|
||||
$updated = true;
|
||||
//Print/do whatever you want
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
notice(get_string('langupdatecomplete','admin'), 'langimport.php');
|
||||
} else {
|
||||
notice(get_string('nolangupdateneeded','admin'), 'langimport.php');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: //display choice mode
|
||||
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$remote = 0; //flag for reading from remote or local
|
||||
|
||||
if ($availablelangs = proxy_url($source)) {
|
||||
$remote = 1;
|
||||
} else {
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
/*
|
||||
if ($fp = fopen($source, 'r')){ /// attempt to get the list from Moodle.org.
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
$remote = 1; //can read from download.moodle.org
|
||||
} else { /// fopen failed, we find local copy of list.
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
*/
|
||||
if (!$remote) {
|
||||
print_simple_box_start('center','60%');
|
||||
echo '<div align="center">';
|
||||
print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/');
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
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 name="uninstallform" action="langimport.php?mode=4" method="POST">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
unset($CFG->langlist); // ignore admin's langlist
|
||||
$installedlangs = get_list_of_languages();
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
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 '</form>';
|
||||
echo '<form name="updateform" action="langimport.php?mode=5" method="POST">';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</form>';
|
||||
echo '<p />';
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
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">';
|
||||
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 name="installform" method="POST" action="langimport.php?mode=2">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
if ($remote) {
|
||||
echo '<select name="pack" size="15">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
if (trim($alang[0]) != "en_utf8") {
|
||||
if ($remote){
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
|
||||
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
|
||||
}
|
||||
} else { //print list in local format, and instruction to install
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br/ ><input type="submit" value="<-- '.get_string('install','admin').'">';
|
||||
}
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<tr><td align="center">';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
echo '</td><tr></table>'; //close available langs table
|
||||
echo '<form>';
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
|
||||
break;
|
||||
|
||||
} //close of main switch
|
||||
|
||||
print_footer();
|
||||
|
||||
/* 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
|
||||
* @return array
|
||||
*/
|
||||
function get_local_list_of_languages() {
|
||||
global $CFG;
|
||||
$source = $CFG->wwwroot.'/lib/languages.md5';
|
||||
$availablelangs = array();
|
||||
if ($fp = fopen($source, 'r')){
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
}
|
||||
return $availablelangs;
|
||||
}
|
||||
|
||||
/* 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
|
||||
* @return bool
|
||||
*/
|
||||
function is_installed_lang($lang, $md5check) {
|
||||
global $CFG;
|
||||
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
|
||||
if (file_exists($md5file)){
|
||||
return (file_get_contents($md5file) == $md5check);
|
||||
}
|
||||
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) {
|
||||
global $CFG;
|
||||
|
||||
if ($CFG->proxyhost && $CFG->proxyport) {
|
||||
|
||||
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
|
||||
if (!$proxy_fp) {
|
||||
return false; //failed
|
||||
}
|
||||
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
|
||||
$i = 0;
|
||||
while(!feof($proxy_fp)) {
|
||||
$string = fgets($proxy_fp, 1024);
|
||||
if ($i > 11) { //12 lines of info skipped
|
||||
$availablelangs[] = split(',', $string);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fclose($proxy_fp);
|
||||
|
||||
} else { //proxy not in use
|
||||
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
} else { /// fopen failed, return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $availablelangs;
|
||||
}
|
||||
?>
|
||||
@@ -4,6 +4,7 @@
|
||||
require('../config.php');
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$sesskey = optional_param('sesskey');
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
+8
-15
@@ -1,7 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
// module.php - allows admin to edit all local configuration variables for a module
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -16,20 +16,19 @@
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
$module = optional_param('module', '', PARAM_SAFEDIR);
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
if ($module = optional_param('module', '', PARAM_CLEANFILE)) {
|
||||
// if the config.html contains a hidden form field giving
|
||||
// the module name then the form does not have to prefix all
|
||||
// its variable names, we will do it here.
|
||||
$moduleprefix = $module.'_';
|
||||
// let the module process the form data if it has to,
|
||||
// $config is passed to this function by reference
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
$moduleconfig = $module.'_process_options';
|
||||
if (function_exists($moduleconfig)) {
|
||||
$moduleconfig($config);
|
||||
@@ -38,9 +37,6 @@
|
||||
$moduleprefix = '';
|
||||
}
|
||||
|
||||
unset($config->sesskey);
|
||||
unset($config->module);
|
||||
|
||||
foreach ($config as $name => $value) {
|
||||
set_config($moduleprefix.$name, $value);
|
||||
}
|
||||
@@ -49,18 +45,15 @@
|
||||
}
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
|
||||
$module = required_param('module', '', PARAM_CLEANFILE);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strmanagemodules = get_string("managemodules");
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
// $CFG->pagepath is used to generate the body and id attributes for the body tag
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'mod/' . $module . '/config';
|
||||
|
||||
|
||||
print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
@@ -68,7 +61,7 @@
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
|
||||
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "50%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
+15
-30
@@ -1,13 +1,13 @@
|
||||
<?PHP // $Id$
|
||||
// Allows the admin to manage activity modules
|
||||
// Allows the admin to create, delete and rename course categories
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('../course/lib.php');
|
||||
require_once("../config.php");
|
||||
require_once("../course/lib.php");
|
||||
|
||||
$show = optional_param('show', '', PARAM_SAFEDIR);
|
||||
$hide = optional_param('hide', '', PARAM_SAFEDIR);
|
||||
$delete = optional_param('delete', '', PARAM_SAFEDIR);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
optional_variable($disable);
|
||||
optional_variable($enable);
|
||||
optional_variable($delete);
|
||||
optional_variable($confirm);
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
|
||||
print_heading($strmanagemodules);
|
||||
|
||||
$coursesaffected = false;
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
@@ -48,29 +46,25 @@
|
||||
if (!$module = get_record("modules", "name", $hide)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
set_field('course_modules', 'visibleold', '1', 'visible' ,'1', 'module', $module->id); // Remember the previous visible state so we can toggle this back if the module is unhidden.
|
||||
set_field('course_modules', 'visibleold', '0', 'visible' ,'0', 'module', $module->id);
|
||||
set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $show)) {
|
||||
error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold', '1', 'module', $module->id); // Get the previous saved visible state for the course module.
|
||||
$coursesaffected = true;
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field("course_modules", "visible", "1", "module", $module->id); // Show all related activity modules
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
|
||||
$strmodulename = get_string("modulename", "$delete");
|
||||
|
||||
if (!$confirm) {
|
||||
if (empty($confirm)) {
|
||||
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
|
||||
"modules.php?delete=$delete&confirm=1&sesskey=$USER->sesskey",
|
||||
"modules.php?delete=$delete&confirm=$delete&sesskey=$USER->sesskey",
|
||||
"modules.php");
|
||||
print_footer();
|
||||
exit;
|
||||
@@ -127,19 +121,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
//rebuild_course_cache(); // Because things have changed
|
||||
$coursesaffected = true;
|
||||
rebuild_course_cache(); // Because things have changed
|
||||
|
||||
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
notice(get_string("moduledeletefiles", "", $a), "modules.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($coursesaffected) {
|
||||
rebuild_course_cache(); // Because things have changed
|
||||
}
|
||||
|
||||
|
||||
/// Get and sort the existing modules
|
||||
|
||||
@@ -149,10 +138,6 @@
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$strmodulename = get_string("modulename", "$module->name");
|
||||
// Deal with modules which are lacking the language string
|
||||
if ($strmodulename == '[[modulename]]') {
|
||||
$strmodulename = $module->name;
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
if (!isset($CFG)) {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/php -f
|
||||
<?php // $Id$
|
||||
<?
|
||||
define('FULLME','cron'); // prevent warnings
|
||||
//error_reporting(0);
|
||||
//ini_set('display_errors',0);
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// Allows the admin to manage questiontypes
|
||||
// This page is adapted from modules.php
|
||||
|
||||
// This page is not yet in service, the whole plug-in architecture
|
||||
// for question types is still under construction.
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$show = optional_param('show', '', PARAM_SAFEDIR);
|
||||
$hide = optional_param('hide', '', PARAM_SAFEDIR);
|
||||
$delete = optional_param('delete', '', PARAM_SAFEDIR);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only administrators can use this page!");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
|
||||
/// Print headings
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strdelete = get_string("delete");
|
||||
$strversion = get_string("version");
|
||||
$strhide = get_string("hide");
|
||||
$strshow = get_string("show");
|
||||
$strsettings = get_string("settings");
|
||||
$strquestions = get_string("questions");
|
||||
$strquestiontype = get_string("questiontype", 'quiz');
|
||||
|
||||
print_header("$site->shortname: $strquestions", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strquestions");
|
||||
|
||||
print_heading($strquestions);
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
if (!$qtype = get_record("question_types", "name", $hide)) {
|
||||
error("Question type doesn't exist!");
|
||||
}
|
||||
set_field("question_types", "visible", "0", "id", $qtype->id); // Hide question type
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$qtype = get_record("question_types", "name", $show)) {
|
||||
error("Question type doesn't exist!");
|
||||
}
|
||||
set_field("question_types", "visible", "1", "id", $qtype->id); // Show question type
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
|
||||
$strqtypename = get_string("qtypename", "qtype_$delete");
|
||||
|
||||
if (!$confirm) {
|
||||
notice_yesno(get_string("qtypedeleteconfirm", "admin", $strqtypename),
|
||||
"questiontypes.php?delete=$delete&confirm=1&sesskey=$USER->sesskey",
|
||||
"questiontypes.php");
|
||||
print_footer();
|
||||
exit;
|
||||
|
||||
} else { // Delete everything!!
|
||||
|
||||
if ($delete == "random") {
|
||||
error("You can not delete the random question type!!");
|
||||
}
|
||||
|
||||
if (!$qtype = get_record("question_types", "name", $delete)) {
|
||||
error("Question type doesn't exist!");
|
||||
}
|
||||
|
||||
// OK, first delete all the questions
|
||||
if ($questions = get_records("quiz_questions", "qtype", $qtype->id)) {
|
||||
foreach ($questions as $question) {
|
||||
if (! quiz_delete_question($coursemod->id, $coursemod->section)) {
|
||||
notify("Could not delete the $strqtypename with id = $question->id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// And the qtype entry itself
|
||||
if (!delete_records("question_types", "name", $qtype->name)) {
|
||||
notify("Error occurred while deleting the $strqtypename record from question_types table");
|
||||
}
|
||||
|
||||
// Then the tables themselves
|
||||
|
||||
if ($tables = $db->Metatables()) {
|
||||
$prefix = $CFG->prefix.$qtype->name;
|
||||
foreach ($tables as $table) {
|
||||
if (strpos($table, $prefix) === 0) {
|
||||
if (!execute_sql("DROP TABLE $table", false)) {
|
||||
notify("ERROR: while trying to drop table $table");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a->qtype = $strqtypename;
|
||||
$a->directory = "$CFG->dirroot/qtype/$delete";
|
||||
notice(get_string("qtypedeletefiles", "", $a), "questiontypes.php");
|
||||
}
|
||||
}
|
||||
|
||||
/// Get and sort the existing questiontypes
|
||||
|
||||
if (!$qtypes = get_records("question_types")) {
|
||||
error("No question types found!!"); // Should never happen
|
||||
}
|
||||
|
||||
foreach ($qtypes as $qtype) {
|
||||
$strqtypename = get_string("qtypename", "qtype_$qtype->name");
|
||||
$qtypebyname[$strqtypename] = $qtype;
|
||||
}
|
||||
ksort($qtypebyname);
|
||||
|
||||
/// Print the table of all questiontypes
|
||||
|
||||
$table->head = array ($strquestiontype, $strquestions, $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 ($qtypebyname as $qtypename => $qtype) {
|
||||
|
||||
$icon = "<img src=\"$CFG->dirroot/mod/quiz/questiontypes/$qtype->name/icon.gif\" hspace=\"10\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" />";
|
||||
|
||||
if (file_exists("$CFG->dirroot/mod/quiz/questiontypes/$qtype->name/config.html")) {
|
||||
$settings = "<a href=\"questiontype.php?qtype=$qtype->name\">$strsettings</a>";
|
||||
} else {
|
||||
$settings = "";
|
||||
}
|
||||
|
||||
$count = count_records('quiz_questions', 'qtype', $qtype->id);
|
||||
|
||||
$delete = $count ? '' : "<a href=\"questiontypes.php?delete=$qtype->name&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
|
||||
if ($qtype->visible) {
|
||||
$visible = "<a href=\"questiontypes.php?hide=$qtype->name&sesskey=$USER->sesskey\" title=\"$strhide\">".
|
||||
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
|
||||
$class = "";
|
||||
} else {
|
||||
$visible = "<a href=\"questiontypes.php?show=$qtype->name&sesskey=$USER->sesskey\" title=\"$strshow\">".
|
||||
"<img src=\"$CFG->pixpath/i/show.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
|
||||
$class = "class=\"dimmed_text\"";
|
||||
}
|
||||
if ($qtype->name == "random") {
|
||||
$delete = "";
|
||||
$visible = "";
|
||||
$class = "";
|
||||
}
|
||||
$table->data[] = array ("<span $class>$icon $qtypename</span>", $count, $qtype->version, $visible, $delete, $settings);
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php // $Id$
|
||||
// register.php - allows admin to register their site on moodle.org
|
||||
|
||||
require_once('../config.php');
|
||||
include("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
$count = count_records('question');
|
||||
$count = count_records('quiz_questions');
|
||||
echo get_string("questions", 'quiz').": ".$count;
|
||||
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\">\n";
|
||||
echo '<br />';
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
<?php /// $Id$
|
||||
/// Search and replace strings throughout all texts in the whole database
|
||||
|
||||
require_once('../config.php');
|
||||
require('../config.php');
|
||||
|
||||
$search = optional_param('search', '', PARAM_RAW);
|
||||
$replace = optional_param('replace', '', PARAM_RAW);
|
||||
$search = optional_param('search', '');
|
||||
$replace = optional_param('replace', '');
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -45,7 +45,7 @@ foreach ($tables as $table) {
|
||||
foreach ($columns as $column => $data) {
|
||||
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
|
||||
$db->debug = true;
|
||||
execute_sql("UPDATE $table SET $column = REPLACE($column, '$search', '$replace');");
|
||||
execute_sql("UPDATE {$CFG->prefix}$table SET $column = REPLACE($column, '$search', '$replace');");
|
||||
$db->debug = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php // $Id$
|
||||
// Display all the reports available in admin/report
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You are not allowed to look at this page");
|
||||
}
|
||||
|
||||
$stradmin = get_string('administration');
|
||||
$strreports = get_string('reports');
|
||||
|
||||
print_header($strreports, $strreports,
|
||||
'<a href="index.php">'.$stradmin.'</a> -> '.$strreports);
|
||||
|
||||
$directories = get_list_of_plugins('admin/report');
|
||||
|
||||
foreach ($directories as $directory) {
|
||||
echo '<div class="plugin '.$directory.'">';
|
||||
include_once($CFG->dirroot.'/admin/report/'.$directory.'/mod.php'); // Fragment for listing
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
|
||||
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
error("Stats is not enabled.");
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("This page is for admins only");
|
||||
}
|
||||
|
||||
$course = get_site();
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
$strreports = get_string('reports');
|
||||
$strcourseoverview = get_string('courseoverview');
|
||||
|
||||
$strnav = '<a href="'.$CFG->wwwroot.'/admin/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/admin/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
|
||||
|
||||
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
|
||||
|
||||
$tableprefix = $CFG->prefix.'stats_';
|
||||
|
||||
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
|
||||
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
|
||||
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
|
||||
|
||||
if (empty($earliestday)) $earliestday = time();
|
||||
if (empty($earliestweek)) $earliestweek = time();
|
||||
if (empty($earliestmonth)) $earliestmonth = time();
|
||||
|
||||
$now = stats_get_base_daily();
|
||||
$lastweekend = stats_get_base_weekly();
|
||||
$lastmonthend = stats_get_base_monthly();
|
||||
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
if (empty($timeoptions)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
print_header($strcourseoverview, $strcourseoverview, $strnav,'','',true,' ');
|
||||
|
||||
echo '<form action="index.php" method="post">'."\n";
|
||||
|
||||
$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),
|
||||
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
print_table($table);
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby
|
||||
." LIMIT ".$numcourses;
|
||||
|
||||
$courses = get_records_sql($sql);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/report/courseoverview/index.php');
|
||||
}
|
||||
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/admin/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
|
||||
|
||||
$table = new object();
|
||||
$table->align = array('left','center','center','center');
|
||||
$table->head = array(get_string('course'),$param->line1);
|
||||
if (!empty($param->line2)) {
|
||||
$table->head[] = $param->line2;
|
||||
}
|
||||
if (!empty($param->line3)) {
|
||||
$table->head[] = $param->line3;
|
||||
}
|
||||
|
||||
foreach ($courses as $c) {
|
||||
$a = array();
|
||||
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
|
||||
|
||||
$a[] = $c->line1;
|
||||
if (isset($c->line2)) {
|
||||
$a[] = $c->line2;
|
||||
}
|
||||
if (isset($c->line3)) {
|
||||
$a[] = $c->line3;
|
||||
}
|
||||
$table->data[] = $a;
|
||||
}
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
|
||||
$strreports = get_string('reports');
|
||||
$strcourseoverview = get_string('courseoverview');
|
||||
|
||||
print_heading("$strcourseoverview:");
|
||||
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
|
||||
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
$course = get_site();
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
|
||||
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
|
||||
|
||||
$tableprefix = $CFG->prefix.'stats_';
|
||||
|
||||
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
|
||||
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
|
||||
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
|
||||
|
||||
if (empty($earliestday)) $earliestday = time();
|
||||
if (empty($earliestweek)) $earliestweek = time();
|
||||
if (empty($earliestmonth)) $earliestmonth = time();
|
||||
|
||||
$now = stats_get_base_daily();
|
||||
$lastweekend = stats_get_base_weekly();
|
||||
$lastmonthend = stats_get_base_monthly();
|
||||
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
$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),
|
||||
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
echo '<form action="report/courseoverview/index.php" method="post">'."\n";
|
||||
print_table($table);
|
||||
echo '</form>';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
require_once($CFG->dirroot.'/lib/graphlib.php');
|
||||
|
||||
$report = required_param('report', PARAM_INT);
|
||||
$time = required_param('time', PARAM_INT);
|
||||
$numcourses = required_param('numcourses', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You must be an admin to use this page");
|
||||
}
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby
|
||||
." LIMIT ".$numcourses;
|
||||
|
||||
$courses = get_records_sql($sql);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/report/course/index.php');
|
||||
}
|
||||
|
||||
|
||||
$graph = new graph(750,400);
|
||||
|
||||
$graph->parameter['legend'] = 'outside-right';
|
||||
$graph->parameter['legend_size'] = 10;
|
||||
$graph->parameter['x_axis_angle'] = 90;
|
||||
$graph->parameter['title'] = false; // moodle will do a nicer job.
|
||||
if ($report != STATS_REPORT_ACTIVE_COURSES) {
|
||||
$graph->parameter['y_decimal_left'] = 2;
|
||||
}
|
||||
|
||||
foreach ($courses as $c) {
|
||||
$graph->x_data[] = get_field('course','shortname','id',$c->courseid);
|
||||
$graph->y_data['bar1'][] = $c->{$param->graphline};
|
||||
}
|
||||
$graph->y_order = array('bar1');
|
||||
$graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
|
||||
|
||||
$graph->draw_stack();
|
||||
|
||||
?>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->dirroot.'/course/report/log/lib.php');
|
||||
|
||||
$course = get_site();
|
||||
|
||||
print_heading(get_string('chooselogs') .':');
|
||||
|
||||
print_log_selector_form($course);
|
||||
|
||||
echo '<br />';
|
||||
print_heading(get_string('chooselivelogs') .':');
|
||||
|
||||
echo '<center><h3>';
|
||||
link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
|
||||
echo '</h3></center>';
|
||||
|
||||
?>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
require_once($CFG->dirroot.'/course/report/stats/lib.php');
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
error("Stats is not enabled.");
|
||||
}
|
||||
|
||||
$courseid = required_param('course', PARAM_INT);
|
||||
$report = optional_param('report', 0, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
|
||||
if ($report == STATS_REPORT_USER_LOGINS) {
|
||||
$courseid = SITEID; //override
|
||||
}
|
||||
|
||||
if ($mode == STATS_MODE_RANKED) {
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time);
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!empty($userid)) {
|
||||
if (!$user = get_record('user','id',$userid)) {
|
||||
error("That's an invalid user id");
|
||||
}
|
||||
}
|
||||
|
||||
require_login();
|
||||
if (!isteacher($course->id)) {
|
||||
error("You need to be a teacher to use this page");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
|
||||
$strreports = get_string("reports");
|
||||
$strstats = get_string('stats');
|
||||
|
||||
$menu = report_stats_mode_menu($course, $mode, $time);
|
||||
|
||||
|
||||
$crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
|
||||
<a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
|
||||
$strstats";
|
||||
|
||||
print_header("$course->shortname: $strstats", "$course->fullname",
|
||||
$crumb, '', '', true, ' ', $menu);
|
||||
|
||||
|
||||
require_once($CFG->dirroot.'/course/report/stats/report.php');
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php //$Id$
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
echo '<p style="text-align:center;">';
|
||||
echo '<a href="'.$CFG->wwwroot.'/admin/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
|
||||
echo '</p>';
|
||||
}
|
||||
?>
|
||||
+5
-21
@@ -29,35 +29,19 @@
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("frontpageformat") ?>:</td>
|
||||
<td>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<?php
|
||||
<td><?php
|
||||
$options = array(FRONTPAGENEWS => get_string("frontpagenews"),
|
||||
FRONTPAGECOURSELIST => get_string("frontpagecourselist"),
|
||||
FRONTPAGECATEGORYNAMES => get_string("frontpagecategorynames"),
|
||||
);
|
||||
$values = array(get_string('hide'), get_string('order1', 'admin'), get_string('order2', 'admin'));
|
||||
$seq = array_flip(explode(',',$form->frontpage));
|
||||
foreach ($seq as $k => $s) {
|
||||
$seq[$k]++;
|
||||
}
|
||||
FRONTPAGETOPICONLY => get_string("frontpagetopiconly"));
|
||||
if (count_records("course") > 200) {
|
||||
unset($options[FRONTPAGECOURSELIST]);
|
||||
if (isset($seq[FRONTPAGECOURSELIST])) {
|
||||
unset($options[1]);
|
||||
if ($form->frontpage == 1) {
|
||||
$form->frontpage = 2;
|
||||
}
|
||||
} else {
|
||||
$values[] = get_string('order3', 'admin');
|
||||
}
|
||||
foreach ($options as $key => $option) {
|
||||
echo "<td>$option<br />";
|
||||
choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, "");
|
||||
echo '</td>';
|
||||
}
|
||||
choose_from_menu ($options, "frontpage", "$form->frontpage", "");
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
|
||||
+7
-10
@@ -1,7 +1,7 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('../course/lib.php');
|
||||
require_once("../config.php");
|
||||
require_once("../course/lib.php");
|
||||
|
||||
if ($site = get_site()) {
|
||||
require_login();
|
||||
@@ -11,8 +11,6 @@
|
||||
$site->format = "social"; // override
|
||||
}
|
||||
|
||||
$focus = "form.fullname";
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
@@ -27,13 +25,8 @@
|
||||
|
||||
if (count($err) == 0) {
|
||||
|
||||
$form->frontpage = array_flip($form->frontpage);
|
||||
unset($form->frontpage[0]);
|
||||
$form->frontpage = array_flip($form->frontpage);
|
||||
asort($form->frontpage);
|
||||
$form->frontpage = implode(',',array_flip($form->frontpage));
|
||||
set_config("frontpage", $form->frontpage);
|
||||
if ($form->frontpage == '') {
|
||||
if ($form->frontpage == FRONTPAGETOPICONLY) {
|
||||
$form->numsections = 1; // Force the topic display for this format
|
||||
}
|
||||
|
||||
@@ -104,6 +97,10 @@
|
||||
set_config("frontpage", $form->frontpage);
|
||||
}
|
||||
|
||||
if (empty($focus)) {
|
||||
$focus = "form.fullname";
|
||||
}
|
||||
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strsitesettings = get_string("sitesettings");
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/my/pagelib.php');
|
||||
require_once($CFG->dirroot.'/lib/pagelib.php');
|
||||
require_once($CFG->dirroot.'/lib/blocklib.php');
|
||||
|
||||
$pt = optional_param('pt', null, PARAM_SAFEDIR); //alhanumeric and -
|
||||
|
||||
$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
|
||||
'lib' => '/my/pagelib.php',
|
||||
'name' => get_string('stickyblocksmymoodle','admin')),
|
||||
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
|
||||
'lib' => '/lib/pagelib.php',
|
||||
'name' => get_string('stickyblockscourseview','admin'))
|
||||
// ... more?
|
||||
);
|
||||
|
||||
// for choose_from_menu
|
||||
$options = array();
|
||||
foreach ($pagetypes as $p) {
|
||||
$options[$p['id']] = $p['name'];
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
// first thing to do is print the dropdown menu
|
||||
|
||||
$strtitle = get_string('stickyblocks','admin');
|
||||
$strheading = get_string('adminhelpstickyblocks');
|
||||
|
||||
print_header($strtitle,$strtitle,'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.
|
||||
get_string('admin').'</a> -> '.$strtitle);
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
|
||||
echo '<tr valign="top">';
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
require_once($CFG->dirroot.$pagetypes[$pt]['lib']);
|
||||
|
||||
define('ADMIN_STICKYBLOCKS',$pt);
|
||||
|
||||
$PAGE = page_create_object($pt);
|
||||
|
||||
$blocks = blocks_setup($PAGE,BLOCKS_PINNED_TRUE);
|
||||
|
||||
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
|
||||
echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
|
||||
} else {
|
||||
echo '<td style="vertical-align: top;" id="left-column">';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td valign="top" width="*" id="middle-column">';
|
||||
print_simple_box_start('center');
|
||||
print_heading($strheading);
|
||||
echo '<form method="post" action="'.$CFG->wwwroot.'/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();
|
||||
echo '</td>';
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
|
||||
}
|
||||
echo '<td style="vertical-align: top;" id="left-column">';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
print_footer();
|
||||
|
||||
|
||||
?>
|
||||
+22
-7
@@ -1,8 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$zone = optional_param('zone', '', PARAM_PATH); //not a path, but it looks like it anyway
|
||||
include("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -19,7 +17,7 @@
|
||||
|
||||
print_heading("");
|
||||
|
||||
if (!empty($zone) and confirm_sesskey()) {
|
||||
if (isset($zone) and confirm_sesskey()) {
|
||||
$db->debug = true;
|
||||
echo "<center>";
|
||||
execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'");
|
||||
@@ -29,12 +27,29 @@
|
||||
$USER->timezone = $zone;
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
$timezones = get_list_of_timezones();
|
||||
$user = $USER;
|
||||
|
||||
if (abs($user->timezone) > 13) {
|
||||
$user->timezone = 99;
|
||||
}
|
||||
$timenow = time();
|
||||
$timeformat = get_string('strftimedaytime');
|
||||
|
||||
for ($tz = -26; $tz <= 26; $tz++) {
|
||||
$zone = (float)$tz/2.0;
|
||||
$usertime = $timenow + ($tz * 1800);
|
||||
if ($tz == 0) {
|
||||
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT)";
|
||||
} else if ($tz < 0) {
|
||||
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT$zone)";
|
||||
} else {
|
||||
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT+$zone)";
|
||||
}
|
||||
}
|
||||
|
||||
echo '<center><form action="timezone.php" method="get">';
|
||||
echo "$strusers ($strall): ";
|
||||
choose_from_menu ($timezones, "zone", 99, get_string("serverlocaltime"), "", "99");
|
||||
choose_from_menu ($timezones, "zone", $user->timezone, get_string("serverlocaltime"), "", "99");
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
|
||||
echo "<input type=\"submit\" value=\"$strsavechanges\">";
|
||||
echo "</form></center>";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/olson.php');
|
||||
|
||||
$ok = optional_param('ok', 0, PARAM_BOOL);
|
||||
$ok = optional_param('ok');
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
include("../config.php");
|
||||
|
||||
$action = optional_param('action','LIST',PARAM_ALPHA);
|
||||
$url = optional_param('url');
|
||||
$info = optional_param('info');
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
print_header('Admin : Unchecked Vars' );
|
||||
|
||||
if ($action == 'DELETE') {
|
||||
delete_records('log', 'url', $url, 'info', $info);
|
||||
}
|
||||
|
||||
if ($errors = get_records_sql("SELECT DISTINCT url, info
|
||||
FROM {$CFG->prefix}log
|
||||
WHERE module = 'dev' AND
|
||||
action = 'unchecked vars'")) {
|
||||
echo '<table border="1" cellpadding="5">';
|
||||
foreach ($errors as $error) {
|
||||
echo '<tr>';
|
||||
echo '<td>'.$error->url.'</td>';
|
||||
echo '<td>'.$error->info.'</td>';
|
||||
echo '<td><a href="unchecked_vars.php?action=DELETE&url='.$error->url.'&info='.$error->info.'">Delete this</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo "No unchecked vars were detected";
|
||||
}
|
||||
?>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
require("../config.php");
|
||||
require("$CFG->dirroot/mod/forum/lib.php");
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
optional_variable($confirm);
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
print_header("$site->shortname: $stradministration: $strupgradingdata", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> $strupgradingdata");
|
||||
|
||||
if (empty($confirm)) {
|
||||
if (empty($_GET['confirm'])) {
|
||||
notice_yesno(get_string("upgradeforumreadinfo", "admin"),
|
||||
"upgradeforumread.php?confirm=true&sesskey=$USER->sesskey",
|
||||
"index.php");
|
||||
@@ -115,4 +115,46 @@
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function print_progress($done, $total, $updatetime=5, $sleeptime=1) {
|
||||
static $count;
|
||||
static $starttime;
|
||||
static $lasttime;
|
||||
|
||||
if (empty($starttime)) {
|
||||
$starttime = $lasttime = time();
|
||||
$lasttime = $starttime - $updatetime;
|
||||
echo '<table width="500" cellpadding="0" cellspacing="0" align="center"><tr><td width="500">';
|
||||
echo '<div id="bar" style="border-style:solid;border-width:1px;width:500px;height:50px;">';
|
||||
echo '<div id="slider" style="border-style:solid;border-width:1px;height:48px;width:10px;background-color:green;"></div>';
|
||||
echo '</div>';
|
||||
echo '<div id="text" align="center" style="width:500px;"></div>';
|
||||
echo '</td></tr></table>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (!isset($count)) {
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
$now = time();
|
||||
|
||||
if ($done && (($now - $lasttime) >= $updatetime)) {
|
||||
$elapsedtime = $now - $starttime;
|
||||
$projectedtime = (int)(((float)$total / (float)$done) * $elapsedtime) - $elapsedtime;
|
||||
$percentage = format_float((float)$done / (float)$total, 2);
|
||||
$width = (int)(500 * $percentage);
|
||||
|
||||
echo '<script>';
|
||||
echo 'document.getElementById("text").innerHTML = "'.$count.' done. Ending: '.format_time($projectedtime).'";'."\n";
|
||||
echo 'document.getElementById("slider").style.width = \''.$width.'px\';'."\n";
|
||||
echo '</script>';
|
||||
|
||||
$lasttime = $now;
|
||||
sleep($sleeptime);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?PHP //$Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require("../config.php");
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
optional_variable($confirm);
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
print_header("$site->shortname: $stradministration: $strupgradinglogs", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> $strupgradinglogs");
|
||||
|
||||
if (empty($confirm)) {
|
||||
if (empty($_GET['confirm'])) {
|
||||
notice_yesno(get_string("upgradelogsinfo", "admin"),
|
||||
"upgradelogs.php?confirm=true&sesskey=$USER->sesskey",
|
||||
"index.php");
|
||||
|
||||
+256
-373
@@ -3,402 +3,285 @@
|
||||
/// Bulk user registration script from a comma separated file
|
||||
/// Returns list of users with their user ids
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/uploadlib.php');
|
||||
require_once("../config.php");
|
||||
|
||||
$createpassword = optional_param('createpassword', 0, PARAM_BOOL);
|
||||
$updateaccounts = optional_param('updateaccounts', 0, PARAM_BOOL);
|
||||
$allowrenames = optional_param('allowrenames', 0, PARAM_BOOL);
|
||||
optional_variable($numusers, 0);
|
||||
|
||||
require_login();
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You must be an administrator to edit users this way.");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
}
|
||||
|
||||
$streditmyprofile = get_string("editmyprofile");
|
||||
$stradministration = get_string("administration");
|
||||
$strfile = get_string("file");
|
||||
$struser = get_string("user");
|
||||
$strusers = get_string("users");
|
||||
$strusersnew = get_string("usersnew");
|
||||
$strusersupdated = get_string("usersupdated");
|
||||
$struploadusers = get_string("uploadusers");
|
||||
$straddnewuser = get_string("importuser");
|
||||
|
||||
$csv_encode = '/\&\#44/';
|
||||
if (isset($CFG->CSV_DELIMITER)) {
|
||||
$csv_delimiter = '\\' . $CFG->CSV_DELIMITER;
|
||||
$csv_delimiter2 = $CFG->CSV_DELIMITER;
|
||||
|
||||
if (isset($CFG->CSV_ENCODE)) {
|
||||
$csv_encode = '/\&\#' . $CFG->CSV_ENCODE . '/';
|
||||
if (!isadmin()) {
|
||||
error("You must be an administrator to edit users this way.");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
}
|
||||
|
||||
$streditmyprofile = get_string("editmyprofile");
|
||||
$stradministration = get_string("administration");
|
||||
$strchoose = get_string("choose");
|
||||
$struser = get_string("user");
|
||||
$strusers = get_string("users");
|
||||
$strusersnew = get_string("usersnew");
|
||||
$struploadusers = get_string("uploadusers");
|
||||
$straddnewuser = get_string("importuser");
|
||||
|
||||
$csv_encode = '/\&\#44/';
|
||||
if (isset($CFG->CSV_DELIMITER)) {
|
||||
$csv_delimiter = '\\' . $CFG->CSV_DELIMITER;
|
||||
$csv_delimiter2 = $CFG->CSV_DELIMITER;
|
||||
|
||||
if (isset($CFG->CSV_ENCODE)) {
|
||||
$csv_encode = '/\&\#' . $CFG->CSV_ENCODE . '/';
|
||||
}
|
||||
} else {
|
||||
$csv_delimiter = "\,";
|
||||
$csv_delimiter2 = ",";
|
||||
}
|
||||
} else {
|
||||
$csv_delimiter = "\,";
|
||||
$csv_delimiter2 = ",";
|
||||
}
|
||||
|
||||
/// Print the header
|
||||
|
||||
print_header("$site->shortname: $struploadusers", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> ->
|
||||
<a href=\"users.php\">$strusers</a> -> $struploadusers");
|
||||
print_header("$site->shortname: $struploadusers", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> ->
|
||||
<a href=\"users.php\">$strusers</a> -> $struploadusers");
|
||||
|
||||
|
||||
/// If a file has been uploaded, then process it
|
||||
|
||||
|
||||
$um = new upload_manager('userfile',false,false,null,false,0);
|
||||
require_once($CFG->dirroot.'/lib/uploadlib.php');
|
||||
$um = new upload_manager('userfile',false,false,null,false,0);
|
||||
if ($um->preprocess_files()) {
|
||||
$filename = $um->files['userfile']['tmp_name'];
|
||||
|
||||
if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
$filename = $um->files['userfile']['tmp_name'];
|
||||
//Fix mac/dos newlines
|
||||
$text = my_file_get_contents($filename);
|
||||
$text = preg_replace('!\r\n?!',"\n",$text);
|
||||
$fp = fopen($filename, "w");
|
||||
fwrite($fp,$text);
|
||||
fclose($fp);
|
||||
|
||||
// Large files are likely to take their time and memory. Let PHP know
|
||||
// that we'll take longer, and that the process should be recycled soon
|
||||
// to free up memory.
|
||||
@set_time_limit(0);
|
||||
@raise_memory_limit("128M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
@apache_child_terminate();
|
||||
$fp = fopen($filename, "r");
|
||||
|
||||
// make arrays of valid fields for error checking
|
||||
$required = array("username" => 1,
|
||||
"password" => 1,
|
||||
"firstname" => 1,
|
||||
"lastname" => 1,
|
||||
"email" => 1);
|
||||
$optionalDefaults = array("institution" => 1,
|
||||
"department" => 1,
|
||||
"city" => 1,
|
||||
"country" => 1,
|
||||
"lang" => 1,
|
||||
"auth" => 1,
|
||||
"timezone" => 1);
|
||||
$optional = array("idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"phone1" => 1,
|
||||
"phone2" => 1,
|
||||
"address" => 1,
|
||||
"url" => 1,
|
||||
"description" => 1,
|
||||
"mailformat" => 1,
|
||||
"maildisplay" => 1,
|
||||
"htmleditor" => 1,
|
||||
"autosubscribe" => 1,
|
||||
"idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"course1" => 1,
|
||||
"course2" => 1,
|
||||
"course3" => 1,
|
||||
"course4" => 1,
|
||||
"course5" => 1,
|
||||
"group1" => 1,
|
||||
"group2" => 1,
|
||||
"group3" => 1,
|
||||
"group4" => 1,
|
||||
"group5" =>1);
|
||||
|
||||
// --- get header (field names) ---
|
||||
$header = split($csv_delimiter, fgets($fp,1024));
|
||||
// check for valid field names
|
||||
foreach ($header as $i => $h) {
|
||||
$h = trim($h); $header[$i] = $h; // remove whitespace
|
||||
if (!($required[$h] or $optionalDefaults[$h] or $optional[$h])) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
if ($required[$h]) {
|
||||
$required[$h] = 2;
|
||||
}
|
||||
}
|
||||
// check for required fields
|
||||
foreach ($required as $key => $value) {
|
||||
if ($value < 2) {
|
||||
error(get_string('fieldrequired', 'error', $key), 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
}
|
||||
$linenum = 2; // since header is line 1
|
||||
|
||||
while (!feof ($fp)) {
|
||||
foreach ($optionalDefaults as $key => $value) {
|
||||
$user->$key = addslashes($adminuser->$key);
|
||||
}
|
||||
//Note: commas within a field should be encoded as , (for comma separated csv files)
|
||||
//Note: semicolon within a field should be encoded as ; (for semicolon separated csv files)
|
||||
$line = split($csv_delimiter, fgets($fp,1024));
|
||||
foreach ($line as $key => $value) {
|
||||
//decode encoded commas
|
||||
$record[$header[$key]] = preg_replace($csv_encode,$csv_delimiter2,trim($value));
|
||||
}
|
||||
if ($record[$header[0]]) {
|
||||
// add a new user to the database
|
||||
optional_variable($newuser, "");
|
||||
|
||||
// add fields to object $user
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if ($required[$name] and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum) .". ".
|
||||
get_string('processingstops', 'error'),
|
||||
'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
// password needs to be encrypted
|
||||
else if ($name == "password") {
|
||||
$user->password = md5($value);
|
||||
}
|
||||
else if ($name == "username") {
|
||||
$user->username = addslashes(moodle_strtolower($value));
|
||||
}
|
||||
// normal entry
|
||||
else {
|
||||
$user->{$name} = addslashes($value);
|
||||
}
|
||||
}
|
||||
$user->confirmed = 1;
|
||||
$user->timemodified = time();
|
||||
$linenum++;
|
||||
$username = $user->username;
|
||||
$addcourse[0] = $user->course1;
|
||||
$addcourse[1] = $user->course2;
|
||||
$addcourse[2] = $user->course3;
|
||||
$addcourse[3] = $user->course4;
|
||||
$addcourse[4] = $user->course5;
|
||||
$addgroup[0] = $user->group1;
|
||||
$addgroup[1] = $user->group2;
|
||||
$addgroup[2] = $user->group3;
|
||||
$addgroup[3] = $user->group4;
|
||||
$addgroup[4] = $user->group5;
|
||||
$courses = get_courses("all",'c.sortorder','c.id,c.shortname,c.fullname,c.sortorder');
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$courseid[$i]=0;
|
||||
}
|
||||
foreach ($courses as $course) {
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($course->shortname == $addcourse[$i]) {
|
||||
$courseid[$i] = $course->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (get_record("user","username",$username) || !($user->id = insert_record("user", $user))) {
|
||||
if (!$user = get_record("user", "username", "changeme")) { // half finished user from another time
|
||||
//Record not added - probably because user is already registered
|
||||
//In this case, output userid from previous registration
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
if ($user = get_record("user","username",$username)) {
|
||||
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
} else {
|
||||
notify(get_string('usernotaddederror', 'error', $username));
|
||||
}
|
||||
}
|
||||
} else if ($user->username != "changeme") {
|
||||
notify("$struser: $user->id = $user->username");
|
||||
$numusers++;
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($addcourse[$i] && !$courseid[$i]) {
|
||||
notify(get_string('unknowncourse', 'error', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$groupid[$i] = 0;
|
||||
if ($addgroup[$i]) {
|
||||
if (!$courseid[$i]) {
|
||||
notify(get_string('coursegroupunknown','error',$addgroup[$i]));
|
||||
} else {
|
||||
if ($group = get_record("groups","courseid",$courseid[$i],"name",$addgroup[$i])) {
|
||||
$groupid[$i] = $group->id;
|
||||
} else {
|
||||
notify(get_string('groupunknown','error',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($courseid[$i]) {
|
||||
if (enrol_student($user->id, $courseid[$i])) {
|
||||
notify('-->'. get_string('enrolledincourse', '', $addcourse[$i]));
|
||||
} else {
|
||||
notify('-->'.get_string('enrolledincoursenot', '', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($courseid[$i] && $groupid[$i]) {
|
||||
if (record_exists("user_students","userid",$user->id,"course",$courseid[$i])) {
|
||||
$usergroup = user_group($courseid[$i],$user->id);
|
||||
if ($usergroup) {
|
||||
notify('-->' . get_string('groupalready','error',$usergroup->name));
|
||||
} else {
|
||||
$group_member->groupid = $groupid[$i];
|
||||
$group_member->userid = $user->id;
|
||||
$group_member->timeadded = time();
|
||||
if (insert_record("groups_members",$group_member)) {
|
||||
notify('-->' . get_string('addedtogroup','',$addgroup[$i]));
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnot','',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnotenrolled','',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset ($user);
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
notify("$strusersnew: $numusers");
|
||||
|
||||
echo '<hr />';
|
||||
}
|
||||
|
||||
//Fix mac/dos newlines
|
||||
$text = my_file_get_contents($filename);
|
||||
$text = preg_replace('!\r\n?!',"\n",$text);
|
||||
$fp = fopen($filename, "w");
|
||||
fwrite($fp,$text);
|
||||
fclose($fp);
|
||||
|
||||
$fp = fopen($filename, "r");
|
||||
|
||||
// make arrays of valid fields for error checking
|
||||
$required = array("username" => 1,
|
||||
"password" => !$createpassword,
|
||||
"firstname" => 1,
|
||||
"lastname" => 1,
|
||||
"email" => 1);
|
||||
$optionalDefaults = array("institution" => 1,
|
||||
"department" => 1,
|
||||
"city" => 1,
|
||||
"country" => 1,
|
||||
"lang" => 1,
|
||||
"auth" => 1,
|
||||
"timezone" => 1);
|
||||
$optional = array("idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"phone1" => 1,
|
||||
"phone2" => 1,
|
||||
"address" => 1,
|
||||
"url" => 1,
|
||||
"description" => 1,
|
||||
"mailformat" => 1,
|
||||
"maildisplay" => 1,
|
||||
"htmleditor" => 1,
|
||||
"autosubscribe" => 1,
|
||||
"idnumber" => 1,
|
||||
"icq" => 1,
|
||||
"course1" => 1,
|
||||
"course2" => 1,
|
||||
"course3" => 1,
|
||||
"course4" => 1,
|
||||
"course5" => 1,
|
||||
"group1" => 1,
|
||||
"group2" => 1,
|
||||
"group3" => 1,
|
||||
"group4" => 1,
|
||||
"group5" => 1,
|
||||
"type1" => 1,
|
||||
"type2" => 1,
|
||||
"type3" => 1,
|
||||
"type4" => 1,
|
||||
"type5" => 1,
|
||||
"password" => $createpassword,
|
||||
"oldusername" => $allowrenames);
|
||||
|
||||
// --- get header (field names) ---
|
||||
$header = split($csv_delimiter, fgets($fp,1024));
|
||||
// check for valid field names
|
||||
foreach ($header as $i => $h) {
|
||||
$h = trim($h); $header[$i] = $h; // remove whitespace
|
||||
if (!($required[$h] or $optionalDefaults[$h] or $optional[$h])) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
if ($required[$h]) {
|
||||
$required[$h] = 0;
|
||||
}
|
||||
}
|
||||
// check for required fields
|
||||
foreach ($required as $key => $value) {
|
||||
if ($value) { //required field missing
|
||||
error(get_string('fieldrequired', 'error', $key), 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
}
|
||||
$linenum = 2; // since header is line 1
|
||||
|
||||
$usersnew = 0;
|
||||
$usersupdated = 0;
|
||||
$userserrors = 0;
|
||||
$renames = 0;
|
||||
$renameerrors = 0;
|
||||
|
||||
// Will use this course array a lot
|
||||
// so fetch it early and keep it in memory
|
||||
$courses = get_courses('all','c.sortorder','c.id,c.shortname,c.fullname,c.sortorder,c.teacher');
|
||||
|
||||
while (!feof ($fp)) {
|
||||
foreach ($optionalDefaults as $key => $value) {
|
||||
$user->$key = addslashes($adminuser->$key);
|
||||
}
|
||||
//Note: commas within a field should be encoded as , (for comma separated csv files)
|
||||
//Note: semicolon within a field should be encoded as ; (for semicolon separated csv files)
|
||||
$line = split($csv_delimiter, fgets($fp,1024));
|
||||
foreach ($line as $key => $value) {
|
||||
//decode encoded commas
|
||||
$record[$header[$key]] = preg_replace($csv_encode,$csv_delimiter2,trim($value));
|
||||
}
|
||||
if ($record[$header[0]]) {
|
||||
// add a new user to the database
|
||||
|
||||
// add fields to object $user
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if ($required[$name] and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum) .". ".
|
||||
get_string('processingstops', 'error'),
|
||||
'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
}
|
||||
// password needs to be encrypted
|
||||
else if ($name == "password" && !empty($value)) {
|
||||
$user->password = hash_internal_user_password($value);
|
||||
}
|
||||
else if ($name == "username") {
|
||||
$user->username = addslashes(moodle_strtolower($value));
|
||||
}
|
||||
// normal entry
|
||||
else {
|
||||
$user->{$name} = addslashes($value);
|
||||
}
|
||||
}
|
||||
$user->confirmed = 1;
|
||||
$user->timemodified = time();
|
||||
$linenum++;
|
||||
$username = $user->username;
|
||||
$addcourse[0] = $user->course1;
|
||||
$addcourse[1] = $user->course2;
|
||||
$addcourse[2] = $user->course3;
|
||||
$addcourse[3] = $user->course4;
|
||||
$addcourse[4] = $user->course5;
|
||||
$addgroup[0] = $user->group1;
|
||||
$addgroup[1] = $user->group2;
|
||||
$addgroup[2] = $user->group3;
|
||||
$addgroup[3] = $user->group4;
|
||||
$addgroup[4] = $user->group5;
|
||||
$addtype[0] = $user->type1;
|
||||
$addtype[1] = $user->type2;
|
||||
$addtype[2] = $user->type3;
|
||||
$addtype[3] = $user->type4;
|
||||
$addtype[4] = $user->type5;
|
||||
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$course[$i]=NULL;
|
||||
}
|
||||
foreach ($courses as $eachcourse) {
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($eachcourse->shortname == $addcourse[$i]) {
|
||||
$course[$i] = $eachcourse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)) {
|
||||
if (set_field('user', 'username', $user->username, 'username', $user->oldusername)) {
|
||||
notify(get_string('userrenamed', 'admin') . " : $user->oldusername $user->username");
|
||||
$renames++;
|
||||
} else {
|
||||
notify(get_string('usernotrenamedexists', 'error') . " : $user->oldusername $user->username");
|
||||
$renameerrors++;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
notify(get_string('usernotrenamedmissing', 'error') . " : $user->oldusername $user->username");
|
||||
$renameerrors++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($olduser = get_record("user","username",$username)) {
|
||||
if ($updateaccounts) {
|
||||
// Record is being updated
|
||||
$user->id = $olduser->id;
|
||||
if (update_record('user', $user)) {
|
||||
notify("$user->id , $user->username ".get_string('useraccountupdated', 'admin'));
|
||||
$usersupdated++;
|
||||
} else {
|
||||
notify(get_string('usernotupdatederror', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
//Record not added - user is already registered
|
||||
//In this case, output userid from previous registration
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
} else { // new user
|
||||
if ($user->id = insert_record("user", $user)) {
|
||||
notify("$struser: $user->id = $user->username");
|
||||
$usersnew++;
|
||||
if (empty($user->password) && $createpassword) {
|
||||
// passwords will be created and sent out on cron
|
||||
insert_record('user_preferences', array( userid => $user->id,
|
||||
name => 'create_password',
|
||||
value => 1));
|
||||
insert_record('user_preferences', array( userid => $user->id,
|
||||
name => 'auth_forcepasswordchange',
|
||||
value => 1));
|
||||
}
|
||||
} else {
|
||||
// Record not added -- possibly some other error
|
||||
notify(get_string('usernotaddederror', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($addcourse[$i] && !$course[$i]) {
|
||||
notify(get_string('unknowncourse', 'error', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$groupid[$i] = 0;
|
||||
if ($addgroup[$i]) {
|
||||
if (!$course[$i]) {
|
||||
notify(get_string('coursegroupunknown','error',$addgroup[$i]));
|
||||
} else {
|
||||
if ($group = get_record("groups","courseid",$course[$i]->id,"name",$addgroup[$i])) {
|
||||
$groupid[$i] = $group->id;
|
||||
} else {
|
||||
notify(get_string('groupunknown','error',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) { /// Enrol into courses if necessary
|
||||
if ($course[$i]) {
|
||||
if (isset($addtype[$i])) {
|
||||
switch ($addtype[$i]) {
|
||||
case 2: // teacher
|
||||
$ret = add_teacher($user->id, $course[$i]->id, 1);
|
||||
break;
|
||||
|
||||
case 3: // non-editing teacher
|
||||
$ret = add_teacher($user->id, $course[$i]->id, 0);
|
||||
break;
|
||||
|
||||
default: // student
|
||||
$ret = enrol_student($user->id, $course[$i]->id);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$ret = enrol_student($user->id, $course[$i]->id);
|
||||
}
|
||||
if ($ret) { // OK
|
||||
notify('-->'. get_string('enrolledincourse', '', $addcourse[$i]));
|
||||
} else {
|
||||
notify('-->'.get_string('enrolledincoursenot', '', $addcourse[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=0; $i<5; $i++) { // Add user to groups if necessary
|
||||
if ($course[$i] && $groupid[$i]) {
|
||||
if (record_exists('user_students','userid',$user->id,'course',$course[$i]->id) ||
|
||||
record_exists('user_teachers','userid',$user->id,'course',$course[$i]->id)) {
|
||||
if (add_user_to_group($groupid[$i], $user->id)) {
|
||||
notify('-->' . get_string('addedtogroup','',$addgroup[$i]));
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnot','',$addgroup[$i]));
|
||||
}
|
||||
} else {
|
||||
notify('-->' . get_string('addedtogroupnotenrolled','',$addgroup[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset ($user);
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
notify("$strusersnew: $usersnew");
|
||||
notify(get_string('usersupdated', 'admin') . ": $usersupdated");
|
||||
notify(get_string('errors', 'admin') . ": $userserrors");
|
||||
if ($allowrenames) {
|
||||
notify(get_string('usersrenamed', 'admin') . ": $renames");
|
||||
notify(get_string('renameerrors', 'admin') . ": $renameerrors");
|
||||
}
|
||||
echo '<hr />';
|
||||
}
|
||||
|
||||
/// Print the form
|
||||
print_heading_with_help($struploadusers, 'uploadusers');
|
||||
print_heading_with_help($struploadusers, 'uploadusers');
|
||||
|
||||
$noyesoptions = array( get_string('no'), get_string('yes') );
|
||||
$maxuploadsize = get_max_upload_file_size();
|
||||
echo '<center>';
|
||||
echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php">'.
|
||||
$strchoose.':<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'">'.
|
||||
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">'.
|
||||
'<input type="file" name="userfile" size="30">'.
|
||||
'<input type="submit" value="'.$struploadusers.'">'.
|
||||
'</form></br>';
|
||||
echo '</center>';
|
||||
|
||||
$maxuploadsize = get_max_upload_file_size();
|
||||
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>';
|
||||
echo '<tr><td>' . get_string('passwordhandling', 'auth') . '</td><td>';
|
||||
$passwordopts = array( 0 => get_string('infilefield', 'auth'),
|
||||
1 => get_string('createpasswordifneeded', 'auth'),
|
||||
);
|
||||
choose_from_menu($passwordopts, 'createpassword', $createpassword);
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<tr><td>' . get_string('updateaccounts', 'admin') . '</td><td>';
|
||||
choose_from_menu($noyesoptions, 'updateaccounts', $updateaccounts);
|
||||
echo '</td></tr>';
|
||||
|
||||
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 '</form><br />';
|
||||
echo '</center>';
|
||||
|
||||
print_footer($course);
|
||||
print_footer($course);
|
||||
|
||||
|
||||
|
||||
function my_file_get_contents($filename, $use_include_path = 0) {
|
||||
/// Returns the file as one big long string
|
||||
/// Returns the file as one big long string
|
||||
|
||||
$data = "";
|
||||
$file = @fopen($filename, "rb", $use_include_path);
|
||||
|
||||
+43
-40
@@ -1,35 +1,38 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.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);
|
||||
$sort = optional_param('sort', 'name', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
|
||||
$search = 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
|
||||
optional_variable($newuser, "");
|
||||
optional_variable($delete, "");
|
||||
optional_variable($confirm, "");
|
||||
optional_variable($confirmuser, "");
|
||||
optional_variable($sort, "name");
|
||||
optional_variable($dir, "ASC");
|
||||
optional_variable($page, 0);
|
||||
optional_variable($search, "");
|
||||
if (!empty($search)) {
|
||||
$search=trim($search);
|
||||
}
|
||||
optional_variable($lastinitial, ""); // only show students with this last initial
|
||||
optional_variable($firstinitial, ""); // only show students with this first initial
|
||||
optional_variable($perpage, "30"); // how many per page
|
||||
|
||||
unset($user);
|
||||
unset($admin);
|
||||
unset($teacher);
|
||||
|
||||
$search = trim($search);
|
||||
|
||||
$user = new object();
|
||||
$admin = new object();
|
||||
$teacher = new object();
|
||||
|
||||
if (! record_exists("user_admins")) { // No admin user yet
|
||||
|
||||
$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->firstname = get_string("admin");
|
||||
$user->lastname = get_string("user");
|
||||
$user->username = "admin";
|
||||
$user->password = md5("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)) {
|
||||
@@ -82,14 +85,14 @@
|
||||
}
|
||||
|
||||
if ($newuser and confirm_sesskey()) { // Create a new user
|
||||
$user->auth = "manual";
|
||||
$user->firstname = "";
|
||||
$user->lastname = "";
|
||||
$user->username = "changeme";
|
||||
$user->password = "";
|
||||
$user->email = "";
|
||||
$user->lang = $CFG->lang;
|
||||
$user->confirmed = 1;
|
||||
$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 (! $user->id = insert_record("user", $user)) {
|
||||
@@ -127,7 +130,7 @@
|
||||
error("No such user!");
|
||||
}
|
||||
|
||||
$confirmeduser = new object();
|
||||
unset($confirmeduser);
|
||||
$confirmeduser->id = $confirmuser;
|
||||
$confirmeduser->confirmed = 1;
|
||||
$confirmeduser->timemodified = time();
|
||||
@@ -155,7 +158,7 @@
|
||||
|
||||
exit;
|
||||
} else if (!$user->deleted) {
|
||||
$updateuser = new object();
|
||||
unset($updateuser);
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = "1";
|
||||
$updateuser->username = "$user->email.".time(); // Remember it just in case
|
||||
@@ -196,7 +199,7 @@
|
||||
$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";
|
||||
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=$search&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
@@ -259,15 +262,15 @@
|
||||
echo "</center>";
|
||||
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
|
||||
|
||||
flush();
|
||||
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
if ($search !== '') {
|
||||
$match[] = s($search);
|
||||
if ($search) {
|
||||
$match[] = $search;
|
||||
}
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string("firstname").": $firstinitial"."___";
|
||||
@@ -333,7 +336,7 @@
|
||||
|
||||
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=\"text\" name=\"search\" value=\"$search\" size=\"20\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsearch\" />";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
|
||||
@@ -346,7 +349,7 @@
|
||||
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))."&");
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
|
||||
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once("../config.php");
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")."</a></b>",
|
||||
get_string("adminhelpuploadusers"));
|
||||
$table->data[] = array('', '<hr />');
|
||||
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolmentplugins")."</a></b>",
|
||||
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolments")."</a></b>",
|
||||
get_string("adminhelpenrolments"));
|
||||
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
|
||||
get_string("adminhelpassignstudents"));
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?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>
|
||||
File diff suppressed because it is too large
Load Diff
+7
-21
@@ -1,27 +1,13 @@
|
||||
<?php
|
||||
require_once('languages.php');
|
||||
// Initialize vars
|
||||
if (!isset ($config->cas_hostname)) {
|
||||
$config->cas_hostname = "";
|
||||
}
|
||||
if (!isset ($config->cas_port)) {
|
||||
$config->cas_port = "";
|
||||
}
|
||||
if (!isset ($config->cas_version)) {
|
||||
$config->cas_version = "";
|
||||
}
|
||||
if (!isset ($config->cas_baseuri)) {
|
||||
$config->cas_baseuri = "";
|
||||
}
|
||||
if (!isset ($config->cas_language)) {
|
||||
$config->cas_language = "";
|
||||
}
|
||||
if (!isset ($config->cas_use_cas)) {
|
||||
$config->cas_use_cas = "";
|
||||
}
|
||||
if (!isset ($config->cas_create_user)) {
|
||||
$config->cas_create_user = "0";
|
||||
}
|
||||
optional_variable($config->cas_hostname,"");
|
||||
optional_variable($config->cas_port,"");
|
||||
optional_variable($config->cas_version,"");
|
||||
optional_variable($config->cas_baseuri,"");
|
||||
optional_variable($config->cas_language,"");
|
||||
optional_variable($config->cas_use_cas,"");
|
||||
optional_variable($config->cas_create_user,"0");
|
||||
?>
|
||||
|
||||
|
||||
|
||||
@@ -1,87 +1 @@
|
||||
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center">
|
||||
<tr>
|
||||
<?php if ($show_instructions) { ?>
|
||||
<td width="50%" class="headingblock">
|
||||
<p align="center"><b><font size="3"><?php print_string("returningtosite") ?></font></b></p>
|
||||
</td>
|
||||
<td width="50%" class="headingblock">
|
||||
<p align="center"><b><font size="3"><?php print_string("firsttime") ?></font></b></p>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" align="center" valign="top" class="generalbox">
|
||||
<p><?php print_string("loginusing") ?>:<br />
|
||||
(<?php print_string("cookiesenabled");?>)
|
||||
<?php helpbutton("cookies", get_string("cookiesenabled"))?><br /><?php formerr($errormsg) ?>
|
||||
</p>
|
||||
<form action="index.php" method="post" name="login" id="login">
|
||||
<table border="0" align="center" style="font-size: small">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<input type="hidden" name="username" value="cas" />
|
||||
<input type="hidden" name="password" value="cas" />
|
||||
<input type="submit" value="<?php print_string("auth_cas_logincas", "auth") ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php if ($CFG->guestloginbutton) { ?>
|
||||
<hr width="80%" />
|
||||
<p><?php print_string("someallowguest") ?>:</p>
|
||||
<form action="index.php" method="post" name="guestlogin">
|
||||
<input type="hidden" name="username" value="guest" />
|
||||
<input type="hidden" name="password" value="guest" />
|
||||
<input type="submit" value="<?php print_string("loginguest") ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (is_internal_auth() ) {
|
||||
$changepassword = "forgot_password.php";
|
||||
$changebuttonname = get_string("senddetails");
|
||||
?>
|
||||
<hr width="80%" />
|
||||
<p><?php print_string("forgotten") ?></p>
|
||||
<form action="<?php p($changepassword) ?>" method="get" name="changepassword">
|
||||
<input type="submit" value="<?php p($changebuttonname) ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<?php if ($show_instructions) { ?>
|
||||
<td width="50%" valign="top" class="generalbox">
|
||||
<?php switch ($CFG->auth) {
|
||||
case "email":
|
||||
print_string("loginsteps", "", "signup.php");
|
||||
?>
|
||||
<div align="center">
|
||||
<form action="signup.php" method="get" name="signup">
|
||||
<input type="submit" value="<?php print_string("startsignup") ?>" />
|
||||
</form>
|
||||
</div>
|
||||
<?php break;
|
||||
case "none":
|
||||
print_string("loginstepsnone");
|
||||
break;
|
||||
default:
|
||||
echo format_text($CFG->auth_instructions);
|
||||
if (!function_exists('auth_user_login')) {
|
||||
require_once("../auth/$CFG->auth/lib.php");
|
||||
}
|
||||
if (!empty($CFG->auth_user_create) and function_exists('auth_user_create') ){
|
||||
?>
|
||||
|
||||
<div align="center">
|
||||
<form action="signup.php" method="get" name="signup">
|
||||
<input type="submit" value="<?php print_string("startsignup") ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center">
|
||||
+10
-11
@@ -98,11 +98,13 @@ function cas_ldap_auth_user_login ($username, $password) {
|
||||
function cas_authenticate_user_login ($username, $password) {
|
||||
|
||||
global $CFG;
|
||||
// FIX ME: $cas_validate is not global
|
||||
$cas_validate=true;
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
phpCAS::setLang($CFG->cas_language);
|
||||
phpCAS::forceAuthentication();
|
||||
if (!phpCAS::isAuthenticated()){
|
||||
phpCAS::authenticateIfNeeded();
|
||||
}
|
||||
if ($CFG->cas_create_user=="0"){
|
||||
if (record_exists('user', 'username', phpCAS::getUser())) {
|
||||
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
|
||||
@@ -132,16 +134,14 @@ function cas_authenticate_user_login ($username, $password) {
|
||||
*/
|
||||
function cas_automatic_authenticate ($user="") {
|
||||
global $CFG;
|
||||
// FIX ME: $cas_validate is not global, but it works anyway ;-)
|
||||
if (!$cas_validate){
|
||||
$cas_validate=true;
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
phpCAS::setLang($CFG->cas_language);
|
||||
$cas_user_exist=phpCAS::checkAuthentication();
|
||||
if (!$cas_user_exist && !$CFG->guestloginbutton){
|
||||
$cas_user_exist=phpCAS::forceAuthentication();
|
||||
if (!phpCAS::isAuthenticated() && !$CFG->guestloginbutton){
|
||||
phpCAS::authenticateIfNeeded();
|
||||
}
|
||||
if ($cas_user_exist){
|
||||
if (phpCAS::isAuthenticated()){
|
||||
if ($CFG->cas_create_user=="0"){
|
||||
if (record_exists('user', 'username', phpCAS::getUser())) {
|
||||
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
|
||||
@@ -167,5 +167,4 @@ function cas_automatic_authenticate ($user="") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+9
-3
@@ -18,7 +18,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
$wwwroot = str_replace('http','https',$CFG->wwwroot);
|
||||
}
|
||||
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
}
|
||||
@@ -109,7 +109,10 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
//Select password change url
|
||||
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
} elseif($CFG->changepassword) {
|
||||
$passwordchangeurl=$CFG->changepassword;
|
||||
}
|
||||
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)){
|
||||
@@ -216,7 +219,10 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
//Select password change url
|
||||
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
}
|
||||
} elseif($CFG->changepassword) {
|
||||
$passwordchangeurl=$CFG->changepassword;
|
||||
}
|
||||
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)){
|
||||
@@ -313,4 +319,4 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
// No footer on this page
|
||||
|
||||
?>
|
||||
?>
|
||||
+5
-9
@@ -1,15 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Id$
|
||||
// logout the user from CAS server (destroy the ticket)
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
global $CFG;
|
||||
if ($CFG->cas_logout){
|
||||
require_once($CFG->dirroot.'/config.php');
|
||||
include_once($CFG->dirroot.'/lib/cas/CAS.php');
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
$backurl = $CFG->wwwroot;
|
||||
phpCAS::logout($backurl);
|
||||
}
|
||||
include_once($CFG->dirroot.'/lib/cas/CAS.php');
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
$backurl = $CFG->wwwroot;
|
||||
phpCAS::logout($backurl);
|
||||
|
||||
?>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/** auth_db_sync_users.php
|
||||
*
|
||||
* This script is meant to be called from a cronjob to sync moodle with the LDAP
|
||||
* backend in those setups where the LDAP backend acts as 'master'.
|
||||
*
|
||||
* Recommended cron entry:
|
||||
* # 5 minutes past 4am
|
||||
* 5 4 * * * /usr/bin/php -c /etc/php4/cli/php.ini /var/www/moodle/auth/db/auth_db_sync_users.php
|
||||
*
|
||||
* Notes:
|
||||
* - If you have a large number of users, you may want to raise the memory limits
|
||||
* by passing -d memory_limit=256M
|
||||
* - For debugging & better logging, you are encouraged to use in the command line:
|
||||
* -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
|
||||
*
|
||||
* Performance notes:
|
||||
* + The code is simpler, but not as optimized as its LDAP counterpart.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if(!empty($_SERVER['GATEWAY_INTERFACE'])){
|
||||
error_log("should not be called from apache!");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->dirroot.'/lib/blocklib.php');
|
||||
require_once($CFG->dirroot.'/mod/resource/lib.php');
|
||||
require_once($CFG->dirroot.'/auth/db/lib.php');
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
$CFG->debug=10;
|
||||
auth_sync_users(true );
|
||||
|
||||
?>
|
||||
@@ -26,10 +26,7 @@
|
||||
if (!isset($config->auth_dbpasstype)) {
|
||||
$config->auth_dbpasstype = "plaintext";
|
||||
}
|
||||
|
||||
$pluginconfig = get_config('auth/db');
|
||||
?>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">auth_dbhost:</td>
|
||||
<td>
|
||||
@@ -129,8 +126,6 @@
|
||||
<?php
|
||||
$passtype["plaintext"] = get_string("plaintext", "auth");
|
||||
$passtype["md5"] = get_string("md5", "auth");
|
||||
$passtype["internal"] = get_string("internal", "auth");
|
||||
|
||||
choose_from_menu($passtype, "auth_dbpasstype", $config->auth_dbpasstype, "");
|
||||
?>
|
||||
|
||||
|
||||
+20
-344
@@ -21,59 +21,31 @@ function auth_user_login ($username, $password) {
|
||||
}
|
||||
|
||||
// Connect to the external database
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
|
||||
if ($CFG->auth_dbpasstype === 'internal') {
|
||||
// lookup username externally, but resolve
|
||||
// password locally -- to support backend that
|
||||
// don't track passwords
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username' ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
// user exists exterally
|
||||
// check username/password internally
|
||||
if ($user = get_record('user', 'username', $username)) {
|
||||
return validate_internal_user_password($user, $password);
|
||||
}
|
||||
} else {
|
||||
// user does not exist externally
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
// normal case: use external db for passwords
|
||||
|
||||
if ($CFG->auth_dbpasstype === 'md5') { // Re-format password accordingly
|
||||
switch ($CFG->auth_dbpasstype) { // Re-format password accordingly
|
||||
case "md5":
|
||||
$password = md5($password);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username'
|
||||
AND $CFG->auth_dbfieldpass = '$password' ");
|
||||
$authdb->Close();
|
||||
|
||||
$CFG->prefix = $prefix;
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$authdb->Close();
|
||||
|
||||
$CFG->prefix = $prefix;
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,11 +76,7 @@ function auth_get_userinfo($username){
|
||||
if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username'")) {
|
||||
if ( $rs->RecordCount() == 1 ) {
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$result["$field"] = addslashes(stripslashes($rs->fields[0]));
|
||||
} else {
|
||||
$result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
|
||||
}
|
||||
$result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,296 +85,4 @@ function auth_get_userinfo($username){
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* syncronizes user fron external db to moodle user table
|
||||
*
|
||||
* Sync shouid be done by using idnumber attribute, not username.
|
||||
* You need to pass firstsync parameter to function to fill in
|
||||
* idnumbers if they dont exists in moodle user table.
|
||||
*
|
||||
* Syncing users removes (disables) users that dont exists anymore in external db.
|
||||
* Creates new users and updates coursecreator status of users.
|
||||
*
|
||||
* @param bool $do_updates Optional: set to true to force an update of existing accounts
|
||||
*
|
||||
* This implementation is simpler but less scalable than the one found in the LDAP module.
|
||||
*
|
||||
*/
|
||||
function auth_sync_users ($do_updates=0) {
|
||||
|
||||
global $CFG;
|
||||
$pcfg = get_config('auth/db');
|
||||
|
||||
///
|
||||
/// list external users
|
||||
///
|
||||
$userlist = auth_get_userlist();
|
||||
$quoteduserlist = implode("', '", $userlist);
|
||||
$quoteduserlist = "'$quoteduserlist'";
|
||||
|
||||
///
|
||||
/// delete obsolete internal users
|
||||
///
|
||||
|
||||
// find obsolete users
|
||||
if (count($userlist)) {
|
||||
$sql = 'SELECT u.id, u.username
|
||||
FROM ' . $CFG->prefix .'user u
|
||||
WHERE u.auth=\'db\' AND u.deleted=\'0\' AND u.username NOT IN (' . $quoteduserlist . ')';
|
||||
} else {
|
||||
$sql = 'SELECT u.id, u.username
|
||||
FROM ' . $CFG->prefix .'user u
|
||||
WHERE u.auth=\'db\' AND u.deleted=\'0\' ';
|
||||
}
|
||||
$remove_users = get_records_sql($sql);
|
||||
|
||||
if (!empty($remove_users)){
|
||||
print "User entries to remove: ". count($remove_users) . "\n";
|
||||
|
||||
begin_sql();
|
||||
foreach ($remove_users as $user) {
|
||||
//following is copy pasted from admin/user.php
|
||||
//maybe this should moved to function in lib/datalib.php
|
||||
unset($updateuser);
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = "1";
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record("user", $updateuser)) {
|
||||
unenrol_student($user->id); // From all courses
|
||||
remove_teacher($user->id); // From all courses
|
||||
remove_admin($user->id);
|
||||
notify(get_string("deletedactivity", "", fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string("deletednot", "", fullname($user, true)));
|
||||
}
|
||||
//copy pasted part ends
|
||||
}
|
||||
commit_sql();
|
||||
}
|
||||
unset($remove_users); // free mem!
|
||||
|
||||
if (!count($userlist)) {
|
||||
// exit right here
|
||||
// nothing else to do
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
/// update existing accounts
|
||||
///
|
||||
if ($do_updates) {
|
||||
// narrow down what fields we need to update
|
||||
$all_keys = array_keys(get_object_vars($pcfg));
|
||||
$updatekeys = array();
|
||||
foreach ($all_keys as $key) {
|
||||
if (preg_match('/^field_updatelocal_(.+)$/',$key, $match)) {
|
||||
if ($pcfg->{$match[0]}) { // if it has a true value
|
||||
array_push($updatekeys, $match[1]); // the actual key name
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_r($all_keys); print_r($updatekeys);
|
||||
unset($all_keys); unset($key);
|
||||
|
||||
// only go ahead if we actually
|
||||
// have fields to update locally
|
||||
if (!empty($updatekeys)) {
|
||||
$sql = 'SELECT u.id, u.username
|
||||
FROM ' . $CFG->prefix .'user u
|
||||
WHERE u.auth=\'db\' AND u.deleted=\'0\' AND u.username IN (' . $quoteduserlist . ')';
|
||||
$update_users = get_records_sql($sql);
|
||||
|
||||
foreach ($update_users as $user) {
|
||||
auth_db_update_user_record($user->username, $updatekeys);
|
||||
}
|
||||
unset($update_users); // free memory
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// create missing accounts
|
||||
///
|
||||
// NOTE: this is very memory intensive
|
||||
// and generally inefficient
|
||||
$sql = 'SELECT u.id, u.username
|
||||
FROM ' . $CFG->prefix .'user u
|
||||
WHERE u.auth=\'db\' AND u.deleted=\'0\'';
|
||||
|
||||
$users = get_records_sql($sql);
|
||||
|
||||
// simplify down to usernames
|
||||
$usernames = array();
|
||||
foreach ($users as $user) {
|
||||
array_push($usernames, $user->username);
|
||||
}
|
||||
unset($users);
|
||||
|
||||
$add_users = array_diff($userlist, $usernames);
|
||||
unset($usernames);
|
||||
|
||||
if(!empty($add_users)){
|
||||
print "User entries to add: ". count($add_users). "\n";
|
||||
begin_sql();
|
||||
foreach($add_users as $user){
|
||||
$username = $user;
|
||||
$user = auth_get_userinfo_asobj($user);
|
||||
|
||||
// prep a few params
|
||||
$user->username = $username;
|
||||
$user->modified = time();
|
||||
$user->confirmed = 1;
|
||||
$user->auth = 'db';
|
||||
|
||||
// insert it
|
||||
$old_debug=$CFG->debug;
|
||||
$CFG->debug=10;
|
||||
|
||||
// maybe the user has been deleted before
|
||||
if ($old_user = get_record('user', 'username', $user->username, 'deleted', 1)) {
|
||||
$user->id = $old_user->id;
|
||||
set_field('user', 'deleted', 0, 'username', $user->username);
|
||||
echo "Revived user $user->username id $user->id\n";
|
||||
} elseif ($id=insert_record ('user',$user)) { // it is truly a new user
|
||||
echo "inserted user $user->username id $id\n";
|
||||
$user->id = $id;
|
||||
// if relevant, tag for password generation
|
||||
if ($CFG->auth_dbpasstype === 'internal') {
|
||||
set_user_preference('auth_forcepasswordchange', 1, $id);
|
||||
set_user_preference('create_password', 1, $id);
|
||||
}
|
||||
} else {
|
||||
echo "error inserting user $user->username \n";
|
||||
}
|
||||
$CFG->debug=$old_debug;
|
||||
}
|
||||
commit_sql();
|
||||
unset($add_users); // free mem
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function auth_user_exists ($username) {
|
||||
global $CFG;
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
|
||||
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
||||
WHERE $CFG->auth_dbfielduser = '$username' ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
// user exists exterally
|
||||
// check username/password internally
|
||||
// ?? there is no $password variable, so why??
|
||||
/*if ($user = get_record('user', 'username', $username)) {
|
||||
return ($user->password == md5($password));
|
||||
}*/
|
||||
return $rs->RecordCount();
|
||||
} else {
|
||||
// user does not exist externally
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function auth_get_userlist() {
|
||||
|
||||
global $CFG;
|
||||
|
||||
// Connect to the external database
|
||||
$authdb = &ADONewConnection($CFG->auth_dbtype);
|
||||
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
||||
|
||||
// fetch userlist
|
||||
$rs = $authdb->Execute("SELECT $CFG->auth_dbfielduser AS username
|
||||
FROM $CFG->auth_dbtable ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
notify("Could not connect to the specified authentication database...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
$userlist = array();
|
||||
while ($rec = $rs->FetchRow()) {
|
||||
array_push($userlist, $rec['username']);
|
||||
}
|
||||
return $userlist;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reads userinformation from DB and return it in an object
|
||||
*
|
||||
* @param string $username username
|
||||
* @return array
|
||||
*/
|
||||
function auth_get_userinfo_asobj($username){
|
||||
$user_array = truncate_userinfo(auth_get_userinfo($username));
|
||||
$user = new object;
|
||||
foreach($user_array as $key=>$value){
|
||||
$user->{$key} = $value;
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
||||
function auth_db_update_user_record($username, $updatekeys=false) {
|
||||
/// will update a local user record from an external source.
|
||||
/// is a lighter version of the one in moodlelib -- won't do
|
||||
/// expensive ops such as enrolment
|
||||
///
|
||||
/// If you don't pass $updatekeys, there is a performance hit and
|
||||
/// values removed from DB won't be removed from moodle.
|
||||
|
||||
global $CFG;
|
||||
|
||||
$pcfg = get_config('auth/db');
|
||||
|
||||
//just in case check text case
|
||||
$username = trim(moodle_strtolower($username));
|
||||
|
||||
// get the current user record
|
||||
$user = get_record('user', 'username', $username);
|
||||
if (empty($user)) { // trouble
|
||||
error_log("Cannot update non-existent user: $username");
|
||||
die;
|
||||
}
|
||||
|
||||
if (function_exists('auth_get_userinfo')) {
|
||||
if ($newinfo = auth_get_userinfo($username)) {
|
||||
$newinfo = truncate_userinfo($newinfo);
|
||||
|
||||
if (empty($updatekeys)) { // all keys? this does not support removing values
|
||||
$updatekeys = array_keys($newinfo);
|
||||
}
|
||||
|
||||
foreach ($updatekeys as $key){
|
||||
unset($value);
|
||||
if (isset($newinfo[$key])) {
|
||||
$value = $newinfo[$key];
|
||||
$value = addslashes(stripslashes($value)); // Just in case
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
if (!empty($pcfg->{'field_updatelocal_' . $key})) {
|
||||
if ($user->{$key} != $value) { // only update if it's changed
|
||||
set_field('user', $key, $value, 'username', $username);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return get_record_select("user", "username = '$username' AND deleted <> '1'");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+4
-4
@@ -7,11 +7,11 @@ function auth_user_login ($username, $password) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($user = get_record('user', 'username', $username)) {
|
||||
return validate_internal_user_password($user, $password);
|
||||
if (! $user = get_record('user', 'username', $username)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return ($user->password == md5($password));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+38
-60
@@ -1,51 +1,29 @@
|
||||
<?php
|
||||
// Initialize vars
|
||||
if (!isset($config->ldap_host_url))
|
||||
{ $config->ldap_host_url = ''; }
|
||||
if (!isset($config->ldap_contexts))
|
||||
{ $config->ldap_contexts = ''; }
|
||||
if (!isset($config->ldap_user_type))
|
||||
{ $config->ldap_user_type = ''; }
|
||||
if (!isset($config->ldap_user_attribute))
|
||||
{ $config->ldap_user_attribute = ''; }
|
||||
if (!isset($config->ldap_search_sub))
|
||||
{ $config->ldap_search_sub = ''; }
|
||||
if (!isset($config->ldap_opt_deref))
|
||||
{ $config->ldap_opt_deref = ''; }
|
||||
if (!isset($config->ldap_preventpassindb))
|
||||
{ $config->ldap_preventpassindb = 0; }
|
||||
if (!isset($config->ldap_bind_dn))
|
||||
{$config->ldap_bind_dn = ''; }
|
||||
if (!isset($config->ldap_bind_pw))
|
||||
{$config->ldap_bind_pw = ''; }
|
||||
if (!isset($config->ldap_version))
|
||||
{$config->ldap_version = '2'; }
|
||||
if (!isset($config->ldap_objectclass))
|
||||
{$config->ldap_objectclass = ''; }
|
||||
if (!isset($config->ldap_memberattribute))
|
||||
{$config->ldap_memberattribute = ''; }
|
||||
if (!isset($config->ldap_creators))
|
||||
{$config->ldap_creators = ''; }
|
||||
if (!isset($config->ldap_create_context))
|
||||
{$config->ldap_create_context = ''; }
|
||||
if (!isset($config->ldap_expiration))
|
||||
{$config->ldap_expiration = ''; }
|
||||
if (!isset($config->ldap_expiration_warning))
|
||||
{$config->ldap_expiration_warning = '10'; }
|
||||
if (!isset($config->ldap_expireattr))
|
||||
{$config->ldap_expireattr = ''; }
|
||||
if (!isset($config->ldap_gracelogins))
|
||||
{$config->ldap_gracelogins = ''; }
|
||||
if (!isset($config->ldap_graceattr))
|
||||
{$config->ldap_graceattr = ''; }
|
||||
if (!isset($config->auth_user_create))
|
||||
{$config->auth_user_create = ''; }
|
||||
if (!isset($config->auth_ldap_forcechangepassword))
|
||||
{$config->auth_ldap_forcechangepassword = false; }
|
||||
if (!isset($config->auth_ldap_stdchangepassword))
|
||||
{$config->auth_ldap_stdchangepassword = false; }
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
optional_variable($config->ldap_host_url, "");
|
||||
optional_variable($config->ldap_contexts, "");
|
||||
optional_variable($config->ldap_user_type, "");
|
||||
optional_variable($config->ldap_user_attribute, "");
|
||||
optional_variable($config->ldap_search_sub, "");
|
||||
optional_variable($config->ldap_opt_deref, "");
|
||||
optional_variable($config->ldap_preventpassindb, 0);
|
||||
optional_variable($config->ldap_bind_dn, "");
|
||||
optional_variable($config->ldap_bind_pw, "");
|
||||
optional_variable($config->ldap_version, "2");
|
||||
optional_variable($config->ldap_objectclass, "");
|
||||
optional_variable($config->ldap_memberattribute, "");
|
||||
optional_variable($config->ldap_creators, "");
|
||||
optional_variable($config->ldap_create_context, "");
|
||||
optional_variable($config->ldap_expiration, "");
|
||||
optional_variable($config->ldap_expiration_warning, "10");
|
||||
optional_variable($config->ldap_expireattr, "");
|
||||
optional_variable($config->ldap_gracelogins, "");
|
||||
optional_variable($config->ldap_graceattr, "");
|
||||
optional_variable($config->auth_user_create, "");
|
||||
optional_variable($config->auth_user_create, "");
|
||||
optional_variable($config->auth_ldap_forcechangepassword, "");
|
||||
|
||||
optional_variable($config->auth_ldap_stdchangepassword, false);
|
||||
|
||||
if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
print '<tr><td><p align="center"><font color="red"><strong>Warning:
|
||||
@@ -63,7 +41,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_host_url:</td>
|
||||
<td>
|
||||
<input name="ldap_host_url" type="text" size="30" value="<?php echo $config->ldap_host_url?>" />
|
||||
<input name="ldap_host_url" type="text" size="30" value="<?php echo $config->ldap_host_url?>">
|
||||
<?php if (isset($err["ldap_host_url"])) formerr($err["ldap_host_url"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -109,7 +87,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_bind_dn:</td>
|
||||
<td>
|
||||
<input name="ldap_bind_dn" type="text" size="30" value="<?php echo $config->ldap_bind_dn?>" />
|
||||
<input name="ldap_bind_dn" type="text" size="30" value="<?php echo $config->ldap_bind_dn?>">
|
||||
<?php if (isset($err["ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("auth_ldap_bind_dn","auth") ?>
|
||||
@@ -119,7 +97,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_bind_pw:</td>
|
||||
<td>
|
||||
<input name="ldap_bind_pw" type="password" size="30" value="<?php echo $config->ldap_bind_pw?>" />
|
||||
<input name="ldap_bind_pw" type="password" size="30" value="<?php echo $config->ldap_bind_pw?>">
|
||||
<?php if (isset($err["ldap_bind_pw"])) formerr($err["ldap_bind_pw"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("auth_ldap_bind_pw","auth") ?>
|
||||
@@ -146,7 +124,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_contexts:</td>
|
||||
<td>
|
||||
<input name="ldap_contexts" type="text" size="30" value="<?php echo $config->ldap_contexts?>" />
|
||||
<input name="ldap_contexts" type="text" size="30" value="<?php echo $config->ldap_contexts?>">
|
||||
<?php if (isset($err["ldap_contexts"])) formerr($err["ldap_contexts"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -189,7 +167,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_user_attribute:</td>
|
||||
<td>
|
||||
<input name="ldap_user_attribute" type="text" size="30" value="<?php echo $config->ldap_user_attribute?>" />
|
||||
<input name="ldap_user_attribute" type="text" size="30" value="<?php echo $config->ldap_user_attribute?>">
|
||||
<?php if (isset($err["ldap_user_attribute"])) formerr($err["ldap_user_attribute"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -200,7 +178,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_memberattribute:</td>
|
||||
<td>
|
||||
<input name="ldap_memberattribute" type="text" size="30" value="<?php echo $config->ldap_memberattribute?>" />
|
||||
<input name="ldap_memberattribute" type="text" size="30" value="<?php echo $config->ldap_memberattribute?>">
|
||||
<?php if (isset($err["ldap_memberattribute"])) formerr($err["ldap_memberattribute"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("auth_ldap_memberattribute","auth") ?>
|
||||
@@ -210,7 +188,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_objectclass:</td>
|
||||
<td>
|
||||
<input name="ldap_objectclass" type="text" size="30" value="<?php echo $config->ldap_objectclass?>" />
|
||||
<input name="ldap_objectclass" type="text" size="30" value="<?php echo $config->ldap_objectclass?>">
|
||||
<?php if (isset($err["ldap_objectclass"])) formerr($err["ldap_objectclass"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -233,7 +211,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<?php print_string("no") ?></option>
|
||||
<option value="1" <?php echo ($config->auth_ldap_forcechangepassword ? 'selected="yes"' : '') ?> >
|
||||
<?php print_string("yes") ?></option>
|
||||
</select><br />
|
||||
</select><br>
|
||||
|
||||
</td>
|
||||
<td align="left" valign="top">
|
||||
@@ -250,7 +228,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<?php print_string("no") ?></option>
|
||||
<option value="1" <?php echo ($config->auth_ldap_stdchangepassword ? 'selected="yes"' : '') ?> >
|
||||
<?php print_string("yes") ?></option>
|
||||
</select><br />
|
||||
</select><br>
|
||||
|
||||
</td>
|
||||
<td align="left" valign="top">
|
||||
@@ -284,7 +262,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_expiration_warning:</td>
|
||||
<td>
|
||||
<input name="ldap_expiration_warning" type="text" size="2" value="<?php echo $config->ldap_expiration_warning?>" />
|
||||
<input name="ldap_expiration_warning" type="text" size="2" value="<?php echo $config->ldap_expiration_warning?>">
|
||||
<?php if (isset($err["ldap_expiration_warning"])) formerr($err["ldap_expiration_warning"]);
|
||||
?>
|
||||
</td>
|
||||
@@ -296,7 +274,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_exprireattr:</td>
|
||||
<td>
|
||||
<input name="ldap_expireattr" type="text" size="30" value="<?php echo $config->ldap_expireattr?>" />
|
||||
<input name="ldap_expireattr" type="text" size="30" value="<?php echo $config->ldap_expireattr?>">
|
||||
<?php if (isset($err["ldap_expireattr"])) formerr($err["ldap_expireattr"]);
|
||||
?>
|
||||
</td>
|
||||
@@ -323,7 +301,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_graceattr:</td>
|
||||
<td>
|
||||
<input name="ldap_graceattr" type="text" size="30" value="<?php echo $config->ldap_graceattr?>" />
|
||||
<input name="ldap_graceattr" type="text" size="30" value="<?php echo $config->ldap_graceattr?>">
|
||||
<?php if (isset($err["ldap_graceattr"])) formerr($err["ldap_graceattr"]);
|
||||
?>
|
||||
</td>
|
||||
@@ -344,7 +322,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_create_context:</td>
|
||||
<td>
|
||||
<input name="ldap_create_context" type="text" size="30" value="<?php echo $config->ldap_create_context?>" />
|
||||
<input name="ldap_create_context" type="text" size="30" value="<?php echo $config->ldap_create_context?>">
|
||||
<?php if (isset($err["ldap_create_context"])) formerr($err["ldap_create_context"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("auth_ldap_create_context","auth") ?>
|
||||
@@ -361,7 +339,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">ldap_creators:</td>
|
||||
<td>
|
||||
<input name="ldap_creators" type="text" size="30" value="<?php echo $config->ldap_creators?>" />
|
||||
<input name="ldap_creators" type="text" size="30" value="<?php echo $config->ldap_creators?>">
|
||||
<?php if (isset($err["ldap_creators"])) formerr($err["ldap_creators"]); ?>
|
||||
</td><td>
|
||||
<?php print_string("auth_ldap_creators","auth") ?>
|
||||
|
||||
+10
-25
@@ -127,26 +127,16 @@ function auth_get_userinfo($username){
|
||||
$ldapval = NULL;
|
||||
foreach ($values as $value) {
|
||||
if(is_array($user_entry[0][strtolower($value)])) {
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$newval = addslashes(stripslashes($user_entry[0][strtolower($value)][0]));
|
||||
} else {
|
||||
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
|
||||
}
|
||||
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
|
||||
}
|
||||
else {
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$newval = addslashes(stripslashes($user_entry[0][strtolower($value)]));
|
||||
} else {
|
||||
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
|
||||
}
|
||||
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
|
||||
}
|
||||
if (!empty($newval)) { // favour ldap entries that are set
|
||||
$ldapval = $newval;
|
||||
}
|
||||
}
|
||||
if (!is_null($ldapval)) {
|
||||
$result[$key] = $ldapval;
|
||||
}
|
||||
$result[$key] = $ldapval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,11 +206,7 @@ function auth_user_create ($userobject,$plainpass) {
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
if(!empty($userobject->$key) ){
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$newuser[$value]= $userobject->$key;
|
||||
} else {
|
||||
$newuser[$value]=utf8_encode($userobject->$key);
|
||||
}
|
||||
$newuser[$value]=utf8_encode($userobject->$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -840,7 +826,7 @@ function auth_user_update($olduser, $newuser) {
|
||||
if ($user_info_result){
|
||||
|
||||
$user_entry = auth_ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (count($user_entry) > 1) {
|
||||
if (count($user_entry)) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -1077,15 +1063,15 @@ function auth_ldap_getdefaults(){
|
||||
'rfc2307' => 'member',
|
||||
'rfc2307bis' => 'member',
|
||||
'samba' => 'member',
|
||||
'ad' => 'member',
|
||||
'ad' => 'memberOf',
|
||||
'default' => 'member'
|
||||
);
|
||||
$default['ldap_memberattribute_isdn'] = array(
|
||||
'edir' => '1',
|
||||
'rfs2307' => '0',
|
||||
'rfs2307bis' => '1',
|
||||
'rfc2307' => '0',
|
||||
'rfc2307bis' => '1',
|
||||
'samba' => '0', //is this right?
|
||||
'ad' => '1',
|
||||
'ad' => '0', //is this right?
|
||||
'default' => '0'
|
||||
);
|
||||
$default['ldap_expireattr'] = array (
|
||||
@@ -1260,8 +1246,7 @@ function auth_ldap_isgroupmember ($username='', $groupdns='') {
|
||||
}
|
||||
//echo "Checking group $group for member $username\n";
|
||||
$search = @ldap_read($ldapconnection, $group, '('.$CFG->ldap_memberattribute.'='.$username.')', array($CFG->ldap_memberattribute));
|
||||
|
||||
if (!empty($search) AND ldap_count_entries($ldapconnection, $search)) {$info = auth_ldap_get_entries($ldapconnection, $search);
|
||||
if (ldap_count_entries($ldapconnection, $search)) {$info = auth_ldap_get_entries($ldapconnection, $search);
|
||||
|
||||
if (count($info) > 0 ) {
|
||||
// user is member of group
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ function auth_user_login ($username, $password) {
|
||||
// Returns true if the username and password work
|
||||
|
||||
if ($user = get_record('user', 'username', $username)) {
|
||||
return validate_internal_user_password($user, $password);
|
||||
return ($user->password == md5($password));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ function auth_user_login ($username, $password) {
|
||||
// Returns true if the username and password work
|
||||
|
||||
if ($user = get_record('user', 'username', $username)) {
|
||||
return validate_internal_user_password($user, $password);
|
||||
return ($user->password == md5($password));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?PHP // $Id: config.html
|
||||
|
||||
if ((!include_once('Auth/RADIUS.php')) or (!class_exists(Auth_RADIUS_PAP))) { // Is Auth/RADIUS really there?
|
||||
print '<p align="center"><font color="red"><strong>Warning: The Auth_RADIUS module does not seem to be present. Please ensure it is installed and enabled.</strong></font></p>';
|
||||
}
|
||||
if (!isset($config->auth_radiushost)) {
|
||||
$config->auth_radiushost = "127.0.0.1";
|
||||
}
|
||||
if (!isset($config->auth_radiusnasport)) {
|
||||
$config->auth_radiusport = "0";
|
||||
}
|
||||
if (!isset($config->auth_radiussecret)) {
|
||||
$config->auth_radiussecret = "";
|
||||
}
|
||||
?>
|
||||
<tr valign="top" >
|
||||
<td align="right"><P>auth_radiushost:</td>
|
||||
<td>
|
||||
<input name="auth_radiushost" type="text" size="30" value="<?php echo $config->auth_radiushost?>">
|
||||
<?php if (isset($err["auth_radiushost"]))
|
||||
formerr($err["auth_radiushost"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("auth_radiushost","auth") ?>
|
||||
</td>
|
||||
</TR>
|
||||
|
||||
<TR valign="top" >
|
||||
<td align="right"><P>auth_radiusnasport:</td>
|
||||
<td>
|
||||
<input name="auth_radiusport" type="text" size="6" value="<?php echo $config->auth_radiusport ?>">
|
||||
<?php if (isset($err["auth_radiusnasport"])) formerr($err["auth_radiusnasport"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("auth_radiusnasport","auth") ?>
|
||||
</td>
|
||||
</TR>
|
||||
|
||||
<TR valign="top" >
|
||||
<td align="right"><P>auth_radiussecret:</td>
|
||||
<td>
|
||||
<input name="auth_radiussecret" type="text" size="6" value="<?php echo $config->auth_radiussecret ?>">
|
||||
<?php if (isset($err["auth_radiussecret"])) formerr($err["auth_radiussecret"]); ?> </td>
|
||||
<td>
|
||||
<?php print_string("auth_radiussecret","auth") ?>
|
||||
</td>
|
||||
</TR>
|
||||
|
||||
<TR valign="top">
|
||||
<td align="right"><P><?php print_string("instructions", "auth")
|
||||
?>:</td>
|
||||
<td>
|
||||
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php
|
||||
p($config->auth_instructions) ?></textarea>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("authinstructions","auth") ?>
|
||||
<?php helpbutton("text", get_string("helptext")) ?>
|
||||
</td>
|
||||
</TR>
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?PHP // $Id$
|
||||
// Authentication by looking up a RADIUS server
|
||||
// Contributed by Clive Gould <clive@ce.bromley.ac.uk>
|
||||
|
||||
function auth_user_login ($username, $password) {
|
||||
// Returns true if the username and password work
|
||||
// and false if they are wrong or don't exist.
|
||||
|
||||
require_once 'Auth/RADIUS.php';
|
||||
|
||||
global $CFG;
|
||||
|
||||
// Added by Clive on 7th May for test purposes
|
||||
// printf("Username: $username <br>");
|
||||
// printf("Password: $password <br>");
|
||||
// printf("auth_radiushost: $CFG->auth_radiushost <br>");
|
||||
// printf("auth_radiusnasport: $CFG->auth_radiusnasport <br>");
|
||||
// printf("auth_radiussecret: $CFG->auth_radiussecret <br>");
|
||||
|
||||
$rauth = new Auth_RADIUS_PAP($username, $password);
|
||||
$rauth->addServer($CFG->auth_radiushost, $CFG->auth_radiusnasport, $CFG->auth_radiussecret);
|
||||
|
||||
if (!$rauth->start()) {
|
||||
printf("Radius start: %s<br>\n", $rauth->getError());
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = $rauth->send();
|
||||
if (PEAR::isError($result)) {
|
||||
printf("Radius send failed: %s<br>\n", $result->getMessage());
|
||||
exit;
|
||||
} else if ($result === true) {
|
||||
// printf("Radius Auth succeeded<br>\n");
|
||||
return true;
|
||||
} else {
|
||||
// printf("Radius Auth rejected<br>\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// get attributes, even if auth failed
|
||||
if (!$rauth->getAttributes()) {
|
||||
printf("Radius getAttributes: %s<br>\n", $rauth->getError());
|
||||
} else {
|
||||
$rauth->dumpAttributes();
|
||||
}
|
||||
|
||||
$rauth->close();
|
||||
}
|
||||
?>
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
# Requires a Shibboleth session
|
||||
# Be sure to read moodle/auth/shibboleth/README.txt for instructions
|
||||
# on how to configure Moodle for Shibboleth authentication
|
||||
AuthType shibboleth
|
||||
ShibRequireSession Off
|
||||
require shibboleth
|
||||
|
||||
+46
-43
@@ -2,6 +2,7 @@ Shibboleth Authentication for Moodle
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Requirements:
|
||||
- Moodle 1.5 or later
|
||||
- Shibboleth target 1.1 or later. See documentation for your Shibboleth
|
||||
federation on how to set up Shibboleth.
|
||||
|
||||
@@ -11,20 +12,21 @@ Changes:
|
||||
- 05. 2005: Various extensions and fixes by Lukas Haemmerle
|
||||
- 06. 2005: Adaptions to new field locks and plugin config structures by Marting
|
||||
Langhoff and Lukas Haemmerle
|
||||
- 10. 2005: Added better error messages and moved text to language directories
|
||||
- 02. 2006: Simplified authentication so that authorization works properly
|
||||
Added instructions for IIS
|
||||
|
||||
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
1. Protect the directory moodle/auth/shibboleth/ with Shibboleth.
|
||||
The page index.php in that directory actually logs in a Shibboleth user.
|
||||
For Apache you have to define a rule like the following in the Apache config:
|
||||
1. Ensure that the .htaccess file in moodle/auth/shibboleth/ is active
|
||||
It may be possible that you have to change the configuration of your web
|
||||
server to allow .htaccess files to override certain settings. Alternatively,
|
||||
you also could define the rules from the .htaccess file in the web server
|
||||
configuration file.
|
||||
|
||||
2. Protect the file moodle/auth/shibboleth/shib-protected.php with Shibboleth.
|
||||
This page just needs to redirect the users to moodle/auth/shibboleth/
|
||||
For Apache you have to define a rule like the following:
|
||||
|
||||
--
|
||||
<Location ~ "/auth/shibboleth">
|
||||
<Location ~ "/auth/shibboleth/shib-protected.php">
|
||||
AuthType shibboleth
|
||||
ShibRequireSession On
|
||||
require valid-user
|
||||
@@ -34,14 +36,10 @@ Moodle Configuration with Dual login
|
||||
To restrict access to Moodle, replace the access rule 'require valid-user'
|
||||
with something that fits your needs, e.g. 'require affiliation student'.
|
||||
|
||||
For IIS you have protect the auth/shibboleth directory directly in the
|
||||
RequestMap of the Shibboleth configuration file (shibboleth.xml). See
|
||||
https://authdev.it.ohio-state.edu/twiki/bin/view/Shibboleth/xmlaccesscontrol?topic=XMLAccessControl
|
||||
|
||||
2. As Moodle admin, go to the 'Administrations >> Users >> Authentication
|
||||
3. As Moodle admin, go to the 'Administrations >> Users >> Authentication
|
||||
Options' and select the 'Shibboleth' authentication method from the pop-up.
|
||||
|
||||
3. Fill in the fields of the form. The fields 'Username', 'First name',
|
||||
4. Fill in the fields of the form. The fields 'Username', 'First name',
|
||||
'Surname', etc should contain the name of the environment variables of the
|
||||
Shibboleth attributes that you want to map onto the corresponding Moodle
|
||||
variable (e.g. 'HTTP_SHIB_PERSON_SURNAME' for the person's last name, refer
|
||||
@@ -60,45 +58,47 @@ Moodle Configuration with Dual login
|
||||
lengths for each field in the user profile.
|
||||
#############################################################################
|
||||
|
||||
4. The large text field 'Instructions' must contain a link to the
|
||||
moodle/auth/shibboleth/index.php file which is protected by
|
||||
Shibboleth (see step 1) and causes the Shibboleth login procedure to start.
|
||||
You could also use HTML code in that field, e.g. to create your own
|
||||
5. The large text field 'Instructions' must contain a link to the
|
||||
moodle/auth/shibboleth/shib-protected.php file which is protected by
|
||||
Shibboleth (see step 2) and causes the Shibboleth login procedure to start.
|
||||
You also coudl use HTML code in that field, e.g. to create your own
|
||||
Shibboleth login button.
|
||||
|
||||
5. Save the changes for the Shibboleth authentication method.
|
||||
6. Save the changes for the Shibboleth authentication method.
|
||||
|
||||
Moodle Configuration with Shibboleth only login
|
||||
-------------------------------------------------------------------------------
|
||||
If you want Shibboleth as your only authentication method, configure Moodle as
|
||||
described in the dual login section above and do the following steps:
|
||||
|
||||
4.a On the Moodle Shibboleth settings page, set the 'Alternate Login URL' to
|
||||
the URL of the file 'moodle/auth/shibboleth/index.php'
|
||||
5.a On the Moodle Shibboleth settings page, set the 'Alternate Login URL' to
|
||||
the URL of the file 'moodle/auth/shibboleth/shib-protected.php'
|
||||
This will enforce Shibboleth login.
|
||||
|
||||
How the Shibboleth authentication works
|
||||
--------------------------------------------------------------------------------
|
||||
To get Shibboleth authenticated in Moodle a user basically must access the
|
||||
Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only
|
||||
authentication method (see 4.a), this happens automatically when a user wants to
|
||||
login in Moodle. Otherwise, the user has to click on the link on the login page
|
||||
you provided in step 4.
|
||||
For a user to get Shibboleth authenticated in Moodle he first must go to the
|
||||
Shibboleth-protected page shib-protected.php. If Shibboleth authentication is
|
||||
enabled this happens automatically when a user wants to login.
|
||||
Otherwise the user has to click on the link on the login page you provided in
|
||||
step 5.
|
||||
|
||||
If the user is successfully Shibboleth authenticated he is redirected to
|
||||
moodle/auth/shibboleth where he also gets authenticated in Moodle.
|
||||
Moodle basically checks whether the Shibboleth attribute that you mapped
|
||||
as the username is present. This attribute should only be present if a user is
|
||||
as the username is present. This attribute is only present if a user is
|
||||
Shibboleth authenticated.
|
||||
|
||||
If the user's Moodle account has not existed yet, it gets automatically created.
|
||||
Unless the user's firstname, last name and email address is provided, the user
|
||||
is automatically redirected to the edit profile page by Moodle.
|
||||
|
||||
To prevent that every Shibboleth user can access your Moodle site you have to
|
||||
adapt the 'require valid-user' line in your webserver's config (see step 1) to
|
||||
allow only specific users. If you defined some authorization rules in step 1,
|
||||
these are checked by Shibboleth itself. Only users who met these rules
|
||||
actually can access /auth/shibboleth/index.php and get logged in.
|
||||
adapt the 'require valid-user' line in your webserver's config (see step 2) to
|
||||
allow only specific users.
|
||||
|
||||
You can use Shibboleth AND another authentication method (it was tested with
|
||||
manual login). So, if there are a few users that don't have a Shibboleth
|
||||
manual login only). So if there are a few users that don't have a Shibboleth
|
||||
login, you could create manual accounts for them and they could use the manual
|
||||
login. For other authentication methods you first have to configure them and
|
||||
then set Shibboleth as your authentication method. Users can log in only via one
|
||||
@@ -107,17 +107,18 @@ authentication method unless they have two accounts in Moodle.
|
||||
Shibboleth dual login with custom login page
|
||||
--------------------------------------------------------------------------------
|
||||
Of course you can create a dual login page that better fits your needs. For this
|
||||
to work, you have to set up the two authentication methods (e.g. 'Manual' and
|
||||
'Shibboleth') and specify an alternate login link to your own dual login page.
|
||||
On that page you basically need a link to the Shibboleth-protected page
|
||||
('/auth/shibboleth/index.php') for the Shibboleth login and a
|
||||
to work you have to set up the two authentication methods (e.g. 'Manual' and
|
||||
'Shibboleth', Shibboleth has to be the current authentication method) and
|
||||
specify an alternate login link to your own dual login page. On that page you
|
||||
basically need a link to the Shibboleth-protected page
|
||||
('moodle/auth/shibboleth/shib-protected.php') for the Shibboleth login and a
|
||||
form that sends 'username' and 'password' to moodle/login/index.php.
|
||||
Consult the Moodle documentation for further instructions and requirements.
|
||||
|
||||
How to customize the way the Shibboleth user data is used in Moodle
|
||||
How to customize the way the Shibboleth user data is used in ILIAS
|
||||
--------------------------------------------------------------------------------
|
||||
Among the Shibboleth settings in Moodle there is a field that should contain a
|
||||
path to a php file that can be used as data manipulation hook.
|
||||
path to a php file that can be used as data manipulation API.
|
||||
You can use this if you want to further process the way your Shibboleth
|
||||
attributes are used in Moodle.
|
||||
|
||||
@@ -130,11 +131,11 @@ Example 2: The country, city and street are provided in one Shibboleth attribute
|
||||
and you want these values to be used in the Moodle user profile. So
|
||||
You have to parse the corresponding attribute to fill the user fields.
|
||||
|
||||
If you want to use this hook you have to be a skilled PHP programmer. It is
|
||||
If you want to use this API you have to be a skilled PHP programmer. It is
|
||||
strongly recommended that you take a look at the file
|
||||
moodle/auth/shibboleth/lib.php, especially the function 'auth_get_userinfo'
|
||||
where this file is included.
|
||||
The context of the file is the same as within this login function. So you
|
||||
where this API file is included.
|
||||
The context of the API file is the same as within this login function. So you
|
||||
can directly edit the object $result.
|
||||
|
||||
Example file:
|
||||
@@ -150,6 +151,7 @@ Example file:
|
||||
// institution, street, zipcode, city and country
|
||||
$address = $_SERVER[$pluginconfig->field_map_address];
|
||||
list($institution, $street, $zip_city) = split('\$', $address);
|
||||
|
||||
ereg(' (.+)',$zip_city, $regs);
|
||||
$city = $regs[1];
|
||||
|
||||
@@ -166,7 +168,8 @@ Example file:
|
||||
|
||||
Bugs
|
||||
--------------------------------------------------------------------------------
|
||||
Please send bug reports concerning the Shibboleth part to
|
||||
The current implementation has not yet been extensively tested. So there may be
|
||||
bugs. Please send bug reports concerning the Shibboleth part to
|
||||
Lukas Haemmerle <haemmerle@switch.ch>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
+10
-13
@@ -1,17 +1,14 @@
|
||||
<?php
|
||||
// Set default values
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
// Set default values
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
|
||||
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/index.php');
|
||||
}
|
||||
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
|
||||
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
|
||||
}
|
||||
|
||||
optional_variable($pluginconfig->user_attribute, '');
|
||||
optional_variable($pluginconfig->convert_data, '');
|
||||
|
||||
if (!isset ($pluginconfig->user_attribute)) {
|
||||
$pluginconfig->user_attribute = '';
|
||||
}
|
||||
if (!isset ($pluginconfig->convert_data)) {
|
||||
$pluginconfig->convert_data = '';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" align="left">
|
||||
@@ -37,7 +34,7 @@
|
||||
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("auth_shib_instructions_help","auth", htmlspecialchars($CFG->wwwroot.'/auth/shibboleth/index.php')) ?>
|
||||
<?php print_string("auth_shib_instructions_help","auth", htmlspecialchars($CFG->wwwroot.'/auth/shibboleth')) ?>
|
||||
<?php helpbutton("text", get_string("helptext")) ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -45,7 +42,7 @@
|
||||
<td align="right"><?php print_string("auth_shib_convert_data", "auth") ?>:</td>
|
||||
<td>
|
||||
<input name="pluginconfig_convert_data" type="text" size="30" value="<?php echo $pluginconfig->convert_data?>">
|
||||
<?php
|
||||
<?
|
||||
if ($pluginconfig->convert_data && $pluginconfig->convert_data != '' && !is_readable($pluginconfig->convert_data)){
|
||||
echo '<br><font color="red">';
|
||||
print_string("auth_shib_convert_data_warning", "auth");
|
||||
|
||||
@@ -4,25 +4,16 @@
|
||||
require('../../config.php');
|
||||
require('lib.php');
|
||||
|
||||
if (isloggedin() && $USER->username != 'guest') { // Nothing to do
|
||||
if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)){
|
||||
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
|
||||
unset($SESSION->wantsurl);
|
||||
|
||||
} else {
|
||||
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
|
||||
unset($SESSION->wantsurl); /// Just in case
|
||||
}
|
||||
|
||||
redirect($urltogo);
|
||||
if (isloggedin()) { // Nothing to do
|
||||
redirect($CFG->wwwroot.'/index.php');
|
||||
}
|
||||
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
// Check whether Shibboleth is configured properly
|
||||
if (empty($pluginconfig->shib_user_attribute)) {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
}
|
||||
error('Shibboleth authentication (\'shib_user_attribute\') is not set up correctly. You probably haven\'t yet configured the Shibboleth authentication. Please consult the README in moodle/auth/shibboleth for further instructions on how to set up Shibboleth authentication.');
|
||||
}
|
||||
|
||||
/// If we can find the Shibboleth attribute, save it in session and return to main login page
|
||||
if (!empty($_SERVER[$pluginconfig->shib_user_attribute])) { // Shibboleth auto-login
|
||||
@@ -60,13 +51,9 @@
|
||||
redirect($urltogo);
|
||||
}
|
||||
}
|
||||
|
||||
// If we can find any (user independent) Shibboleth attributes but no user
|
||||
// attributes we probably didn't receive any user attributes
|
||||
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])){
|
||||
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->shib_user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
|
||||
} else {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
}
|
||||
|
||||
$SESSION->shibboleth_checked = true; // This will stop us bouncing back here
|
||||
|
||||
redirect($CFG->wwwroot.'/login/index.php');
|
||||
|
||||
?>
|
||||
|
||||
+22
-20
@@ -8,20 +8,25 @@ function auth_user_login($username, $password) {
|
||||
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
// If we are in the shibboleth directory then we trust the server var
|
||||
/// If we are in the shibboleth directory then we trust the server var
|
||||
if (!empty($_SERVER[$pluginconfig->shib_user_attribute])) {
|
||||
return ($_SERVER[$pluginconfig->shib_user_attribute] == $username);
|
||||
} else {
|
||||
// If we are not, the user has used the manual login and the login name is
|
||||
// unknown, so we return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// If we are not, then the server is probably set to not be Shibboleth-only
|
||||
/// and the user has used the normal login screen, so we redirect to the shibboleth
|
||||
/// directory for a proper check
|
||||
redirect($CFG->wwwroot.'/auth/shibboleth/index.php');
|
||||
|
||||
/// There's no point doing anything further here
|
||||
exit;
|
||||
}
|
||||
|
||||
function auth_get_userinfo($username) {
|
||||
// reads user information from shibboleth attributes and return it in array()
|
||||
global $CFG;
|
||||
|
||||
$config = (array)$CFG;
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
// Check whether we have got all the essential attributes
|
||||
@@ -31,7 +36,7 @@ function auth_get_userinfo($username) {
|
||||
|| empty($_SERVER[$pluginconfig->field_map_lastname])
|
||||
|| empty($_SERVER[$pluginconfig->field_map_email])
|
||||
) {
|
||||
error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')"));
|
||||
error("Moodle needs certain Shibboleth attributes which are not present in your case. The attributes are: '".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')<br>Please contact your Identity Service Provider.");
|
||||
}
|
||||
|
||||
$attrmap = auth_shib_attributes();
|
||||
@@ -40,24 +45,20 @@ function auth_get_userinfo($username) {
|
||||
$search_attribs = array();
|
||||
|
||||
foreach ($attrmap as $key=>$value) {
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$result[$key]=$_SERVER[$value];
|
||||
} else {
|
||||
$result[$key]=utf8_decode($_SERVER[$value]);
|
||||
}
|
||||
$result[$key]=utf8_decode($_SERVER[$value]);
|
||||
}
|
||||
|
||||
|
||||
// Provide an API to modify the information to fit the Moodle internal
|
||||
// data representation
|
||||
if (
|
||||
$pluginconfig->convert_data
|
||||
&& $pluginconfig->convert_data != ''
|
||||
&& is_readable($pluginconfig->convert_data)
|
||||
$config["shib_convert_data"]
|
||||
&& $config["shib_convert_data"] != ''
|
||||
&& is_readable($config["shib_convert_data"])
|
||||
){
|
||||
|
||||
// Include a custom file outside the Moodle dir to
|
||||
// modify the variable $moodleattributes
|
||||
include($pluginconfig->convert_data);
|
||||
include($config["shib_convert_data"]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -65,8 +66,9 @@ function auth_get_userinfo($username) {
|
||||
|
||||
function auth_shib_attributes(){
|
||||
//returns array containg attribute mappings between Moodle and shibboleth
|
||||
global $CFG;
|
||||
global $CFG;
|
||||
|
||||
$config = (array)$CFG;
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
$pluginconfig = (array) $pluginconfig;
|
||||
|
||||
@@ -80,8 +82,8 @@ function auth_shib_attributes(){
|
||||
$moodleattributes[$field] = $pluginconfig["field_map_$field"];
|
||||
}
|
||||
}
|
||||
$moodleattributes['username']=$pluginconfig["shib_user_attribute"];
|
||||
$moodleattributes['username']=$config["shib_user_attribute"];
|
||||
|
||||
return $moodleattributes;
|
||||
return $moodleattributes;
|
||||
}
|
||||
?>
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// This file must be Shibboleth protected
|
||||
// Consult the README for further instructions
|
||||
|
||||
require_once("../../config.php");
|
||||
header("Location: ".$CFG->wwwroot."/auth/shibboleth/");
|
||||
?>
|
||||
@@ -116,10 +116,6 @@
|
||||
|
||||
//Call the form, depending the step we are
|
||||
if (!$launch) {
|
||||
// if we're at the start, clear the cache of prefs
|
||||
if (isset($SESSION->backupprefs[$course->id])) {
|
||||
unset($SESSION->backupprefs[$course->id]);
|
||||
}
|
||||
include_once("backup_form.html");
|
||||
} else if ($launch == "check") {
|
||||
include_once("backup_check.html");
|
||||
|
||||
+107
-53
@@ -20,16 +20,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$backupprefs = new StdClass;
|
||||
$count = 0;
|
||||
backup_fetch_prefs_from_request($backupprefs,$count,$course);
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
}
|
||||
|
||||
//Checks for the required files/functions to backup every mod
|
||||
//And check if there is data about it
|
||||
$count = 0;
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
$modbackup = $modname."_backup_mods";
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
if (file_exists($modfile)) {
|
||||
include_once($modfile);
|
||||
if (function_exists($modbackup) and function_exists($modcheckbackup)) {
|
||||
$var = "exists_".$modname;
|
||||
$$var = true;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//Check data
|
||||
//Check module info
|
||||
$var = "backup_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
}
|
||||
}
|
||||
|
||||
//Check other parameters
|
||||
$backup_metacourse = optional_param('backup_metacourse',1);
|
||||
$backup_users = optional_param('backup_users',1);
|
||||
$backup_logs = optional_param('backup_logs',0);
|
||||
$backup_user_files = optional_param('backup_user_files',1);
|
||||
$backup_course_files = optional_param('backup_course_files',1);
|
||||
$backup_messages = optional_param('backup_messages',1);
|
||||
|
||||
if ($count == 0) {
|
||||
notice("No backupable modules are installed!");
|
||||
}
|
||||
@@ -39,6 +70,46 @@
|
||||
<table cellpadding="5">
|
||||
<?php
|
||||
|
||||
//Calculate the backup string
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
|
||||
//If non-translated, use "backup"
|
||||
if (substr($backup_word,0,1) == "[") {
|
||||
$backup_word= "backup";
|
||||
}
|
||||
|
||||
//Calculate the date format string
|
||||
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
//If non-translated, use "%Y%m%d-%H%M"
|
||||
if (substr($backup_date_format,0,1) == "[") {
|
||||
$backup_date_format = "%%Y%%m%%d-%%H%%M";
|
||||
}
|
||||
|
||||
//Calculate the shortname
|
||||
$backup_shortname = clean_filename($course->shortname);
|
||||
if (empty($backup_shortname) or $backup_shortname == '_' ) {
|
||||
$backup_shortname = $course->id;
|
||||
}
|
||||
|
||||
//Calculate the final backup filename
|
||||
//The backup word
|
||||
$backup_name = $backup_word."-";
|
||||
//The shortname
|
||||
$backup_name .= strtolower($backup_shortname)."-";
|
||||
//The date format
|
||||
$backup_name .= userdate(time(),$backup_date_format,99,false);
|
||||
//The extension
|
||||
$backup_name .= ".zip";
|
||||
//And finally, clean everything
|
||||
$backup_name = clean_filename($backup_name);
|
||||
|
||||
//Calculate the backup unique code to allow simultaneus backups (to define
|
||||
//the temp-directory name and records in backup temp tables
|
||||
$backup_unique_code = time();
|
||||
|
||||
if (empty($to)) {
|
||||
//Now print the Backup Name tr
|
||||
echo "<tr>";
|
||||
@@ -46,7 +117,7 @@
|
||||
echo get_string("name").":";
|
||||
echo "</b></td><td>";
|
||||
//Add as text field
|
||||
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backupprefs->backup_name."\" />";
|
||||
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\" />";
|
||||
echo "</td></tr>";
|
||||
|
||||
//Line
|
||||
@@ -56,30 +127,32 @@
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\" align=\"center\"><b>";
|
||||
|
||||
} else {
|
||||
echo '<input type="hidden" name="backup_name" value="'.$backup_name.'" /></b>';
|
||||
}
|
||||
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
|
||||
//inform the user.
|
||||
if ($backupprefs->backup_users == 2) {
|
||||
if ($backup_users == 2) {
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
if (isset($$var)) {
|
||||
$$var = 0;
|
||||
}
|
||||
$var = "backup_".$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
if (isset($$var)) {
|
||||
if ($modname == "exercise" || $modname == "workshop") {
|
||||
$backupprefs->$var = 0;
|
||||
$$var = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
$backup_user_files = 0;
|
||||
$backup_logs = 0;
|
||||
$backup_messages = 0;
|
||||
}
|
||||
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
|
||||
echo "<hr />";
|
||||
@@ -96,24 +169,21 @@
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = $CFG->dirroot.'/mod/'.$modname.'/backuplib.php';
|
||||
if (!file_exists($modfile)) {
|
||||
continue;
|
||||
}
|
||||
require_once($modfile);
|
||||
$modbackup = $modname."_backup_mods";
|
||||
//If exists the lib & function
|
||||
$var = "exists_".$modname;
|
||||
if (isset($backupprefs->$var) && $backupprefs->$var) {
|
||||
if (isset($$var) && $$var) {
|
||||
$var = "backup_".$modname;
|
||||
//Only if selected
|
||||
if (!empty($backupprefs->$var) and ($backupprefs->$var == 1)) {
|
||||
if ($$var == 1) {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\">";
|
||||
//Add hidden fields
|
||||
$var = "backup_".$modname;
|
||||
echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
|
||||
$var = "backup_user_info_".$modname;
|
||||
echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
|
||||
//Print the mod name
|
||||
echo "<b>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
|
||||
//Now look for user-data status
|
||||
@@ -121,29 +191,10 @@
|
||||
$backup_user_options[1] = get_string("withuserdata");
|
||||
$var = "backup_user_info_".$modname;
|
||||
//Print the user info
|
||||
echo $backup_user_options[$backupprefs->$var]."</b>";
|
||||
echo $backup_user_options[$$var]."</b>";
|
||||
//Call the check function to show more info
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
$var = $modname.'_instances';
|
||||
$instancestopass = array();
|
||||
if (!empty($backupprefs->$var) && is_array($backupprefs->$var) && count($backupprefs->$var)) {
|
||||
$table->data = array();
|
||||
$countinstances = 0;
|
||||
foreach ($backupprefs->$var as $instance) {
|
||||
$var1 = 'backup_'.$modname.'_instance_'.$instance->id;
|
||||
$var2 = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
if (!empty($backupprefs->$var1)) {
|
||||
$obj = new StdClass;
|
||||
$obj->name = $instance->name;
|
||||
$obj->userdata = $backupprefs->$var2;
|
||||
$obj->id = $instance->id;
|
||||
$instancestopass[$instance->id]= $obj;
|
||||
$countinstances++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$table->data = $modcheckbackup($id,$backupprefs->$var,$backupprefs->backup_unique_code,$instancestopass);
|
||||
$table->data = $modcheckbackup($id,$$var,$backup_unique_code);
|
||||
print_table($table);
|
||||
echo "</td></tr>";
|
||||
}
|
||||
@@ -161,16 +212,16 @@
|
||||
$user_options[0] = get_string("includeallusers");
|
||||
$user_options[1] = get_string("includecourseusers");
|
||||
$user_options[2] = get_string("includenoneusers");
|
||||
echo $user_options[$backupprefs->backup_users].'</b>';
|
||||
echo $user_options[$backup_users].'</b>';
|
||||
//Print info
|
||||
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages);
|
||||
$table->data = user_check_backup($id,$backup_unique_code,$backup_users,$backup_messages);
|
||||
print_table($table);
|
||||
echo "</td></tr>";
|
||||
|
||||
}
|
||||
|
||||
//Now print the Logs tr conditionally
|
||||
if ($backupprefs->backup_logs && empty($to)) {
|
||||
if ($backup_logs && empty($to)) {
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\"><b>";
|
||||
echo get_string("includelogentries").'</b>';
|
||||
@@ -181,35 +232,38 @@
|
||||
}
|
||||
|
||||
//Now print the User Files tr conditionally
|
||||
if ($backupprefs->backup_user_files) {
|
||||
if ($backup_user_files) {
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\"><b>";
|
||||
echo get_string("includeuserfiles").'</b>';
|
||||
//Print info
|
||||
$table->data = user_files_check_backup($id,$backupprefs->backup_unique_code);
|
||||
$table->data = user_files_check_backup($id,$backup_unique_code);
|
||||
print_table($table);
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
//Now print the Course Files tr conditionally
|
||||
if ($backupprefs->backup_course_files) {
|
||||
if ($backup_course_files) {
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\"><b>";
|
||||
echo get_string("includecoursefiles").'</b>';
|
||||
//Print info
|
||||
$table->data = course_files_check_backup($id,$backupprefs->backup_unique_code);
|
||||
$table->data = course_files_check_backup($id,$backup_unique_code);
|
||||
print_table($table);
|
||||
echo "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// now keep it for next time.
|
||||
$SESSION->backupprefs[$course->id] = $backupprefs;
|
||||
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
<center>
|
||||
<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code) ?>" />
|
||||
<input type="hidden" name="backup_metacourse" value="<?php p($backup_metacourse) ?>" />
|
||||
<input type="hidden" name="backup_users" value="<?php p($backup_users) ?>" />
|
||||
<input type="hidden" name="backup_logs" value="<?php p($backup_logs) ?>" />
|
||||
<input type="hidden" name="backup_user_files" value="<?php p($backup_user_files) ?>" />
|
||||
<input type="hidden" name="backup_course_files" value="<?php p($backup_course_files) ?>" />
|
||||
<input type="hidden" name="backup_messages" value="<?php p($backup_messages) ?>" />
|
||||
<input type="hidden" name="to" value="<?php p($to) ?>" />
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="launch" value="execute" />
|
||||
|
||||
+72
-12
@@ -26,8 +26,71 @@
|
||||
error("Site not found!");
|
||||
}
|
||||
|
||||
$preferences = new StdClass;
|
||||
backup_fetch_prefs_from_request($preferences,$count,$course);
|
||||
//Checks for the required files/functions to backup every mod
|
||||
//And check if there is data about it
|
||||
$count = 0;
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
$modbackup = $modname."_backup_mods";
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
if (file_exists($modfile)) {
|
||||
include_once($modfile);
|
||||
if (function_exists($modbackup) and function_exists($modcheckbackup)) {
|
||||
$var = "exists_".$modname;
|
||||
$$var = true;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
//Check data
|
||||
//Check module info
|
||||
$var = "backup_".$modname;
|
||||
$$var = optional_param( $var,0,PARAM_INT );
|
||||
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
$$var = optional_param( $var,0,PARAM_INT );
|
||||
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->userinfo = $$var;
|
||||
//And the name of the mod
|
||||
$preferences->mods[$modname]->name = $modname;
|
||||
}
|
||||
}
|
||||
|
||||
//Check other parameters
|
||||
$backup_metacourse = optional_param( 'backup_metacourse',1,PARAM_INT );
|
||||
$preferences->backup_metacourse = $backup_metacourse;
|
||||
|
||||
$backup_users = optional_param( 'backup_users',1,PARAM_INT );
|
||||
$preferences->backup_users = $backup_users;
|
||||
|
||||
$backup_logs = optional_param( 'backup_logs',0,PARAM_INT );
|
||||
$preferences->backup_logs = $backup_logs;
|
||||
|
||||
$backup_user_files = optional_param( 'backup_user_files',1,PARAM_INT );
|
||||
$preferences->backup_user_files = $backup_user_files;
|
||||
|
||||
$backup_course_files = optional_param( 'backup_course_files',2,PARAM_INT );
|
||||
$preferences->backup_course_files = $backup_course_files;
|
||||
|
||||
$backup_messages = optional_param( 'backup_messages',1,PARAM_INT );
|
||||
$preferences->backup_messages = $backup_messages;
|
||||
|
||||
$id = required_param('id');
|
||||
$preferences->backup_course = $id;
|
||||
|
||||
$backup_name = required_param('backup_name',PARAM_FILE );
|
||||
$preferences->backup_name = $backup_name;
|
||||
|
||||
$backup_unique_code = required_param('backup_unique_code');
|
||||
$preferences->backup_unique_code = $backup_unique_code;
|
||||
|
||||
//Another Info
|
||||
$preferences->moodle_version = $CFG->version;
|
||||
$preferences->moodle_release = $CFG->release;
|
||||
@@ -61,10 +124,10 @@
|
||||
//Check for temp and backup and backup_unique_code directory
|
||||
//Create them as needed
|
||||
echo "<li>".get_string("creatingtemporarystructures").'</li>';
|
||||
$status = check_and_create_backup_dir($preferences->backup_unique_code);
|
||||
$status = check_and_create_backup_dir($backup_unique_code);
|
||||
//Empty dir
|
||||
if ($status) {
|
||||
$status = clear_backup_dir($preferences->backup_unique_code);
|
||||
$status = clear_backup_dir($backup_unique_code);
|
||||
}
|
||||
|
||||
//Delete old_entries from backup tables
|
||||
@@ -81,7 +144,7 @@
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("writingheader").'</li>';
|
||||
//Obtain the xml file (create and open) and print prolog information
|
||||
$backup_file = backup_open_xml($preferences->backup_unique_code);
|
||||
$backup_file = backup_open_xml($backup_unique_code);
|
||||
echo "<li>".get_string("writinggeneralinfo").'</li>';
|
||||
//Prints general info about backup to file
|
||||
if ($backup_file) {
|
||||
@@ -127,7 +190,7 @@
|
||||
echo "</ul></li>";
|
||||
|
||||
//User info
|
||||
if ($status) {
|
||||
if ($status && $preferences->backup_users) {
|
||||
echo "<li>".get_string("writinguserinfo").'</li>';
|
||||
if (!$status = backup_user_info($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up user info");
|
||||
@@ -145,10 +208,9 @@
|
||||
|
||||
//If we have selected to backup quizzes, backup categories and
|
||||
//questions structure (step 1). See notes on mod/quiz/backuplib.php
|
||||
if ($status and !empty($preferences->mods['quiz']->backup)) {
|
||||
if ($status and $preferences->mods['quiz']->backup) {
|
||||
echo "<li>".get_string("writingcategoriesandquestions").'</li>';
|
||||
require_once($CFG->dirroot.'/mod/quiz/backuplib.php');
|
||||
if (!$status = backup_question_categories($backup_file,$preferences)) {
|
||||
if (!$status = quiz_backup_question_categories($backup_file,$preferences)) {
|
||||
notify("An error occurred while backing up quiz categories");
|
||||
}
|
||||
}
|
||||
@@ -318,8 +380,6 @@
|
||||
}
|
||||
error_log($filename);
|
||||
$SESSION->import_preferences = $preferences;
|
||||
print_continue($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
|
||||
print_continue($CFG->wwwroot.'/course/import.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
|
||||
}
|
||||
|
||||
$SESSION->backupprefs[$course->id] = null; // unset it so we're clear next time.
|
||||
?>
|
||||
|
||||
+4
-76
@@ -33,7 +33,6 @@
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
$modbackup = $modname."_backup_mods";
|
||||
$modbackupone = $modname.'_backup_one_mod';
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
if (file_exists($modfile)) {
|
||||
include_once($modfile);
|
||||
@@ -41,11 +40,6 @@
|
||||
$var = "exists_".$modname;
|
||||
$$var = true;
|
||||
$count++;
|
||||
// check that there are instances and we can back them up individually
|
||||
if (count_records('course_modules','course',$course->id,'module',$mod->id) && function_exists($modbackupone)) {
|
||||
$var = 'exists_one_'.$modname;
|
||||
$$var = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Check data
|
||||
@@ -100,7 +94,7 @@ function selectItemInRadioByName(formId, radioName, selectIndex ) {
|
||||
}
|
||||
|
||||
function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
myForm = document.getElementById(formId);
|
||||
myForm = document.getElementById(formId)
|
||||
for (i=0,n=myForm.elements.length;i<n;i++) {
|
||||
myLen = checkName.length;
|
||||
myName = myForm.elements[i].name;
|
||||
@@ -150,42 +144,19 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
$var = "backup_".$modname;
|
||||
//choose_from_menu($backup_options, $var, $$var, "");
|
||||
//Print the checkbox
|
||||
print_checkbox($var, $$var, $$var, get_string("modulenameplural",$modname),'','selectItemInCheckboxByName(\'form1\',\'backup_'.$modname.'\',this.checked)');
|
||||
print_checkbox($var, $$var, $$var, get_string("modulenameplural",$modname));
|
||||
$var = "backup_user_info_".$modname;
|
||||
echo "</td><td align=\"right\"> ";
|
||||
echo "</td><td>";
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (empty($to)) {
|
||||
$backup_user_options[0] = get_string("withoutuserdata");
|
||||
$backup_user_options[1] = get_string("withuserdata");
|
||||
//choose_from_menu($backup_user_options, $var, $$var, "");
|
||||
print_checkbox($var, $$var, $$var, get_string("userdata"),'','selectItemInCheckboxByName(\'form1\',\'backup_user_info_'.$modname.'\',this.checked)');
|
||||
print_checkbox($var, $$var, $$var, get_string("userdata"));
|
||||
} else {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
// if we have the backup_one_mod function, loop here.
|
||||
$var = 'exists_one_'.$modname;
|
||||
if (!empty($$var)) {
|
||||
echo '<tr><td></td><td colspan="3"><table class="backup-form-instances">';
|
||||
$instances = get_all_instances_in_course($modname,$course);
|
||||
foreach ($instances as $instance) {
|
||||
echo '<tr><td>';
|
||||
$var = 'backup_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
print_checkbox($var,$$var,$$var,$instance->name,$instance->name,'this.form.elements[\'backup_'.$modname.'\'].checked=1;');
|
||||
echo '</td><td align="right"> ';
|
||||
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,1);
|
||||
if (empty($to)) {
|
||||
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'backup_user_info_'.$modname.'\'].checked=1;');
|
||||
} else {
|
||||
echo '<input type="hidden" name="'.$var.'" value="0" />';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table></td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//Line
|
||||
@@ -276,55 +247,12 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo '<input type="hidden" name="backup_messages" value="0" />';
|
||||
}
|
||||
}
|
||||
|
||||
$backup_unique_code = time();
|
||||
|
||||
//Calculate the backup string
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
|
||||
//If non-translated, use "backup"
|
||||
if (substr($backup_word,0,1) == "[") {
|
||||
$backup_word= "backup";
|
||||
}
|
||||
|
||||
//Calculate the date format string
|
||||
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
//If non-translated, use "%Y%m%d-%H%M"
|
||||
if (substr($backup_date_format,0,1) == "[") {
|
||||
$backup_date_format = "%%Y%%m%%d-%%H%%M";
|
||||
}
|
||||
|
||||
//Calculate the shortname
|
||||
$backup_shortname = clean_filename($course->shortname);
|
||||
if (empty($backup_shortname) or $backup_shortname == '_' ) {
|
||||
$backup_shortname = $course->id;
|
||||
}
|
||||
|
||||
//Calculate the final backup filename
|
||||
//The backup word
|
||||
$backup_name = $backup_word."-";
|
||||
//The shortname
|
||||
$backup_name .= strtolower($backup_shortname)."-";
|
||||
//The date format
|
||||
$backup_name .= userdate(time(),$backup_date_format,99,false);
|
||||
//The extension
|
||||
$backup_name .= ".zip";
|
||||
//And finally, clean everything
|
||||
$backup_name = clean_filename($backup_name);
|
||||
|
||||
//Calculate the backup unique code to allow simultaneus backups (to define
|
||||
//the temp-directory name and records in backup temp tables
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
<center>
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="to" value="<?php p($to) ?>" />
|
||||
<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code); ?>" />
|
||||
<input type="hidden" name="backup_name" value="<?php p($backup_name); ?>" />
|
||||
<input type="hidden" name="launch" value="check" />
|
||||
<input type="submit" value="<?php print_string("continue") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
|
||||
+22
-58
@@ -98,17 +98,9 @@ function schedule_backup_cron() {
|
||||
if (!$backup_course) {
|
||||
mtrace(" ERROR (in backup_courses detection)");
|
||||
$status = false;
|
||||
continue;
|
||||
}
|
||||
// Skip backup of unavailable courses that have remained unmodified in a month
|
||||
$skipped = false;
|
||||
if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
|
||||
mtrace(" SKIPPING - hidden+unmodified");
|
||||
set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
|
||||
$skipped = true;
|
||||
}
|
||||
//Now we backup every non skipped course with nextstarttime < now
|
||||
if (!$skipped && $backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
|
||||
//Now we backup every course with nextstarttime < now
|
||||
if ($backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
|
||||
//We have to send a email because we have included at least one backup
|
||||
$emailpending = true;
|
||||
//Only make the backup if laststatus isn't 2-UNFINISHED (uncontrolled error)
|
||||
@@ -162,7 +154,6 @@ function schedule_backup_cron() {
|
||||
$count_ok = count_records('backup_courses','laststatus','1');
|
||||
$count_error = count_records('backup_courses','laststatus','0');
|
||||
$count_unfinished = count_records('backup_courses','laststatus','2');
|
||||
$count_skipped = count_records('backup_courses','laststatus','3');
|
||||
|
||||
//Build the message text
|
||||
//Summary
|
||||
@@ -170,7 +161,6 @@ function schedule_backup_cron() {
|
||||
$message .= "==================================================\n";
|
||||
$message .= " ".get_string('courses').": ".$count_all."\n";
|
||||
$message .= " ".get_string('ok').": ".$count_ok."\n";
|
||||
$message .= " ".get_string('skipped').": ".$count_skipped."\n";
|
||||
$message .= " ".get_string('error').": ".$count_error."\n";
|
||||
$message .= " ".get_string('unfinished').": ".$count_unfinished."\n\n";
|
||||
|
||||
@@ -335,7 +325,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$backup_config->backup_sche_coursefiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_messages)) {
|
||||
$backup_config->backup_sche_messages = 0;
|
||||
$backup_config->backup_sche_messages = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_active)) {
|
||||
$backup_config->backup_sche_active = 0;
|
||||
@@ -373,46 +363,26 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$var = "exists_".$modname;
|
||||
$$var = true;
|
||||
$count++;
|
||||
|
||||
// PENNY NOTES: I have moved from here to the closing brace inside
|
||||
// by two sets of ifs()
|
||||
// to avoid the backup failing on a non existant backup.
|
||||
// If the file/function/whatever doesn't exist, we don't want to set this
|
||||
// this module in backup preferences at all.
|
||||
//Check data
|
||||
//Check module info
|
||||
$var = "backup_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_modules;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_withuserdata;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->userinfo = $$var;
|
||||
//And the name of the mod
|
||||
$preferences->mods[$modname]->name = $modname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// now set instances
|
||||
if ($coursemods = get_course_mods($course->id)) {
|
||||
foreach ($coursemods as $mod) {
|
||||
if (array_key_exists($mod->modname,$preferences->mods)) { // we are to backup this module
|
||||
if (empty($preferences->mods[$mod->modname]->instances)) {
|
||||
$preferences->mods[$mod->modname]->instances = array(); // avoid warnings
|
||||
}
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->backup = $preferences->mods[$modname]->backup;
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->userinfo = $preferences->mods[$modname]->userinfo;
|
||||
// there isn't really a nice way to do this...
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->name = get_field($mod->modname,'name','id',$mod->instance);
|
||||
//Check data
|
||||
//Check module info
|
||||
$var = "backup_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_modules;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
if (!isset($$var)) {
|
||||
$$var = $backup_config->backup_sche_withuserdata;
|
||||
}
|
||||
//Now stores all the mods preferences into an array into preferences
|
||||
$preferences->mods[$modname]->userinfo = $$var;
|
||||
//And the name of the mod
|
||||
$preferences->mods[$modname]->name = $modname;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,13 +484,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
//Now calculate the users
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating users");
|
||||
//Decide about include users with messages, based on SITEID
|
||||
if ($preferences->backup_messages && $preferences->backup_course == SITEID) {
|
||||
$include_message_users = true;
|
||||
} else {
|
||||
$include_message_users = false;
|
||||
}
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$include_message_users);
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$preferences->backup_messages);
|
||||
}
|
||||
|
||||
//Now calculate the logs
|
||||
@@ -641,7 +605,7 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
//questions structure (step 1). See notes on mod/quiz/backuplib.php
|
||||
if ($status and $preferences->mods['quiz']->backup) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," categories & questions");
|
||||
$status = backup_question_categories($backup_file,$preferences);
|
||||
$status = quiz_backup_question_categories($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print logs if selected
|
||||
|
||||
+31
-210
@@ -78,7 +78,7 @@
|
||||
|
||||
//Insert the record id. backup_users decide it.
|
||||
//When all users
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$status = insert_record("backup_ids",$backupids_rec,false,"backup_code");
|
||||
$count_users++;
|
||||
}
|
||||
//Do some output
|
||||
@@ -414,20 +414,13 @@
|
||||
}
|
||||
|
||||
//Return the xml start tag
|
||||
function start_tag($tag,$level=0,$endline=false,$attributes=null) {
|
||||
function start_tag($tag,$level=0,$endline=false) {
|
||||
if ($endline) {
|
||||
$endchar = "\n";
|
||||
} else {
|
||||
$endchar = "";
|
||||
}
|
||||
$attrstring = '';
|
||||
if (!empty($attributes) && is_array($attributes)) {
|
||||
foreach ($attributes as $key => $value) {
|
||||
$attrstring .= " ".xml_tag_safe_content($key)."=\"".
|
||||
xml_tag_safe_content($value)."\"";
|
||||
}
|
||||
}
|
||||
return str_repeat(" ",$level*2)."<".strtoupper($tag).$attrstring.">".$endchar;
|
||||
return str_repeat(" ",$level*2)."<".strtoupper($tag).">".$endchar;
|
||||
}
|
||||
|
||||
//Return the xml end tag
|
||||
@@ -441,38 +434,30 @@
|
||||
}
|
||||
|
||||
//Return the start tag, the contents and the end tag
|
||||
function full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {
|
||||
function full_tag($tag,$level=0,$endline=true,$content,$to_utf=true) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
//Here we encode absolute links
|
||||
$content = backup_encode_absolute_links($content);
|
||||
|
||||
$st = start_tag($tag,$level,$endline,$attributes);
|
||||
|
||||
$co = xml_tag_safe_content($content);
|
||||
|
||||
$et = end_tag($tag,0,true);
|
||||
|
||||
return $st.$co.$et;
|
||||
}
|
||||
|
||||
|
||||
function xml_tag_safe_content($content) {
|
||||
global $CFG;
|
||||
//If enabled, we strip all the control chars (\x0-\x1f) from the text but tabs (\x9),
|
||||
//newlines (\xa) and returns (\xd). The delete control char (\x7f) is also included.
|
||||
//If enabled, we strip all the control chars from the text but tabs, newlines and returns
|
||||
//because they are forbiden in XML 1.0 specs. The expression below seems to be
|
||||
//UTF-8 safe too because it simply ignores the rest of characters.
|
||||
$content = preg_replace("/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is","",$content);
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
// Don't perform the conversion. Contents are Unicode.
|
||||
$content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
|
||||
if (!empty($CFG->backup_strip_controlchars)) {
|
||||
$content = preg_replace("/(?(?=[[:cntrl:]])[^\n\r\t])/is","",$content);
|
||||
}
|
||||
|
||||
//Start to build the tag
|
||||
$st = start_tag($tag,$level,$endline);
|
||||
$co="";
|
||||
if ($to_utf) {
|
||||
$co = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
|
||||
} else {
|
||||
// Perform the conversion. Contents aren't Unicode.
|
||||
$content = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
|
||||
}
|
||||
return $content;
|
||||
$co = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
|
||||
}
|
||||
$et = end_tag($tag,0,true);
|
||||
return $st.$co.$et;
|
||||
}
|
||||
|
||||
//Prints General info about the course
|
||||
@@ -513,39 +498,13 @@
|
||||
$included = "true";
|
||||
if ($element->userinfo) {
|
||||
$userinfo = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
//Prints the mod start
|
||||
fwrite ($bf,start_tag("MOD",3,true));
|
||||
fwrite ($bf,full_tag("NAME",4,false,$element->name));
|
||||
fwrite ($bf,full_tag("INCLUDED",4,false,$included));
|
||||
fwrite ($bf,full_tag("USERINFO",4,false,$userinfo));
|
||||
|
||||
if (is_array($preferences->mods[$element->name]->instances)
|
||||
&& count($preferences->mods[$element->name]->instances)) {
|
||||
fwrite ($bf, start_tag("INSTANCES",4,true));
|
||||
foreach ($preferences->mods[$element->name]->instances as $id => $object) {
|
||||
if (!empty($object->backup)) {
|
||||
//Calculate info
|
||||
$included = "false";
|
||||
$userinfo = "false";
|
||||
if ($object->backup) {
|
||||
$included = "true";
|
||||
if ($object->userinfo) {
|
||||
$userinfo = "true";
|
||||
}
|
||||
}
|
||||
fwrite ($bf, start_tag("INSTANCE",5,true));
|
||||
fwrite ($bf, full_tag("ID",5,false,$id));
|
||||
fwrite ($bf, full_tag("NAME",5,false,$object->name));
|
||||
fwrite ($bf, full_tag("INCLUDED",5,false,$included)) ;
|
||||
fwrite ($bf, full_tag("USERINFO",5,false,$userinfo));
|
||||
fwrite ($bf, end_tag("INSTANCE",5,true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("INSTANCES",4,true));
|
||||
}
|
||||
|
||||
|
||||
//Print the end
|
||||
fwrite ($bf,end_tag("MOD",3,true));
|
||||
@@ -650,7 +609,6 @@
|
||||
fwrite ($bf,full_tag("LANG",3,false,$course->lang));
|
||||
fwrite ($bf,full_tag("THEME",3,false,$course->theme));
|
||||
fwrite ($bf,full_tag("COST",3,false,$course->cost));
|
||||
fwrite ($bf,full_tag("CURRENCY",3,false,$course->currency));
|
||||
fwrite ($bf,full_tag("MARKER",3,false,$course->marker));
|
||||
fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible));
|
||||
fwrite ($bf,full_tag("HIDDENSECTIONS",3,false,$course->hiddensections));
|
||||
@@ -987,14 +945,6 @@
|
||||
fwrite ($bf,start_tag("MODS",4,true));
|
||||
$first_record = false;
|
||||
}
|
||||
// if we're doing selected instances, check that too.
|
||||
if (is_array($preferences->mods[$moduletype]->instances)
|
||||
&& count($preferences->mods[$moduletype]->instances)
|
||||
&& (!array_key_exists($course_module[$tok]->instance,$preferences->mods[$moduletype]->instances)
|
||||
|| empty($preferences->mods[$moduletype]->instances[$course_module[$tok]->instance]->backup))) {
|
||||
$tok = strtok(",");
|
||||
continue;
|
||||
}
|
||||
//Print mod info from course_modules
|
||||
fwrite ($bf,start_tag("MOD",5,true));
|
||||
//Save neccesary info to backup_ids
|
||||
@@ -1002,6 +952,7 @@
|
||||
fwrite ($bf,full_tag("TYPE",6,false,$moduletype));
|
||||
fwrite ($bf,full_tag("INSTANCE",6,false,$course_module[$tok]->instance));
|
||||
fwrite ($bf,full_tag("ADDED",6,false,$course_module[$tok]->added));
|
||||
fwrite ($bf,full_tag("DELETED",6,false,$course_module[$tok]->deleted));
|
||||
fwrite ($bf,full_tag("SCORE",6,false,$course_module[$tok]->score));
|
||||
fwrite ($bf,full_tag("INDENT",6,false,$course_module[$tok]->indent));
|
||||
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module[$tok]->visible));
|
||||
@@ -1048,6 +999,7 @@
|
||||
//Output all user data
|
||||
fwrite ($bf,full_tag("ID",4,false,$user_data->id));
|
||||
fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
|
||||
fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
|
||||
fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
|
||||
fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
|
||||
fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
|
||||
@@ -1077,7 +1029,7 @@
|
||||
fwrite ($bf,full_tag("LASTACCESS",4,false,$user_data->lastaccess));
|
||||
fwrite ($bf,full_tag("LASTLOGIN",4,false,$user_data->lastlogin));
|
||||
fwrite ($bf,full_tag("CURRENTLOGIN",4,false,$user_data->currentlogin));
|
||||
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastip));
|
||||
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastIP));
|
||||
fwrite ($bf,full_tag("SECRET",4,false,$user_data->secret));
|
||||
fwrite ($bf,full_tag("PICTURE",4,false,$user_data->picture));
|
||||
fwrite ($bf,full_tag("URL",4,false,$user_data->url));
|
||||
@@ -1659,29 +1611,14 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
require_once($CFG->dirroot.'/mod/'.$module.'/backuplib.php');
|
||||
|
||||
if (is_array($preferences->mods[$module]->instances)) {
|
||||
$onemodbackup = $module.'_backup_one_mod';
|
||||
if (function_exists($onemodbackup)) {
|
||||
foreach ($preferences->mods[$module]->instances as $instance => $object) {
|
||||
if (!empty($object->backup)) {
|
||||
$status = $onemodbackup($bf,$preferences,$instance);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
} else { // whole module.
|
||||
//First, re-check if necessary functions exists
|
||||
$modbackup = $module."_backup_mods";
|
||||
if (function_exists($modbackup)) {
|
||||
//Call the function
|
||||
$status = $modbackup($bf,$preferences);
|
||||
} else {
|
||||
//Something was wrong. Function should exist.
|
||||
$status = false;
|
||||
}
|
||||
//First, re-check if necessary functions exists
|
||||
$modbackup = $module."_backup_mods";
|
||||
if (function_exists($modbackup)) {
|
||||
//Call the function
|
||||
$status = $modbackup($bf,$preferences);
|
||||
} else {
|
||||
//Something was wrong. Function should exist.
|
||||
$status = false;
|
||||
}
|
||||
|
||||
return $status;
|
||||
@@ -1725,7 +1662,7 @@
|
||||
}
|
||||
|
||||
if ($result != $content && $CFG->debug>7) { //Debug
|
||||
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />'; //Debug
|
||||
echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />'; //Debug
|
||||
} //Debug
|
||||
|
||||
return $result;
|
||||
@@ -1919,120 +1856,4 @@
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* compatibility function
|
||||
* with new granular backup
|
||||
* we need to know
|
||||
*/
|
||||
function backup_userdata_selected($preferences,$modname,$modid) {
|
||||
return ((empty($preferences->mods[$modname]->instances)
|
||||
&& !empty($preferences->mods[$modname]->userinfo))
|
||||
|| (is_array($preferences->mods[$modname]->instances)
|
||||
&& array_key_exists($modid,$preferences->mods[$modname]->instances)
|
||||
&& !empty($preferences->mods[$modname]->instances[$modid]->userinfo)));
|
||||
}
|
||||
|
||||
|
||||
function backup_mod_selected($preferences,$modname,$modid) {
|
||||
return ((empty($preferences->mods[$modname]->instances)
|
||||
&& !empty($preferences->mods[$modname]->backup))
|
||||
|| (is_array($preferences->mods[$modname]->instances)
|
||||
&& array_key_exists($modid,$preferences->mods[$modname]->instances)
|
||||
&& !empty($preferences->mods[$modname]->instances[$modid]->backup)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks for the required files/functions to backup every mod
|
||||
* And check if there is data about it
|
||||
*/
|
||||
function backup_fetch_prefs_from_request(&$preferences,&$count,$course) {
|
||||
global $CFG,$SESSION;
|
||||
|
||||
// check to see if it's in the session already
|
||||
if (!empty($SESSION->backupprefs) && array_key_exists($course->id,$SESSION->backupprefs) && !empty($SESSION->backupprefs[$course->id])) {
|
||||
$sprefs = $SESSION->backupprefs[$course->id];
|
||||
$preferences = $sprefs;
|
||||
// refetch backup_name just in case.
|
||||
$bn = optional_param('backup_name','',PARAM_FILE);
|
||||
if (!empty($bn)) {
|
||||
$preferences->backup_name = $bn;
|
||||
}
|
||||
$count = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
$modbackup = $modname."_backup_mods";
|
||||
$modbackupone = $modname."_backup_one_mod";
|
||||
$modcheckbackup = $modname."_check_backup_mods";
|
||||
if (!file_exists($modfile)) {
|
||||
continue;
|
||||
}
|
||||
include_once($modfile);
|
||||
if (!function_exists($modbackup) || !function_exists($modcheckbackup)) {
|
||||
continue;
|
||||
}
|
||||
$var = "exists_".$modname;
|
||||
$preferences->$var = true;
|
||||
$count++;
|
||||
// check that there are instances and we can back them up individually
|
||||
if (!count_records('course_modules','course',$course->id,'module',$mod->id) || !function_exists($modbackupone)) {
|
||||
continue;
|
||||
}
|
||||
$var = 'exists_one_'.$modname;
|
||||
$preferences->$var = true;
|
||||
$varname = $modname.'_instances';
|
||||
$preferences->$varname = get_all_instances_in_course($modname,$course);
|
||||
foreach ($preferences->$varname as $instance) {
|
||||
$preferences->mods[$modname]->instances[$instance->id]->name = $instance->name;
|
||||
$var = 'backup_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
$preferences->$var = $$var;
|
||||
$preferences->mods[$modname]->instances[$instance->id]->backup = $$var;
|
||||
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
$preferences->$var = $$var;
|
||||
$preferences->mods[$modname]->instances[$instance->id]->userinfo = $$var;
|
||||
$var = 'backup_'.$modname.'_instances';
|
||||
$preferences->$var = 1; // we need this later to determine what to display in modcheckbackup.
|
||||
}
|
||||
|
||||
//Check data
|
||||
//Check module info
|
||||
$preferences->mods[$modname]->name = $modname;
|
||||
|
||||
$var = "backup_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
$preferences->$var = $$var;
|
||||
$preferences->mods[$modname]->backup = $$var;
|
||||
|
||||
//Check include user info
|
||||
$var = "backup_user_info_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
$preferences->$var = $$var;
|
||||
$preferences->mods[$modname]->userinfo = $$var;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Check other parameters
|
||||
$preferences->backup_metacourse = optional_param('backup_metacourse',1,PARAM_INT);
|
||||
$preferences->backup_users = optional_param('backup_users',1,PARAM_INT);
|
||||
$preferences->backup_logs = optional_param('backup_logs',0,PARAM_INT);
|
||||
$preferences->backup_user_files = optional_param('backup_user_files',1,PARAM_INT);
|
||||
$preferences->backup_course_files = optional_param('backup_course_files',1,PARAM_INT);
|
||||
$preferences->backup_messages = optional_param('backup_messages',1,PARAM_INT);
|
||||
$preferences->backup_course = $course->id;
|
||||
$preferences->backup_name = required_param('backup_name',PARAM_FILE );
|
||||
$preferences->backup_unique_code = required_param('backup_unique_code');
|
||||
|
||||
// put it (back) in the session
|
||||
$SESSION->backupprefs[$course->id] = $preferences;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+13
-10
@@ -1,9 +1,10 @@
|
||||
Ziba Scott <ziba@linuxbox.com> 06/23/05
|
||||
Ziba Scott <ziba@linuxbox.com> 11/19/04
|
||||
|
||||
This is a utility to convert Blackboard Course export zip files into
|
||||
Moodle course export zip files. It has been successfully tested with
|
||||
Blackboard 5.5 and Moodle 1.4.1 and Moodle CVS. There is minimal
|
||||
Blackboard 6 support. It will convert:
|
||||
This is a beta demonstration of a utility to convert Blackboard
|
||||
Course export zip files into Moodle course export zip files. It
|
||||
has been successfully tested with Blackboard 5.5 and
|
||||
Moodle 1.4.1 and Moodle CVS. There is minimal Blackboard 6 support.
|
||||
It will convert:
|
||||
|
||||
* Course Name/Title
|
||||
* Forum Topics
|
||||
@@ -11,14 +12,17 @@ Blackboard 6 support. It will convert:
|
||||
* Assignments
|
||||
* External Links
|
||||
|
||||
The current status of this project is
|
||||
exploration/proof-of-concept. We have successfully converted
|
||||
basic Blackboard course information as well as course documents
|
||||
and forum topics using the XSLT methods described above.
|
||||
|
||||
AUTOMATED OPERATION:
|
||||
|
||||
REQUIREMENTS FOR WEB INTERFACE:
|
||||
*Moodle 1.4.1 or greater
|
||||
*PHP 4.3 compiled with --enable-xslt --with-xslt-sablot options
|
||||
*PHP compiled with --enable-xslt --with-xslt-sablot options
|
||||
(Check php.net for instructions on enabling xslt for your platform)
|
||||
*Alternatively, PHP 5 compiled with xml and xsl support (-with-xsl)
|
||||
|
||||
INSTALLATION:
|
||||
*Unpack this file into the "backup" directory
|
||||
@@ -32,11 +36,10 @@ MANUAL OPERATION:
|
||||
*An XSLT 1.0 processor (like Sablotron)
|
||||
*A zipping utility
|
||||
|
||||
REQUIREMENTS FOR COMMAND LINE INTERFACE:
|
||||
REQUIREMENTS FOR WEB INTERFACE:
|
||||
|
||||
*Linux/Unix
|
||||
*PHP 4 compiled with --enable-xslt --with-xslt-sablot options.
|
||||
*PHP 5 compiled with -with-xsl and the default xml support left in.
|
||||
*PHP compiled with --enable-xslt --with-xslt-sablot options.
|
||||
*Apache with write access to /tmp
|
||||
*A commandline zipping utility
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
// This file facilitates the conversion of a Blackboard course export
|
||||
// into a Moodle course export. It assumes an unzipped directory and makes in-place alterations.
|
||||
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
|
||||
// Ziba Scott <ziba@linuxbox.com> 10-25-04
|
||||
require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
require_once('xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
@@ -36,7 +34,7 @@ function blackboard_convert($dir){
|
||||
|
||||
|
||||
// Check for a Blackboard manifest file
|
||||
if (is_readable($dir.'/imsmanifest.xml') && !is_readable($dir.'/moodle.xml')){
|
||||
if (is_readable($dir.'/imsmanifest.xml')){
|
||||
|
||||
if (!function_exists('xslt_create')) { // XSLT MUST be installed for this to work
|
||||
notify('You need the XSLT library installed in PHP to open this Blackboard file');
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
function migrate2utf8_backup_ids_info($recordid){
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$backupids= get_record('backup_ids', 'id', $recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = null;
|
||||
$userlang = null; //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($backupids->info, $fromenc);
|
||||
|
||||
$newbackupids = new object;
|
||||
$newbackupids->id = $recordid;
|
||||
$newbackupids->info = $result;
|
||||
migrate2utf8_update_record('backup_ids',$newbackupids);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
@@ -1,36 +0,0 @@
|
||||
<DBMIGRATION type="backup" VERSION="2005120100">
|
||||
<TABLES>
|
||||
<TABLE name="backup_config">
|
||||
<FIELDS>
|
||||
<FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
|
||||
<FIELD name="value" method="NO_CONV" type="varchar" length="255" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="backup_courses">
|
||||
<FIELDS>
|
||||
<FIELD name="laststatus" method="NO_CONV" type="char" length="1" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="backup_files">
|
||||
<FIELDS>
|
||||
<FIELD name="file_type" method="NO_CONV" type="varchar" length="10" dropindex="backup_files_uk" />
|
||||
<FIELD name="path" method="NO_CONV" type="varchar" length="255" adduniqueindex="backup_files_uk (backup_code, file_type(10), path(255))"/>
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="backup_ids">
|
||||
<FIELDS>
|
||||
<FIELD name="table_name" method="NO_CONV" type="varchar" length="30" dropindex="backup_ids_uk" adduniqueindex=" backup_ids_uk(backup_code, table_name(30), old_id)"/>
|
||||
<FIELD name="info" method="PHP_FUNCTION" type="mediumtext" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_backup_ids_info(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="backup_log">
|
||||
<FIELDS>
|
||||
<FIELD name="info" method="NO_CONV" type="varchar" length="255" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</DBMIGRATION>
|
||||
+1
-62
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?PHP //$Id$
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// backup/restore utility.
|
||||
@@ -104,67 +104,6 @@ function backup_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2006011600 and $result) {
|
||||
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
|
||||
if ($result) {
|
||||
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_files` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(10) unsigned NOT NULL default '0',
|
||||
`file_type` varchar(10) NOT NULL default '',
|
||||
`path` varchar(255) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `{$CFG->prefix}backup_files_uk` (`backup_code`,`file_type`,`path`)
|
||||
) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.'");
|
||||
}
|
||||
if ($result) {
|
||||
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
|
||||
}
|
||||
if ($result) {
|
||||
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_ids` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(12) unsigned NOT NULL default '0',
|
||||
`table_name` varchar(30) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
`info` mediumtext,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `{$CFG->prefix}backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
|
||||
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// code to drop the prefix in tables
|
||||
if ($oldversion < 2006042100) {
|
||||
// see bug 5205, silent drops, so should not panic anyone
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX backup_files_uk", false);
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX {$CFG->prefix}backup_files_uk", false);
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX backup_ids_uk", false);
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX {$CFG->prefix}backup_ids_uk", false);
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files ADD UNIQUE INDEX backup_files_uk(backup_code,file_type(10),path(255))");
|
||||
$result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids ADD UNIQUE INDEX backup_ids_uk(backup_code,table_name(30),old_id)");
|
||||
}
|
||||
|
||||
// chaing default nulls to not null default 0
|
||||
|
||||
if ($oldversion < 2006042800) {
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}backup_files SET old_id='0' WHERE old_id IS NULL");
|
||||
table_column('backup_files','old_id','old_id','int','10','unsigned','0','not null');
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}backup_files SET new_id='0' WHERE new_id IS NULL");
|
||||
table_column('backup_files','new_id','new_id','int','10','unsigned','0','not null');
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}backup_ids SET new_id='0' WHERE new_id IS NULL");
|
||||
table_column('backup_ids','new_id','new_id','int','10','unsigned','0','not null');
|
||||
|
||||
execute_sql("UPDATE {$CFG->prefix}backup_ids SET info='' WHERE info IS NULL");
|
||||
table_column('backup_ids','info','info','mediumtext','','','','not null');
|
||||
}
|
||||
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
|
||||
+6
-10
@@ -3,14 +3,12 @@
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_files` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(10) unsigned NOT NULL default '0',
|
||||
`file_type` varchar(10) NOT NULL default '',
|
||||
`path` varchar(255) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`)
|
||||
`old_id` int(10) unsigned default NULL,
|
||||
`new_id` int(10) unsigned default NULL,
|
||||
PRIMARY KEY (`backup_code`,`file_type`,`path`)
|
||||
) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -19,14 +17,12 @@ CREATE TABLE `prefix_backup_files` (
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_ids` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(12) unsigned NOT NULL default '0',
|
||||
`table_name` varchar(30) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
`info` mediumtext NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
|
||||
`new_id` int(10) unsigned default NULL,
|
||||
`info` mediumtext,
|
||||
PRIMARY KEY (`backup_code`,`table_name`,`old_id`)
|
||||
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore';
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ rem
|
||||
drop TABLE prefix_backup_config;
|
||||
|
||||
CREATE TABLE prefix_backup_config (
|
||||
id number(10) default '0' not null,
|
||||
name varchar2(255) default '' not null,
|
||||
value varchar2(255) default '' not null,
|
||||
id number(10) not null,
|
||||
name varchar2(255) not null,
|
||||
value varchar2(255) not null,
|
||||
constraint pk_baco primary key (id),
|
||||
constraint uk_baco_name unique (name)
|
||||
);
|
||||
|
||||
+1
-46
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?PHP //$Id$
|
||||
//
|
||||
// This file keeps track of upgrades to Moodle's
|
||||
// backup/restore utility.
|
||||
@@ -23,55 +23,10 @@ function backup_upgrade($oldversion=0) {
|
||||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 2006011600 and $result) {
|
||||
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
|
||||
if ($result) {
|
||||
$result = execute_sql("CREATE TABLE {$CFG->prefix}backup_files (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
file_type varchar(10) NOT NULL default '',
|
||||
path varchar(255) NOT NULL default '',
|
||||
old_id integer default NULL,
|
||||
new_id integer default NULL,
|
||||
CONSTRAINT {$CFG->prefix}backup_files_uk UNIQUE (backup_code, file_type, path))");
|
||||
}
|
||||
if ($result) {
|
||||
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
|
||||
}
|
||||
if ($result) {
|
||||
$result = execute_sql("CREATE TABLE {$CFG->prefix}backup_ids (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
table_name varchar(30) NOT NULL default '',
|
||||
old_id integer NOT NULL default '0',
|
||||
new_id integer default NULL,
|
||||
info text,
|
||||
CONSTRAINT {$CFG->prefix}backup_ids_uk UNIQUE (backup_code, table_name, old_id))");
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2006042801) {
|
||||
modify_database('', 'ALTER TABLE prefix_backup_log
|
||||
ALTER COLUMN "time" TYPE integer,
|
||||
ALTER COLUMN "time" SET DEFAULT 0,
|
||||
ALTER COLUMN laststarttime TYPE integer,
|
||||
ALTER COLUMN laststarttime SET DEFAULT 0,
|
||||
ALTER COLUMN courseid TYPE integer,
|
||||
ALTER COLUMN courseid SET DEFAULT 0');
|
||||
|
||||
modify_database('', 'ALTER TABLE mdl_backup_courses
|
||||
ALTER COLUMN lastendtime TYPE integer,
|
||||
ALTER COLUMN lastendtime SET DEFAULT 0,
|
||||
ALTER COLUMN laststarttime TYPE integer,
|
||||
ALTER COLUMN laststarttime SET DEFAULT 0,
|
||||
ALTER COLUMN courseid TYPE integer,
|
||||
ALTER COLUMN courseid SET DEFAULT 0,
|
||||
ALTER COLUMN nextstarttime TYPE integer,
|
||||
ALTER COLUMN nextstarttime SET DEFAULT 0');
|
||||
|
||||
}
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
+19
-19
@@ -1,32 +1,35 @@
|
||||
# THIS FILE IS UNTESTED!!!
|
||||
# PLEASE HELP TEST/FIX IT AND CONTACT MARTIN OR ELOY!
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_files
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_files (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
file_type varchar(10) NOT NULL default '',
|
||||
path varchar(255) NOT NULL default '',
|
||||
old_id integer default NULL,
|
||||
new_id integer default NULL,
|
||||
CONSTRAINT prefix_backup_files_uk UNIQUE (backup_code, file_type, path)
|
||||
new_id integer default NULL
|
||||
);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
CREATE INDEX prefix_backup_codetypepath_idx ON prefix_backup_files (backup_code,file_type,path);
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_ids
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_ids (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
backup_code int8 NOT NULL default '0',
|
||||
table_name varchar(30) NOT NULL default '',
|
||||
old_id integer NOT NULL default '0',
|
||||
new_id integer default NULL,
|
||||
info text,
|
||||
CONSTRAINT prefix_backup_ids_uk UNIQUE (backup_code, table_name, old_id)
|
||||
old_id int8 NOT NULL default '0',
|
||||
new_id int8 default NULL,
|
||||
info text
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_backup_codenameid_idx ON prefix_backup_ids (backup_code,table_name,old_id);
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_config
|
||||
@@ -38,30 +41,27 @@ CREATE TABLE prefix_backup_config (
|
||||
value varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_courses
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_courses (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid integer UNIQUE NOT NULL default '0',
|
||||
laststarttime integer NOT NULL default '0',
|
||||
lastendtime integer NOT NULL default '0',
|
||||
courseid int8 UNIQUE NOT NULL default '0',
|
||||
laststarttime int8 NOT NULL default '0',
|
||||
lastendtime int8 NOT NULL default '0',
|
||||
laststatus varchar(1) NOT NULL default '0',
|
||||
nextstarttime integer NOT NULL default '0'
|
||||
nextstarttime int8 NOT NULL default '0'
|
||||
);
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_log
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_log (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid integer NOT NULL default '0',
|
||||
time integer NOT NULL default '0',
|
||||
laststarttime integer NOT NULL default '0',
|
||||
courseid int8 NOT NULL default '0',
|
||||
time int8 NOT NULL default '0',
|
||||
laststarttime int8 NOT NULL default '0',
|
||||
info varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
+25
-125
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?PHP //$Id$
|
||||
//This file contains all the general function needed (file manipulation...)
|
||||
//not directly part of the backup/restore utility
|
||||
|
||||
@@ -81,6 +81,24 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Function to check if a directory exists
|
||||
//and, optionally, create it
|
||||
function check_dir_exists($dir,$create=false) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
if(!is_dir($dir)) {
|
||||
if (!$create) {
|
||||
$status = false;
|
||||
} else {
|
||||
umask(0000);
|
||||
$status = mkdir ($dir,$CFG->directorypermissions);
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Function to check and create the needed dir to
|
||||
//save all the backup
|
||||
function check_and_create_backup_dir($backup_unique_code) {
|
||||
@@ -409,10 +427,10 @@
|
||||
$rec->backup_code = $backup_unique_code;
|
||||
$rec->table_name = $table;
|
||||
$rec->old_id = $old_id;
|
||||
$rec->new_id = ($new_id === null? 0 : $new_id);
|
||||
$rec->new_id =$new_id;
|
||||
$rec->info = $info_to_save;
|
||||
|
||||
$status = insert_record('backup_ids', $rec, false);
|
||||
$status = insert_record ("backup_ids", $rec, false,"backup_code");
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
@@ -470,40 +488,26 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function is used to add slashes (and decode from UTF-8 if needed)
|
||||
//This function is used to add slashes and decode from UTF-8
|
||||
//It's used intensivelly when restoring modules and saving them in db
|
||||
function backup_todb ($data) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->unicodedb)) {
|
||||
return restore_decode_absolute_links(addslashes(utf8_decode($data)));
|
||||
} else {
|
||||
return restore_decode_absolute_links(addslashes($data));
|
||||
}
|
||||
return restore_decode_absolute_links(addslashes(utf8_decode($data)));
|
||||
}
|
||||
|
||||
//This function is used to check that every necessary function to
|
||||
//backup/restore exists in the current php installation. Thanks to
|
||||
//gregb@crowncollege.edu by the idea.
|
||||
function backup_required_functions($justcheck=false) {
|
||||
function backup_required_functions() {
|
||||
|
||||
if(!function_exists('utf8_encode')) {
|
||||
if (empty($justcheck)) {
|
||||
error('You need to add XML support to your PHP installation');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
error('You need to add XML support to your PHP installation');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//This function send n white characters to the browser and flush the
|
||||
//output buffer. Used to avoid browser timeouts and to show the progress.
|
||||
function backup_flush($n=0,$time=false) {
|
||||
if (defined('RESTORE_SILENTLY_NOFLUSH')) {
|
||||
return;
|
||||
}
|
||||
if ($time) {
|
||||
$ti = strftime("%X",time());
|
||||
} else {
|
||||
@@ -539,108 +543,4 @@
|
||||
|
||||
return ($status && $status2);
|
||||
}
|
||||
|
||||
/** this function will restore an entire backup.zip into the specified course
|
||||
* using standard moodle backup/restore functions, but silently.
|
||||
* @param string $pathtofile the absolute path to the backup file.
|
||||
* @param int $destinationcourse the course id to restore to.
|
||||
* @param boolean $emptyfirst whether to delete all coursedata first.
|
||||
* @param boolean $userdata whether to include any userdata that may be in the backup file.
|
||||
*/
|
||||
function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false) {
|
||||
global $CFG,$SESSION,$USER; // is there such a thing on cron? I guess so..
|
||||
|
||||
if (empty($USER)) {
|
||||
$USER = get_admin();
|
||||
$USER->admin = 1; // not sure why, but this doesn't get set
|
||||
}
|
||||
|
||||
define('RESTORE_SILENTLY',true); // don't output all the stuff to us.
|
||||
|
||||
$debuginfo = 'import_backup_file_silently: ';
|
||||
$cleanupafter = false;
|
||||
$errorstr = ''; // passed by reference to restore_precheck to get errors from.
|
||||
|
||||
if (!$course = get_record('course','id',$destinationcourse)) {
|
||||
mtrace($debuginfo.'Course with id $destinationcourse was not a valid course!');
|
||||
return false;
|
||||
}
|
||||
|
||||
// first check we have a valid file.
|
||||
if (!file_exists($pathtofile) || !is_readable($pathtofile)) {
|
||||
mtrace($debuginfo.'File '.$pathtofile.' either didn\'t exist or wasn\'t readable');
|
||||
return false;
|
||||
}
|
||||
|
||||
// now make sure it's a zip file
|
||||
require_once($CFG->dirroot.'/lib/filelib.php');
|
||||
$filename = substr($pathtofile,strrpos($pathtofile,'/')+1);
|
||||
$mimetype = mimeinfo("type", $filename);
|
||||
if ($mimetype != 'application/zip') {
|
||||
mtrace($debuginfo.'File '.$pathtofile.' was of wrong mimetype ('.$mimetype.')' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// restore_precheck wants this within dataroot, so lets put it there if it's not already..
|
||||
if (strstr($pathtofile,$CFG->dataroot) === false) {
|
||||
// first try and actually move it..
|
||||
if (!check_dir_exists($CFG->dataroot.'/temp/backup/',true)) {
|
||||
mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! ');
|
||||
return false;
|
||||
}
|
||||
if (!copy($pathtofile,$CFG->dataroot.'/temp/backup/'.$filename)) {
|
||||
mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! ');
|
||||
return false;
|
||||
} else {
|
||||
$pathtofile = 'temp/backup/'.$filename;
|
||||
$cleanupafter = true;
|
||||
}
|
||||
} else {
|
||||
// it is within dataroot, so take it off the path for restore_precheck.
|
||||
$pathtofile = substr($pathtofile,strlen($CFG->dataroot.'/'));
|
||||
}
|
||||
|
||||
if (!backup_required_functions()) {
|
||||
mtrace($debuginfo.'Required function check failed (see backup_required_functions)');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ini_set("max_execution_time","3000");
|
||||
raise_memory_limit("128M");
|
||||
|
||||
if (!$backup_unique_code = restore_precheck($destinationcourse,$pathtofile,$errorstr,true)) {
|
||||
mtrace($debuginfo.'Failed restore_precheck (error was '.$errorstr.')');
|
||||
return false;
|
||||
}
|
||||
|
||||
restore_setup_for_check($SESSION->restore,$backup_unique_code);
|
||||
|
||||
// add on some extra stuff we need...
|
||||
$SESSION->restore->restoreto = 1;
|
||||
$SESSION->restore->course_id = $destinationcourse;
|
||||
$SESSION->restore->deleting = $emptyfirst;
|
||||
|
||||
// maybe we need users (defaults to 2 in restore_setup_for_check)
|
||||
if (!empty($userdata)) {
|
||||
$SESSION->restore->users = 1;
|
||||
}
|
||||
|
||||
// we also need modules...
|
||||
if ($allmods = get_records("modules")) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
//Now check that we have that module info in the backup file
|
||||
if (isset($SESSION->info->mods[$modname]) && $SESSION->info->mods[$modname]->backup == "true") {
|
||||
$SESSION->restore->mods[$modname]->restore = true;
|
||||
$SESSION->restore->mods[$modname]->userinfo = $userdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!restore_execute($SESSION->restore,$SESSION->info,$SESSION->course_header,$errorstr)) {
|
||||
mtrace($debuginfo.'Failed restore_execute (error was '.$errorstr.')');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+1
-4
@@ -4,7 +4,7 @@
|
||||
require_once("../config.php");
|
||||
require_once("../backup/lib.php");
|
||||
|
||||
$courseid = optional_param('courseid',0,PARAM_INT);
|
||||
optional_variable($courseid);
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
$strerror = get_string("error");
|
||||
$strok = get_string("ok");
|
||||
$strunfinished = get_string("unfinished");
|
||||
$strskipped = get_string("skipped");
|
||||
$strcourse = get_string("course");
|
||||
$strtimetaken = get_string("timetaken","quiz");
|
||||
$strstatus = get_string("status");
|
||||
@@ -72,8 +71,6 @@
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
|
||||
} else if ($course->laststatus == 2) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
|
||||
} else if ($course->laststatus == 3) {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
|
||||
} else {
|
||||
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
|
||||
}
|
||||
|
||||
+3
-23
@@ -15,35 +15,14 @@
|
||||
|
||||
//Optional
|
||||
$id = optional_param( 'id' );
|
||||
$file = optional_param( 'file' );
|
||||
$file = optional_param( 'file' );;
|
||||
$cancel = optional_param( 'cancel' );
|
||||
$launch = optional_param( 'launch' );
|
||||
$to = optional_param( 'to' );
|
||||
$method = optional_param( 'method' );
|
||||
$backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT);
|
||||
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
/// With method=manual, we come from the FileManager so we delete all the backup/restore/import session structures
|
||||
if ($method == 'manual') {
|
||||
if (isset($SESSION->course_header)) {
|
||||
unset ($SESSION->course_header);
|
||||
}
|
||||
if (isset($SESSION->info)) {
|
||||
unset ($SESSION->info);
|
||||
}
|
||||
if (isset($SESSION->backupprefs)) {
|
||||
unset ($SESSION->backupprefs);
|
||||
}
|
||||
if (isset($SESSION->restore)) {
|
||||
unset ($SESSION->restore);
|
||||
}
|
||||
if (isset($SESSION->import_preferences)) {
|
||||
unset ($SESSION->import_preferences);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$to && isset($SESSION->restore->restoreto) && isset($SESSION->restore->importing) && isset($SESSION->restore->course_id)) {
|
||||
$to = $SESSION->restore->course_id;
|
||||
}
|
||||
@@ -137,10 +116,11 @@
|
||||
|
||||
//Call the form, depending the step we are
|
||||
|
||||
|
||||
if (!$launch) {
|
||||
include_once("restore_precheck.html");
|
||||
} else if ($launch == "form") {
|
||||
if (!empty($SESSION->restore->importing)) {
|
||||
if ($SESSION->restore->importing) {
|
||||
// set up all the config stuff and skip asking the user about it.
|
||||
restore_setup_for_check($SESSION->restore,$backup_unique_code);
|
||||
include_once("restore_execute.html");
|
||||
|
||||
@@ -14,12 +14,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Detect if we are coming from the restore form
|
||||
$fromform = optional_param ('fromform', 0, PARAM_INT);
|
||||
|
||||
//If restore session info exists, but we are coming from the form
|
||||
//it has prioriry
|
||||
if (isset($restore) and !empty($fromform)) {
|
||||
//If restore session info exists, but we are posting parameters
|
||||
//manually, this has prioriry
|
||||
if (isset($restore) and isset($restore_restoreto)) {
|
||||
unset($restore);
|
||||
}
|
||||
|
||||
@@ -45,16 +42,6 @@
|
||||
$$var = optional_param( $var,0);
|
||||
$var = "restore_user_info_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
|
||||
if ($instances === NULL) {
|
||||
continue;
|
||||
}
|
||||
foreach ($instances as $instance) {
|
||||
$var = 'restore_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$$var = optional_param($var,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//restoreto
|
||||
@@ -72,8 +59,10 @@
|
||||
//restore_messages
|
||||
$restore_messages = required_param('restore_messages');
|
||||
|
||||
//Check we've selected a course to restore to
|
||||
$course_id = optional_param('course_id', 0, PARAM_INT);
|
||||
//Check we've selected a course
|
||||
if (!isset($course_id)) {
|
||||
$course_id = 0;
|
||||
}
|
||||
|
||||
//We are here, having all we need !!
|
||||
//Create the restore object and put it in the session
|
||||
@@ -86,16 +75,6 @@
|
||||
$restore->mods[$modname]->restore=$$var;
|
||||
$var = "restore_user_info_".$modname;
|
||||
$restore->mods[$modname]->userinfo=$$var;
|
||||
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
|
||||
if ($instances === NULL) {
|
||||
continue;
|
||||
}
|
||||
foreach ($instances as $instance) {
|
||||
$var = 'restore_'.$modname.'_instance_'.$instance->id;
|
||||
$restore->mods[$modname]->instances[$instance->id]->restore = $$var;
|
||||
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
|
||||
$restore->mods[$modname]->instances[$instance->id]->userinfo = $$var;
|
||||
}
|
||||
}
|
||||
}
|
||||
$restore->restoreto=$restore_restoreto;
|
||||
@@ -109,7 +88,6 @@
|
||||
} else {
|
||||
//We have the object, so check if we have a new course_id
|
||||
//passed as parammeter
|
||||
$course_id = optional_param('course_id', 0, PARAM_INT);
|
||||
if ($course_id) {
|
||||
$restore->course_id=$course_id;
|
||||
}
|
||||
|
||||
+346
-3
@@ -41,14 +41,357 @@
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
}
|
||||
$errorstr = '';
|
||||
$status = restore_execute($restore,$info,$course_header,$errorstr);
|
||||
|
||||
//Checks for the required files/functions to restore every module
|
||||
//and include them
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/restorelib.php";
|
||||
//If file exists and we have selected to restore that type of module
|
||||
if ((file_exists($modfile)) and ($restore->mods[$modname]->restore)) {
|
||||
include_once($modfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Start the main table
|
||||
echo "<table cellpadding=\"5\">";
|
||||
echo "<tr><td>";
|
||||
|
||||
//Start the main ul
|
||||
echo "<ul>";
|
||||
|
||||
//Init status
|
||||
$status = true;
|
||||
|
||||
//Localtion of the xml file
|
||||
$xml_file = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code."/moodle.xml";
|
||||
|
||||
//If we've selected to restore into new course
|
||||
//create it (course)
|
||||
//Saving conversion id variables into backup_tables
|
||||
if ($restore->restoreto == 2) {
|
||||
echo "<li>".get_string("creatingnewcourse");
|
||||
$oldidnumber = $course_header->course_idnumber;
|
||||
if (!$status = restore_create_new_course($restore,$course_header)) {
|
||||
notify("Error while creating the new empty course.");
|
||||
}
|
||||
//Print course fullname and shortname and category
|
||||
if ($status) {
|
||||
echo "<ul>";
|
||||
echo "<li>".$course_header->course_fullname." (".$course_header->course_shortname.")".'</li>';
|
||||
echo "<li>".get_string("category").": ".$course_header->category->name.'</li>';
|
||||
if (!empty($oldidnumber)) {
|
||||
echo "<li>".get_string("nomoreidnumber","moodle",$oldidnumber)."</li>";
|
||||
}
|
||||
echo "</ul></li>";
|
||||
//Put the destination course_id
|
||||
$restore->course_id = $course_header->course_id;
|
||||
}
|
||||
} else {
|
||||
$course = get_record("course","id",$restore->course_id);
|
||||
if ($course) {
|
||||
echo "<li>".get_string("usingexistingcourse");
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("from").": ".$course_header->course_fullname." (".$course_header->course_shortname.")".'</li>';
|
||||
echo "<li>".get_string("to").": ".$course->fullname." (".$course->shortname.")".'</li>';
|
||||
if (($restore->deleting)) {
|
||||
echo "<li>".get_string("deletingexistingcoursedata").'</li>';
|
||||
} else {
|
||||
echo "<li>".get_string("addingdatatoexisting").'</li>';
|
||||
}
|
||||
echo "</ul></li>";
|
||||
//If we have selected to restore deleting, we do it now.
|
||||
if ($restore->deleting) {
|
||||
echo "<li>".get_string("deletingolddata").'</li>';
|
||||
$status = remove_course_contents($restore->course_id,false) and
|
||||
delete_dir_contents($CFG->dataroot."/".$restore->course_id,"backupdata");
|
||||
if ($status) {
|
||||
//Now , this situation is equivalent to the "restore to new course" one (we
|
||||
//have a course record and nothing more), so define it as "to new course"
|
||||
$restore->restoreto = 2;
|
||||
} else {
|
||||
notify("An error occurred while deleting some of the course contents.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notify("Error opening existing course.");
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Now create the course_sections and their associated course_modules
|
||||
if ($status) {
|
||||
//Into new course
|
||||
if ($restore->restoreto == 2) {
|
||||
echo "<li>".get_string("creatingsections").'</li>';
|
||||
if (!$status = restore_create_sections($restore,$xml_file)) {
|
||||
notify("Error creating sections in the existing course.");
|
||||
}
|
||||
//Into existing course
|
||||
} else if ($restore->restoreto == 0 or $restore->restoreto == 1) {
|
||||
echo "<li>".get_string("checkingsections").'</li>';
|
||||
if (!$status = restore_create_sections($restore,$xml_file)) {
|
||||
notify("Error creating sections in the existing course.");
|
||||
}
|
||||
//Error
|
||||
} else {
|
||||
notify("Neither a new course or an existing one was specified.");
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Now create users as needed
|
||||
if ($status and ($restore->users == 0 or $restore->users == 1)) {
|
||||
echo "<li>".get_string("creatingusers")."<br />";
|
||||
if (!$status = restore_create_users($restore,$xml_file)) {
|
||||
notify("Could not restore users.");
|
||||
}
|
||||
//Now print info about the work done
|
||||
if ($status) {
|
||||
$recs = get_records_sql("select old_id, new_id from {$CFG->prefix}backup_ids
|
||||
where backup_code = '$restore->backup_unique_code' and
|
||||
table_name = 'user'");
|
||||
//We've records
|
||||
if ($recs) {
|
||||
$new_count = 0;
|
||||
$exists_count = 0;
|
||||
$student_count = 0;
|
||||
$teacher_count = 0;
|
||||
$counter = 0;
|
||||
//Iterate, filling counters
|
||||
foreach ($recs as $rec) {
|
||||
//Get full record, using backup_getids
|
||||
$record = backup_getid($restore->backup_unique_code,"user",$rec->old_id);
|
||||
if (strpos($record->info,"new") !== false) {
|
||||
$new_count++;
|
||||
}
|
||||
if (strpos($record->info,"exists") !== false) {
|
||||
$exists_count++;
|
||||
}
|
||||
if (strpos($record->info,"student") !== false) {
|
||||
$student_count++;
|
||||
} else if (strpos($record->info,"teacher") !== false) {
|
||||
$teacher_count++;
|
||||
}
|
||||
//Do some output
|
||||
$counter++;
|
||||
if ($counter % 10 == 0) {
|
||||
echo ".";
|
||||
if ($counter % 200 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
//Now print information gathered
|
||||
echo " (".get_string("new").": ".$new_count.", ".get_string("existing").": ".$exists_count.")";
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("students").": ".$student_count.'</li>';
|
||||
echo "<li>".get_string("teachers").": ".$teacher_count.'</li>';
|
||||
echo "</ul>";
|
||||
} else {
|
||||
notify("No users were found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now create metacourse info
|
||||
if ($status and $restore->metacourse) {
|
||||
//Only to new courses!
|
||||
if ($restore->restoreto == 2) {
|
||||
echo "</li><li>".get_string("creatingmetacoursedata");
|
||||
if (!$status = restore_create_metacourse($restore,$xml_file)) {
|
||||
notify("Error creating metacourse in the course.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Now create categories and questions as needed (STEP1)
|
||||
if ($status and ($restore->mods['quiz']->restore)) {
|
||||
echo "</li><li>".get_string("creatingcategoriesandquestions");
|
||||
echo "<ul>";
|
||||
if (!$status = restore_create_questions($restore,$xml_file)) {
|
||||
notify("Could not restore categories and questions!");
|
||||
}
|
||||
echo "</ul></li>";
|
||||
}
|
||||
|
||||
//Now create user_files as needed
|
||||
if ($status and ($restore->user_files)) {
|
||||
echo "<li>".get_string("copyinguserfiles");
|
||||
if (!$status = restore_user_files($restore)) {
|
||||
notify("Could not restore user files!");
|
||||
}
|
||||
//If all is ok (and we have a counter)
|
||||
if ($status and ($status !== true)) {
|
||||
//Inform about user dirs created from backup
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("userzones").": ".$status;
|
||||
echo "</li></ul>";
|
||||
}
|
||||
}
|
||||
|
||||
//Now create course files as needed
|
||||
if ($status and ($restore->course_files)) {
|
||||
echo "</li><li>".get_string("copyingcoursefiles")."</li>";
|
||||
if (!$status = restore_course_files($restore)) {
|
||||
notify("Could not restore course files!");
|
||||
}
|
||||
//If all is ok (and we have a counter)
|
||||
if ($status and ($status !== true)) {
|
||||
//Inform about user dirs created from backup
|
||||
echo "<ul>";
|
||||
echo "<li>".get_string("filesfolders").": ".$status;
|
||||
echo "</ul>";
|
||||
}
|
||||
}
|
||||
|
||||
//Now create messages as needed
|
||||
if ($status and ($restore->messages)) {
|
||||
echo "<li>".get_string("creatingmessagesinfo");
|
||||
if (!$status = restore_create_messages($restore,$xml_file)) {
|
||||
notify("Could not restore messages!");
|
||||
}
|
||||
echo "</li>";
|
||||
}
|
||||
|
||||
//Now create scales as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatingscales").'</li>';
|
||||
if (!$status = restore_create_scales($restore,$xml_file)) {
|
||||
notify("Could not restore custom scales!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create groups as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatinggroups").'</li>';
|
||||
if (!$status = restore_create_groups($restore,$xml_file)) {
|
||||
notify("Could not restore groups!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create events as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatingevents").'</li>';
|
||||
if (!$status = restore_create_events($restore,$xml_file)) {
|
||||
notify("Could not restore course events!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create course modules as needed
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatingcoursemodules");
|
||||
if (!$status = restore_create_modules($restore,$xml_file)) {
|
||||
notify("Could not restore modules!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now create gradebook as needed -- AFTER modules!!!
|
||||
if ($status) {
|
||||
echo "<li>".get_string("creatinggradebook");
|
||||
if (!$status = restore_create_gradebook($restore,$xml_file)) {
|
||||
notify("Could not restore gradebook!");
|
||||
}
|
||||
}
|
||||
|
||||
//Bring back the course blocks -- do it AFTER the modules!!!
|
||||
if($status) {
|
||||
//If we are deleting and bringing into a course or making a new course, same situation
|
||||
if($restore->restoreto == 0 || $restore->restoreto == 2) {
|
||||
echo '<li>'.get_string('creatingblocks').'</li>';
|
||||
if (!$status = restore_create_blocks($restore, $info->backup_block_format, $course_header->blockinfo, $xml_file)) {
|
||||
notify('Error while creating the course blocks');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Now create log entries as needed
|
||||
if ($status and ($restore->logs)) {
|
||||
echo "</li><li>".get_string("creatinglogentries");
|
||||
if (!$status = restore_create_logs($restore,$xml_file)) {
|
||||
notify("Could not restore logs!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if all is OK, adjust the instance field in course_modules !!
|
||||
if ($status) {
|
||||
echo "</li><li>".get_string("checkinginstances").'</li>';
|
||||
if (!$status = restore_check_instances($restore)) {
|
||||
notify("Could not adjust instances in course_modules!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if all is OK, adjust activity events
|
||||
if ($status) {
|
||||
echo "<li>".get_string("refreshingevents").'</li>';
|
||||
if (!$status = restore_refresh_events($restore)) {
|
||||
notify("Could not refresh events for activities!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, if all is OK, adjust inter-activity links
|
||||
if ($status) {
|
||||
echo "<li>".get_string("decodinginternallinks");
|
||||
if (!$status = restore_decode_content_links($restore)) {
|
||||
notify("Could not refresh events for activities!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now, with backup files prior to version 2005041100,
|
||||
//convert all the wiki texts in the course to markdown
|
||||
if ($status && $restore->backup_version < 2005041100) {
|
||||
echo "<li>".get_string("convertingwikitomarkdown");
|
||||
if (!$status = restore_convert_wiki2markdown($restore)) {
|
||||
notify("Could not convert wiki texts to markdown!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now if all is OK, update:
|
||||
// - course modinfo field
|
||||
// - categories table
|
||||
// - add user as teacher
|
||||
if ($status) {
|
||||
echo "</li><li>".get_string("checkingcourse").'</li>';
|
||||
//modinfo field
|
||||
rebuild_course_cache($restore->course_id);
|
||||
//categories table
|
||||
$course = get_record("course","id",$restore->course_id);
|
||||
fix_course_sortorder();
|
||||
//Make the user a teacher if the course hasn't teachers (bug 2381)
|
||||
if (!isadmin()) {
|
||||
if (!$checktea = get_records('user_teachers','course', $restore->course_id)) {
|
||||
//Add the teacher to the course
|
||||
$status = add_teacher($USER->id, $restore->course_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Cleanup temps (files and db)
|
||||
if ($status) {
|
||||
echo "<li>".get_string("cleaningtempdata").'</li>';
|
||||
if (!$status = clean_temp_data ($restore)) {
|
||||
notify("Could not clean up temporary data from files and database");
|
||||
}
|
||||
}
|
||||
|
||||
//End the main ul
|
||||
echo "</ul>";
|
||||
|
||||
|
||||
//End the main table
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
if (!$status) {
|
||||
error ("An error has occurred and the restore could not be completed!");
|
||||
}
|
||||
|
||||
if (empty($restore->importing)) {
|
||||
if (!$restore->importing) {
|
||||
echo $output;
|
||||
//Print final message
|
||||
print_simple_box(get_string("restorefinished"),"center");
|
||||
} else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user