Compare commits
1569 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 585b76a0e8 | |||
| 15e6b71bc0 | |||
| 94c265fe95 | |||
| 9f3c4120f9 | |||
| 734b4d4dd1 | |||
| 94cf182211 | |||
| 2c7def765e | |||
| 63ae91cc6d | |||
| f7c44f3873 | |||
| 58331043d0 | |||
| 08dc6e642a | |||
| 6a22b20efd | |||
| ccb472e7b9 | |||
| eccbfc92ae | |||
| d4e9a98087 | |||
| 1b44161802 | |||
| 66fd7a7612 | |||
| 60a18dc226 | |||
| 7209121b5d | |||
| f154315266 | |||
| 189bb2de50 | |||
| 35cff7a641 | |||
| f0e4cbcabd | |||
| 464b3d80fa | |||
| 08450fe007 | |||
| 6387e05acd | |||
| fd21a93e5f | |||
| 548a5a4ae3 | |||
| f45aff70d9 | |||
| 63b33f502d | |||
| 8f79558997 | |||
| 31820054f2 | |||
| 536273ae99 | |||
| e331f94902 | |||
| 8a53bb7c91 | |||
| 97634109b7 | |||
| c7aebb6755 | |||
| e8b45d3e1d | |||
| 9059cb4550 | |||
| 078c8b402b | |||
| 0a22085fdb | |||
| 14942a2508 | |||
| 0abc6db872 | |||
| 0771778fff | |||
| cbca4dbf6c | |||
| 0e55fb3512 | |||
| 3747744140 | |||
| 0b0bfed7f3 | |||
| 2a1245108c | |||
| 591f3a61ab | |||
| b893b91a47 | |||
| e018b8db42 | |||
| 0e8422bf22 | |||
| 551f60bd3b | |||
| dec87682bf | |||
| 38e533a43c | |||
| 0ed613096c | |||
| 6778021371 | |||
| d3228e8238 | |||
| b17ce9a429 | |||
| 2758b9a780 | |||
| 3fb558da2f | |||
| 5c32a46383 | |||
| 4b76cb6fc0 | |||
| 7c6e10fe39 | |||
| 68d6a45263 | |||
| 517e069dec | |||
| ed1b0d012c | |||
| cb8faf0f12 | |||
| 0854d3f00e | |||
| d3b68faff0 | |||
| 7684e6314d | |||
| a6b6baf25e | |||
| 7551972d69 | |||
| 6f5fd34644 | |||
| 4e2d942e71 | |||
| 8ea0f9c792 | |||
| 70adc76b61 | |||
| ca45180f23 | |||
| 9b80ac3538 | |||
| bb6010edaa | |||
| 2c1868ca6b | |||
| 0a08be2397 | |||
| 6a4bd1e861 | |||
| 524c0c8fab | |||
| 6468df8aca | |||
| fb10b05479 | |||
| 86def10b64 | |||
| 9e1889cdae | |||
| 08bae0231a | |||
| 351b7cd179 | |||
| ed997a6b9c | |||
| 94ff81261d | |||
| 58bf9beea3 | |||
| 0844c5d93b | |||
| 26e8984b51 | |||
| 2f599e1732 | |||
| c67c987c80 | |||
| b1f3971caf | |||
| dfaa493161 | |||
| 3e02d264ab | |||
| 670fd620d8 | |||
| d47d910b13 | |||
| 5874bee4d1 | |||
| e74d5d31af | |||
| 9913f77ed1 | |||
| ef201b4775 | |||
| 36d07602b7 | |||
| 2a154e890e | |||
| 2bef07cd85 | |||
| 5ab05fb15f | |||
| 3236902cdd | |||
| c1d1f1679e | |||
| 871836deb7 | |||
| d242777c73 | |||
| ea80372129 | |||
| ce896718cf | |||
| 13db6cc1e4 | |||
| 997dc05600 | |||
| e588753478 | |||
| 52ffec20aa | |||
| c254ed8511 | |||
| 8900fdf11d | |||
| 4dc9acd3db | |||
| 2d08c94d20 | |||
| 3bbc889109 | |||
| eecbfe6e80 | |||
| 65be953852 | |||
| c8842694e2 | |||
| 207828729e | |||
| e5f7002f2f | |||
| 00f60cd1cb | |||
| 659cae579e | |||
| 8d0aa2442d | |||
| 8389c869ee | |||
| 7bbd75dc6e | |||
| 186fa912d9 | |||
| 30c56fe4dc | |||
| 21c24eb64f | |||
| a55d206ce7 | |||
| 578629dabe | |||
| f362682471 | |||
| 3dd102788f | |||
| a4166d5966 | |||
| d7f64fa590 | |||
| c5b4af2e5d | |||
| 3fa7bee5ce | |||
| e7bbc17fa2 | |||
| 2dc8d0e158 | |||
| e9e0641372 | |||
| 6343168321 | |||
| 3c5591c51c | |||
| 7afc1d07f4 | |||
| 137a439ac6 | |||
| 4984973b93 | |||
| 3ded4d989d | |||
| e9a0e86e70 | |||
| 10487fa6da | |||
| 58ea1ced21 | |||
| d6f8bc5b15 | |||
| 4d6eee8d65 | |||
| 6652a915eb | |||
| 72876267d2 | |||
| 391cd0eb8e | |||
| dc62cb9ecc | |||
| f55102c501 | |||
| f866f7be99 | |||
| 91e727f9ae | |||
| 1afe433c80 | |||
| f0f4244474 | |||
| e278eb4830 | |||
| dde95d41ec | |||
| 3310c48044 | |||
| 13ced7fb17 | |||
| 2bfb2f1f05 | |||
| 2ec2175f1e | |||
| 1f7448fc9d | |||
| da693b58b8 | |||
| 4ba7849b64 | |||
| 01911fa4b2 | |||
| 7545ecdb86 | |||
| 0ed6f1fc6b | |||
| 11274206e0 | |||
| f543e2acf7 | |||
| 794fc9a9a3 | |||
| 1bd430af60 | |||
| 910fa9c611 | |||
| 11f95c99ad | |||
| 17178a4ec3 | |||
| 54a252ba51 | |||
| 2771076cab | |||
| 80eb2b104b | |||
| 11925184b7 | |||
| 4c264c7ff8 | |||
| a5725844ff | |||
| 458544ed1d | |||
| 6b1b51c095 | |||
| 7541ac282a | |||
| 65c75c3ca7 | |||
| 20dd99627c | |||
| c070c4021e | |||
| 48ab51a5ff | |||
| 58dcf7ad08 | |||
| bda3445de9 | |||
| 5ed1079984 | |||
| 321fcad3ae | |||
| e731779d7a | |||
| 9688dc4e27 | |||
| b8d4faed6b | |||
| 570d5b907d | |||
| e98a1b9ef3 | |||
| e5a33e0082 | |||
| a919ee17b3 | |||
| 20d03127ad | |||
| 2e14f03a63 | |||
| 1e095f1636 | |||
| 7a67c58424 | |||
| fdc61d3e9f | |||
| 246eb27d88 | |||
| 83ad6e2213 | |||
| 71ebb06911 | |||
| 0746cf3e40 | |||
| c98be5a96f | |||
| d20c043713 | |||
| 4f353aadf5 | |||
| 16b963e777 | |||
| d970b5a0b2 | |||
| 6d643c9d6d | |||
| 2c4bd0a648 | |||
| 645beec03b | |||
| 0db6d34e6d | |||
| 6b465e1867 | |||
| 5420407e1e | |||
| 9660a6ddf2 | |||
| 8ae9a7dffc | |||
| f499bdf505 | |||
| d0c276727d | |||
| 3eb9c93999 | |||
| 86e44df6b0 | |||
| d30f1d1ad9 | |||
| f3aac02c26 | |||
| 2116a8a428 | |||
| f8471a1a96 | |||
| bebd1968b2 | |||
| ed3b8f3d0c | |||
| 978af5c28b | |||
| 1cc44fbf90 | |||
| 17e4bb1533 | |||
| aede0ebcc0 | |||
| 5f65bc5b94 | |||
| 4a906d7333 | |||
| 281ec00e8f | |||
| d685fe5705 | |||
| c26f59b6fc | |||
| 9e931faa98 | |||
| f6dde04372 | |||
| e4fd076246 | |||
| 5407ff018b | |||
| 6fd30e78c7 | |||
| d33eb04648 | |||
| a81b97bf9b | |||
| a5cf0536aa | |||
| 827ea538e5 | |||
| adb4cdc5a8 | |||
| ff90e9be5f | |||
| acb05e1d85 | |||
| a19e31a1d6 | |||
| a1b3e19dd4 | |||
| 8905e7b645 | |||
| b28a21b88b | |||
| 35e8af0edf | |||
| a607365fc8 | |||
| ce07f4dc34 | |||
| 48c52be77a | |||
| c4e643d335 | |||
| 1ba4c3e132 | |||
| eed0327fd9 | |||
| e8f4d7e395 | |||
| 9159c64a7d | |||
| 1f30b89fd8 | |||
| 985ea691ac | |||
| 205e71d01a | |||
| 55534cfdd2 | |||
| 832ca9bd1b | |||
| c2f2f33541 | |||
| d29877ac8c | |||
| 44ceee90e9 | |||
| bd9a7b89a7 | |||
| 1b268daa33 | |||
| 490c14fe8a | |||
| 53726ba409 | |||
| ee6689b003 | |||
| 29252268ca | |||
| bd09b95b81 | |||
| 3db9b3c2b1 | |||
| 30914826c9 | |||
| 32d746f1d7 | |||
| 02bb190c1d | |||
| 11a30670cb | |||
| fc98a031c3 | |||
| 5afa13193d | |||
| 14715db3ee | |||
| 28febd2534 | |||
| 282e599572 | |||
| 626b76b38f | |||
| 4dd6dd7155 | |||
| a41ba92752 | |||
| c9d4eba186 | |||
| 9988024f6e | |||
| 1fe0ed0b7d | |||
| 3ecc34b2d5 | |||
| 186c4de5ac | |||
| 7a26b64a13 | |||
| 43a4458850 | |||
| 6fcb1a4e2d | |||
| 66714f7c98 | |||
| 5623276da8 | |||
| af9ce11eec | |||
| f34dfc143f | |||
| 8a881c78de | |||
| 4618409cfd | |||
| 6644a4f4e5 | |||
| 916071c464 | |||
| a01d104cdf | |||
| 5710f8575c | |||
| 0962e21070 | |||
| 0594a0aaee | |||
| 624c7abf1a | |||
| 0871252e6b | |||
| 311ea49f58 | |||
| 111c351849 | |||
| aebdc0bdb3 | |||
| 91fa457ea2 | |||
| c2d04f05a0 | |||
| a63215000d | |||
| 6fec177f09 | |||
| a1cc49c6b1 | |||
| fa868b8a3d | |||
| 78298a17dd | |||
| 4890c92d15 | |||
| a3b2abed80 | |||
| e26612356b | |||
| 40a15c546e | |||
| f8cfb1230f | |||
| f461eacc8e | |||
| 67574a93c5 | |||
| a6a781458e | |||
| 32e854e51f | |||
| 713f0c63dd | |||
| ab147736c1 | |||
| 2a5e3d244b | |||
| d8347a0ab7 | |||
| c9c2c21b84 | |||
| 4f8ac26792 | |||
| 8f5ef63f5d | |||
| 9e10147777 | |||
| 58da996994 | |||
| 9c76f3b45e | |||
| ffd15ec8f6 | |||
| f1bd9b5ecf | |||
| d916897125 | |||
| ef7b0cc319 | |||
| 03daf74013 | |||
| 1eff062408 | |||
| c472c4bb50 | |||
| f296008fe5 | |||
| 782532955d | |||
| f6ea800797 | |||
| 1fe2c24de3 | |||
| 0e47869e99 | |||
| 6708fa8b98 | |||
| c6a4075609 | |||
| 9430296726 | |||
| ddc33af359 | |||
| 907a481674 | |||
| 7021c8441d | |||
| 50d0bb2e24 | |||
| 56352ac96f | |||
| 4811aacb5a | |||
| 2008bbe5de | |||
| 816219141b | |||
| aad4873cc6 | |||
| 369865830c | |||
| ea5a1c3bf6 | |||
| ecf7fad11a | |||
| f3c789cd94 | |||
| 63fc9bd4fd | |||
| 74f7fe1b30 | |||
| ad619206e1 | |||
| d7df0a5d84 | |||
| 1ee448b935 | |||
| 62556bfefa | |||
| 087f51bde0 | |||
| 7677bef81e | |||
| cebf5d77a3 | |||
| 1b053c41a4 | |||
| 4512e31e51 | |||
| d6ab69f11b | |||
| 0088748449 | |||
| 71b750ed86 | |||
| b632c1b6c9 | |||
| 022747163e | |||
| 038b5bd550 | |||
| 270c2f9a0d | |||
| c1abb7586f | |||
| e2f8d8a212 | |||
| a3b9814156 | |||
| b79595db64 | |||
| 38d6367287 | |||
| 936eeefdcb | |||
| ea3c67c5cb | |||
| 27ea59826f | |||
| c0207b1ba7 | |||
| e0acc94f9f | |||
| fc637ec2c1 | |||
| 04d79b7a0e | |||
| 9ddb243f13 | |||
| 8f92c1f78b | |||
| 01eaffcf75 | |||
| f995637ed3 | |||
| 14f79d5a2f | |||
| ccd48da98d | |||
| 82ecf200b7 | |||
| 0e87d49e09 | |||
| 98cb031e96 | |||
| 7e49db8100 | |||
| fe5f3d08ac | |||
| ede88ab3be | |||
| 3d4646688f | |||
| 59780d2e8f | |||
| 38f3f5f1a1 | |||
| c2508a1608 | |||
| 0bc5c5f8c6 | |||
| f32f73c0a6 | |||
| 765235a121 | |||
| 0975cc6e50 | |||
| ab3f9fc74e | |||
| c102e3aade | |||
| 8d8105fdf7 | |||
| 4ce19d978c | |||
| ab62d48e88 | |||
| 6242b7c12b | |||
| e629fc4ed0 | |||
| bb4bab500b | |||
| 34f06f743b | |||
| cfce2efbf3 | |||
| 1659924e8d | |||
| 88e2f1c4bc | |||
| e21d53b06b | |||
| 42e9c00f18 | |||
| 08576b0d0a | |||
| 740e1c8bd7 | |||
| 7f5e32ce55 | |||
| a227d4c0d9 | |||
| 013df172c0 | |||
| 9724b07ebc | |||
| 53938064c5 | |||
| 0a3158d669 | |||
| 9e1a55242f | |||
| f98f1a922e | |||
| 4334697e9e | |||
| 000b78f3f0 | |||
| ea4e7a0226 | |||
| 30b646c765 | |||
| bcdb377366 | |||
| 06e22959d1 | |||
| d9ab63d7e9 | |||
| 3b32b74f43 | |||
| b8a2e4a095 | |||
| 6f36f19a62 | |||
| 4d4938c15e | |||
| 296c5450fd | |||
| d74e9bf395 | |||
| e783513693 | |||
| 50d3025947 | |||
| d2f18a8694 | |||
| c15c851c3b | |||
| d53e1e9535 | |||
| dd0070851d | |||
| 339726d0d0 | |||
| 5c90d8094c | |||
| 04d1cad3bf | |||
| b09b58f052 | |||
| 357eefcdbe | |||
| 66d4805a81 | |||
| 5e41141993 | |||
| 03901b0c62 | |||
| b8f671b379 | |||
| 59a745a6ad | |||
| 3f134ab610 | |||
| 5cfbedea89 | |||
| df599bc11f | |||
| 8b722fe0b0 | |||
| 278ecb2567 | |||
| c86003482a | |||
| d7b02b694e | |||
| 53bdf7e60a | |||
| 6b18f14151 | |||
| be664f9a44 | |||
| 2b5db7a39f | |||
| fecac81cac | |||
| db9f04b35d | |||
| e3a08c6eaa | |||
| ed3a874632 | |||
| a2b4c8cb94 | |||
| 9f7d599561 | |||
| 4175366743 | |||
| 080ed4ba60 | |||
| b227269e56 | |||
| d8898325db | |||
| 94cbbdbd2e | |||
| f954aeaecd | |||
| f0421951ed | |||
| 405350262e | |||
| c92941d7a4 | |||
| 3a8093f895 | |||
| 293a2545b1 | |||
| 98e13c2eea | |||
| 227323aecf | |||
| adea20f6dc | |||
| 0c1d63a43e | |||
| e30a701156 | |||
| 95a7a2b866 | |||
| 369f3834ca | |||
| be5709b7fb | |||
| b1c418839e | |||
| 300ce0c64d | |||
| 1b5d15ba9d | |||
| 5c5d465c97 | |||
| 8ab96578ab | |||
| ccbbdc7319 | |||
| 0c89fe886d | |||
| 9bd0d5f805 | |||
| 182ac1d6d8 | |||
| 8ba998c60e | |||
| f547727478 | |||
| f5f4cc3fe7 | |||
| 3e6a1aa58e | |||
| 690b1d1324 | |||
| d6ad2b61f1 | |||
| af1a463811 | |||
| b55b207c27 | |||
| 7bff26bed6 | |||
| 173ac66759 | |||
| 7604731552 | |||
| 75ec296d45 | |||
| 14a3c9f3bc | |||
| fa2d7d3201 | |||
| 6be5bdfb8e | |||
| d6b6304fc3 | |||
| 5db97707d3 | |||
| 9d6bdd5874 | |||
| d4e4739aed | |||
| 5dd81daaed | |||
| 29ad04a314 | |||
| 4516dce1a3 | |||
| 0fbc5579fb | |||
| 9455d7c920 | |||
| bfaa2a61dc | |||
| 46203368b5 | |||
| 5fffec5d49 | |||
| 9275a2bae5 | |||
| 9051fd4e30 | |||
| 949e8de8e7 | |||
| 69329d504a | |||
| cb2bf96fe9 | |||
| ec5e30a4e9 | |||
| 39477c96a9 | |||
| a746e49818 | |||
| 6c9aa9b38b | |||
| 890204da8c | |||
| 49aa2ee116 | |||
| acfc18d8e8 | |||
| 82a6cc3f44 | |||
| 7bb1b32039 | |||
| 996177940e | |||
| a948673c75 | |||
| 85caf1b299 | |||
| 047e7670aa | |||
| 3824b03f06 | |||
| 4b4d9ef4fa | |||
| 654a2dae51 | |||
| 66b3a7bcec | |||
| e7504c319b | |||
| c562b0f504 | |||
| bab754c727 | |||
| 7300023df8 | |||
| 3983345254 | |||
| 047901cbd0 | |||
| e0ade9dbe7 | |||
| 6d07659acf | |||
| f35daade0d | |||
| e9a903a539 | |||
| 5a60b8a69a | |||
| 91cb9645d4 | |||
| c9262623e7 | |||
| 6489172657 | |||
| 64ca832445 | |||
| f9348b84bc | |||
| d994fe68bc | |||
| a28baeb99c | |||
| e52c8d89f6 | |||
| f845a2fba9 | |||
| 3475eeac11 | |||
| 7a15af7d90 | |||
| b972485c21 | |||
| 1c9a35efa2 | |||
| 3e5f98212d | |||
| ae1a7e05a6 | |||
| 3ed692737c | |||
| be1448f47b | |||
| 86f404fa52 | |||
| 8c4ca06f88 | |||
| 33c34c5705 | |||
| 0972aa2291 | |||
| 8b2a37e7b1 | |||
| c1139b492e | |||
| 94000d7320 | |||
| aaf8bbd470 | |||
| c8db08b82e | |||
| b81e38ec0b | |||
| 2a5bbf81ca | |||
| 3f710c6be5 | |||
| 3416e63f61 | |||
| f86a5be206 | |||
| 8ac075addf | |||
| d15518f149 | |||
| 9c8bcc6562 | |||
| 2cf92c01fb | |||
| 4575e76e98 | |||
| 5d53aa0544 | |||
| 22c2af60e8 | |||
| 4a6a7074ce | |||
| f92b08d9e1 | |||
| d42e5b0034 | |||
| c279331f64 | |||
| be176082f4 | |||
| 2c30fce4a2 | |||
| 17be8562d7 | |||
| 0cb3c46479 | |||
| f300eadf46 | |||
| 901c3d48a6 | |||
| bcb667b7f5 | |||
| 9040c8d4e9 | |||
| 99f36270c0 | |||
| 5a3cafc899 | |||
| ca9b92d39f | |||
| f57cdf69c8 | |||
| 18778321e8 | |||
| 56db843241 | |||
| d9d18969f0 | |||
| c309d41688 | |||
| 2ac2ce803e | |||
| a8482189a7 | |||
| 9e87c6033e | |||
| 692866105a | |||
| b5c8f2f808 | |||
| ba4aea2b35 | |||
| 3dc2b907da | |||
| 168eda8b3a | |||
| fa366ea698 | |||
| d67aacd867 | |||
| 33d2459c8d | |||
| ff82f12d5e | |||
| 0e2c2828fa | |||
| decfd5028c | |||
| ab54cc74d8 | |||
| 65743c17e0 | |||
| 84dc99bbe9 | |||
| 5be691946f | |||
| 675b1a05ea | |||
| d3d791f208 | |||
| 0e544a84e6 | |||
| 79a9b69e28 | |||
| 8f4a3ae2f1 | |||
| 3dd4e13cd6 | |||
| f00d4c451b | |||
| 18077e8b96 | |||
| 78fb3bf3df | |||
| fd0e2fec76 | |||
| 4d7325ef33 | |||
| 220a6d19b1 | |||
| 8826b45a5a | |||
| 1ec0ef254c | |||
| 941802c3d1 | |||
| 95fb95cb3e | |||
| 07e27f4746 | |||
| 9b672f584f | |||
| 8049c822ec | |||
| bf2de3499f | |||
| 8432e9ba39 | |||
| 5e17bdd0eb | |||
| 5ae009ad6d | |||
| a35ce8ef14 | |||
| 6730788f48 | |||
| 27e05b35a9 | |||
| b521e9ed8a | |||
| e0a411d4a4 | |||
| 0229dc83ea | |||
| 39dfcf7138 | |||
| 0b7c820a73 | |||
| dc51efed7e | |||
| df2a9e2a0a | |||
| d65bb1547b | |||
| d0d840eaed | |||
| 7e65c42f39 | |||
| 6b843dfac1 | |||
| d091ee027f | |||
| d18387534d | |||
| 9276c875dd | |||
| f1d52ce1aa | |||
| 9dc8c1b014 | |||
| 264d665380 | |||
| 4658b598b4 | |||
| 4ebe85b6a5 | |||
| 3e117fb6af | |||
| f5687e385b | |||
| b5ea0a4a52 | |||
| 8658d5c5b0 | |||
| 22edc02cf9 | |||
| 3f1e6d3c73 | |||
| 53d3f7fd89 | |||
| ba702c6731 | |||
| b8dc2b75a4 | |||
| 6d5d43bab3 | |||
| 285b024ebf | |||
| 26de0996d9 | |||
| 18ef2fc61e | |||
| 73733d1b4b | |||
| f0a794d200 | |||
| 235b0335ef | |||
| fea7cdb0ba | |||
| c319e83622 | |||
| 890aec679c | |||
| 377002f981 | |||
| c5e1dedb3c | |||
| b85226a64e | |||
| c05ce94476 | |||
| 2fa04d6d4b | |||
| f113b4cc91 | |||
| 883ceaf293 | |||
| d282117166 | |||
| d2b41f28a8 | |||
| 4d3e308a52 | |||
| a54217c8fd | |||
| fa0516e1c4 | |||
| 5b6d891d19 | |||
| 936649fc69 | |||
| 6a981df540 | |||
| 60eb215831 | |||
| 789d840942 | |||
| 8a898cb994 | |||
| a6c905fdac | |||
| fb179457ce | |||
| 9263acf92a | |||
| ecf8aad8ca | |||
| 225ff8f476 | |||
| 2d00ab58bf | |||
| dc2c453d63 | |||
| f3566b2674 | |||
| 5cc576de2f | |||
| 1ee938f8ef | |||
| 40a6466542 | |||
| f7cf45ab80 | |||
| 3e04a3cae9 | |||
| e967a609ae | |||
| 6a51c3b132 | |||
| 1dd5f6455f | |||
| 1ac07fdbcd | |||
| 19f28a9a35 | |||
| 6dbe0406b6 | |||
| 5738a677f2 | |||
| 7271bdaf04 | |||
| bd955d4add | |||
| 668932588a | |||
| 5a5534d815 | |||
| 52d4f11037 | |||
| 593eb8ee75 | |||
| 994190c63b | |||
| f2bb3ae677 | |||
| c992ccef67 | |||
| 56c256f030 | |||
| 3d3e3df555 | |||
| 69cf3d1ffb | |||
| da367cb720 | |||
| 8ab536ef8c | |||
| 6984aea08f | |||
| e2d53c3d9e | |||
| f62b5930a7 | |||
| 1a30e1bc5c | |||
| 1946941cd7 | |||
| 3e6c7834ed | |||
| b097747f75 | |||
| 93c366d35d | |||
| 9dbf0647b4 | |||
| 4698d64435 | |||
| b4cc78ec68 | |||
| bb28536f44 | |||
| f0f110ff74 | |||
| e7282f1fe6 | |||
| 23d08ac7be | |||
| 16614d8106 | |||
| 32261099c9 | |||
| e0a046d040 | |||
| 2a2113d1be | |||
| 4efbaec111 | |||
| 5fcd786eca | |||
| aef130f71e | |||
| d7d14a80ef | |||
| f1b73b438f | |||
| 1107dde0a1 | |||
| 11bdc5ab49 | |||
| ed3e48f765 | |||
| 9964700f5b | |||
| 17f1039b58 | |||
| 36d703a877 | |||
| 08b6eeeae3 | |||
| e3a87a68b9 | |||
| ad2c8da954 | |||
| f6453c1cde | |||
| c5f4b371fe | |||
| cf0352fa3b | |||
| 50726e2969 | |||
| 05a3688962 | |||
| 564c1a9392 | |||
| 1665e2d3b6 | |||
| fbedee57ef | |||
| e262e268b2 | |||
| 3ff4e0d771 | |||
| 8450217132 | |||
| b2bc7cc85c | |||
| 8a4cb9dd5e | |||
| 74a05d3fc8 | |||
| cb6400a485 | |||
| c525a81701 | |||
| 7938b1cced | |||
| 1444c9d07e | |||
| 54e0d9a55c | |||
| 9ddbe2cfb8 | |||
| cbf2ebdeee | |||
| 37c9edcbdf | |||
| 5dc7db71af | |||
| 868f172373 | |||
| 4bdb55f50b | |||
| 0c6d0ae8ed | |||
| 05b11fcb66 | |||
| 8d6e06a18a | |||
| ed2d5284f7 | |||
| 2be702e457 | |||
| 7c23e5eff3 | |||
| eeaf6aa373 | |||
| d44522b5f7 | |||
| 068deeb136 | |||
| 6bd8edfbde | |||
| 88b020ce95 | |||
| 999fb96f7b | |||
| f7bd77baf5 | |||
| 67c2776bae | |||
| dc82ac6eff | |||
| 0319f6ccac | |||
| 13ffbef897 | |||
| c15475c93b | |||
| 73c4f0de0e | |||
| c7d6dce97d | |||
| 45158bdb9d | |||
| 766acf6ce4 | |||
| 5d2fb0f679 | |||
| 583c8c1ebe | |||
| cf20428733 | |||
| 7e9b2809a9 | |||
| ed277edea0 | |||
| 0c3cdd4d79 | |||
| ae74081cc3 | |||
| 847af02833 | |||
| 176c6e8a23 | |||
| bcb2b60ff9 | |||
| 59a1e0f320 | |||
| 204f51c760 | |||
| 0d3b5bdc16 | |||
| 165ea8e3bb | |||
| 5f4d28ccf9 | |||
| 2b9cc5a966 | |||
| 363d415464 | |||
| 4d3769bf61 | |||
| bc97420bd4 | |||
| a5b7f1ab73 | |||
| a3eed2b0c0 | |||
| c695bf2783 | |||
| a8419f1a9d | |||
| 00c2507ab0 | |||
| 285286acf3 | |||
| 765e3e8e82 | |||
| 3e1f8e095c | |||
| 40f43aa1fc | |||
| d7381358f8 | |||
| 530239bbc9 | |||
| 92c1df4735 | |||
| 07053e3df5 | |||
| 86a42c8ac9 | |||
| 8caa580efd | |||
| 618689ef22 | |||
| 6237517812 | |||
| 5b8f6bcc0b | |||
| 2328f76997 | |||
| f58505164c | |||
| 0384e168e8 | |||
| 14b34c4af3 | |||
| 6dd47a844f | |||
| b310a2d7c0 | |||
| 7542409d39 | |||
| 5af229ea58 | |||
| 16ee776952 | |||
| e8fe560958 | |||
| 0600c266e9 | |||
| 4f5ffe5a7e | |||
| e5f0e7d200 | |||
| b9015c2c2b | |||
| fc025aeae5 | |||
| 3f7c4ee5c4 | |||
| dca17878da | |||
| 5db5737b4f | |||
| 7293bdf4cb | |||
| 44e65ebf62 | |||
| 5b6219a750 | |||
| 72d707a346 | |||
| 075e3c715d | |||
| 7fdfade8dc | |||
| 470b711740 | |||
| e1be3139a4 | |||
| cfa16a536e | |||
| 860f345ceb | |||
| 833711e3b8 | |||
| 204666c569 | |||
| 00ff61c64a | |||
| 0b777b60c6 | |||
| 071680021c | |||
| 04a9e1a834 | |||
| 5b243bb55d | |||
| 60414b0b11 | |||
| f337e9c2c9 | |||
| 6c9f235d93 | |||
| dd377953f7 | |||
| 2559de3be6 | |||
| 504e7efe76 | |||
| 138b92ce7f | |||
| 7d23e00836 | |||
| 05719ae21a | |||
| 2637d1d193 | |||
| 62d19b5336 | |||
| 4df7a2ef4f | |||
| 8b32d8e829 | |||
| b0f0e1bb3a | |||
| 7fdb5ee675 | |||
| fc9aacd2d7 | |||
| 7006fb7609 | |||
| aeb10b1c28 | |||
| c9cde2149e | |||
| ac11681809 | |||
| ddd8279beb | |||
| 6a729d0756 | |||
| 99a4959494 | |||
| c912cc7258 | |||
| 86b73f8e9c | |||
| 946db1620f | |||
| a488df2a95 | |||
| 4e0af3b107 | |||
| b7f00cff12 | |||
| ea7f759cbf | |||
| 297178bc87 | |||
| 82b7f28a61 | |||
| d40f5b74e6 | |||
| 214f6d7493 | |||
| a88c2ffdaa | |||
| 5775ef80c0 | |||
| 0eea4f9355 | |||
| 8d531749c3 | |||
| 6233a11b29 | |||
| 0a440a8682 | |||
| c6d734d3f9 | |||
| 2ec308a8b5 | |||
| 29308ee5da | |||
| eabc30d78b | |||
| 66064c5262 | |||
| 1c8bf4e4c2 | |||
| 64fa3a1f8f | |||
| be350cb127 | |||
| 0abcfef0c9 | |||
| ed8bd3952b | |||
| 25977a0eaf | |||
| abc011e5cc | |||
| 1bb997ecc3 | |||
| 200640a52c | |||
| 2494fa8c7b | |||
| 6931f8a7b5 | |||
| d6948ebc6a | |||
| 91cd49491c | |||
| c9a6c442a3 | |||
| 25da458902 | |||
| f8c7c3ae32 | |||
| cc4dae1350 | |||
| 1b2335b2c6 | |||
| ac1b88eab8 | |||
| 58520f98b0 | |||
| 3563da4aad | |||
| 15ad5491a4 | |||
| ec7125dc19 | |||
| 8353edcdf1 | |||
| b1b887fd84 | |||
| ba1674a11c | |||
| 9132d15eca | |||
| b97e501d33 | |||
| 4ead5c7e3c | |||
| a8e3b790b5 | |||
| e0af2ed26c | |||
| a964e03d4f | |||
| 0cec6e0c68 | |||
| f8ed98f83b | |||
| 6aac29e4ef | |||
| be8e377c91 | |||
| 3bdac46d14 | |||
| a08b933a00 | |||
| ccc64d9cf0 | |||
| 22dd4e275a | |||
| ecfa2d90ff | |||
| 6e7e89849a | |||
| 33dfd09c2d | |||
| 4e5fa682b5 | |||
| 1c47be2472 | |||
| 566e9d1313 | |||
| 26deeb61ab | |||
| c635d2acc8 | |||
| ce9dd0470a | |||
| 907e321018 | |||
| a7502277f2 | |||
| 5203f7252e | |||
| d5ca7a5706 | |||
| afeec49db6 | |||
| dbb552852a | |||
| 7e17fa336e | |||
| fc3a00b2dc | |||
| a3fd4aeea7 | |||
| eaad116912 | |||
| 522437d506 | |||
| 8473f41780 | |||
| d5694b16bb | |||
| ff302bdbb9 | |||
| ce32e5047d | |||
| 50371de63b | |||
| 257d6684ca | |||
| 4d502df33f | |||
| 9008efba33 | |||
| 3e328cac4e | |||
| ab8eeb7b5a | |||
| 5c451f237d | |||
| d062a31039 | |||
| 58d4c2f1c0 | |||
| 974fc258fb | |||
| 25c052dbd7 | |||
| 4b50cb9857 | |||
| 79aa617250 | |||
| 5ed7235b17 | |||
| 2548ed0c9c | |||
| abe74df9d9 | |||
| 5642a74c63 | |||
| a723bf77c4 | |||
| 4904f5c7a5 | |||
| e38cd94623 | |||
| 4c75fbc5bb | |||
| 84f78756c8 | |||
| 095c40469a | |||
| cb60bc9eda | |||
| 811c6b01e0 | |||
| 210caf54a8 | |||
| 6480900924 | |||
| c5de7683ad | |||
| 63aaa32f88 | |||
| 49aeee2bf6 | |||
| a863e9a119 | |||
| 53bbf98533 | |||
| f6ae5aee7c | |||
| 55271966bf | |||
| 2266595f2f | |||
| 33d78656e4 | |||
| 76cf7cce29 | |||
| b4c11424e2 | |||
| 7f5f3d5f28 | |||
| 43ba326a82 | |||
| b3469a7e13 | |||
| 4761566c54 | |||
| 9333d66af5 | |||
| cd7bc967e3 | |||
| 00a00321ae | |||
| 430196f1a0 | |||
| dab7fce2aa | |||
| 19907e0cfa | |||
| 2be1f0f6bb | |||
| 81bfdff8dd | |||
| 81d923af09 | |||
| 619b3ca8db | |||
| 52fbb269fd | |||
| 1e27409e63 | |||
| 35c9a930f3 | |||
| 717d379f57 | |||
| 98ee46df71 | |||
| cb00cf26de | |||
| 013c9869e1 | |||
| a11abf14cb | |||
| ef4ad6c66e | |||
| a7d006a0d9 | |||
| 6900784f92 | |||
| d6756ebbbc | |||
| a87249f196 | |||
| 868282ddc0 | |||
| 7b6da3346c | |||
| a75f4ef3e3 | |||
| d1453ce26e | |||
| 4aa2dc193f | |||
| 1dcf42a4ba | |||
| a4a66fc93b | |||
| 338efed0ca | |||
| d2957326c8 | |||
| 81e19d3595 | |||
| b7144a35b3 | |||
| 3202bd7416 | |||
| 9e4ae46a4b | |||
| 4a0f06d551 | |||
| a5f1acc2b4 | |||
| ac6fa5eb90 | |||
| c4c1a7737f | |||
| 375f8d33f8 | |||
| 5612af0dba | |||
| e80944a42a | |||
| 08403fd61c | |||
| 02bd2e0d38 | |||
| 36d2ca6559 | |||
| 7a92a518b3 | |||
| a62cc62551 | |||
| 794d8721c0 | |||
| c75d22a17c | |||
| e7b43fe5a2 | |||
| 3b0d855c3c | |||
| eebf6e2a47 | |||
| 5ee185d12e | |||
| b35f76841d | |||
| 011508b2b0 | |||
| e1a0eb49d6 | |||
| 09846a54ad | |||
| 06d7ef9cd3 | |||
| 14156d6b54 | |||
| 104838c9db | |||
| 1a632495f7 | |||
| 6ededd5f41 | |||
| 36103b02fa | |||
| c1427112a1 | |||
| cba041369f | |||
| a559555e6c | |||
| 244f618892 | |||
| 27bb711fe9 | |||
| d77bd5ecbe | |||
| 24b3c8307f | |||
| bad6da7acc | |||
| 70e10c77f3 | |||
| 9523ad0ab7 | |||
| ee20235449 | |||
| 17afefef30 | |||
| d0131dbd89 | |||
| 64b489a10d | |||
| 8ed7f23e33 | |||
| 08f256c416 | |||
| 27278d2346 | |||
| bb4bfe13df | |||
| c124578f93 | |||
| 2e2892ce89 | |||
| 896c18e842 | |||
| a3752a0b13 | |||
| fc0e5e988e | |||
| 4ea6f1f0ef | |||
| 8bb10719d6 | |||
| 2fa4b6d68e | |||
| 9e65d861f7 | |||
| 92db621b5d | |||
| 119fb86673 | |||
| 056ac15288 | |||
| be4dd6c79b | |||
| 9743ed49b9 | |||
| eafe828b26 | |||
| 16ba1b0cf2 | |||
| 6d1ad6b3e1 | |||
| e56fb50a4a | |||
| 519b6676c8 | |||
| 0c46637a1a | |||
| 326cf96333 | |||
| 2bb2aa4dbb | |||
| fc4a2fffc6 | |||
| b173ea77d9 | |||
| 441df375b6 | |||
| 1adb0ebb50 | |||
| 5a948984c4 | |||
| 6df78935f8 | |||
| 45b20961da | |||
| 14975c1946 | |||
| d9b9b40a71 | |||
| d9c7b58af6 | |||
| 990e04d823 | |||
| b8e8419bfc | |||
| 791ad685b2 | |||
| 6142a99373 | |||
| 72c475f9ab | |||
| 1ea47ba4c0 | |||
| 89d2e91d13 | |||
| 3941cc43f1 | |||
| f545230234 | |||
| d0d5d320b1 | |||
| 4217056ab9 | |||
| c90933facf | |||
| edc62676a2 | |||
| f2ee9706a2 | |||
| 42cf57fb26 | |||
| 59a24c227e | |||
| 77db689064 | |||
| 4e5813e6f2 | |||
| 53cda2de31 | |||
| c1ef755c30 | |||
| 8b435d0993 | |||
| 4912df1582 | |||
| 6e45019417 | |||
| d8ee4dfa6e | |||
| 8f09118ae0 | |||
| 176307a26a | |||
| 58af55c35e | |||
| afac1a0781 | |||
| a1353477c4 | |||
| 3ae767d8ba | |||
| bdadff33ff | |||
| 94beeb79c7 | |||
| 056a54babe | |||
| 04038968be | |||
| 6d3da6bf92 | |||
| b3ebb9802e | |||
| 12a113f24e | |||
| 8f5c5184aa | |||
| 9d6a3d1513 | |||
| 5f3315e78e | |||
| 5f084a4ecb | |||
| 2115a30667 | |||
| dee938a59e | |||
| 582e15dfd2 | |||
| d2219dda26 | |||
| cf8781f41c | |||
| 2fca979ee3 | |||
| 85ab48b33f | |||
| 3929ee53cd | |||
| cf6e361c02 | |||
| 8909a7a075 | |||
| 0fb90ef70b | |||
| b21ca22e1f | |||
| cfb5feb8b5 | |||
| bc304733e8 | |||
| 90cef3dc05 | |||
| b4deed5688 | |||
| 11b9b76181 | |||
| e3f5d9654a | |||
| 8ead149149 | |||
| 08d82f5688 | |||
| 1a78d381ff | |||
| 2c00ee97df | |||
| 1a35d7472f | |||
| 4d85a640dd | |||
| c8693d4dc1 | |||
| 3d5f5f6021 | |||
| 8ab940c495 | |||
| 0fe0327175 | |||
| cd73c31074 | |||
| 995a53787b | |||
| 6f04b5d626 | |||
| 522803d42a | |||
| 815673e92f | |||
| 69a4aef1e1 | |||
| d0796153bf | |||
| 0fe09ea8fe | |||
| 8490c5350e | |||
| 8ca956147b | |||
| 04139219e7 | |||
| 24bcd2e3b1 | |||
| 393150a996 | |||
| 903740173f | |||
| ce97dd9102 | |||
| 2efdf88b94 | |||
| ff3cf1e507 | |||
| aaef7468ac | |||
| fb529d5c10 | |||
| 6a1a00bc50 | |||
| fb87e8ae3b | |||
| 60a4797402 | |||
| cdedf35b0f | |||
| b3c26633e5 | |||
| 1e73338065 | |||
| d184f8f9b7 | |||
| 537e8dedfa | |||
| 1463bdc4ee | |||
| 6ba839a768 | |||
| 42ae2fccb2 | |||
| d770f41a00 | |||
| e9a5857b7d | |||
| 57a676ee7a | |||
| a48ae8ec5d | |||
| fa9ad7b620 | |||
| c10cac4e4a | |||
| e4e1faa6ab | |||
| b72d8a7b98 | |||
| fbaf314c87 | |||
| eb8a6e6c60 | |||
| 5bdacd72ef | |||
| 46bdf8d1a8 | |||
| 05bab49047 | |||
| f6b74139d7 | |||
| 44445b034f | |||
| 85c9758459 | |||
| f75cf3a13d | |||
| 41b08f2d96 | |||
| 366c49848f | |||
| 5d735c5281 | |||
| f91a5b733a | |||
| 6d3bcb44dd | |||
| 41c88b8cda | |||
| 228d5ecb07 | |||
| 38161091d6 | |||
| 67945637f3 | |||
| 0646497a1e | |||
| 69eedfa2fe | |||
| 6c5efa9157 | |||
| 7d1b0eee29 | |||
| 0cd2561466 | |||
| 4e3dad540c | |||
| 7135ffca51 | |||
| 6a021d6fc4 | |||
| 211e9c6d3f | |||
| 071aeb9926 | |||
| d5defbf5a8 | |||
| a17ca7ba09 | |||
| 31248c5d9c | |||
| dd861fbc33 | |||
| 3aa5023ef9 | |||
| c92718aa13 | |||
| f991a28d5c | |||
| 76980fca70 | |||
| 481425fadb | |||
| 8453485495 | |||
| 5cf2c57a22 | |||
| f2723764f7 | |||
| 2b22a5f423 | |||
| 745a099abf | |||
| b687218970 | |||
| 92a1d319fc | |||
| 98547f476f | |||
| dddcaf6358 | |||
| 98a6fc4a3b | |||
| 7499f511c8 | |||
| 359ee558f0 | |||
| 7b5f66308c | |||
| 81c9dd751a | |||
| 0a48ba0c0b | |||
| 915e268e62 | |||
| 5fc40f4208 | |||
| aa37778ca3 | |||
| 482b3d1677 | |||
| f018ef4a52 | |||
| e8fc2358ca | |||
| 7e33b18807 | |||
| 219927349a | |||
| f6d8678098 | |||
| 71494eb0b1 | |||
| 3e6e9eaa52 | |||
| 442e308648 | |||
| 48f66dd36e | |||
| c0d1c8f9cb | |||
| f46a06d08c | |||
| 6d7ab89b65 | |||
| 2e978de3d1 | |||
| a999da51c5 | |||
| 150692da89 | |||
| d01930668d | |||
| 809baca60a | |||
| 594676271f | |||
| a8f56ba982 | |||
| aa4847c757 | |||
| 29cf643cad | |||
| c546706479 | |||
| 3d94c5e08e | |||
| 3724757d96 | |||
| 11551df2c3 | |||
| d09ab40142 | |||
| 435d7bdba9 | |||
| 7e340b3e8d | |||
| 384a9cbda9 | |||
| 8b405ab59b | |||
| 6543cbde7a | |||
| 6e0fd47067 | |||
| 90f36eaf96 | |||
| 13beed44aa | |||
| 1db25b8950 | |||
| 4288cc0e90 | |||
| fdd91b7098 | |||
| 7da47c8128 | |||
| 2e8b9f7325 | |||
| 9a873b571d | |||
| eab9dead49 | |||
| 3a267ca3a0 | |||
| b1e96ca8b2 | |||
| 360342a41f | |||
| ce249c4de5 | |||
| a32126839c | |||
| 020eae6335 | |||
| d5d95c5e02 | |||
| 038ee13b04 | |||
| d6beb4690a | |||
| 893194c625 | |||
| 55c7250333 | |||
| b4f675e1d5 | |||
| 96e3537213 | |||
| 7823acb0c9 | |||
| 5e691be585 | |||
| b7049c9222 | |||
| 8941942a02 | |||
| e685d5838d | |||
| 70efa359e2 | |||
| edc0fe896d | |||
| fbaa57cbf8 | |||
| 2ee13c5c8b | |||
| a7212cb9c7 | |||
| e63938ba8a | |||
| 6597b34eeb | |||
| c6ed8589e0 | |||
| bebdb9b162 | |||
| 677ab5e475 | |||
| 4a4b110509 | |||
| 5e919c34ee | |||
| 00f65b4e5d | |||
| 4ad8ec74e7 | |||
| 8e48cb7180 | |||
| 6a3ba4e585 | |||
| b16832dd09 | |||
| e88133dc12 | |||
| 841d2ca4c9 | |||
| 319e0b83a5 | |||
| 210f57ff8a | |||
| 7ee7b84e9d | |||
| 7cc3f26d18 | |||
| 8ac54989eb | |||
| 867354f9ae | |||
| b27db1be63 | |||
| b39a4fec6a | |||
| a358f9b4e2 | |||
| cde191082a | |||
| fcad0318e9 | |||
| 2f40c9ea94 | |||
| d5f05bd60e | |||
| 94707762b5 | |||
| bcdb15f066 | |||
| 0846150380 | |||
| f39432cafe | |||
| 8809b99a1f | |||
| aaf277889b | |||
| f7266dd323 | |||
| ee41a6a7c8 | |||
| 8b378edc14 | |||
| e3dccebf8d | |||
| e21b7f0a57 | |||
| 74812cb716 | |||
| 7931e74e44 | |||
| 612f6992c5 | |||
| 30a16e7e83 | |||
| 8b6f55ee7a | |||
| 2b0e9d6ef9 | |||
| 8336513809 | |||
| 0b0ff32d3c | |||
| 45bddb6e6d | |||
| 5a27d062ee | |||
| 551f994986 | |||
| 1e5d9d5d5f | |||
| 1914e3a8f3 | |||
| 650044d9a2 | |||
| fb38e114e7 | |||
| 6d19ce3361 | |||
| 2bf84bba09 | |||
| 6bfe184be4 | |||
| b85eb9fa4a | |||
| c5c60abd3e | |||
| 0c3f1da5b6 | |||
| a27b6c2c52 | |||
| cdb4e23f90 | |||
| e19f971389 | |||
| 47405f9b6f | |||
| e04584907b | |||
| 3dff7f538b | |||
| bef2f86f04 | |||
| cf5a890bd6 | |||
| 244d9553ca | |||
| f8c11d0afc | |||
| bdd77c8326 | |||
| c470dada5b | |||
| 472bce6d12 | |||
| aeb50096a1 | |||
| 8af53beeec | |||
| ede4316c01 | |||
| 49fa880ef6 | |||
| 7063eb9fbb | |||
| abbad4af13 | |||
| 40c6886f95 | |||
| 49ce7ff03c | |||
| a4fbad6e80 | |||
| 646a6d9481 | |||
| 936450330a | |||
| ac331d6a4a | |||
| 29858f020e | |||
| 625faf10a3 | |||
| f9144364f4 | |||
| e19c5c1018 | |||
| 516c425215 | |||
| 28215f3286 | |||
| d815125160 | |||
| 56ce5f0965 | |||
| 0e319f934d | |||
| 35c114a9dc | |||
| 8d62aacbda | |||
| 4a7cd55555 | |||
| 8608db739d | |||
| 4c8aa550dd | |||
| 290084cfdc | |||
| cc2c883f80 | |||
| 7914d49318 | |||
| 4776de0668 | |||
| 478c9e9380 | |||
| 1258810abc | |||
| ca005e23f7 | |||
| ec74fb3501 | |||
| bee3222be8 | |||
| 8241c5e324 | |||
| 47641637e5 | |||
| 8ee76d1ffe | |||
| 86bea5c65e | |||
| 7a158dac13 | |||
| b782e682f0 | |||
| 94f07cd524 | |||
| eee9477bfd | |||
| c2325b6ffd | |||
| c09019a4b5 | |||
| b1abcbd50a | |||
| ced48de808 | |||
| 01d786178d | |||
| 46387ff2ae | |||
| b34fc1be24 | |||
| c971067f91 | |||
| 64b0ce50b7 | |||
| 36f4fa0c2d | |||
| a1d04b878b | |||
| 3ab263074c | |||
| b024b748c7 | |||
| 22ee674191 | |||
| 0f132d1bee | |||
| c58f9a458e | |||
| d54a1b6712 | |||
| 3ffbc9a3e0 | |||
| 0741bdca11 | |||
| ba79369331 | |||
| 0a4025eaa5 | |||
| 1ce63d3fc2 | |||
| b9ecfd4957 | |||
| 16ef809654 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
README $Id$
|
||||
README $Id$
|
||||
------
|
||||
|
||||
QUICK INSTALL
|
||||
|
||||
+8
-220
@@ -11,7 +11,10 @@ require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
admin_externalpage_setup('userauthentication');
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
@@ -19,13 +22,6 @@ $auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
// get currently installed and enabled auth plugins
|
||||
$authsavailable = get_list_of_plugins('auth');
|
||||
|
||||
//revert auth_plugins_enabled
|
||||
if (isset($CFG->auth_plugins_enabled)) {
|
||||
set_config('auth', $CFG->auth_plugins_enabled);
|
||||
delete_records('config', 'name', 'auth_plugins_enabled');
|
||||
unset($CFG->auth_plugins_enabled);
|
||||
}
|
||||
|
||||
get_enabled_auth_plugins(true); // fix the list of enabled auths
|
||||
if (empty($CFG->auth)) {
|
||||
$authsenabled = array();
|
||||
@@ -33,44 +29,18 @@ if (empty($CFG->auth)) {
|
||||
$authsenabled = explode(',', $CFG->auth);
|
||||
}
|
||||
|
||||
if (!isset($CFG->registerauth)) {
|
||||
set_config('registerauth', '');
|
||||
}
|
||||
|
||||
if (!isset($CFG->auth_instructions)) {
|
||||
set_config('auth_instructions', '');
|
||||
}
|
||||
|
||||
if (!empty($auth) and !exists_auth_plugin($auth)) {
|
||||
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// process actions
|
||||
|
||||
$status = '';
|
||||
if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'save':
|
||||
if (data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// save settings
|
||||
set_config('guestloginbutton', required_param('guestloginbutton', PARAM_BOOL));
|
||||
set_config('alternateloginurl', stripslashes(trim(required_param('alternateloginurl', PARAM_RAW))));
|
||||
set_config('registerauth', required_param('register', PARAM_SAFEDIR));
|
||||
set_config('auth_instructions', stripslashes(trim(required_param('auth_instructions', PARAM_RAW))));
|
||||
|
||||
// enable registerauth in $CFG->auth if needed
|
||||
if (!empty($CFG->registerauth) and !in_array($CFG->registerauth, $authsenabled)) {
|
||||
$authsenabled[] = $CFG->registerauth;
|
||||
set_config('auth', implode(',', $authsenabled));
|
||||
}
|
||||
$status = get_string('changessaved');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
// remove from enabled list
|
||||
$key = array_search($auth, $authsenabled);
|
||||
@@ -127,188 +97,6 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
// display strings
|
||||
$txt = get_strings(array('authenticationplugins', 'users', 'administration',
|
||||
'settings', 'edit', 'name', 'enable', 'disable',
|
||||
'up', 'down', 'none'));
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
|
||||
// construct the display array, with enabled auth plugins at the top, in order
|
||||
$displayauths = array();
|
||||
$registrationauths = array();
|
||||
$registrationauths[''] = $txt->disable;
|
||||
foreach ($authsenabled as $auth) {
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($authsavailable as $auth) {
|
||||
if (array_key_exists($auth, $displayauths)) {
|
||||
continue; //already in the list
|
||||
}
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
/// Apply titles
|
||||
$displayauths[$auth] = $authtitle;
|
||||
if ($authplugin->can_signup()) {
|
||||
$registrationauths[$auth] = $authtitle;
|
||||
}
|
||||
}
|
||||
|
||||
// build the display table
|
||||
$table = new flexible_table('auth_admin_table');
|
||||
$table->define_columns(array('name', 'enable', 'order', 'settings'));
|
||||
$table->define_headers(array($txt->name, $txt->enable, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("{$CFG->wwwroot}/{$CFG->admin}/auth.php");
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
//add always enabled plugins first
|
||||
$displayname = "<span>".$displayauths['manual']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=manual\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
$displayname = "<span>".$displayauths['nologin']."</span>";
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=nologin\">{$txt->settings}</a>";
|
||||
$table->add_data(array($displayname, '', '', $settings));
|
||||
|
||||
|
||||
// iterate through auth plugins and add to the display table
|
||||
$updowncount = 1;
|
||||
$authcount = count($authsenabled);
|
||||
$url = "auth.php?sesskey=" . sesskey();
|
||||
foreach ($displayauths as $auth => $name) {
|
||||
if ($auth == 'manual' or $auth == 'nologin') {
|
||||
continue;
|
||||
}
|
||||
// hide/show link
|
||||
if (in_array($auth, $authsenabled)) {
|
||||
$hideshow = "<a href=\"$url&action=disable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"disable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=disable&auth=$auth\"><input type=\"checkbox\" checked /></a>";
|
||||
$enabled = true;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$url&action=enable&auth=$auth\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"enable\" /></a>";
|
||||
// $hideshow = "<a href=\"$url&action=enable&auth=$auth\"><input type=\"checkbox\" /></a>";
|
||||
$enabled = false;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
// up/down link (only if auth is enabled)
|
||||
$updown = '';
|
||||
if ($enabled) {
|
||||
if ($updowncount > 1) {
|
||||
$updown .= "<a href=\"$url&action=up&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount < $authcount) {
|
||||
$updown .= "<a href=\"$url&action=down&auth=$auth\">";
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
|
||||
}
|
||||
++ $updowncount;
|
||||
}
|
||||
|
||||
// settings link
|
||||
$settings = "<a href=\"auth_config.php?sesskey={$USER->sesskey}&auth=$auth\">{$txt->settings}</a>";
|
||||
|
||||
// add a row to the table
|
||||
$table->add_data(array($displayname, $hideshow, $updown, $settings));
|
||||
}
|
||||
|
||||
// output form
|
||||
admin_externalpage_print_header();
|
||||
|
||||
//print stus messages
|
||||
if ($status !== '') {
|
||||
notify($status, 'notifysuccess');
|
||||
}
|
||||
|
||||
print_simple_box(get_string('configauthenticationplugins', 'admin'), 'center', '700');
|
||||
|
||||
$table->print_html();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$guestoptions = array();
|
||||
$guestoptions[0] = get_string("hide");
|
||||
$guestoptions[1] = get_string("show");
|
||||
|
||||
echo '<hr />';
|
||||
|
||||
echo '<form '.$CFG->frametarget.' id="adminsettings" method="post" action="auth.php">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
print_heading(get_string('auth_common_settings', 'auth'));
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
echo '<fieldset>';
|
||||
##echo '<table cellspacing="0" cellpadding="5" border="0" style="margin-left:auto;margin-right:auto">';
|
||||
|
||||
// User self registration
|
||||
echo '<div class="form-item" id="admin-register">';
|
||||
echo '<label for = "menuregister">' . get_string("selfregistration", "auth");
|
||||
echo '<span class="form-shortname">registerauth</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($registrationauths, "register", $CFG->registerauth, "");
|
||||
echo '<div class="description">' . get_string("selfregistration_help", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
// Login as guest button enabled
|
||||
echo '<div class="form-item" id="admin-guestloginbutton">';
|
||||
echo '<label for = "menuguestloginbutton">' . get_string("guestloginbutton", "auth");
|
||||
echo '<span class="form-shortname">guestloginbutton</span>';
|
||||
echo '</label>';
|
||||
choose_from_menu($guestoptions, "guestloginbutton", $CFG->guestloginbutton, "");
|
||||
echo '<div class="description">' . get_string("showguestlogin", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
/// An alternate url for the login form. It means we can use login forms that are integrated
|
||||
/// into non-moodle pages
|
||||
echo '<div class="form-item" id="admin-alternateloginurl">';
|
||||
echo '<label for = "alternateloginurl">' . get_string("alternateloginurl", "auth");
|
||||
echo '<span class="form-shortname">alternateloginurl</span>';
|
||||
echo '</label>';
|
||||
echo '<input type="text" size="60" name="alternateloginurl" id="alternateloginurl" value="'.$CFG->alternateloginurl."\" />\n";
|
||||
echo '<div class="description">' . get_string("alternatelogin", "auth", htmlspecialchars($CFG->wwwroot.'/login/index.php')) . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
/// Instructions about login/password
|
||||
/// to be showed to users
|
||||
echo '<div class="form-item" id="admin-auth_instructions">';
|
||||
echo '<label for = "auth_instructions">' . get_string("instructions", "auth");
|
||||
echo '<span class="form-shortname">auth_instructions</span>';
|
||||
echo '</label>';
|
||||
echo '<textarea cols="30" rows="4" name="auth_instructions" id="auth_instructions">'.s($CFG->auth_instructions)."</textarea>\n";
|
||||
echo '<div class="description">' . get_string("authinstructions", "auth") . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
admin_externalpage_print_footer();
|
||||
redirect ($returnurl);
|
||||
|
||||
?>
|
||||
|
||||
+11
-16
@@ -6,18 +6,19 @@
|
||||
require_once '../config.php';
|
||||
require_once $CFG->libdir.'/adminlib.php';
|
||||
|
||||
admin_externalpage_setup('userauthentication');
|
||||
$auth = required_param('auth', PARAM_SAFEDIR);
|
||||
|
||||
$CFG->pagepath = 'auth/' . $auth;
|
||||
|
||||
admin_externalpage_setup('authsetting'.$auth);
|
||||
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
$err = array();
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
|
||||
|
||||
// save configuration changes
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
$frm = stripslashes_recursive($frm);
|
||||
|
||||
$authplugin->validate_form($frm, $err);
|
||||
@@ -37,7 +38,7 @@ if ($frm = data_submitted()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect("auth.php");
|
||||
redirect($returnurl);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
@@ -52,15 +53,9 @@ if ($frm = data_submitted()) {
|
||||
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
|
||||
|
||||
/// Get the auth title (from core or own auth lang files)
|
||||
$authtitle = get_string("auth_{$auth}title", "auth");
|
||||
if ($authtitle == "[[auth_{$auth}title]]") {
|
||||
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
$authtitle = $authplugin->get_title();
|
||||
/// Get the auth descriptions (from core or own auth lang files)
|
||||
$authdescription = get_string("auth_{$auth}description", "auth");
|
||||
if ($authdescription == "[[auth_{$auth}description]]") {
|
||||
$authdescription = get_string("auth_{$auth}description", "auth_{$auth}");
|
||||
}
|
||||
$authdescription = $authplugin->get_description();
|
||||
|
||||
// output configuration form
|
||||
admin_externalpage_print_header();
|
||||
|
||||
+4
-9
@@ -6,14 +6,14 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
|
||||
admin_externalpage_setup('manageblocks');
|
||||
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
|
||||
if(($blockrecord = blocks_get_record($blockid)) === false) {
|
||||
if(!$blockrecord = blocks_get_record($blockid)) {
|
||||
error('This block does not exist');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('blocksetting'.$blockrecord->name);
|
||||
|
||||
$block = block_instance($blockrecord->name);
|
||||
if($block === false) {
|
||||
error('Problem in instantiating block object');
|
||||
@@ -50,11 +50,6 @@
|
||||
$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';
|
||||
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strblockname);
|
||||
@@ -70,6 +65,6 @@
|
||||
echo '</p>';
|
||||
$block->config_print();
|
||||
echo '</form>';
|
||||
admin_externalpage_print_footer();
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+30
-28
@@ -29,10 +29,6 @@
|
||||
$strmultiple = get_string('blockmultiple', 'admin');
|
||||
$strshowblockcourse = get_string('showblockcourse');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) && confirm_sesskey()) {
|
||||
@@ -40,6 +36,7 @@
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($show) && confirm_sesskey() ) {
|
||||
@@ -47,6 +44,7 @@
|
||||
error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '1', 'id', $block->id); // Show block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($multiple) && confirm_sesskey()) {
|
||||
@@ -55,9 +53,12 @@
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
update_record('block', $block);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($delete) && confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
if (!$block = blocks_get_record($delete)) {
|
||||
error("Block doesn't exist!");
|
||||
@@ -99,25 +100,9 @@
|
||||
notify("Error occurred while deleting the $strblockname record from blocks table");
|
||||
}
|
||||
|
||||
// Then the tables themselves
|
||||
if ($tables = $db->Metatables()) {
|
||||
$prefix = $CFG->prefix.$block->name;
|
||||
$prefix2 = $CFG->prefix.'block_'.$block->name;
|
||||
foreach ($tables as $table) {
|
||||
if (strpos($table, $prefix) === 0 || strpos($table, $prefix2) === 0) {
|
||||
/// If the match has been due to the 1st condition, debug to developers
|
||||
if (strpos($table, $prefix) === 0) {
|
||||
debugging('This block has some wrongly named tables. See Moodle Docs coding guidelines (and MDL-6786)', DEBUG_DEVELOPER);
|
||||
}
|
||||
/// Strip prefix from $table
|
||||
$table = preg_replace("/^{$CFG->prefix}/", '', $table);
|
||||
$xmldb_table = new XMLDBTable($table);
|
||||
if (!drop_table($xmldb_table, true, false)) {
|
||||
notify("ERROR: while trying to drop table $table");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
drop_plugin_tables($block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false); // old obsoleted table names
|
||||
drop_plugin_tables('block_'.$block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false);
|
||||
|
||||
// Delete the capabilities that were defined by this block
|
||||
capabilities_cleanup('block/'.$block->name);
|
||||
|
||||
@@ -130,6 +115,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
/// Main display starts here
|
||||
|
||||
/// Get and sort the existing blocks
|
||||
@@ -174,21 +162,35 @@
|
||||
foreach ($blockbyname as $blockname => $blockid) {
|
||||
|
||||
$blockobject = $blockobjects[$blockid];
|
||||
$block = $blocks[$blockid];
|
||||
|
||||
$delete = '<a href="blocks.php?delete='.$blockid.'&sesskey='.$USER->sesskey.'">'.$strdelete.'</a>';
|
||||
|
||||
$settings = ''; // By default, no configuration
|
||||
if($blockobject->has_config()) {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
if ($blockobject->has_config()) {
|
||||
if (file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
|
||||
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
|
||||
} else {
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$count = count_records('block_instance', 'blockid', $blockid);
|
||||
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
|
||||
// and it should not show up on course search page
|
||||
|
||||
$totalcount = count_records('block_instance', 'blockid', $blockid);
|
||||
|
||||
$count = count_records_sql('SELECT COUNT(*)
|
||||
FROM '.$CFG->prefix.'block_instance
|
||||
WHERE blockid = '.$blockid.' AND
|
||||
pagetype = \'course-view\'');
|
||||
|
||||
if ($count>0) {
|
||||
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
|
||||
}
|
||||
else {
|
||||
$blocklist = "$count";
|
||||
$blocklist = "$totalcount";
|
||||
}
|
||||
$class = ''; // Nothing fancy, by default
|
||||
|
||||
|
||||
+66
-52
@@ -100,7 +100,8 @@
|
||||
/// Run all cron jobs for each module
|
||||
|
||||
mtrace("Starting activity modules");
|
||||
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
get_mailer('buffer');
|
||||
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1 ")) {
|
||||
foreach ($mods as $mod) {
|
||||
$libfile = "$CFG->dirroot/mod/$mod->name/lib.php";
|
||||
if (file_exists($libfile)) {
|
||||
@@ -108,6 +109,7 @@
|
||||
$cron_function = $mod->name."_cron";
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing module function $cron_function ...", '');
|
||||
$pre_dbqueries = null;
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(1);
|
||||
@@ -128,10 +130,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
get_mailer('close');
|
||||
mtrace("Finished activity modules");
|
||||
|
||||
mtrace("Starting blocks");
|
||||
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1")) {
|
||||
// we will need the base class.
|
||||
require_once($CFG->dirroot.'/blocks/moodleblock.class.php');
|
||||
foreach ($blocks as $block) {
|
||||
@@ -157,6 +160,33 @@
|
||||
}
|
||||
mtrace('Finished blocks');
|
||||
|
||||
mtrace('Starting admin reports');
|
||||
// Admin reports do not have a database table that lists them. Instead a
|
||||
// report includes cron.php with function report_reportname_cron() if it wishes
|
||||
// to be cronned. It is up to cron.php to handle e.g. if it only needs to
|
||||
// actually do anything occasionally.
|
||||
$reports = get_list_of_plugins($CFG->admin.'/report');
|
||||
foreach($reports as $report) {
|
||||
$cronfile = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php';
|
||||
if (file_exists($cronfile)) {
|
||||
require_once($cronfile);
|
||||
$cronfunction = 'report_'.$report.'_cron';
|
||||
mtrace('Processing cron function for '.$report.'...', '');
|
||||
$pre_dbqueries = null;
|
||||
if (!empty($PERF->dbqueries)) {
|
||||
$pre_dbqueries = $PERF->dbqueries;
|
||||
$pre_time = microtime(true);
|
||||
}
|
||||
$cronfunction();
|
||||
if (isset($pre_dbqueries)) {
|
||||
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
|
||||
mtrace("... used " . round(microtime(true) - $pre_time, 2) . " seconds");
|
||||
}
|
||||
mtrace('done.');
|
||||
}
|
||||
}
|
||||
mtrace('Finished admin reports');
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages(true);
|
||||
@@ -189,9 +219,9 @@
|
||||
}
|
||||
|
||||
|
||||
mtrace('Starting grade job ...', '');
|
||||
mtrace('Starting main gradebook job ...');
|
||||
grade_cron();
|
||||
mtrace('Done ...');
|
||||
mtrace('done.');
|
||||
|
||||
|
||||
/// Run all core cron jobs, but not every time since they aren't too important.
|
||||
@@ -428,56 +458,31 @@
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
$timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour*60*60 + $CFG->statsruntimestartminute*60;
|
||||
|
||||
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')) {
|
||||
// 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);
|
||||
// process max 31 days per cron execution
|
||||
if (stats_cron_daily(31)) {
|
||||
if (stats_cron_weekly()) {
|
||||
if (stats_cron_monthly()) {
|
||||
stats_clean_old();
|
||||
}
|
||||
}
|
||||
}
|
||||
@set_time_limit(0);
|
||||
} else {
|
||||
mtrace('Next stats run after:'. userdate($timetocheck));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// run gradebook import/export/report cron
|
||||
if ($gradeimports = get_list_of_plugins('grade/import')) {
|
||||
foreach ($gradeimports as $gradeimport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/import/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/import/lib.php');
|
||||
$cron_function = 'gradeimport_'.$gradeimport.'_cron';
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
|
||||
$cron_function = 'grade_import_'.$gradeimport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook import function $cron_function ...", '');
|
||||
$cron_function;
|
||||
@@ -488,9 +493,9 @@
|
||||
|
||||
if ($gradeexports = get_list_of_plugins('grade/export')) {
|
||||
foreach ($gradeexports as $gradeexport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/export/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||
$cron_function = 'gradeexport_'.$gradeexport.'_cron';
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
|
||||
$cron_function = 'grade_export_'.$gradeexport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook export function $cron_function ...", '');
|
||||
$cron_function;
|
||||
@@ -498,12 +503,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($gradereports = get_list_of_plugins('grade/report')) {
|
||||
foreach ($gradereports as $gradereport) {
|
||||
if (file_exists($CFG->dirroot.'/grade/report/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/report/lib.php');
|
||||
$cron_function = 'gradereport_'.$gradereport.'_cron';
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
|
||||
$cron_function = 'grade_report_'.$gradereport.'_cron';
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing gradebook report function $cron_function ...", '');
|
||||
$cron_function;
|
||||
@@ -511,6 +516,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run any customized cronjobs, if any
|
||||
// looking for functions in lib/local/cron.php
|
||||
if (file_exists($CFG->dirroot.'/local/cron.php')) {
|
||||
mtrace('Processing customized cron script ...', '');
|
||||
include_once($CFG->dirroot.'/local/cron.php');
|
||||
mtrace('done.');
|
||||
}
|
||||
|
||||
|
||||
//Unset session variables and destroy it
|
||||
@session_unset();
|
||||
@@ -521,7 +535,7 @@
|
||||
$difftime = microtime_diff($starttime, microtime());
|
||||
mtrace("Execution took ".$difftime." seconds");
|
||||
|
||||
/// finishe the IE hack
|
||||
/// finish the IE hack
|
||||
if (check_browser_version('MSIE')) {
|
||||
echo "</xmp>";
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@@ -65,10 +65,10 @@
|
||||
if ($cd = new component_installer('http://download.moodle.org',
|
||||
'environment',
|
||||
'environment.zip')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/environment/environment.zip';
|
||||
$a->dest= $CFG->dataroot.'/';
|
||||
@@ -77,10 +77,10 @@
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
|
||||
}
|
||||
break;
|
||||
case UPTODATE:
|
||||
case COMPONENT_UPTODATE:
|
||||
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
|
||||
break;
|
||||
case INSTALLED:
|
||||
case COMPONENT_INSTALLED:
|
||||
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.9">
|
||||
@@ -167,6 +172,11 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
@@ -180,6 +190,11 @@
|
||||
<ON_OK message="questioncwqpfsok" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="globalswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.0" requires="1.9">
|
||||
@@ -229,6 +244,11 @@
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
|
||||
@@ -237,6 +257,11 @@
|
||||
<ON_OK message="qtyperqpwillberemoved" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="globalswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+12
-19
@@ -6,20 +6,15 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
admin_externalpage_setup('managefilters');
|
||||
$filterfull = required_param('filter', PARAM_PATH);
|
||||
$forcereset = optional_param('reset', 0, PARAM_BOOL);
|
||||
|
||||
// get parameters
|
||||
$param = new Object;
|
||||
$filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
|
||||
|
||||
$param->filter = required_param('filter', PARAM_PATH);
|
||||
$param->submit = optional_param('submit', 0, PARAM_BOOL);
|
||||
$param->reset = optional_param('reset', 0, PARAM_BOOL);
|
||||
admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
|
||||
|
||||
$filtername = substr($param->filter, strpos( $param->filter, '/' )+1 ) ;
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
|
||||
|
||||
// $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;
|
||||
@@ -32,12 +27,7 @@
|
||||
//======================
|
||||
|
||||
// if reset pressed let filter config page handle it
|
||||
$forcereset = false;
|
||||
if (!empty($param->reset)) {
|
||||
$forcereset = true;
|
||||
}
|
||||
else
|
||||
if ($config = data_submitted()) {
|
||||
if ($config = data_submitted() and !$forcereset) {
|
||||
|
||||
// check session key
|
||||
if (!confirm_sesskey()) {
|
||||
@@ -61,7 +51,10 @@
|
||||
set_config($name, stripslashes($value));
|
||||
}
|
||||
}
|
||||
redirect("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
|
||||
reset_text_filters_cache();
|
||||
|
||||
redirect($returnurl);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -79,11 +72,11 @@
|
||||
print_simple_box_start("center",'');
|
||||
|
||||
?>
|
||||
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
|
||||
<form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
|
||||
<div style="text-align: center">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
|
||||
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
|
||||
<?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
|
||||
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
|
||||
|
||||
+41
-215
@@ -1,135 +1,73 @@
|
||||
<?php // $Id$
|
||||
// filters.php
|
||||
// Edit list of available text filters
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
// defines
|
||||
define('FILTER_TABLE','filter_administration_table');
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$filterpath = optional_param('filterpath', '', PARAM_PATH);
|
||||
|
||||
admin_externalpage_setup('managefilters');
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
// 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);
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
|
||||
|
||||
// some basic information
|
||||
$url = 'filters.php';
|
||||
$myurl = "$url?sesskey=" . sesskey();
|
||||
$img = "$CFG->pixpath/t";
|
||||
if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
// 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');
|
||||
|
||||
// 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
|
||||
// get a list of installed filters
|
||||
$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)) {
|
||||
$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";
|
||||
}
|
||||
$installedfilters["$filterlocation/$plugin"] = "$filterlocation/$plugin";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get all the currently selected filters
|
||||
if (!empty($CFG->textfilters)) {
|
||||
$oldactivefilters = explode(',', $CFG->textfilters);
|
||||
$oldactivefilters = array_unique($oldactivefilters);
|
||||
$activefilters = explode(',', $CFG->textfilters);
|
||||
} else {
|
||||
$oldactivefilters = array();
|
||||
}
|
||||
|
||||
// take this opportunity to clean up filters
|
||||
$activefilters = array();
|
||||
foreach ($oldactivefilters as $oldactivefilter) {
|
||||
if (!empty($oldactivefilter) and array_key_exists($oldactivefilter, $installedfilters)) {
|
||||
$activefilters[] = $oldactivefilter;
|
||||
}
|
||||
$activefilters = array();
|
||||
}
|
||||
|
||||
//======================
|
||||
// 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);
|
||||
switch ($action) {
|
||||
|
||||
case 'hide':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
// ignore it - doubleclick??
|
||||
} else {
|
||||
// just delete it
|
||||
unset($activefilters[$key]);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
break;
|
||||
}
|
||||
} elseif (($params->action=="show") and confirm_sesskey()) {
|
||||
// just delete it
|
||||
unset($activefilters[$key]);
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
// 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)) {
|
||||
if (!array_key_exists($filterpath, $installedfilters)) {
|
||||
error("Filter $filterpath is not currently installed", $url);
|
||||
} elseif (array_search($filterpath,$activefilters)) {
|
||||
// filterpath is already active - doubleclick??
|
||||
} else {
|
||||
// add it to installed filters
|
||||
$activefilters[] = $params->filterpath;
|
||||
$activefilters[] = $filterpath;
|
||||
$activefilters = array_unique($activefilters);
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
}
|
||||
} elseif (($params->action=="down") and confirm_sesskey()) {
|
||||
$key=array_search($params->filterpath, $activefilters);
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
} elseif ($key>=(count($activefilters)-1)) {
|
||||
// cannot be moved any further down - doubleclick??
|
||||
} else {
|
||||
@@ -137,13 +75,14 @@
|
||||
$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);
|
||||
break;
|
||||
|
||||
case 'up':
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $params->filterpath is not currently active", $url);
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
} elseif ($key<1) {
|
||||
//cannot be moved any further up - doubleclick??
|
||||
} else {
|
||||
@@ -151,126 +90,13 @@
|
||||
$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);
|
||||
break;
|
||||
}
|
||||
|
||||
//======================
|
||||
// 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->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
$table->set_attribute('id', 'filters');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->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\" class=\"icon\" alt=\"$txt->hide\" /></a>";
|
||||
$hidden = false;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$myurl&action=show&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"$txt->show\" /></a>";
|
||||
$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=\"$txt->up\" /></a> ";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount<$activefilterscount) {
|
||||
$updown .= "<a href=\"$myurl&action=down&filterpath=$upath\">";
|
||||
$updown .= "<img src=\"$img/down.gif\" alt=\"$txt->down\" /></a>";
|
||||
}
|
||||
else {
|
||||
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" class=\"icon\" 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
|
||||
//==============================
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading_with_help($txt->managefilters, 'filters');
|
||||
|
||||
// print the table of all the filters
|
||||
$table->print_html();
|
||||
|
||||
// cache control table has been removed
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
// save, reset cache and return
|
||||
set_config('textfilters', implode(',', $activefilters));
|
||||
reset_text_filters_cache();
|
||||
redirect($returnurl);
|
||||
|
||||
?>
|
||||
|
||||
+79
-44
@@ -24,13 +24,15 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
|
||||
require_once($CFG->libdir.'/ddllib.php'); // Install/upgrade related db functions
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Upgrade-related functions
|
||||
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$id = optional_param('id', '', PARAM_TEXT);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
||||
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
|
||||
$confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||
|
||||
/// check upgrade status first
|
||||
if ($ignoreupgradewarning and !empty($_SESSION['upgraderunning'])) {
|
||||
@@ -122,6 +124,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $maintables) {
|
||||
/// hide errors from headers in case debug enabled in config.php
|
||||
$origdebug = $CFG->debug;
|
||||
@@ -157,6 +160,7 @@
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
$strdatabasesetup = get_string("databasesetup");
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
$navigation = build_navigation(array(array('name'=>$strdatabasesetup, 'link'=>null, 'type'=>'misc')));
|
||||
@@ -202,27 +206,21 @@
|
||||
// install core event handlers
|
||||
events_update_definition();
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
$adminroot = admin_get_root();
|
||||
$adminroot->prune('backups'); // backup settings table not created yet
|
||||
apply_default_settings($adminroot);
|
||||
|
||||
/// This is used to handle any settings that must exist in $CFG but which do not exist in
|
||||
/// admin_get_root()/$ADMIN as admin_setting objects (there are some exceptions).
|
||||
apply_default_exception_settings(array('alternateloginurl' => '',
|
||||
'auth' => 'email',
|
||||
apply_default_exception_settings(array('auth' => 'email',
|
||||
'auth_pop3mailbox' => 'INBOX',
|
||||
'changepassword' => '',
|
||||
'enrol' => 'manual',
|
||||
'enrol_plugins_enabled' => 'manual',
|
||||
'guestloginbutton' => 1,
|
||||
'registerauth' => 'email',
|
||||
'style' => 'default',
|
||||
'template' => 'default',
|
||||
'theme' => 'standardwhite',
|
||||
'filter_multilang_converted' => 1));
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
admin_apply_default_settings(NULL, true);
|
||||
|
||||
notify($strdatabasesuccess, "green");
|
||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||
} else {
|
||||
@@ -264,8 +262,9 @@
|
||||
$CFG->debug = DEBUG_MINIMAL;
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
// logout in case we are upgrading from pre 1.7 version - prevention of weird session problems
|
||||
if ($CFG->version < 2006050600) {
|
||||
// logo ut in case we are upgrading from pre 1.9 version in order to prevent
|
||||
// weird session/role problems caused by incorrect data in USER and SESSION
|
||||
if ($CFG->version < 2007101500) {
|
||||
require_logout();
|
||||
}
|
||||
|
||||
@@ -275,6 +274,7 @@
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
|
||||
print_footer('none');
|
||||
exit;
|
||||
|
||||
} else if (empty($confirmrelease)){
|
||||
@@ -287,22 +287,51 @@
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<div class="continuebutton">';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
print_footer('none');
|
||||
die;
|
||||
} elseif (empty($confirmplugincheck)) {
|
||||
$strplugincheck = get_string('plugincheck');
|
||||
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, " ", " ");
|
||||
print_heading($strplugincheck);
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('pluginchecknotice');
|
||||
print_box_end();
|
||||
print_plugin_tables();
|
||||
echo "<br />";
|
||||
echo '<div class="continuebutton">';
|
||||
print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
|
||||
echo '</div><br />';
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
print_footer('none');
|
||||
die();
|
||||
|
||||
} else {
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
|
||||
@@ -360,7 +389,7 @@
|
||||
/// Main upgrade not success
|
||||
} else {
|
||||
notify('Main Upgrade failed! See lib/db/upgrade.php');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
@@ -415,6 +444,9 @@
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check all auth plugins and upgrade if necessary
|
||||
upgrade_plugins('auth','auth',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all course formats and upgrade if necessary
|
||||
upgrade_plugins('format','course/format',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
@@ -424,7 +456,7 @@
|
||||
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for changes to RPC functions
|
||||
require_once($CFG->dirroot.'/admin/mnet/adminlib.php');
|
||||
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
||||
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Upgrade all plugins for gradebook
|
||||
@@ -435,6 +467,9 @@
|
||||
/// Check all message output plugins and upgrade if necessary
|
||||
upgrade_plugins('message','message/output',"$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
/// Check all admin report plugins and upgrade if necessary
|
||||
upgrade_plugins('report', $CFG->admin.'/report', "$CFG->wwwroot/$CFG->admin/index.php");
|
||||
|
||||
|
||||
/// just make sure upgrade logging is properly terminated
|
||||
upgrade_log_finish();
|
||||
@@ -472,6 +507,7 @@
|
||||
|
||||
$cat = new object();
|
||||
$cat->name = get_string('miscellaneous');
|
||||
$cat->depth = 1;
|
||||
if (!$catid = insert_record('course_categories', $cat)) {
|
||||
error("Serious Error! Could not set up a default course category!");
|
||||
}
|
||||
@@ -521,8 +557,8 @@
|
||||
create_admin_user();
|
||||
}
|
||||
|
||||
/// Check for valid admin user
|
||||
require_login();
|
||||
/// Check for valid admin user - no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
@@ -542,10 +578,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
$adminroot =& admin_get_root();
|
||||
|
||||
/// Check if there are any new admin settings which have still yet to be set
|
||||
if( any_new_admin_settings( $adminroot ) ){
|
||||
if (any_new_admin_settings($adminroot)){
|
||||
redirect('upgradesettings.php');
|
||||
}
|
||||
|
||||
@@ -566,14 +602,21 @@
|
||||
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_box(get_string('globalsquoteswarning', 'admin'), 'generalbox adminwarning');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_box(get_string('globalswarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
if (substr($CFG->wwwroot, -1) == '/') {
|
||||
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
||||
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
if (time() - $lastcron > 3600 * 24) {
|
||||
@@ -593,18 +636,19 @@
|
||||
}
|
||||
|
||||
|
||||
/// Print slightly annoying registration button every six months ;-)
|
||||
/// You can set the "registered" variable to something far in the future
|
||||
/// if you really want to prevent this. eg 9999999999
|
||||
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_box_start('generalbox adminwarning');
|
||||
print_string('pleaseregister', 'admin');
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
print_box_end();
|
||||
$registrationbuttonshown = true;
|
||||
/// Print slightly annoying registration button
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_box_start('generalbox adminwarning');
|
||||
if(!isset($CFG->registered)) {
|
||||
print_string('pleaseregister', 'admin');
|
||||
}
|
||||
else { /* if (isset($CFG->registered) && $CFG->registered < (time() - 3600*24*30*6)) { */
|
||||
print_string('pleaserefreshregistration', 'admin', userdate($CFG->registered));
|
||||
}
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
print_box_end();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
||||
@@ -616,15 +660,6 @@
|
||||
print_box($copyrighttext, 'copyright');
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if (empty($registrationbuttonshown)) {
|
||||
$options = array();
|
||||
$options['sesskey'] = $USER->sesskey;
|
||||
print_single_button('register.php', $options, get_string('registration'));
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+413
-39
@@ -7,6 +7,8 @@
|
||||
* @param bool $uselocal save translations into *_local pack?
|
||||
*/
|
||||
|
||||
$dbg = ''; // debug output;
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
@@ -18,15 +20,21 @@
|
||||
define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines?
|
||||
define('LANG_DISPLAY_MISSING_LINKS', 1); // display "go to first/next missing string" links?
|
||||
define('LANG_DEFAULT_FILE', ''); // default file to translate. Empty allowed
|
||||
define('LANG_DEFAULT_HELPFILE', ''); // default helpfile to translate. Empty allowed
|
||||
define('LANG_LINK_MISSING_STRINGS', 1); // create links from "missing" page to "compare" page?
|
||||
define('LANG_DEFAULT_USELOCAL', 0); // should *_utf8_local be used by default?
|
||||
define('LANG_MISSING_TEXT_MAX_LEN', 60); // maximum length of the missing text to display
|
||||
define('LANG_KEEP_ORPHANS', 1); // keep orphaned strings (i.e. strings w/o English reference)
|
||||
define('LANG_SEARCH_EXTRA', 1); // search lang files in extra locations
|
||||
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
$currentfile = optional_param('currentfile', LANG_DEFAULT_FILE, PARAM_FILE);
|
||||
$uselocal = optional_param('uselocal', -1, PARAM_INT);
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
if ($mode == 'helpfiles') {
|
||||
// use different PARAM_ options according to mode
|
||||
$currentfile = optional_param('currentfile', LANG_DEFAULT_HELPFILE, PARAM_PATH);
|
||||
} else {
|
||||
$currentfile = optional_param('currentfile', LANG_DEFAULT_FILE, PARAM_FILE);
|
||||
}
|
||||
$uselocal = optional_param('uselocal', -1, PARAM_INT);
|
||||
|
||||
if ($uselocal == -1) {
|
||||
if (isset($SESSION->langtranslateintolocal)) {
|
||||
@@ -70,6 +78,9 @@
|
||||
$strlangpackmaintaining = get_string('langpackmaintaining', 'admin');
|
||||
$strnomissingstrings = get_string('nomissingstrings', 'admin');
|
||||
$streditingnoncorelangfile = get_string('editingnoncorelangfile', 'admin');
|
||||
$strlanglocalpackage = get_string('langlocalpackage', 'admin');
|
||||
$strlangmasterpackage = get_string('langmasterpackage', 'admin');
|
||||
$strlangmasterenglish = get_string('langmasterenglish', 'admin');
|
||||
|
||||
$currentlang = current_language();
|
||||
|
||||
@@ -82,11 +93,13 @@
|
||||
case "compare":
|
||||
$title = $streditstrings;
|
||||
break;
|
||||
case "helpfiles":
|
||||
$title = $stredithelpdocs;
|
||||
default:
|
||||
$title = $strlanguage;
|
||||
break;
|
||||
}
|
||||
$navlinks[] = array('name' => $strlanguage, 'link' => "$CFG->wwwroot/admin/lang.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $strlanguage, 'link' => "$CFG->wwwroot/$CFG->admin/lang.php", 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
@@ -106,24 +119,23 @@
|
||||
}
|
||||
if (has_capability('moodle/site:langeditlocal', $context, $USER->id, false)) {
|
||||
$firstrow[] = new tabobject('uselocal',
|
||||
$CFG->wwwroot."/admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=1",
|
||||
"$CFG->wwwroot/$CFG->admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=1",
|
||||
$strlocalstringcustomization );
|
||||
}
|
||||
if (has_capability('moodle/site:langeditmaster', $context, $USER->id, false)) {
|
||||
$firstrow[] = new tabobject('usemaster',
|
||||
$CFG->wwwroot."/admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=0",
|
||||
"$CFG->wwwroot/$CFG->admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=0",
|
||||
$strlangpackmaintaining );
|
||||
}
|
||||
$secondrow[] = new tabobject('missing', $CFG->wwwroot.'/admin/lang.php?mode=missing', $strmissingstrings );
|
||||
$secondrow[] = new tabobject('compare', $CFG->wwwroot.'/admin/lang.php?mode=compare', $streditstrings );
|
||||
// TODO
|
||||
// langdoc.php functionality is planned to be merged into lang.php
|
||||
$secondrow[] = new tabobject('langdoc', $CFG->wwwroot.'/admin/langdoc.php', $stredithelpdocs );
|
||||
$secondrow[] = new tabobject('missing', "$CFG->wwwroot/$CFG->admin/lang.php?mode=missing", $strmissingstrings );
|
||||
$secondrow[] = new tabobject('compare', "$CFG->wwwroot/$CFG->admin/lang.php?mode=compare", $streditstrings );
|
||||
$secondrow[] = new tabobject('helpfiles', "$CFG->wwwroot/$CFG->admin/lang.php?mode=helpfiles", $stredithelpdocs );
|
||||
$tabs = array($firstrow, $secondrow);
|
||||
print_tabs($tabs, $currenttab, $inactive, $activated);
|
||||
|
||||
|
||||
if (!$mode) {
|
||||
// TODO this is a very nice place to put some translation statistics
|
||||
print_box_start();
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages(false, true);
|
||||
@@ -143,17 +155,30 @@
|
||||
$langdir = "$langbase/$currentlang";
|
||||
}
|
||||
$locallangdir = "$langbase/{$currentlang}_local";
|
||||
$saveto = $uselocal ? $locallangdir : $langdir;
|
||||
|
||||
// get the list of all English stringfiles
|
||||
$stringfiles = lang_standard_locations();
|
||||
if (LANG_SEARCH_EXTRA) {
|
||||
$stringfiles += lang_extra_locations();
|
||||
}
|
||||
if (count($stringfiles) == 0) {
|
||||
error("Could not find English language pack!");
|
||||
if (($mode == 'missing') || ($mode == 'compare')) {
|
||||
// get the list of all English stringfiles
|
||||
$stringfiles = lang_standard_locations();
|
||||
if (LANG_SEARCH_EXTRA) {
|
||||
$stringfiles += lang_extra_locations();
|
||||
}
|
||||
if (count($stringfiles) == 0) {
|
||||
error("Could not find English language pack!");
|
||||
}
|
||||
} elseif ($mode == 'helpfiles') {
|
||||
$helpfiles = lang_help_standard_locations();
|
||||
if (LANG_SEARCH_EXTRA) {
|
||||
$helpfiles += lang_help_extra_locations();
|
||||
}
|
||||
if (count($helpfiles) == 0) {
|
||||
error("Could not find help files in the English language pack!");
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "missing") {
|
||||
|
||||
|
||||
if ($mode == 'missing') {
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
@@ -200,7 +225,7 @@
|
||||
}
|
||||
// $enstring = English strings distributed either in the core space or in plugin space
|
||||
include($enfilepath);
|
||||
$enstring = $string;
|
||||
$enstring = isset($string) ? $string : array();
|
||||
unset($string);
|
||||
ksort($enstring);
|
||||
|
||||
@@ -209,7 +234,7 @@
|
||||
if (file_exists($lcfilepath)) {
|
||||
include($lcfilepath);
|
||||
$localfileismissing = 0;
|
||||
if (is_array($string)) {
|
||||
if (isset($string) && is_array($string)) {
|
||||
$lcstring = $string;
|
||||
}
|
||||
unset($string);
|
||||
@@ -334,7 +359,7 @@
|
||||
notice(get_string("languagegood"), "lang.php" );
|
||||
}
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
} else if ($mode == 'compare') {
|
||||
|
||||
if (!file_exists($langbase) ){
|
||||
if (!lang_make_directory($langbase) ){
|
||||
@@ -436,7 +461,7 @@
|
||||
}
|
||||
|
||||
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
|
||||
notify(get_string("changessaved")." ($saveinto/$currentfile)", "green");
|
||||
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
|
||||
} else {
|
||||
error("Could not save the file '$saveinto/$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile");
|
||||
}
|
||||
@@ -458,20 +483,16 @@
|
||||
}
|
||||
$menufiles[$item_key] = $item_label;
|
||||
}
|
||||
$selectionlabel = '<code class="path">';
|
||||
//$selectionlabel .= $strfilestoredin;
|
||||
$selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang;
|
||||
$selectionlabel .= '/</code>';
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=compare&currentfile=", $menufiles, "choosefile",
|
||||
$currentfile, $strchoosefiletoedit);
|
||||
|
||||
echo '<div class="filestorageinfobox">';
|
||||
echo $strfilestoredin;
|
||||
echo '<code class="path">';
|
||||
echo $uselocal ? "{$currentlang}_local" : $currentlang;
|
||||
echo '</code>';
|
||||
$currentfile, $strchoosefiletoedit, '', '', false, 'self', $selectionlabel);
|
||||
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
|
||||
echo '</div>';
|
||||
print_box_end();
|
||||
|
||||
|
||||
if ($currentfile <> '') {
|
||||
$saveto = $uselocal ? $locallangdir : $langdir;
|
||||
error_reporting(0);
|
||||
if (!isset($editable) || $editable) {
|
||||
if (!file_exists("$saveto/$currentfile")) {
|
||||
@@ -498,9 +519,9 @@
|
||||
|
||||
unset($string);
|
||||
include($enfilepath);
|
||||
$enstring = $string;
|
||||
$enstring = isset($string) ? $string : array();
|
||||
//
|
||||
// TODO/FIXME: IMHO following should not be here as the strings have moved into langconfig.php -- mudrd8mz
|
||||
// Following strings have moved into langconfig.php, but keep the here for backward compatibility
|
||||
//
|
||||
if ($currentlang != 'en' and $currentfile == 'moodle.php') {
|
||||
$enstring['thislanguage'] = "<< TRANSLATORS: Specify the name of your language here. If possible use Unicode Numeric Character References >>";
|
||||
@@ -573,8 +594,10 @@
|
||||
if (!$value) {
|
||||
if (!$value2) {
|
||||
$cellcolour = 'class="bothmissing"';
|
||||
$usetabindex = true;
|
||||
} else {
|
||||
$cellcolour = 'class="mastermissing"';
|
||||
$usetabindex = true;
|
||||
}
|
||||
$missingcounter++;
|
||||
if (LANG_DISPLAY_MISSING_LINKS) {
|
||||
@@ -591,8 +614,10 @@
|
||||
} else {
|
||||
if ($value <> $value2 && $value2 <> '') {
|
||||
$cellcolour = 'class="localdifferent"';
|
||||
$usetabindex = true;
|
||||
} else {
|
||||
$cellcolour = '';
|
||||
$usetabindex = false;
|
||||
}
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
@@ -611,14 +636,19 @@
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=40;
|
||||
if ($usetabindex) {
|
||||
$tabindex = 'tabindex="'.$missingcounter.'"';
|
||||
} else {
|
||||
$tabindex = '';
|
||||
}
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
$o .= '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
|
||||
$o .= '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'" '.$tabindex.'>'.$value.'</textarea>'."\n";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 5;
|
||||
}
|
||||
$o .= '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
|
||||
$o .= '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" '.$tabindex.' />';
|
||||
}
|
||||
if ($value2 <> '' && $value <> $value2) {
|
||||
$o .= '<br /><span style="font-size:small">'.$value2.'</span>';
|
||||
@@ -660,7 +690,212 @@
|
||||
// no $currentfile specified
|
||||
// no useful information to display - maybe some help? instructions?
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ($mode == 'helpfiles') {
|
||||
|
||||
$saveto = $saveto.'/help'; // the edited content will be saved to
|
||||
$enlangdir = $enlangdir.'/help'; // English master help files localtion
|
||||
$langdir = $langdir.'/help'; // current language master help files location
|
||||
$locallangdir = $locallangdir.'/help'; // local modifications of help files location
|
||||
$altdir = $uselocal ? $langdir : $locallangdir; // alternative to $saveto
|
||||
|
||||
$fileeditorrows = 10; // number of textareas' rows
|
||||
$fileeditorcols = 100; // dtto cols
|
||||
$filemissingmark = ' (***)'; // mark to add to non-existing or zero-length files
|
||||
$fileoldmark = ' (old?)'; // mark to add to filenames in selection form if the English version is newer
|
||||
$filetemplate = ''; // template for new files, e.g. CVS identification
|
||||
|
||||
if (isset($_POST['currentfile'])) { // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "lang.php?mode=helpfiles&currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
}
|
||||
}
|
||||
|
||||
print_box_start('generalbox editstrings');
|
||||
$menufiles = array();
|
||||
$menufiles_coregrp = 1;
|
||||
$origlocation = ''; // the location of the currentfile's English source will be stored here
|
||||
$origplugin = ''; // dtto plugin
|
||||
foreach ($helpfiles as $helppath => $helpfile) {
|
||||
$item_key = $helpfile['filename'];
|
||||
$item_label = $helpfile['filename'];
|
||||
if ((!file_exists($saveto.'/'.$helpfile['filename'])) || (filesize($saveto.'/'.$helpfile['filename']) == 0)) {
|
||||
$item_label .= $filemissingmark;
|
||||
} else {
|
||||
if (filemtime($saveto.'/'.$helpfile['filename']) < filemtime($helppath)) {
|
||||
$item_label .= $fileoldmark;
|
||||
}
|
||||
if ($helpfile['location'] != '' && $helpfile['plugin'] != '') {
|
||||
$item_label .= ' ('.$helpfile['location'].'/'.$helpfile['plugin'].')';
|
||||
if ($menufiles_coregrp == 1) {
|
||||
$menufiles['extra'] = '------------';
|
||||
$menufiles_coregrp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$menufiles[$item_key] = $item_label;
|
||||
if ($currentfile == $helpfile['filename']) {
|
||||
$origlocation = $helpfile['location'];
|
||||
$origplugin = $helpfile['plugin'];
|
||||
}
|
||||
}
|
||||
$selectionlabel = '<code class="path">';
|
||||
//$selectionlabel .= $strfilestoredin;
|
||||
$selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang;
|
||||
$selectionlabel .= '/help/</code>';
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=helpfiles&currentfile=", $menufiles, "choosefile",
|
||||
$currentfile, $strchoosefiletoedit, '', '', false, 'self', $selectionlabel);
|
||||
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
|
||||
print_box_end();
|
||||
|
||||
if (!empty($currentfile)) {
|
||||
|
||||
if (!file_exists("$saveto/$currentfile")) {
|
||||
$dbg .= "File does not exist: $saveto/$currentfile\n";
|
||||
//check if directory exist
|
||||
if (!file_exists(dirname("$saveto/$currentfile"))) {
|
||||
if(!lang_make_directory(dirname("$saveto/$currentfile"))) {
|
||||
echo ('Cannot create directory: '.dirname("$saveto/$currentfile"));
|
||||
}
|
||||
}
|
||||
//
|
||||
// file doesn't exist - let's check webserver's permission to create it
|
||||
//
|
||||
if (!@touch("$saveto/$currentfile")) {
|
||||
//
|
||||
// webserver is unable to create new file
|
||||
//
|
||||
notify(get_string('filemissing', '', "$saveto/$currentfile" ));
|
||||
notify(get_string('makeeditable', '', "$saveto/$currentfile"));
|
||||
$editable = false;
|
||||
} else {
|
||||
//
|
||||
// webserver can create new file - we can delete it now and let
|
||||
// it create again if its filesize() > 0
|
||||
//
|
||||
$editable = true;
|
||||
unlink("$saveto/$currentfile");
|
||||
}
|
||||
} elseif (is_writable("$saveto/$currentfile")) {
|
||||
$editable = true;
|
||||
} else {
|
||||
//
|
||||
// file exists but it is not writeable by web server process :-(
|
||||
//
|
||||
$editable = false;
|
||||
notify(get_string('makeeditable', '', "$saveto/$currentfile"));
|
||||
}
|
||||
|
||||
// master en_utf8 in dataroot is not editable
|
||||
if ((!$uselocal) && ($currentlang == 'en_utf8')) {
|
||||
$editable = false;
|
||||
}
|
||||
|
||||
echo '<div>';
|
||||
|
||||
if ($uselocal) {
|
||||
$strsavetotitle = $strlanglocalpackage . helpbutton('langpackages', $strlanglocalpackage, 'moodle', true, false, '', true);
|
||||
$straltdirtitle = $strlangmasterpackage . helpbutton('langpackages', $strlangmasterpackage, 'moodle', true, false, '', true);
|
||||
} else {
|
||||
$straltdirtitle = $strlanglocalpackage . helpbutton('langpackages', $strlanglocalpackage, 'moodle', true, false, '', true);
|
||||
$strsavetotitle = $strlangmasterpackage . helpbutton('langpackages', $strlangmasterpackage, 'moodle', true, false, '', true);
|
||||
|
||||
}
|
||||
|
||||
if ($editable) {
|
||||
// generate an editor for the current help file in $saveto
|
||||
echo '<fieldset><legend>'.$strsavetotitle.'</legend>';
|
||||
echo "<form id=\"helpfileeditor\" action=\"lang.php\" method=\"post\">";
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
|
||||
echo '<input type="hidden" name="mode" value="helpfiles" />';
|
||||
echo "<div align=\"center\">\n";
|
||||
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">";
|
||||
if (file_exists("$saveto/$currentfile")) {
|
||||
echo htmlspecialchars(file_get_contents("$saveto/$currentfile"));
|
||||
} else {
|
||||
echo ($filetemplate);
|
||||
}
|
||||
echo "</textarea>\n</div>\n";
|
||||
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').'" /></div>';
|
||||
echo '</form>';
|
||||
$preview_url = lang_help_preview_url($currentfile, !$uselocal);
|
||||
if ($preview_url) {
|
||||
link_to_popup_window($preview_url, 'popup', get_string('preview'));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
if (is_readable("$altdir/$currentfile")) {
|
||||
// show the content of the same help file in alternative location
|
||||
echo '<fieldset><legend>'.$straltdirtitle.'</legend>';
|
||||
echo "<div align=\"center\">\n";
|
||||
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">";
|
||||
if (file_exists("$altdir/$currentfile")) {
|
||||
echo htmlspecialchars(file_get_contents("$altdir/$currentfile"));
|
||||
} else {
|
||||
echo ($filetemplate);
|
||||
}
|
||||
echo "</textarea>\n</div>\n";
|
||||
$preview_url = lang_help_preview_url($currentfile, $uselocal);
|
||||
if ($preview_url) {
|
||||
link_to_popup_window($preview_url, 'popup', get_string('preview'));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
// show the content of the original English file either in core space or plugin space
|
||||
if ($origlocation != '' && $origplugin != '') {
|
||||
// non-core help file
|
||||
$ensrc = "$CFG->dirroot/$origlocation/$origplugin/lang/en_utf8/help/$currentfile";
|
||||
} else {
|
||||
// core help file
|
||||
$ensrc = "$enlangdir/$currentfile";
|
||||
}
|
||||
if (is_readable($ensrc)) {
|
||||
echo '<fieldset><legend>'.$strlangmasterenglish;
|
||||
helpbutton('langpackages', $strlangmasterenglish);
|
||||
echo '</legend>';
|
||||
echo "<div align=\"center\">\n<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">";
|
||||
echo htmlspecialchars(file_get_contents($ensrc));
|
||||
echo "</textarea>\n</div>\n";
|
||||
$preview_url = lang_help_preview_url($currentfile, true, 'en_utf8'); // do not display en_utf8_local
|
||||
if ($preview_url) {
|
||||
link_to_popup_window($preview_url, 'popup', get_string('preview'));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
echo '</div>'; // translator box
|
||||
error_reporting($CFG->debug);
|
||||
}
|
||||
|
||||
if (false && $CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) ) {
|
||||
echo '<hr />';
|
||||
print_heading('Debugging info');
|
||||
echo '<pre class="notifytiny">';
|
||||
print_r($dbg);
|
||||
print_r("\n\$currentfile = $currentfile");
|
||||
print_r("\n\$enlangdir = $enlangdir");
|
||||
print_r("\n\$langdir = $langdir");
|
||||
print_r("\n\$locallangdir = $locallangdir");
|
||||
print_r("\n\$saveto = $saveto");
|
||||
print_r("\n\$altdir = $altdir");
|
||||
print_r("\n\$origlocation = $origlocation");
|
||||
print_r("\n\$origplugin = $origplugin");
|
||||
print_r("\n\$ensrc = $ensrc");
|
||||
print_r("\n\$helpfiles = ");
|
||||
print_r($helpfiles);
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
} // fi $mode == 'helpfiles'
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
@@ -781,6 +1016,8 @@ function lang_fix_value_before_save($value='') {
|
||||
/**
|
||||
* Try and create a new language directory.
|
||||
*
|
||||
* Uses PHP>=5.0 syntax of mkdir and tries to create directories recursively.
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param string $directory full path to the directory under $langbase
|
||||
* @return string|false Returns full path to directory if successful, false if not
|
||||
@@ -789,7 +1026,7 @@ function lang_make_directory($dir, $shownotices=true) {
|
||||
global $CFG;
|
||||
umask(0000);
|
||||
if (! file_exists($dir)) {
|
||||
if (! @mkdir($dir, $CFG->directorypermissions)) {
|
||||
if (! @mkdir($dir, $CFG->directorypermissions, true)) { // recursive=true; PHP>=5.0 needed
|
||||
return false;
|
||||
}
|
||||
//@chmod($dir, $CFG->directorypermissions); // Just in case mkdir didn't do it
|
||||
@@ -993,4 +1230,141 @@ function lang_get_file_info($currentfile, $stringfiles) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all English help files in the standard lang/en_utf8/help location.
|
||||
*
|
||||
* Core help files should always be stored here and not in the module space (MDL-10920).
|
||||
* The English version of the file may be found in
|
||||
* $CFG->dirroot/lang/en_utf8/help/filename
|
||||
* The localised version of the found file should be saved into
|
||||
* $CFG->dataroot/lang/currentlang[_local]/help/filename
|
||||
* where "filename" is returned as a part of the file record.
|
||||
*
|
||||
* @return array Array of a file information. Compatible format with {@link lang_extra_locations()}
|
||||
*/
|
||||
function lang_help_standard_locations() {
|
||||
global $CFG;
|
||||
$files = array();
|
||||
// Standard location of master English help files.
|
||||
$places = array($CFG->dirroot.'/lang/en_utf8/help');
|
||||
foreach ($places as $place) {
|
||||
foreach (get_directory_list($place, 'CVS') as $file) {
|
||||
if ((substr($file, -5) == '.html') || (substr($file, -4) == '.txt' )) {
|
||||
$fullpath = $place.'/'.$file;
|
||||
$files[$fullpath] = array(
|
||||
'filename' => $file,
|
||||
'location' => '',
|
||||
'plugin' => '',
|
||||
'prefix' => '',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all English help files in non-standard location.
|
||||
*
|
||||
* Searches for lang/en_utf8/help/* files in various types of plugins (blocks, database presets, question types,
|
||||
* 3rd party modules etc.) and returns an array of found files details.
|
||||
*
|
||||
* The English version of the file may be found in
|
||||
* $CFG->dirroot/location/plugin/lang/en_utf8/help/filename
|
||||
* The localised version of the found file should be saved into
|
||||
* $CFG->dataroot/lang/currentlang[_local]/help/prefix_plugin/filename (XXX is "prefix" here right?)
|
||||
* where "location", "plugin", "prefix" and "filename" are returned as a part of the file record.
|
||||
*
|
||||
* @return array Array of a file information. Compatible format with {@link lang_standard_locations()}
|
||||
*/
|
||||
function lang_help_extra_locations() {
|
||||
global $CFG;
|
||||
$files = array();
|
||||
$places = places_to_search_for_lang_strings();
|
||||
foreach ($places as $prefix => $directories) {
|
||||
if ($prefix != '__exceptions') {
|
||||
foreach ($directories as $directory) {
|
||||
foreach (get_list_of_plugins($directory) as $plugin) {
|
||||
$enlangdirlocation = $CFG->dirroot.'/'.$directory.'/'.$plugin.'/lang/en_utf8/help';
|
||||
foreach (get_directory_list($enlangdirlocation, 'CVS') as $file) {
|
||||
if ((substr($file, -5) == '.html') || (substr($file, -4) == '.txt' )) {
|
||||
$fullpath = $enlangdirlocation.'/'.$file;
|
||||
$files[$fullpath] = array(
|
||||
'filename' => $file,
|
||||
'location' => $directory,
|
||||
'plugin' => $plugin,
|
||||
'prefix' => $prefix,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a preview URL for help file, if available.
|
||||
*
|
||||
* @param string $currentfile The relative path to the help file, e.g. "assignment/types.html" - MDL-12291
|
||||
* @param bool $skiplocal Force displaying the helpfile from a master lang pack
|
||||
* @param string $forcelang Force language of the help, e.g. "en_utf8"
|
||||
* @return string $url
|
||||
*/
|
||||
function lang_help_preview_url($currentfile, $skiplocal=false, $forcelang = '') {
|
||||
$currentpathexp = explode('/', $currentfile);
|
||||
if (count($currentpathexp) > 1) {
|
||||
$url = '/help.php?module='.implode('/',array_slice($currentpathexp,0,count($currentpathexp)-1)).'&file='.end($currentpathexp);
|
||||
} else {
|
||||
$url = '/help.php?module=moodle&file='.$currentfile;
|
||||
}
|
||||
if ($skiplocal) {
|
||||
$url .= '&skiplocal=1';
|
||||
}
|
||||
if ($forcelang) {
|
||||
$url .= '&forcelang='.$forcelang;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves (overwrites) translated help file.
|
||||
*
|
||||
* @param string $helproot The path to the "help" folder
|
||||
* @param string $file The relative path to the html help file
|
||||
* @param string $content HTML data to be saved
|
||||
* @return bool False if save failed, true otherwise
|
||||
*/
|
||||
function lang_help_save_file($helproot, $file, $content) {
|
||||
global $CFG, $USER;
|
||||
|
||||
$content = str_replace("\r", "",$content); // Remove linefeed characters
|
||||
$content = preg_replace("/\n{3,}/", "\n\n", $content); // Collapse runs of blank lines
|
||||
$content = trim($content); // Delete leading/trailing whitespace
|
||||
if (is_readable("$helproot/$file") && filesize("$helproot/$file") > 0 && $content == '') {
|
||||
notify(get_string('langrmyourself', 'admin'));
|
||||
return true;
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
if (!$f = fopen("$helproot/$file","w")) {
|
||||
error_reporting($CFG->debug);
|
||||
return false;
|
||||
}
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
fwrite($f, stripslashes($content));
|
||||
fclose($f);
|
||||
|
||||
// Remove file if its empty
|
||||
if (filesize("$helproot/$file") == 0) {
|
||||
unlink("$helproot/$file");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+4
-1
@@ -33,6 +33,9 @@
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
notify('NOTICE: This interface is obsolete now and will be removed. You should use
|
||||
improved <a href="lang.php?mode=helpfiles">lang.php</a> interface.');
|
||||
|
||||
$currentlang = current_language();
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en_utf8";
|
||||
@@ -243,7 +246,7 @@ function langdoc_preview_url($currentfile) {
|
||||
$currentfile = substr($currentfile, 5);
|
||||
$currentpathexp = explode('/', $currentfile);
|
||||
if (count($currentpathexp) > 1) {
|
||||
$url = '/help.php?module='.$currentpathexp[0].'&file='.$currentpathexp[1];
|
||||
$url = '/help.php?module='.implode('/',array_slice($currentpathexp,0,count($currentpathexp)-1)).'&file='.end($currentpathexp);
|
||||
} else {
|
||||
$url = '/help.php?module=moodle&file='.$currentfile;
|
||||
}
|
||||
|
||||
+188
-200
@@ -6,6 +6,8 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
admin_externalpage_setup('langimport');
|
||||
|
||||
@@ -17,25 +19,24 @@
|
||||
$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);
|
||||
|
||||
$strlang = get_string('langimport','admin');
|
||||
|
||||
$strlanguage = get_string("language");
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$title = $strlang;
|
||||
|
||||
admin_externalpage_print_header();
|
||||
$strlang = get_string('langimport','admin');
|
||||
$strlanguage = get_string('language');
|
||||
$strthislanguage = get_string('thislanguage');
|
||||
$title = $strlang;
|
||||
|
||||
//reset and diagnose lang cache permissions
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
notify('Language cache can not be deleted, please check permissions in dataroot.');
|
||||
error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
|
||||
$notice_ok = array();
|
||||
$notice_error = array();
|
||||
|
||||
switch ($mode){
|
||||
|
||||
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
|
||||
@@ -44,29 +45,27 @@
|
||||
@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
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
$a = new stdClass();
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new object();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
error(get_string($cd->get_error(), 'error', $a));
|
||||
error(get_string($cd->get_error(), 'error', $a), 'langimport.php');
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
error(get_string($cd->get_error(), 'error'), 'langimport.php');
|
||||
}
|
||||
break;
|
||||
|
||||
case INSTALLED:
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1);
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
break;
|
||||
|
||||
case UPTODATE:
|
||||
case COMPONENT_UPTODATE:
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -76,29 +75,20 @@
|
||||
}
|
||||
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()) {
|
||||
if ($uninstalllang == 'en_utf8') {
|
||||
$notice_error[] = 'en_utf8 can not be uninstalled!';
|
||||
|
||||
} else if (!$confirm && confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
|
||||
'langimport.php?mode=4&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(),
|
||||
'langimport.php');
|
||||
print_footer();
|
||||
die;
|
||||
|
||||
} 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;
|
||||
@@ -112,9 +102,9 @@
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'), 3);
|
||||
$notice_ok[] = 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');
|
||||
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -123,7 +113,6 @@
|
||||
|
||||
//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?
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
@@ -131,8 +120,8 @@
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
|
||||
if (!$availablelangs = proxy_url($source)) {
|
||||
error ('can not read from course');
|
||||
if (!$availablelangs = get_remote_list_of_languages()) {
|
||||
print_error('cannotdownloadlanguageupdatelist');
|
||||
}
|
||||
|
||||
//and build an associative array
|
||||
@@ -140,8 +129,12 @@
|
||||
$md5array[$alang[0]] = $alang[1];
|
||||
}
|
||||
|
||||
//filtering out non-16 packs
|
||||
//filtering out non-16 and unofficial packs
|
||||
foreach ($alllangs as $clang) {
|
||||
if (!array_key_exists($clang, $md5array)) {
|
||||
$notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
|
||||
continue;
|
||||
}
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$clang;
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$clang;
|
||||
|
||||
@@ -163,6 +156,7 @@
|
||||
if ($pack == 'en_utf8') { // no update for en_utf8
|
||||
continue;
|
||||
}
|
||||
|
||||
//1. delete old director(ies)
|
||||
|
||||
$dest1 = $CFG->dataroot.'/lang/'.$pack;
|
||||
@@ -170,38 +164,40 @@
|
||||
$rm1 = false;
|
||||
$rm2 = false;
|
||||
if (file_exists($dest1)) {
|
||||
$rm1 = remove_dir($dest1);
|
||||
if (!remove_dir($dest1)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (file_exists($dest2)) {
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
if (!($rm1 || $rm2)) {
|
||||
error ('could not delete old directory, update failed');
|
||||
if (!remove_dir($dest2)) {
|
||||
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//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
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
|
||||
case ERROR:
|
||||
if ($cd->get_error() == 'remotedownloadnotallowed') {
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$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));
|
||||
error(get_string($cd->get_error(), 'error', $a)); // not probable
|
||||
} else {
|
||||
error(get_string($cd->get_error(), 'error'));
|
||||
error(get_string($cd->get_error(), 'error')); // not probable
|
||||
}
|
||||
break;
|
||||
case UPTODATE:
|
||||
case COMPONENT_UPTODATE:
|
||||
//Print error string or whatever you want to do
|
||||
break;
|
||||
case INSTALLED:
|
||||
notify(get_string('langpackupdated','admin',$pack), 'notifysuccess');
|
||||
case COMPONENT_INSTALLED:
|
||||
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
|
||||
$updated = true;
|
||||
//Print/do whatever you want
|
||||
break;
|
||||
@@ -213,131 +209,136 @@
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
notice(get_string('langupdatecomplete','admin'), 'langimport.php');
|
||||
$notice_ok[] = get_string('langupdatecomplete','admin');
|
||||
} else {
|
||||
notice(get_string('nolangupdateneeded','admin'), 'langimport.php');
|
||||
$notice_ok[] = get_string('nolangupdateneeded','admin');
|
||||
}
|
||||
|
||||
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_box_start();
|
||||
print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/');
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
print_box_start();
|
||||
echo '<table summary="">';
|
||||
echo '<tr><td align="center" valign="top">';
|
||||
echo '<form id="uninstallform" action="langimport.php?mode=4" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
$installedlangs = get_list_of_languages(false, true);
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
|
||||
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
|
||||
foreach ($installedlangs as $clang =>$ilang){
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
echo '<form id="updateform" action="langimport.php?mode=5" method="post">';
|
||||
echo '<div>';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
echo '</td><td align="center" valign="top">';
|
||||
//availabe langs table
|
||||
$empty = 1; //something to pring
|
||||
|
||||
/// if this language pack is not already installed, then we allow installation
|
||||
|
||||
echo '<form id="installform" method="post" action="langimport.php?mode=2">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
|
||||
if ($remote) {
|
||||
echo '<select name="pack" id="pack" size="15">';
|
||||
}
|
||||
|
||||
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></td></tr>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<br />';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
}
|
||||
|
||||
//close available langs table
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
|
||||
break;
|
||||
|
||||
} //close of main switch
|
||||
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$installedlangs = get_list_of_languages(true, true);
|
||||
|
||||
if ($availablelangs = get_remote_list_of_languages()) {
|
||||
$remote = 1;
|
||||
} else {
|
||||
$remote = 0; //flag for reading from remote or local
|
||||
$availablelangs = get_local_list_of_languages();
|
||||
}
|
||||
|
||||
if (!$remote) {
|
||||
print_box_start();
|
||||
print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
if ($notice_ok) {
|
||||
$info = implode('<br />', $notice_ok);
|
||||
notify($info, 'notifysuccess');
|
||||
}
|
||||
|
||||
if ($notice_error) {
|
||||
$info = implode('<br />', $notice_error);
|
||||
notify($info, 'notifyproblem');
|
||||
}
|
||||
|
||||
print_box_start();
|
||||
echo '<table summary="">';
|
||||
echo '<tr><td align="center" valign="top">';
|
||||
echo '<form id="uninstallform" action="langimport.php?mode='.DELETION_OF_SELECTED_LANG.'" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
|
||||
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
|
||||
foreach ($installedlangs as $clang =>$ilang){
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($remote) {
|
||||
echo '<form id="updateform" action="langimport.php?mode='.UPDATE_ALL_LANG.'" method="post">';
|
||||
echo '<div>';
|
||||
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
echo '</td><td align="center" valign="top">';
|
||||
//availabe langs table
|
||||
$empty = 1; //something to pring
|
||||
|
||||
/// if this language pack is not already installed, then we allow installation
|
||||
|
||||
echo '<form id="installform" method="post" action="langimport.php?mode='.INSTALLATION_OF_SELECTED_LANG.'">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
|
||||
if ($remote) {
|
||||
echo '<select name="pack" id="pack" size="15">';
|
||||
}
|
||||
|
||||
foreach ($availablelangs as $alang) {
|
||||
if ($alang[0] == '') {
|
||||
continue;
|
||||
}
|
||||
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></td></tr>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
if ($empty) {
|
||||
echo '<br />';
|
||||
print_string('nolanguagetodownload','admin');
|
||||
}
|
||||
|
||||
//close available langs table
|
||||
echo '</td></tr></table>';
|
||||
print_box_end();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
/* returns a list of available language packs from a
|
||||
/**
|
||||
* 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
|
||||
* this is for site that can't download components.
|
||||
* @return array
|
||||
*/
|
||||
function get_local_list_of_languages() {
|
||||
global $CFG;
|
||||
$source = $CFG->wwwroot.'/lib/languages.md5';
|
||||
$source = $CFG->dirroot.'/lib/languages.md5';
|
||||
$availablelangs = array();
|
||||
if ($fp = fopen($source, 'r')){
|
||||
if ($fp = fopen($source, 'r')) {
|
||||
while(!feof ($fp)) {
|
||||
$availablelangs[] = split(',', fgets($fp,1024));
|
||||
}
|
||||
@@ -345,7 +346,8 @@
|
||||
return $availablelangs;
|
||||
}
|
||||
|
||||
/* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
/**
|
||||
* checks the md5 of the zip file, grabbed from download.moodle.org,
|
||||
* against the md5 of the local language file from last update
|
||||
* @param string $lang
|
||||
* @param string $md5check
|
||||
@@ -360,40 +362,26 @@
|
||||
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;
|
||||
/**
|
||||
* Returns the latest list of available language packs from
|
||||
* moodle.org
|
||||
* @return array or false if can not download
|
||||
*/
|
||||
function get_remote_list_of_languages() {
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$availablelangs = array();
|
||||
|
||||
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");
|
||||
|
||||
$headers_done = false;
|
||||
while(!feof($proxy_fp)) {
|
||||
$string = fgets($proxy_fp, 1024);
|
||||
if(!$headers_done){
|
||||
// A new line indicates end of HTTP headers
|
||||
$headers_done = ("\r\n" == $string);
|
||||
} else {
|
||||
$availablelangs[] = split(',', $string);
|
||||
if ($content = download_file_content($source)) {
|
||||
$alllines = split("\n", $content);
|
||||
foreach($alllines as $line) {
|
||||
if (!empty($line)){
|
||||
$availablelangs[] = split(',', $line);
|
||||
}
|
||||
}
|
||||
fclose($proxy_fp);
|
||||
return $availablelangs;
|
||||
|
||||
} 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;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $availablelangs;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/*
|
||||
* Utility to debug mailouts - will save the content of emails to a
|
||||
* logfile instead of sending them out. Use it as a sendmail
|
||||
* "stand-in" when testing mailouts.
|
||||
*
|
||||
* It is not Moodle specific - use it anywhere by setting the php
|
||||
* "sendmail_path" setting to this file with a logfile parameter.
|
||||
*
|
||||
* - Set in php.ini (not settable in config.php):
|
||||
* sendmail_path=/path-to-moodle/admin/mailout-debugger.php');
|
||||
* Or from the commandline
|
||||
* php -d sendmail_path='/path-to-moodle/admin/mailout-debugger.php' /path/to/cron.php
|
||||
*
|
||||
* - Create a file in admin called mailout-debugger.enable
|
||||
* (this is a security check to prevent execution in prod environments)
|
||||
* touch /path/to/moodle/admin/mailout-debugger.enable
|
||||
*
|
||||
* - Mark as executable: chmod ugo+rx mailout-debugger.php
|
||||
*
|
||||
* - Run your admin/cron.php
|
||||
*
|
||||
* - Read /tmp/moodle-mailout.log
|
||||
*
|
||||
*
|
||||
* This script will create logfiles in /tmp/ or in $TMPDIR if set.
|
||||
* On windows, use php -r 'print sys_get_temp_dir()' to see where the file is saved.
|
||||
*/
|
||||
|
||||
// Security check.
|
||||
if (!file_exists(dirname(__FILE__).'/mailout-debugger.enable')) {
|
||||
mdie("Disabled.");
|
||||
}
|
||||
$tmpdir=sys_get_temp_dir(); // default
|
||||
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
mdie("should not be called from web server!");
|
||||
}
|
||||
|
||||
if (isset($_ENV['TMPDIR']) && is_dir($_ENV['TMPDIR'])) {
|
||||
$tmpdir = $_ENV['TMPDIR'];
|
||||
}
|
||||
|
||||
$tmpfile = $tmpdir . '/moodle-mailout.log';
|
||||
$fh = fopen($tmpfile, 'a+', false)
|
||||
or mdie("Error openning $tmpfile on append\n");
|
||||
fwrite($fh, "==== ".strftime("%a %b %e %H:%M:%S %Y", time())." ====\n");
|
||||
fwrite($fh, "==== Commandline: " . implode(' ',$argv) . "\n");
|
||||
|
||||
$stdin = fopen('php://stdin', 'r');
|
||||
|
||||
while ($line = fgets($stdin)) {
|
||||
fwrite($fh, $line);
|
||||
}
|
||||
fwrite($fh, "\n");
|
||||
fclose($fh);
|
||||
fclose($stdin);
|
||||
|
||||
/**
|
||||
* Print an error to STDOUT and exit with a non-zero code. For commandline scripts.
|
||||
* Default errorcode is 1.
|
||||
*
|
||||
* Very useful for perl-like error-handling:
|
||||
*
|
||||
* do_somethting() or mdie("Something went wrong");
|
||||
*
|
||||
* @param string $msg Error message
|
||||
* @param integer $errorcode Error code to emit
|
||||
*
|
||||
*/
|
||||
function mdie($msg='', $errorcode=1) {
|
||||
trigger_error($msg);
|
||||
exit($errorcode);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -45,7 +45,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
// fetch the record in question
|
||||
$id = required_param('id', PARAM_INT);
|
||||
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
|
||||
error(get_string('recordnoexists','mnet'), '/admin/mnet/access_control.php');
|
||||
error(get_string('recordnoexists','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@@ -60,7 +60,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
// require the access parameter, and it must be 'allow' or 'deny'
|
||||
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
|
||||
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
|
||||
error(get_string('invalidaccessparam', 'mnet') , '/admin/mnet/access_control.php');
|
||||
error(get_string('invalidaccessparam', 'mnet') , "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
|
||||
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
|
||||
@@ -73,7 +73,7 @@ if (!empty($action) and confirm_sesskey()) {
|
||||
break;
|
||||
|
||||
default:
|
||||
print_error('invalidactionparam', 'mnet', '/admin/mnet/access_control.php');
|
||||
print_error('invalidactionparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
// check permissions and verify form input
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error(get_string('nomodifyacl','mnet'), '/admin/mnet/access_control.php');
|
||||
error(get_string('nomodifyacl','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
|
||||
}
|
||||
if (empty($form->username)) {
|
||||
$formerror['username'] = get_string('enterausername','mnet');
|
||||
|
||||
@@ -72,7 +72,7 @@ function mnet_get_functions($type, $parentname) {
|
||||
if (!file_exists($filename)) return false;
|
||||
|
||||
if (extension_loaded('tokenizer')) {
|
||||
include_once $CFG->dirroot.'/admin/mnet/MethodTable.php';
|
||||
include_once "$CFG->dirroot/$CFG->admin/mnet/MethodTable.php";
|
||||
$functions = (array)MethodTable::create($filename,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => $CFG->wwwroot.'/admin/index.php', 'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => $CFG->wwwroot.'/admin/mnet/index.php', 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => "$CFG->wwwroot/$CFG->admin/mnet/index.php", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => get_string('deletehost', 'mnet'), 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$site->shortname: $strmnetsettings", "$site->fullname", $navigation);
|
||||
@@ -49,7 +49,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
print_footer();
|
||||
?>
|
||||
|
||||
@@ -243,7 +243,6 @@
|
||||
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
|
||||
/// Get some language strings
|
||||
|
||||
$strassignusers = get_string('assignusers', 'role');
|
||||
$strpotentialusers = get_string('potentialusers', 'role');
|
||||
$strexistingusers = get_string('existingusers', 'role');
|
||||
$straction = get_string('assignroles', 'role');
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$link = $CFG->wwwroot . '/admin/mnet/enr_course_enrol.php?'
|
||||
$link = "$CFG->wwwroot/$CFG->admin/mnet/enr_course_enrol.php?"
|
||||
. "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}";
|
||||
echo '<tr>'
|
||||
. "<td>$icon</td>"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
. '</tr>';
|
||||
$hosts = $enrolment->list_remote_servers();
|
||||
foreach ($hosts as $host) {
|
||||
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursesurl = "$CFG->wwwroot/$CFG->admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
|
||||
if (empty($coursecount)) {
|
||||
$coursecount = '?';
|
||||
@@ -49,7 +49,7 @@
|
||||
. "<td align=\"center\" >$enrolcount</td>"
|
||||
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
|
||||
// TODO: teach report/log/index.php to show per-host-logs
|
||||
// . '<td align="center" ><a href="{$CFG->wwwroot}/admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . '<td align="center" ><a href="$CFG->wwwroot/$CFG->admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . get_string('logs', 'mnet').'</a> </td>'
|
||||
. '</tr>';
|
||||
}
|
||||
|
||||
@@ -48,7 +48,14 @@
|
||||
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
|
||||
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
|
||||
|
||||
if (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
if ($publish != 1 && $subscribe != 1) {
|
||||
if (false == $host2service) {
|
||||
// We don't have or need a record - do nothing!
|
||||
} else {
|
||||
// We don't need the record - delete it
|
||||
delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
|
||||
}
|
||||
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
|
||||
$host2service = new stdClass();
|
||||
$host2service->hostid = $_POST['hostid'];
|
||||
$host2service->serviceid = $key;
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
require_login();
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('mnetpeers', $adminroot);
|
||||
admin_externalpage_setup('mnetpeers');
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c0">wwwroot:</td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2">
|
||||
<select name="applicationid">
|
||||
|
||||
@@ -50,6 +50,11 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (!empty($form->wwwroot)) {
|
||||
// ensure we remove trailing slashes
|
||||
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
|
||||
|
||||
// ensure the wwwroot starts with a http or https prefix
|
||||
if (strtolower(substr($form->wwwroot, 0, 4)) != 'http') {
|
||||
$form->wwwroot = 'http://'.$form->wwwroot;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
|
||||
+6
-4
@@ -4,8 +4,6 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('managemodules');
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
@@ -16,7 +14,8 @@
|
||||
}
|
||||
|
||||
if ($module != '') {
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
admin_externalpage_setup('modsetting'.$module);
|
||||
// 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.
|
||||
@@ -28,6 +27,8 @@
|
||||
$moduleconfig($config);
|
||||
}
|
||||
} else {
|
||||
admin_externalpage_setup('managemodules');
|
||||
|
||||
$moduleprefix = '';
|
||||
}
|
||||
|
||||
@@ -43,7 +44,8 @@
|
||||
|
||||
/// Otherwise print the form.
|
||||
$module = required_param('module', PARAM_SAFEDIR);
|
||||
require_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
include_once("$CFG->dirroot/mod/$module/lib.php");
|
||||
admin_externalpage_setup('modsetting'.$module);
|
||||
|
||||
$strmodulename = get_string("modulename", $module);
|
||||
|
||||
|
||||
+39
-22
@@ -5,6 +5,7 @@
|
||||
require_once('../course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
require_once($CFG->libdir.'/ddllib.php');
|
||||
|
||||
// defines
|
||||
define('MODULE_TABLE','module_administration_table');
|
||||
@@ -29,10 +30,6 @@
|
||||
$stractivitymodule = get_string("activitymodule");
|
||||
$strshowmodulecourse = get_string('showmodulecourse');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($stractivities);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
@@ -55,6 +52,7 @@
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visibleold=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
@@ -72,9 +70,12 @@
|
||||
FROM {$CFG->prefix}course_modules
|
||||
WHERE visible=1 AND module={$module->id})";
|
||||
execute_sql($sql, false);
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
admin_externalpage_print_header();
|
||||
print_heading($stractivities);
|
||||
|
||||
$strmodulename = get_string("modulename", "$delete");
|
||||
|
||||
@@ -104,6 +105,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
// delete calendar events
|
||||
if (!delete_records("event", "modulename", $delete)) {
|
||||
notify("Error occurred while deleting all $strmodulename records in calendar event table");
|
||||
}
|
||||
|
||||
// clear course.modinfo for courses
|
||||
// that used this module...
|
||||
$sql = "UPDATE {$CFG->prefix}course
|
||||
@@ -138,30 +144,39 @@
|
||||
notify("Error occurred while deleting the $strmodulename records from the config table");
|
||||
}
|
||||
|
||||
// Then the tables themselves
|
||||
// cleanup the gradebook
|
||||
require_once($CFG->libdir.'/gradelib.php');
|
||||
grade_uninstalled_module($module->name);
|
||||
|
||||
// Then the tables themselves
|
||||
drop_plugin_tables($module->name, "$CFG->dirroot/mod/$module->name/db/install.xml", false);
|
||||
|
||||
if ($tables = $db->Metatables()) {
|
||||
$prefix = $CFG->prefix.$module->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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Delete the capabilities that were defined by this module
|
||||
capabilities_cleanup('mod/'.$module->name);
|
||||
|
||||
// remove entent handlers and dequeue pending events
|
||||
events_uninstall('mod/'.$module->name);
|
||||
|
||||
// Perform any custom uninstall tasks
|
||||
if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
|
||||
require_once($CFG->dirroot . '/mod/' . $module->name . '/lib.php');
|
||||
$uninstallfunction = $module->name . '_uninstall';
|
||||
if (function_exists($uninstallfunction)) {
|
||||
if (! $uninstallfunction() ) {
|
||||
notify('Encountered a problem running uninstall function for '. $module->name.'!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a->module = $strmodulename;
|
||||
$a->directory = "$CFG->dirroot/mod/$delete";
|
||||
notice(get_string("moduledeletefiles", "", $a), "modules.php");
|
||||
}
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading($stractivities);
|
||||
|
||||
/// Get and sort the existing modules
|
||||
|
||||
if (!$modules = get_records("modules")) {
|
||||
@@ -176,7 +191,7 @@
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname);
|
||||
ksort($modulebyname, SORT_LOCALE_STRING);
|
||||
|
||||
/// Print the table of all modules
|
||||
// construct the flexible table ready to display
|
||||
@@ -195,7 +210,9 @@
|
||||
|
||||
$delete = "<a href=\"modules.php?delete=$module->name&sesskey=$USER->sesskey\">$strdelete</a>";
|
||||
|
||||
if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
|
||||
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php")) {
|
||||
$settings = "<a href=\"settings.php?section=modsetting$module->name\">$strsettings</a>";
|
||||
} else if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
|
||||
$settings = "<a href=\"module.php?module=$module->name\">$strsettings</a>";
|
||||
} else {
|
||||
$settings = "";
|
||||
@@ -226,11 +243,11 @@
|
||||
}
|
||||
|
||||
$table->add_data(array(
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
'<span'.$class.'>'.$icon.' '.$modulename.'</span>',
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
$settings
|
||||
));
|
||||
}
|
||||
|
||||
+7
-18
@@ -21,7 +21,6 @@ page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
class page_admin extends page_base {
|
||||
|
||||
var $section;
|
||||
var $pathtosection;
|
||||
var $visiblepathtosection;
|
||||
|
||||
// hack alert!
|
||||
@@ -34,22 +33,12 @@ class page_admin extends page_base {
|
||||
return;
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
$adminroot =& admin_get_root(false, false); //settings not required - only pages
|
||||
|
||||
// fetch the path parameter
|
||||
$this->section = $section;
|
||||
|
||||
$this->visiblepathtosection = array();
|
||||
|
||||
// this part is (potentially) processor-intensive... there's gotta be a better way
|
||||
// of handling this
|
||||
if ($this->pathtosection = $adminroot->path($this->section)) {
|
||||
foreach($this->pathtosection as $element) {
|
||||
if ($pointer = $adminroot->locate($element)) {
|
||||
array_push($this->visiblepathtosection, $pointer->visiblename);
|
||||
}
|
||||
}
|
||||
}
|
||||
$current =& $adminroot->locate($section, true);
|
||||
$this->visiblepathtosection = array_reverse($current->visiblepath);
|
||||
|
||||
// all done
|
||||
$this->full_init_done = true;
|
||||
@@ -74,9 +63,9 @@ class page_admin extends page_base {
|
||||
function url_get_path() {
|
||||
global $CFG;
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
$adminroot =& admin_get_root(false, false); //settings not required - only pages
|
||||
|
||||
$root = $adminroot->locate($this->section);
|
||||
$root =& $adminroot->locate($this->section);
|
||||
if (is_a($root, 'admin_externalpage')) {
|
||||
return $root->url;
|
||||
} else {
|
||||
@@ -110,7 +99,7 @@ class page_admin extends page_base {
|
||||
parent::init_quick($data);
|
||||
}
|
||||
|
||||
function print_header($section = '') {
|
||||
function print_header($section = '', $focus='') {
|
||||
global $USER, $CFG, $SITE;
|
||||
|
||||
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
|
||||
@@ -132,7 +121,7 @@ class page_admin extends page_base {
|
||||
}
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation,'', '', true, $buttons, '');
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
|
||||
}
|
||||
|
||||
function get_type() {
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($modid == '0') { // special
|
||||
}
|
||||
else {
|
||||
$modname = get_field("modules","name","id",$modid);
|
||||
require_once('mod/'.$modname.'/lib.php');
|
||||
include_once('mod/'.$modname.'/lib.php');
|
||||
}
|
||||
$function = $modname.'_process_email';
|
||||
|
||||
|
||||
+2
-24
@@ -32,32 +32,10 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
if (!$tables = $db->Metatables() ) { // No tables yet at all.
|
||||
error("no tables");
|
||||
}
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
||||
/// Turn off time limits, sometimes upgrades can be slow.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
while(@ob_end_flush());
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if (in_array($table, array($CFG->prefix.'config'))) { // Don't process these
|
||||
continue;
|
||||
}
|
||||
if ($columns = $db->MetaColumns($table, false)) {
|
||||
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');");
|
||||
$db->debug = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!db_replace($search, $replace)) {
|
||||
error('An error has occured during this process');
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/backup/lib.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
admin_externalpage_setup('reportbackups');
|
||||
|
||||
admin_externalpage_setup('reportbackups', $adminroot);
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
@@ -135,6 +133,6 @@
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
}
|
||||
|
||||
|
||||
$course = get_site();
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
@@ -48,7 +47,7 @@
|
||||
}
|
||||
|
||||
echo '<form action="index.php" method="post">'."\n";
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<div>';
|
||||
|
||||
$table->width = '*';
|
||||
$table->align = array('left','left','left','left','left','left');
|
||||
@@ -58,17 +57,19 @@
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
print_table($table);
|
||||
echo '</fieldset>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
print_heading($reportoptions[$report]);
|
||||
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
|
||||
|
||||
if (!empty($param->sql)) {
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby;
|
||||
@@ -82,9 +83,9 @@
|
||||
|
||||
} else {
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo '<div class="boxaligncenter">(' . get_string("gdneed") .')</div>';
|
||||
echo '<div class="graph">(' . get_string("gdneed") .')</div>';
|
||||
} else {
|
||||
echo '<div class="boxaligncenter"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
|
||||
}
|
||||
|
||||
$table = new StdClass;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
$sql = $param->sql;
|
||||
} else {
|
||||
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
|
||||
." WHERE timeend >= ".$param->timeafter.' AND stattype = \'activity\''
|
||||
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
|
||||
." GROUP BY courseid "
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
admin_externalpage_setup('reportquestion');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading(page_doc_link(get_string('adminreport', 'question')));
|
||||
print_heading(get_string('adminreport', 'question'));
|
||||
|
||||
$probstr = '';
|
||||
$contextupgradeversion = 2007081000;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
}
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<?php
|
||||
$i=0;
|
||||
if (!empty($searchtext)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
||||
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
|
||||
while ($user = rs_fetch_next_record($availableusers)) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
|
||||
+62
-17
@@ -6,6 +6,7 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
define("MAX_USERS_PER_PAGE", 5000);
|
||||
define("MAX_USERS_TO_LIST_PER_ROLE", 10);
|
||||
|
||||
$contextid = required_param('contextid',PARAM_INT); // context id
|
||||
$roleid = optional_param('roleid', 0, PARAM_INT); // required role id
|
||||
@@ -74,12 +75,10 @@
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
$strassignusers = get_string('assignusers', 'role');
|
||||
$strpotentialusers = get_string('potentialusers', 'role');
|
||||
$strexistingusers = get_string('existingusers', 'role');
|
||||
$straction = get_string('assignroles', 'role');
|
||||
$strroletoassign = get_string('roletoassign', 'role');
|
||||
$strcurrentcontext = get_string('currentcontext', 'role');
|
||||
$strsearch = get_string('search');
|
||||
$strshowall = get_string('showall');
|
||||
$strparticipants = get_string('participants');
|
||||
@@ -96,7 +95,10 @@
|
||||
$today = time();
|
||||
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
|
||||
|
||||
$basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
|
||||
// MDL-12420, preventing course start date showing up as an option at system context and front page roles.
|
||||
if ($course->startdate > 0) {
|
||||
$basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
|
||||
}
|
||||
if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
|
||||
$basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
|
||||
}
|
||||
@@ -129,7 +131,9 @@
|
||||
/// course header
|
||||
$navlinks = array();
|
||||
if ($courseid != SITEID) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
@@ -153,12 +157,10 @@
|
||||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
$currenttab = 'assign';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
$currenttab = 'assign';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($assignableroles[$alias->roleid])) {
|
||||
$assignableroles[$alias->roleid] = $alias->text.' ('.$assignableroles[$alias->roleid].')';
|
||||
$assignableroles[$alias->roleid] = $alias->name.' ('.$assignableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,7 +226,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@@ -258,17 +262,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($showall) {
|
||||
$searchtext = '';
|
||||
$previoussearch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
|
||||
} else {
|
||||
print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
|
||||
print_heading_with_help(get_string('assignrolesin', 'role', print_context_name($context)), 'assignroles');
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_SYSTEM) {
|
||||
@@ -355,7 +364,7 @@
|
||||
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
|
||||
}
|
||||
|
||||
$usercount = count_records_sql($countselect . $from . $where) - count($contextusers);
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -381,11 +390,11 @@
|
||||
AND r.roleid = '.$roleid.'
|
||||
'.$selectsql.')
|
||||
ORDER BY lastname ASC, firstname ASC');
|
||||
$usercount = count_records_select('user', $select) - count($contextusers);
|
||||
|
||||
$usercount = $availableusers->_numOfRows;
|
||||
}
|
||||
|
||||
echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
echo '<div class="selector">';
|
||||
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$assignableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletoassign);
|
||||
@@ -413,6 +422,34 @@
|
||||
sync_metacourse($course);
|
||||
}
|
||||
|
||||
// Get the names of role holders for roles with between 1 and MAX_USERS_TO_LIST_PER_ROLE users,
|
||||
// and so determine whether to show the extra column.
|
||||
$rolehodlercount = array();
|
||||
$rolehodlernames = array();
|
||||
$strmorethanten = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE);
|
||||
$showroleholders = false;
|
||||
foreach ($assignableroles as $roleid => $rolename) {
|
||||
$countusers = count_role_users($roleid, $context);
|
||||
$rolehodlercount[$roleid] = $countusers;
|
||||
$roleusers = '';
|
||||
if (0 < $countusers && $countusers <= MAX_USERS_TO_LIST_PER_ROLE) {
|
||||
$roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname');
|
||||
if (!empty($roleusers)) {
|
||||
$strroleusers = array();
|
||||
foreach ($roleusers as $user) {
|
||||
$strroleusers[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '" >' . fullname($user) . '</a>';
|
||||
}
|
||||
$rolehodlernames[$roleid] = implode('<br />', $strroleusers);
|
||||
$showroleholders = true;
|
||||
}
|
||||
} else if ($countusers > MAX_USERS_TO_LIST_PER_ROLE) {
|
||||
$rolehodlernames[$roleid] = '<a href="'.$baseurl.'&roleid='.$roleid.'">'.$strmorethanten.'</a>';
|
||||
} else {
|
||||
$rolehodlernames[$roleid] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Print overview table
|
||||
$table->tablealign = 'center';
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
@@ -420,11 +457,19 @@
|
||||
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users'));
|
||||
$table->wrap = array('nowrap', '', 'nowrap');
|
||||
$table->align = array('right', 'left', 'center');
|
||||
if ($showroleholders) {
|
||||
$table->head[] = '';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->align[] = 'left';
|
||||
}
|
||||
|
||||
foreach ($assignableroles as $roleid => $rolename) {
|
||||
$countusers = count_role_users($roleid, $context);
|
||||
$description = format_string(get_field('role', 'description', 'id', $roleid));
|
||||
$table->data[] = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>',$description, $countusers);
|
||||
$row = array('<a href="'.$baseurl.'&roleid='.$roleid.'">'.$rolename.'</a>',$description, $rolehodlercount[$roleid]);
|
||||
if ($showroleholders) {
|
||||
$row[] = $rolehodlernames[$roleid];
|
||||
}
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="shortname"><?php print_string('shortname') ?></label></td>
|
||||
<td><?php
|
||||
echo '<input type="text" id="shortname" name="shortname" maxlength="20" size="15" value="'.s($role->shortname).'" />';
|
||||
echo '<input type="text" id="shortname" name="shortname" maxlength="100" size="15" value="'.s($role->shortname).'" />';
|
||||
if (isset($errors["shortname"])) formerr($errors["shortname"]);
|
||||
?>
|
||||
</td>
|
||||
@@ -113,7 +113,8 @@ $contextlevel = 0;
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
// prepare legacy defaults
|
||||
if (!empty($role->legacytype)) {
|
||||
|
||||
+12
-51
@@ -121,9 +121,12 @@
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
if (empty($errors)) {
|
||||
$rolename = get_field('role', 'name', 'id', $newroleid);
|
||||
add_to_log(SITEID, 'role', 'add', 'admin/roles/manage.php?action=add', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
@@ -233,6 +236,7 @@
|
||||
|
||||
// edited a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
|
||||
|
||||
redirect('manage.php');
|
||||
}
|
||||
@@ -240,6 +244,7 @@
|
||||
// edited a role sitewide - with errors, but still...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@@ -344,8 +349,8 @@
|
||||
$suffixshort = "";
|
||||
}
|
||||
$currentfullname = $fullname.$suffixfull;
|
||||
// Limit the size of shortname - database column accepts <= 15 chars
|
||||
$currentshortname = substr($shortname, 0, 15 - strlen($suffixshort)).$suffixshort;
|
||||
// Limit the size of shortname - database column accepts <= 100 chars
|
||||
$currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)).$suffixshort;
|
||||
$coursefull = get_record("role","name",addslashes($currentfullname));
|
||||
$courseshort = get_record("role","shortname",addslashes($currentshortname));
|
||||
$counter++;
|
||||
@@ -360,6 +365,8 @@
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $newrole);
|
||||
add_to_log(SITEID, 'role', 'duplicate', 'admin/roles/manage.php?roleid='.$newrole.'&action=duplicate', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
@@ -374,6 +381,9 @@
|
||||
// reset a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log(SITEID, 'role', 'reset', 'admin/roles/manage.php?roleid='.$roleid.'&action=reset', $rolename, '', $USER->id);
|
||||
|
||||
redirect('manage.php?action=view&roleid='.$roleid);
|
||||
|
||||
} else {
|
||||
@@ -561,54 +571,5 @@
|
||||
die;
|
||||
|
||||
|
||||
/// ================ some internal functions ====================////
|
||||
|
||||
function switch_roles($first, $second) {
|
||||
$status = true;
|
||||
//first find temorary sortorder number
|
||||
$tempsort = count_records('role') + 3;
|
||||
while (get_record('role','sortorder', $tempsort)) {
|
||||
$tempsort += 3;
|
||||
}
|
||||
|
||||
$r1 = new object();
|
||||
$r1->id = $first->id;
|
||||
$r1->sortorder = $tempsort;
|
||||
$r2 = new object();
|
||||
$r2->id = $second->id;
|
||||
$r2->sortorder = $first->sortorder;
|
||||
|
||||
if (!update_record('role', $r1)) {
|
||||
debugging("Can not update role with ID $r1->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
if (!update_record('role', $r2)) {
|
||||
debugging("Can not update role with ID $r2->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
$r1->sortorder = $second->sortorder;
|
||||
if (!update_record('role', $r1)) {
|
||||
debugging("Can not update role with ID $r1->id!");
|
||||
$status = false;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
// duplicates all the base definitions of a role
|
||||
function role_cap_duplicate($sourcerole, $targetrole) {
|
||||
global $CFG;
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$caps = get_records_sql("SELECT * FROM {$CFG->prefix}role_capabilities
|
||||
WHERE roleid = $sourcerole->id
|
||||
AND contextid = $systemcontext->id");
|
||||
// adding capabilities
|
||||
foreach ($caps as $cap) {
|
||||
unset($cap->id);
|
||||
$cap->roleid = $targetrole;
|
||||
insert_record('role_capabilities', $cap);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
$component = '';
|
||||
|
||||
$strrisks = s(get_string('risks', 'role'));
|
||||
$strcapabilities = s(get_string('capabilities', 'role'));
|
||||
// MDL-11687
|
||||
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
|
||||
|
||||
foreach ($capabilities as $capability) {
|
||||
|
||||
|
||||
+10
-12
@@ -34,6 +34,7 @@
|
||||
} else {
|
||||
$course = clone($SITE);
|
||||
$courseid = SITEID;
|
||||
$coursecontext = $context;
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
@@ -57,10 +58,8 @@
|
||||
/// Get some language strings
|
||||
|
||||
$strroletooverride = get_string('roletooverride', 'role');
|
||||
$stroverrideusers = get_string('overrideusers', 'role');
|
||||
$straction = get_string('overrideroles', 'role');
|
||||
$strcurrentrole = get_string('currentrole', 'role');
|
||||
$strcurrentcontext = get_string('currentcontext', 'role');
|
||||
$strparticipants = get_string('participants');
|
||||
|
||||
/// Make sure this user can override that role
|
||||
@@ -115,7 +114,8 @@
|
||||
|
||||
// force accessinfo refresh for users visiting this context...
|
||||
mark_context_dirty($context->path);
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
redirect($baseurl);
|
||||
}
|
||||
|
||||
@@ -126,8 +126,9 @@
|
||||
$navlinks = array();
|
||||
/// course header
|
||||
if ($course->id != SITEID) {
|
||||
$navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'course');
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&course=$courseid", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
@@ -147,12 +148,10 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
$currenttab = 'override';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
$currenttab = 'override';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
@@ -161,19 +160,18 @@
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($overridableroles[$alias->roleid])) {
|
||||
$overridableroles[$alias->roleid] = $alias->text.' ('.$overridableroles[$alias->roleid].')';
|
||||
$overridableroles[$alias->roleid] = $alias->name.' ('.$overridableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string('overrides', 'role'), 'overrides');
|
||||
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
|
||||
|
||||
if ($roleid) {
|
||||
/// prints a form to swap roles
|
||||
echo '<div class="selector">';
|
||||
echo $strcurrentcontext.': '.print_context_name($context).'<br/>';
|
||||
$overridableroles = array('0'=>get_string('listallroles', 'role').'...') + $overridableroles;
|
||||
popup_form("$CFG->wwwroot/$CFG->admin/roles/override.php?userid=$userid&courseid=$courseid&contextid=$contextid&roleid=",
|
||||
$overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride);
|
||||
|
||||
+36
-43
@@ -19,9 +19,6 @@ if ($currenttab != 'update') {
|
||||
print_header($SITE->fullname, "$SITE->fullname", $navigation);
|
||||
break;
|
||||
|
||||
case CONTEXT_PERSONAL:
|
||||
break;
|
||||
|
||||
case CONTEXT_USER:
|
||||
print_header();
|
||||
break;
|
||||
@@ -50,8 +47,8 @@ if ($currenttab != 'update') {
|
||||
$course = get_record('course', 'id', $context->instanceid);
|
||||
|
||||
require_login($course);
|
||||
$navlinks[] = array('name' => $course->shortname,
|
||||
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
|
||||
$navlinks[] = array('name' => get_string('roles'),
|
||||
'link' => "$CFG->wwwroot/admin/roles/assign.php?contextid=$context->id",
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header($streditcoursesettings, $course->fullname, $navigation);
|
||||
@@ -159,48 +156,41 @@ if ($currenttab != 'update') {
|
||||
}
|
||||
|
||||
|
||||
$toprow = array();
|
||||
$inactive = array();
|
||||
$activetwo = array();
|
||||
|
||||
|
||||
if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context
|
||||
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // only show update button if module?
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module
|
||||
|
||||
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('settings'));
|
||||
|
||||
}
|
||||
|
||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
|
||||
$context->id, get_string('roles'));
|
||||
|
||||
if (!empty($tabsmode)) {
|
||||
|
||||
if (!empty($assignableroles)) {
|
||||
$secondrow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('assignroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$secondrow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overrideroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
$inactive[] = 'roles';
|
||||
$activetwo = array('roles');
|
||||
$currenttab = $tabsmode;
|
||||
|
||||
} else {
|
||||
$inactive[] = '';
|
||||
$activetwo = array();
|
||||
if (!empty($assignableroles)) {
|
||||
$toprow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('localroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$toprow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overridepermissions', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Here other core tabs should go (always calling tabs.php files)
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
/// ej.:
|
||||
/// All the logic to decide what to show must be self-contained in the tabs file
|
||||
/// eg:
|
||||
/// include_once($CFG->dirroot . '/grades/tabs.php');
|
||||
|
||||
/// Finally, we support adding some 'on-the-fly' tabs here
|
||||
@@ -209,7 +199,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
if ($extratabs = explode(',', $CFG->extratabs)) {
|
||||
asort($extratabs);
|
||||
foreach($extratabs as $extratab) {
|
||||
/// Each extra tab mus be one $CFG->dirroot relative file
|
||||
/// Each extra tab must be one $CFG->dirroot relative file
|
||||
if (file_exists($CFG->dirroot . '/' . $extratab)) {
|
||||
include_once($CFG->dirroot . '/' . $extratab);
|
||||
}
|
||||
@@ -217,13 +207,16 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($secondrow)) {
|
||||
$tabs = array($toprow, $secondrow);
|
||||
} else {
|
||||
$tabs = array($toprow);
|
||||
$inactive[] = $currenttab;
|
||||
|
||||
$tabs = array($toprow);
|
||||
|
||||
/// If there are any secondrow defined, let's introduce it
|
||||
if (isset($secondrow) && is_array($secondrow) && !empty($secondrow)) {
|
||||
$tabs[] = $secondrow;
|
||||
}
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive, $activetwo);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+27
-121
@@ -5,152 +5,58 @@
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$query = trim(stripslashes_safe(required_param('query', PARAM_NOTAGS))); // Search string
|
||||
$query = trim(stripslashes(optional_param('query', '', PARAM_NOTAGS))); // Search string
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings here
|
||||
$adminroot->search = $query; // So we can reference it in search boxes later in this invocation
|
||||
$statusmsg = '';
|
||||
$errormsg = '';
|
||||
$focus = '';
|
||||
|
||||
admin_externalpage_setup('search'); // now hidden page
|
||||
|
||||
$CFG->adminsearchquery = $query; // So we can reference it in search boxes later in this invocation
|
||||
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with changed settings
|
||||
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$changedsettings = search_settings(admin_get_root(), $query);
|
||||
$errors = '';
|
||||
|
||||
foreach($changedsettings as $changedsetting) {
|
||||
if (!isset($unslashed['s_' . $changedsetting->name])) {
|
||||
$unslashed['s_' . $changedsetting->name] = ''; // needed for checkboxes
|
||||
}
|
||||
$errors .= $changedsetting->write_setting($unslashed['s_' . $changedsetting->name]);
|
||||
}
|
||||
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
} else {
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
}
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
// and finally, if we get here, then there are matching settings and we have to print a form
|
||||
// to modify them
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($focus);
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
}
|
||||
|
||||
$resultshtml = search_settings_html(admin_get_root(), $query);
|
||||
$resultshtml = admin_search_settings_html($query); // case insensitive search only
|
||||
|
||||
echo '<form action="search.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<input type="hidden" name="query" value="' . s($query) . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="query" value="'.s($query).'" />';
|
||||
echo '</div>';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
if ($resultshtml != '') {
|
||||
echo $resultshtml;
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
} else {
|
||||
echo get_string('noresults','admin');
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
|
||||
/**
|
||||
* Find settings using a query.
|
||||
*
|
||||
* @param string &$node The node at which to start searching. Should be $ADMIN for all external calls to this function.
|
||||
* @param string $query The search string.
|
||||
* @return array An array containing admin_setting objects that match $query.
|
||||
*/
|
||||
function search_settings(&$node, $query) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$return = array();
|
||||
$entries = array_keys($node->children);
|
||||
foreach ($entries as $entry) {
|
||||
$return = array_merge($return, search_settings($node->children[$entry], $query));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$return = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if (stristr($setting->name,$query) || stristr($setting->visiblename,$query) || stristr($setting->description,$query)) {
|
||||
$return[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
function search_settings_html(&$node, $query) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($query == ''){
|
||||
return '';
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$entries = array_keys($node->children);
|
||||
$return = '';
|
||||
foreach ($entries as $entry) {
|
||||
$return .= search_settings_html($node->children[$entry], $query);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$foundsettings = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if (stristr($setting->name,$query) || stristr($setting->visiblename,$query) || stristr($setting->description,$query)) {
|
||||
$foundsettings[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
$return = '';
|
||||
if (count($foundsettings) > 0) {
|
||||
$return .= print_heading(get_string('searchresults','admin').' - '. '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $node->name . '">' . $node->visiblename . '</a>', '', 2, 'main', true);
|
||||
$return .= '<fieldset class="adminsettings">' . "\n";
|
||||
foreach ($foundsettings as $foundsetting) {
|
||||
$return .= '<div class="clearer"><!-- --></div>' . "\n";
|
||||
$return .= highlight($query,$foundsetting->output_html());
|
||||
}
|
||||
$return .= '</fieldset>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+81
-97
@@ -5,25 +5,56 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/pagelib.php');
|
||||
|
||||
if (!empty($THEME->customcorners)) {
|
||||
require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
|
||||
}
|
||||
|
||||
if ($site = get_site()) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
$PAGE = page_create_object(PAGE_ADMIN, 0); // there must be any constant id number
|
||||
|
||||
$section = optional_param('section', '', PARAM_ALPHAEXT);
|
||||
|
||||
$PAGE->init_extra($section); // hack alert!
|
||||
|
||||
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
|
||||
$section = required_param('section', PARAM_SAFEDIR);
|
||||
$return = optional_param('return','', PARAM_ALPHA);
|
||||
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings
|
||||
$page =& $adminroot->locate($section);
|
||||
|
||||
if (empty($page) or !is_a($page, 'admin_settingpage')) {
|
||||
error(get_string('sectionerror', 'admin'), "$CFG->wwwroot/$CFG->admin/");
|
||||
die;
|
||||
}
|
||||
|
||||
if (!($page->check_access())) {
|
||||
error(get_string('accessdenied', 'admin'));
|
||||
die;
|
||||
}
|
||||
|
||||
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
$statusmsg = '';
|
||||
$errormsg = '';
|
||||
$focus = '';
|
||||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
|
||||
if (empty($adminroot->errors)) {
|
||||
switch ($return) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
} else {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
}
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
$page =& $adminroot->locate($section);
|
||||
}
|
||||
|
||||
/// very hacky page setup
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
$PAGE = page_create_object(PAGE_ADMIN, 0); // there must be any constant id number
|
||||
$PAGE->init_extra($section);
|
||||
$CFG->pagepath = 'admin/setting/'.$section;
|
||||
|
||||
if (!isset($USER->adminediting)) {
|
||||
$USER->adminediting = false;
|
||||
@@ -37,86 +68,36 @@ if ($PAGE->user_allowed_editing()) {
|
||||
}
|
||||
}
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
$root = $adminroot->locate($PAGE->section);
|
||||
|
||||
if (!is_a($root, 'admin_settingpage')) {
|
||||
error(get_string('sectionerror', 'admin'));
|
||||
die;
|
||||
}
|
||||
|
||||
if (!($root->check_access())) {
|
||||
error(get_string('accessdenied', 'admin'));
|
||||
die;
|
||||
}
|
||||
|
||||
$CFG->pagepath = 'admin/setting/'.$section;
|
||||
|
||||
|
||||
|
||||
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
$statusmsg = '';
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
$errors = $root->write_settings($unslashed);
|
||||
//force logout if dbsession setting changes
|
||||
if ($olddbsessions != !empty($CFG->dbsessions)) {
|
||||
require_logout();
|
||||
}
|
||||
if (empty($errors)) {
|
||||
switch ($return) {
|
||||
case 'site':
|
||||
redirect("$CFG->wwwroot/");
|
||||
case 'admin':
|
||||
redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
default:
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
} else {
|
||||
$statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors;
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
|
||||
/// print header stuff ------------------------------------------------------------
|
||||
// header must be printed after the redirects and require_logout
|
||||
|
||||
if (empty($SITE->fullname)) {
|
||||
print_header($root->visiblename, $root->visiblename);
|
||||
print_header($page->visiblename, $page->visiblename, '', $focus);
|
||||
print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
|
||||
echo $root->output_html();
|
||||
echo $page->output_html();
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
if (!empty($SITE->fullname)) {
|
||||
} else {
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
@@ -124,53 +105,56 @@ if (!empty($SITE->fullname)) {
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
$PAGE->print_header();
|
||||
$PAGE->print_header('', $focus);
|
||||
|
||||
echo '<table id="layout-table"><tr>';
|
||||
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
|
||||
foreach ($lt as $column) {
|
||||
switch ($column) {
|
||||
case 'left':
|
||||
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'middle':
|
||||
echo '<td id="middle-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
print_container_start();
|
||||
echo '<a name="startofcontent"></a>';
|
||||
|
||||
if ($statusmsg != '') {
|
||||
notify ($statusmsg);
|
||||
if ($errormsg !== '') {
|
||||
notify ($errormsg);
|
||||
|
||||
} else if ($statusmsg !== '') {
|
||||
notify ($statusmsg, 'notifysuccess');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
echo '<input type="hidden" name="return" value="' . $return . '" />';
|
||||
print_heading($root->visiblename);
|
||||
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
print_heading($page->visiblename);
|
||||
|
||||
echo $root->output_html();
|
||||
echo $page->output_html();
|
||||
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'right':
|
||||
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
|
||||
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
|
||||
+76
-113
@@ -2,126 +2,89 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "appearance" category
|
||||
|
||||
$ADMIN->add('appearance', new admin_category('themes', get_string('themes')));
|
||||
// "themesettings" settingpage
|
||||
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('hideactivitytypenavlink', get_string('hideactivitytypenavlink', 'admin'), get_string('confighideactivitytypenavlink', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('hidefromnone', 'admin'),
|
||||
1 => get_string('hidefromstudents', 'admin'),
|
||||
2 => get_string('hidefromall', 'admin')
|
||||
)));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
# for CALENDAR_TF_12 and CALENDAR_TF_24 ...
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
$ADMIN->add('appearance', new admin_category('themes', get_string('themes')));
|
||||
// "themesettings" settingpage
|
||||
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('hideactivitytypenavlink', get_string('hideactivitytypenavlink', 'admin'), get_string('confighideactivitytypenavlink', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('hidefromnone', 'admin'),
|
||||
1 => get_string('hidefromstudents', 'admin'),
|
||||
2 => get_string('hidefromall', 'admin')
|
||||
)));
|
||||
$ADMIN->add('themes', $temp);
|
||||
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
|
||||
|
||||
// calendar
|
||||
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
|
||||
$temp->add(new admin_setting_special_adminseesall());
|
||||
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'), get_string('explain_site_timeformat', 'calendar'), '0',
|
||||
array( 0 => get_string('default', 'calendar'),
|
||||
CALENDAR_TF_12 => get_string('timeformat_12', 'calendar'),
|
||||
CALENDAR_TF_24 => get_string('timeformat_24', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('sunday', 'calendar'),
|
||||
1 => get_string('monday', 'calendar'),
|
||||
2 => get_string('tuesday', 'calendar'),
|
||||
3 => get_string('wednesday', 'calendar'),
|
||||
4 => get_string('thursday', 'calendar'),
|
||||
5 => get_string('friday', 'calendar'),
|
||||
6 => get_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// calendar
|
||||
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
|
||||
$temp->add(new admin_setting_special_adminseesall());
|
||||
//this is hacky because we do not want to include the stuff from calendar/lib.php
|
||||
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'),
|
||||
get_string('explain_site_timeformat', 'calendar'), '0',
|
||||
array('0' => get_string('default', 'calendar'),
|
||||
'%I:%M %p' => get_string('timeformat_12', 'calendar'),
|
||||
'%H:%M' => get_string('timeformat_24', 'calendar'))));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => get_string('sunday', 'calendar'),
|
||||
1 => get_string('monday', 'calendar'),
|
||||
2 => get_string('tuesday', 'calendar'),
|
||||
3 => get_string('wednesday', 'calendar'),
|
||||
4 => get_string('thursday', 'calendar'),
|
||||
5 => get_string('friday', 'calendar'),
|
||||
6 => get_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "filtersettings" settingpage
|
||||
$temp = new admin_settingpage('filtersettings', get_string('filtersettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
|
||||
86400 => get_string('numdays','',1),
|
||||
43200 => get_string('numhours','',12),
|
||||
10800 => get_string('numhours','',3),
|
||||
7200 => get_string('numhours','',2),
|
||||
3600 => get_string('numhours','',1),
|
||||
2700 => get_string('numminutes','',45),
|
||||
1800 => get_string('numminutes','',30),
|
||||
900 => get_string('numminutes','',15),
|
||||
600 => get_string('numminutes','',10),
|
||||
540 => get_string('numminutes','',9),
|
||||
480 => get_string('numminutes','',8),
|
||||
420 => get_string('numminutes','',7),
|
||||
360 => get_string('numminutes','',6),
|
||||
300 => get_string('numminutes','',5),
|
||||
240 => get_string('numminutes','',4),
|
||||
180 => get_string('numminutes','',3),
|
||||
120 => get_string('numminutes','',2),
|
||||
60 => get_string('numminutes','',1),
|
||||
30 => get_string('numseconds','',30),
|
||||
0 => get_string('no'))));
|
||||
$temp->add(new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
|
||||
'1' => get_string('allfiles'),
|
||||
'2' => get_string('htmlfilesonly'))));
|
||||
$temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// "htmleditor" settingpage
|
||||
$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_special_editorfontlist());
|
||||
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
|
||||
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
|
||||
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_editordictionary());
|
||||
}
|
||||
$temp->add(new admin_setting_special_editorhidebuttons());
|
||||
$temp->add(new admin_setting_emoticons());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "documentation" settingpage
|
||||
$temp = new admin_settingpage('documentation', get_string('moodledocs'));
|
||||
$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
|
||||
$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for coursemanager (what roles to display)
|
||||
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
|
||||
$temp->add(new admin_setting_special_coursemanager());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('disablecourseajax', get_string('disablecourseajax', 'admin'), get_string('configdisablecourseajax', 'admin'),
|
||||
isset($CFG->disablecourseajax) ? 1 : empty($CFG->enableajax)));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// "htmleditor" settingpage
|
||||
$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_special_editorfontlist());
|
||||
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
|
||||
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
|
||||
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_editordictionary());
|
||||
}
|
||||
$temp->add(new admin_setting_special_editorhidebuttons());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
// link to tag management interface
|
||||
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));
|
||||
|
||||
// "documentation" settingpage
|
||||
$temp = new admin_settingpage('documentation', get_string('moodledocs'));
|
||||
$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
|
||||
$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for coursemanager (what roles to display)
|
||||
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
|
||||
$temp->add(new admin_setting_special_coursemanager());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$ADMIN->add('appearance', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
|
||||
$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// link to tag management interface
|
||||
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));
|
||||
} // end of speedup
|
||||
?>
|
||||
|
||||
+53
-42
@@ -2,51 +2,62 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "courses" category
|
||||
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
|
||||
|
||||
// "courserequests" settingpage
|
||||
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
|
||||
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
$temp->add(new admin_setting_configselect('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1, make_categories_options()));
|
||||
$ADMIN->add('courses', $temp);
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:backup', $systemcontext)
|
||||
or has_capability('moodle/category:update', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
|
||||
|
||||
// "backups" settingpage
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'),'moodle/site:backup');
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0));
|
||||
$temp->add(new admin_setting_backupselect('backup_sche_users', get_string('users'), get_string('backupusershelp'), 0, array(0 => get_string('all'),
|
||||
1 => get_string('course'))));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0));
|
||||
$temp->add(new admin_setting_backupselect('backup_sche_keep', get_string('keep'), get_string('backupkeephelp'), 1, array(0 => get_string('all'),
|
||||
1 => '1',
|
||||
2 => '2',
|
||||
5 => '5',
|
||||
10 => '10',
|
||||
20 => '20',
|
||||
30 => '30',
|
||||
40 => '40',
|
||||
50 => '50',
|
||||
100 => '100',
|
||||
200 => '200',
|
||||
300 => '300',
|
||||
400 => '400',
|
||||
500 => '500')));
|
||||
$temp->add(new admin_setting_backupcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0));
|
||||
$temp->add(new admin_setting_special_backupdays());
|
||||
$temp->add(new admin_setting_special_backuptime());
|
||||
$temp->add(new admin_setting_special_backupsaveto());
|
||||
$ADMIN->add('courses', $temp);
|
||||
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
|
||||
|
||||
// "courserequests" settingpage
|
||||
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
|
||||
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
|
||||
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1));
|
||||
$ADMIN->add('courses', $temp);
|
||||
|
||||
// "backups" settingpage
|
||||
if (!empty($CFG->backup_version)) {
|
||||
$bi = array();
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0);
|
||||
$bi[] = new admin_setting_configselect('backup_sche_users', get_string('users'), get_string('backupusershelp'),
|
||||
0, array(0 => get_string('all'), 1 => get_string('course')));
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0);
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0);
|
||||
$bi[] = new admin_setting_configselect('backup_sche_keep', get_string('keep'),
|
||||
get_string('backupkeephelp'), 1, array(0 => get_string('all'), 1 => '1',
|
||||
2 => '2',
|
||||
5 => '5',
|
||||
10 => '10',
|
||||
20 => '20',
|
||||
30 => '30',
|
||||
40 => '40',
|
||||
50 => '50',
|
||||
100 => '100',
|
||||
200 => '200',
|
||||
300 => '300',
|
||||
400 => '400',
|
||||
500 => '500'));
|
||||
$bi[] = new admin_setting_configcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0);
|
||||
$bi[] = new admin_setting_special_backupdays();
|
||||
$bi[] = new admin_setting_configtime('backup_sche_hour', 'backup_sche_minute', get_string('executeat'),
|
||||
get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0));
|
||||
$bi[] = new admin_setting_configdirectory('backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), '');
|
||||
|
||||
$temp = new admin_settingpage('backups', get_string('backups','admin'), 'moodle/site:backup');
|
||||
foreach ($bi as $backupitem) {
|
||||
$backupitem->plugin = 'backup';
|
||||
$temp->add($backupitem);
|
||||
}
|
||||
$ADMIN->add('courses', $temp);
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,13 +5,20 @@
|
||||
if (get_site()) { //do not use during installation
|
||||
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
|
||||
if (has_capability('moodle/site:config', $systemcontext)
|
||||
or has_capability('moodle/course:update', $frontpagecontext)
|
||||
or has_capability('moodle/role:assign', $frontpagecontext)
|
||||
or has_capability('moodle/site:restore', $frontpagecontext)
|
||||
or has_capability('moodle/site:backup', $frontpagecontext)
|
||||
or has_capability('moodle/course:managefiles', $frontpagecontext)
|
||||
) {
|
||||
if ($hassiteconfig or has_any_capability(array(
|
||||
'moodle/course:update',
|
||||
'moodle/role:assign',
|
||||
'moodle/site:restore',
|
||||
'moodle/site:backup',
|
||||
'moodle/course:managefiles',
|
||||
'moodle/question:add',
|
||||
'moodle/question:editmine',
|
||||
'moodle/question:editall',
|
||||
'moodle/question:viewmine',
|
||||
'moodle/question:viewall',
|
||||
'moodle/question:movemine',
|
||||
'moodle/question:moveall'), $frontpagecontext)) {
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', NULL)); // no default
|
||||
@@ -52,6 +59,16 @@ if (get_site()) { //do not use during installation
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
|
||||
|
||||
$questioncapabilites = array(
|
||||
'moodle/question:add',
|
||||
'moodle/question:editmine',
|
||||
'moodle/question:editall',
|
||||
'moodle/question:viewmine',
|
||||
'moodle/question:viewall',
|
||||
'moodle/question:movemine',
|
||||
'moodle/question:moveall');
|
||||
$ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilites, false, $frontpagecontext));
|
||||
|
||||
$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
|
||||
}
|
||||
}
|
||||
|
||||
+163
-124
@@ -2,153 +2,192 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "grades" section
|
||||
|
||||
// General settings
|
||||
if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
require_once $CFG->libdir.'/grade/constants.php';
|
||||
// General settings
|
||||
|
||||
$temp = new admin_settingpage('gradessettings', get_string('gradessettings', 'grades'));
|
||||
$temp = new admin_settingpage('gradessettings', get_string('generalsettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
require_once $CFG->libdir.'/grade/constants.php';
|
||||
|
||||
// enable outcomes checkbox
|
||||
$temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
|
||||
// enable publishing in exports/imports
|
||||
$temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0, PARAM_INT));
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
|
||||
get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
|
||||
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
|
||||
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
|
||||
// enable outcomes checkbox
|
||||
$temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
|
||||
get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
$temp->add(new admin_setting_grade_profilereport());
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
|
||||
get_string('configdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
$temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
|
||||
get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
|
||||
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
|
||||
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
|
||||
get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
|
||||
get_string('configexportdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
|
||||
$temp->add(new admin_setting_special_gradeexport());
|
||||
$ADMIN->add('grades', $temp);
|
||||
// enable publishing in exports/imports
|
||||
$temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0, PARAM_INT));
|
||||
|
||||
/// Scales and outcomes
|
||||
$temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
|
||||
get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
|
||||
$scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $scales);
|
||||
$outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $outcomes);
|
||||
$letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
|
||||
$ADMIN->add('grades', $letters);
|
||||
$temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
|
||||
get_string('configexportdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
|
||||
/// Grade category settings
|
||||
$temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'));
|
||||
|
||||
$strnoforce = get_string('noforce', 'grades');
|
||||
|
||||
// Aggregation type
|
||||
$options = array(-1 => $strnoforce,
|
||||
GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
|
||||
GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
|
||||
GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
|
||||
GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
|
||||
GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
|
||||
GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
|
||||
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'));
|
||||
$temp->add(new admin_setting_configselect('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), -1, $options));
|
||||
|
||||
$options = array(-1 => $strnoforce, 0 => get_string('forceoff', 'grades'), 1 => get_string('forceon', 'grades'));
|
||||
$temp->add(new admin_setting_configselect('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
|
||||
get_string('aggregateonlygradedhelp', 'grades'), -1, $options));
|
||||
$temp->add(new admin_setting_configselect('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
|
||||
get_string('aggregateoutcomeshelp', 'grades'), -1, $options));
|
||||
$temp->add(new admin_setting_configselect('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
|
||||
get_string('aggregatesubcatshelp', 'grades'), -1, $options));
|
||||
|
||||
$options = array(-1 => $strnoforce, 0 => get_string('none'));
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('grade_keephigh', get_string('keephigh', 'grades'),
|
||||
get_string('keephighhelp', 'grades'), -1, $options));
|
||||
$temp->add(new admin_setting_configselect('grade_droplow', get_string('droplow', 'grades'),
|
||||
get_string('droplowhelp', 'grades'), -1, $options));
|
||||
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
|
||||
|
||||
// Reports
|
||||
|
||||
$first = true;
|
||||
foreach (get_list_of_plugins('grade/report') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if ($first) {
|
||||
$ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
|
||||
$first = false;
|
||||
$temp->add(new admin_setting_special_gradeexport());
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
|
||||
/// Grade category settings
|
||||
$temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
$temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
|
||||
|
||||
$settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin));
|
||||
include_once($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
|
||||
$ADMIN->add('gradereports', $settings);
|
||||
}
|
||||
}
|
||||
$strnoforce = get_string('noforce', 'grades');
|
||||
|
||||
// Imports
|
||||
// Aggregation type
|
||||
$options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
|
||||
GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
|
||||
GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
|
||||
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
|
||||
GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
|
||||
GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
|
||||
GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
|
||||
GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
|
||||
GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
|
||||
$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
|
||||
|
||||
$first = true;
|
||||
foreach (get_list_of_plugins('grade/import') as $plugin) {
|
||||
$options = array(0 => get_string('no'), 1 => get_string('yes'));
|
||||
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
|
||||
if ($first) {
|
||||
$ADMIN->add('grades', new admin_category('gradeimports', get_string('imports')));
|
||||
$first = false;
|
||||
$defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
|
||||
get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
|
||||
$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
|
||||
get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
|
||||
get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
|
||||
|
||||
$options = array(0 => get_string('none'));
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
|
||||
$settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin));
|
||||
include_once($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
|
||||
$ADMIN->add('gradeimports', $settings);
|
||||
$defaults['value'] = 0;
|
||||
$defaults['forced'] = true;
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
|
||||
get_string('keephighhelp', 'grades'), $defaults, $options));
|
||||
$defaults['forced'] = false;
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
|
||||
get_string('droplowhelp', 'grades'), $defaults, $options));
|
||||
}
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
// Exports
|
||||
/// Grade item settings
|
||||
$temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
$temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
|
||||
get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
|
||||
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
|
||||
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
|
||||
|
||||
$first = true;
|
||||
foreach (get_list_of_plugins('grade/export') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
|
||||
if ($first) {
|
||||
$ADMIN->add('grades', new admin_category('gradeexports', get_string('exports')));
|
||||
$first = false;
|
||||
$temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
|
||||
get_string('configdecimalpoints', 'grades'), 2,
|
||||
array( '0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5')));
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
|
||||
array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
|
||||
array('iteminfo' => get_string('iteminfo', 'grades'),
|
||||
'idnumber' => get_string('idnumbermod'),
|
||||
'gradetype' => get_string('gradetype', 'grades'),
|
||||
'scaleid' => get_string('scale'),
|
||||
'grademin' => get_string('grademin', 'grades'),
|
||||
'grademax' => get_string('grademax', 'grades'),
|
||||
'gradepass' => get_string('gradepass', 'grades'),
|
||||
'plusfactor' => get_string('plusfactor', 'grades'),
|
||||
'multfactor' => get_string('multfactor', 'grades'),
|
||||
'display' => get_string('gradedisplaytype', 'grades'),
|
||||
'decimals' => get_string('decimalpoints', 'grades'),
|
||||
'hidden' => get_string('hidden', 'grades'),
|
||||
'hiddenuntil' => get_string('hiddenuntil', 'grades'),
|
||||
'locked' => get_string('locked', 'grades'),
|
||||
'locktime' => get_string('locktime', 'grades'),
|
||||
'aggregationcoef' => get_string('aggregationcoef', 'grades'),
|
||||
'parentcategory' => get_string('parentcategory', 'grades'))));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
/// Scales and outcomes
|
||||
|
||||
$scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $scales);
|
||||
$outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
|
||||
$ADMIN->add('grades', $outcomes);
|
||||
$letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
|
||||
$ADMIN->add('grades', $letters);
|
||||
|
||||
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
|
||||
|
||||
// Reports
|
||||
$ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/report') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradereports', $settings);
|
||||
}
|
||||
|
||||
$settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin));
|
||||
include_once($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
|
||||
$ADMIN->add('gradeexports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
// Imports
|
||||
$ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/import') as $plugin) {
|
||||
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradeimports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Exports
|
||||
$ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
|
||||
foreach (get_list_of_plugins('grade/export') as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
|
||||
$settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('gradeexports', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+19
-12
@@ -2,21 +2,28 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "appearance" category
|
||||
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:langeditmaster', $systemcontext)
|
||||
or has_capability('moodle/site:langeditlocal', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// new CFG variable for excel encoding
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
|
||||
// new CFG variable for excel encoding
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
|
||||
|
||||
$ADMIN->add('language', $temp);
|
||||
$ADMIN->add('language', $temp);
|
||||
|
||||
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php"));
|
||||
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
|
||||
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php", array('moodle/site:langeditmaster', 'moodle/site:langeditlocal') ));
|
||||
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+19
-19
@@ -1,27 +1,27 @@
|
||||
<?php // $Id$
|
||||
|
||||
// "locations" settingpage
|
||||
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
$options[0] = get_string('choose') .'...';
|
||||
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$iplookups = array();
|
||||
if ($plugins = get_list_of_plugins('iplookup')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$iplookups[$plugin] = $plugin;
|
||||
}
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('iplookup', get_string('iplookup', 'admin'), get_string('configiplookup', 'admin'), 'hostip', $iplookups));
|
||||
// "locations" settingpage
|
||||
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = get_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$options = get_list_of_countries();
|
||||
$options[0] = get_string('choose') .'...';
|
||||
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
|
||||
|
||||
$ADMIN->add('location', $temp);
|
||||
$temp->add(new admin_setting_heading('iplookup', get_string('iplookup', 'admin'), get_string('iplookupinfo', 'admin')));
|
||||
$temp->add(new admin_setting_configfile('geoipfile', get_string('geoipfile', 'admin'), get_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
|
||||
$temp->add(new admin_setting_configtext('googlemapkey', get_string('googlemapkey', 'admin'), get_string('configgooglemapkey', 'admin', $CFG->wwwroot), ''));
|
||||
|
||||
$ADMIN->add('location', $temp);
|
||||
|
||||
|
||||
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
|
||||
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+20
-14
@@ -2,23 +2,29 @@
|
||||
|
||||
// * Miscellaneous settings
|
||||
|
||||
// Experimental settings page
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enablegroupings', get_string('enablegroupings', 'admin'), get_string('configenablegroupings', 'admin'), 0));
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$ADMIN->add('misc', $temp);
|
||||
// Experimental settings page
|
||||
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
|
||||
$item = new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0);
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
$temp->add(new admin_setting_configcheckbox('enablegroupings', get_string('enablegroupings', 'admin'), get_string('configenablegroupings', 'admin'), 0));
|
||||
|
||||
// XMLDB editor
|
||||
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
|
||||
$ADMIN->add('misc', $temp);
|
||||
|
||||
// XMLDB editor
|
||||
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
|
||||
|
||||
|
||||
// hidden scripts linked from elsewhere
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
|
||||
// hidden scripts linked from elsewhere
|
||||
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+15
-9
@@ -2,20 +2,26 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "mnet" category
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/index.php',
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/index.php",
|
||||
'moodle/site:config'));
|
||||
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/peers.php',
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('mnetpeers', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/peers.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', get_string('ssoaccesscontrol', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/access_control.php',
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/access_control.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('mnetenrol', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/enr_hosts.php',
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('mnetenrol', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/enr_hosts.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
$CFG->wwwroot . '/admin/mnet/trustedhosts.php',
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/trustedhosts.php",
|
||||
'moodle/site:config'));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php //$Id$
|
||||
|
||||
if ($hassiteconfig) {
|
||||
|
||||
$ADMIN->add('modules', new admin_category('modsettings', get_string('activities')));
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
if ($modules = get_records('modules')) {
|
||||
$modulebyname = array();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$strmodulename = get_string('modulename', $module->name);
|
||||
// Deal with modules which are lacking the language string
|
||||
if ($strmodulename == '[[modulename]]') {
|
||||
$textlib = textlib_get_instance();
|
||||
$strmodulename = $textlib->strtotitle($module->name);
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname);
|
||||
|
||||
foreach ($modulebyname as $strmodulename=>$module) {
|
||||
$modulename = $module->name;
|
||||
if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) {
|
||||
// do not show disabled modules in tree, keep only settings link on manage page
|
||||
$settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible);
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/mod/'.$modulename.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('modsettings', $settings);
|
||||
} else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/config.html')) {
|
||||
$ADMIN->add('modsettings', new admin_externalpage('modsetting'.$modulename, $strmodulename, "$CFG->wwwroot/$CFG->admin/module.php?module=$modulename", 'moodle/site:config', !$module->visible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
|
||||
$ADMIN->add('blocksettings', new admin_page_manageblocks());
|
||||
$ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
|
||||
if (!empty($CFG->blocks_version) and $blocks = get_records('block')) {
|
||||
$blockbyname = array();
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
if(($blockobject = block_instance($block->name)) === false) {
|
||||
// Failed to load
|
||||
continue;
|
||||
}
|
||||
$blockbyname[$blockobject->get_title()] = $block;
|
||||
}
|
||||
ksort($blockbyname);
|
||||
|
||||
foreach ($blockbyname as $strblockname=>$block) {
|
||||
$blockname = $block->name;
|
||||
if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/settings.php')) {
|
||||
$settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible);
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/blocks/'.$blockname.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('blocksettings', $settings);
|
||||
|
||||
} else if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/config_global.html')) {
|
||||
$ADMIN->add('blocksettings', new admin_externalpage('blocksetting'.$blockname, $strblockname, "$CFG->wwwroot/$CFG->admin/block.php?block=$block->id", 'moodle/site:config', !$block->visible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
|
||||
// "filtersettings" settingpage
|
||||
$temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
$items = array();
|
||||
$items[] = new admin_setting_managefilters();
|
||||
$items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), '');
|
||||
$items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
|
||||
86400 => get_string('numdays','',1),
|
||||
43200 => get_string('numhours','',12),
|
||||
10800 => get_string('numhours','',3),
|
||||
7200 => get_string('numhours','',2),
|
||||
3600 => get_string('numhours','',1),
|
||||
2700 => get_string('numminutes','',45),
|
||||
1800 => get_string('numminutes','',30),
|
||||
900 => get_string('numminutes','',15),
|
||||
600 => get_string('numminutes','',10),
|
||||
540 => get_string('numminutes','',9),
|
||||
480 => get_string('numminutes','',8),
|
||||
420 => get_string('numminutes','',7),
|
||||
360 => get_string('numminutes','',6),
|
||||
300 => get_string('numminutes','',5),
|
||||
240 => get_string('numminutes','',4),
|
||||
180 => get_string('numminutes','',3),
|
||||
120 => get_string('numminutes','',2),
|
||||
60 => get_string('numminutes','',1),
|
||||
30 => get_string('numseconds','',30),
|
||||
0 => get_string('no')));
|
||||
$items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
|
||||
'1' => get_string('allfiles'),
|
||||
'2' => get_string('htmlfilesonly')));
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0);
|
||||
foreach ($items as $item) {
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
}
|
||||
}
|
||||
$ADMIN->add('filtersettings', $temp);
|
||||
|
||||
if (empty($CFG->textfilters)) {
|
||||
$activefilters = array();
|
||||
} else {
|
||||
$activefilters = explode(',', $CFG->textfilters);
|
||||
}
|
||||
$filterlocations = array('mod','filter');
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$filters = get_list_of_plugins($filterlocation);
|
||||
|
||||
$filterbyname = array();
|
||||
|
||||
foreach ($filters as $filter) {
|
||||
$strfiltername = get_string('filtername', $filter);
|
||||
// Deal with filters which are lacking the language string
|
||||
if ($strfiltername == '[[filtername]]') {
|
||||
$textlib = textlib_get_instance();
|
||||
$strfiltername = $textlib->strtotitle($filter);
|
||||
}
|
||||
$filterbyname[$strfiltername] = "$filterlocation/$filter";
|
||||
}
|
||||
ksort($filterbyname);
|
||||
|
||||
foreach ($filterbyname as $strfiltername=>$filterfull) {
|
||||
if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
|
||||
$settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
|
||||
if ($ADMIN->fulltree) {
|
||||
include("$CFG->dirroot/$filterfull/filtersettings.php");
|
||||
}
|
||||
$ADMIN->add('filtersettings', $settings);
|
||||
|
||||
} else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
|
||||
$ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
+94
-89
@@ -1,111 +1,116 @@
|
||||
<?php // $Id$
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
// "sitepolicies" settingpage
|
||||
$temp = new admin_settingpage('sitepolicies', get_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
// "sitepolicies" settingpage
|
||||
$temp = new admin_settingpage('sitepolicies', get_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
|
||||
|
||||
$max_upload_choices = get_max_upload_sizes();
|
||||
// maxbytes set to 0 will allow the maxium server lmit for uploads
|
||||
$max_upload_choices[0] = get_string('serverlimit', 'admin');
|
||||
$temp->add(new admin_setting_configselect('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
|
||||
$max_upload_choices = get_max_upload_sizes();
|
||||
// maxbytes set to 0 will allow the maxium server lmit for uploads
|
||||
$max_upload_choices[0] = get_string('serverlimit', 'admin');
|
||||
$temp->add(new admin_setting_configselect('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
|
||||
array(60 => get_string('numminutes', '', 1),
|
||||
300 => get_string('numminutes', '', 5),
|
||||
900 => get_string('numminutes', '', 15),
|
||||
1800 => get_string('numminutes', '', 30),
|
||||
2700 => get_string('numminutes', '', 45),
|
||||
3600 => get_string('numminutes', '', 60))));
|
||||
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
|
||||
'firstname lastname', array('language' => get_string('language'),
|
||||
'firstname lastname' => get_string('firstname') . ' + ' . get_string('lastname'),
|
||||
'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
2 => get_string('groupblogs','blog'),
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
$temp->add(new admin_setting_configcheckbox('usetags', get_string('usetags','admin'),get_string('configusetags', 'admin'),'1'));
|
||||
$temp->add(new admin_setting_configcheckbox('keeptagnamecase', get_string('keeptagnamecase','admin'),get_string('configkeeptagnamecase', 'admin'),'0'));
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
|
||||
array(60 => get_string('numminutes', '', 1),
|
||||
300 => get_string('numminutes', '', 5),
|
||||
900 => get_string('numminutes', '', 15),
|
||||
1800 => get_string('numminutes', '', 30),
|
||||
2700 => get_string('numminutes', '', 45),
|
||||
3600 => get_string('numminutes', '', 60))));
|
||||
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
|
||||
'firstname lastname', array('language' => get_string('language'),
|
||||
'firstname lastname' => get_string('firstname').' + '.get_string('lastname'),
|
||||
'lastname firstname' => get_string('lastname').' + '.get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
2 => get_string('groupblogs','blog'),
|
||||
1 => get_string('personalblogs','blog'),
|
||||
0 => get_string('disableblogs','blog'))));
|
||||
$temp->add(new admin_setting_configcheckbox('usetags', get_string('usetags','admin'),get_string('configusetags', 'admin'),'1'));
|
||||
$temp->add(new admin_setting_configcheckbox('keeptagnamecase', get_string('keeptagnamecase','admin'),get_string('configkeeptagnamecase', 'admin'),'1'));
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlength', get_string('minpasswordlength', 'admin'), get_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpassworddigits', get_string('minpassworddigits', 'admin'), get_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlower', get_string('minpasswordlower', 'admin'), get_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordupper', get_string('minpasswordupper', 'admin'), get_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', get_string('minpasswordnonalphanum', 'admin'), get_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', get_string('disableuserimages', 'admin'), get_string('configdisableuserimages', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
$temp->add(new admin_setting_configcheckbox('passwordpolicy', get_string('passwordpolicy', 'admin'), get_string('configpasswordpolicy', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlength', get_string('minpasswordlength', 'admin'), get_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpassworddigits', get_string('minpassworddigits', 'admin'), get_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordlower', get_string('minpasswordlower', 'admin'), get_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordupper', get_string('minpasswordupper', 'admin'), get_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', get_string('minpasswordnonalphanum', 'admin'), get_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', get_string('disableuserimages', 'admin'), get_string('configdisableuserimages', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', get_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', get_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
// "modulesecurity" settingpage
|
||||
$temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses',
|
||||
'all' => 'All courses',
|
||||
'requested' => 'Requested courses')));
|
||||
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
|
||||
if (!$options = get_records("modules")) {
|
||||
// "modulesecurity" settingpage
|
||||
$temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses',
|
||||
'all' => 'All courses',
|
||||
'requested' => 'Requested courses')));
|
||||
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
|
||||
if (!$options = get_records("modules")) {
|
||||
$options = array();
|
||||
}
|
||||
$options2 = array();
|
||||
foreach ($options as $option) {
|
||||
$options2[$option->id] = $option->name;
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', get_string('notifications', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('displayloginfailures', get_string('displayloginfailures', 'admin'), get_string('configdisplayloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'admin' => get_string('administrators'),
|
||||
'teacher' => get_string('administratorsandteachers'),
|
||||
'everybody' => get_string('everybody'))));
|
||||
$temp->add(new admin_setting_configselect('notifyloginfailures', get_string('notifyloginfailures', 'admin'), get_string('confignotifyloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'mainadmin' => get_string('administrator'),
|
||||
'alladmins' => get_string('administratorsall'))));
|
||||
$options = array();
|
||||
}
|
||||
$options2 = array();
|
||||
foreach ($options as $option) {
|
||||
$options2[$option->id] = $option->name;
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', get_string('notifications', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('displayloginfailures', get_string('displayloginfailures', 'admin'), get_string('configdisplayloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'admin' => get_string('administrators'),
|
||||
'teacher' => get_string('administratorsandteachers'),
|
||||
'everybody' => get_string('everybody'))));
|
||||
$temp->add(new admin_setting_configselect('notifyloginfailures', get_string('notifyloginfailures', 'admin'), get_string('confignotifyloginfailures', 'admin'), '', array('' => get_string('nobody'),
|
||||
'mainadmin' => get_string('administrator'),
|
||||
'alladmins' => get_string('administratorsall'))));
|
||||
$options = array();
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('notifyloginthreshold', get_string('notifyloginthreshold', 'admin'), get_string('confignotifyloginthreshold', 'admin'), '10', $options));
|
||||
$ADMIN->add('security', $temp);
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('notifyloginthreshold', get_string('notifyloginthreshold', 'admin'), get_string('confignotifyloginthreshold', 'admin'), '10', $options));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => get_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configexecutable('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configdirectory('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => get_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+58
-24
@@ -2,15 +2,18 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "server" category
|
||||
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
// "systempaths" settingpage
|
||||
$temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
|
||||
$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
|
||||
'1' => get_string('gd1'),
|
||||
'2' => get_string('gd2'))));
|
||||
$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '', PARAM_RAW)); // TODO: add path validation
|
||||
$temp->add(new admin_setting_configexecutable('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), ''));
|
||||
$ADMIN->add('server', $temp, 0);
|
||||
|
||||
|
||||
@@ -19,10 +22,9 @@ $ADMIN->add('server', $temp, 0);
|
||||
$temp = new admin_settingpage('mail', get_string('mail','admin'));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
@@ -50,15 +52,17 @@ $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestma
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // not needed here
|
||||
$options = array();
|
||||
$options['0'] = get_string('none');
|
||||
$options['0'] = 'UTF-8';
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
|
||||
$options = array('LF'=>'LF', 'CRLF'=>'CRLF');
|
||||
$temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
|
||||
if (isloggedin()) {
|
||||
global $USER;
|
||||
$primaryadminemail = $USER->email;
|
||||
$primaryadminname = fullname($USER, true);
|
||||
|
||||
|
||||
} else {
|
||||
// no defaults during installation - admin user must be created first
|
||||
$primaryadminemail = NULL;
|
||||
@@ -98,10 +102,10 @@ $ADMIN->add('server', $temp);
|
||||
// "debugging" settingpage
|
||||
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
|
||||
$temp->add(new admin_setting_special_debug());
|
||||
$temp->add(new admin_setting_special_debugdisplay());
|
||||
$temp->add(new admin_setting_configcheckbox('debugdisplay', get_string('debugdisplay', 'admin'), get_string('configdebugdisplay', 'admin'), ini_get('display_errors')));
|
||||
$temp->add(new admin_setting_configcheckbox('xmlstrictheaders', get_string('xmlstrictheaders', 'admin'), get_string('configxmlstrictheaders', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_perfdebug());
|
||||
$temp->add(new admin_setting_configcheckbox('perfdebug', get_string('perfdebug', 'admin'), get_string('configperfdebug', 'admin'), '7', '15', '7'));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -119,7 +123,9 @@ $temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirs
|
||||
60*60*24*140 => get_string('nummonths','moodle',5),
|
||||
60*60*24*168 => get_string('nummonths','moodle',6),
|
||||
'all' => get_string('all') )));
|
||||
$temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime', 'admin'), 0, array(0 => get_string('untilcomplete'),
|
||||
$temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime2', 'admin'), 0, array(0 => get_string('untilcomplete'),
|
||||
60*30 => '10 '.get_string('minutes'),
|
||||
60*30 => '30 '.get_string('minutes'),
|
||||
60*60 => '1 '.get_string('hour'),
|
||||
60*60*2 => '2 '.get_string('hours'),
|
||||
60*60*3 => '3 '.get_string('hours'),
|
||||
@@ -130,6 +136,9 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsma
|
||||
60*60*8 => '8 '.get_string('hours') )));
|
||||
$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
|
||||
$temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
|
||||
|
||||
$options = array(0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6);
|
||||
$temp->add(new admin_setting_configselect('statscatdepth', get_string('statscatdepth', 'admin'), get_string('configstatscatdepth', 'admin'), 1, $options));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -137,8 +146,16 @@ $ADMIN->add('server', $temp);
|
||||
$temp = new admin_settingpage('http', get_string('http', 'admin'));
|
||||
$temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT));
|
||||
$temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
|
||||
$temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
|
||||
$temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
|
||||
$options = array('HTTP'=>'HTTP');
|
||||
if (defined('CURLPROXY_SOCKS5')) {
|
||||
$options['SOCKS5'] = 'SOCKS5';
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('proxytype', get_string('proxytype', 'admin'), get_string('configproxytype','admin'), 'HTTP', $options));
|
||||
$temp->add(new admin_setting_configtext('proxyuser', get_string('proxyuser', 'admin'), get_string('configproxyuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configpasswordunmask('proxypassword', get_string('proxypassword', 'admin'), get_string('configproxypassword', 'admin'), ''));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
$ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
|
||||
@@ -177,7 +194,22 @@ $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime
|
||||
120 => get_string('numdays', '', 120),
|
||||
90 => get_string('numdays', '', 90),
|
||||
60 => get_string('numdays', '', 60),
|
||||
30 => get_string('numdays', '', 30))));
|
||||
35 => get_string('numdays', '', 35))));
|
||||
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
|
||||
get_string('configdisablegradehistory', 'grades'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
|
||||
get_string('configgradehistorylifetime', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
|
||||
1000 => get_string('numdays', '', 1000),
|
||||
365 => get_string('numdays', '', 365),
|
||||
180 => get_string('numdays', '', 180),
|
||||
150 => get_string('numdays', '', 150),
|
||||
120 => get_string('numdays', '', 120),
|
||||
90 => get_string('numdays', '', 90),
|
||||
60 => get_string('numdays', '', 60),
|
||||
30 => get_string('numdays', '', 30))));
|
||||
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
@@ -189,16 +221,16 @@ $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "
|
||||
|
||||
// "performance" settingpage
|
||||
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
|
||||
get_string('configcachetype', 'admin'), '',
|
||||
array( '' => get_string('none'),
|
||||
'internal' => 'internal',
|
||||
'memcached' => 'memcached',
|
||||
$temp->add(new admin_setting_special_selectsetup('cachetype', get_string('cachetype', 'admin'),
|
||||
get_string('configcachetype', 'admin'), '',
|
||||
array( '' => get_string('none'),
|
||||
'internal' => 'internal',
|
||||
'memcached' => 'memcached',
|
||||
'eaccelerator' => 'eaccelerator')));
|
||||
// NOTE: $CFG->rcache is forced to bool in lib/setup.php
|
||||
$temp->add(new admin_setting_configselect('rcache', get_string('rcache', 'admin'),
|
||||
get_string('configrcache', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
$temp->add(new admin_setting_special_selectsetup('rcache', get_string('rcache', 'admin'),
|
||||
get_string('configrcache', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
'1' => get_string('yes'))));
|
||||
$temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
|
||||
get_string('configrcachettl', 'admin'), 10));
|
||||
@@ -207,8 +239,8 @@ $temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax',
|
||||
$temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
|
||||
get_string('configmemcachedhosts', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
|
||||
get_string('configmemcachedpconn', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
get_string('configmemcachedpconn', 'admin'), 0,
|
||||
array( '0' => get_string('no'),
|
||||
'1' => get_string('yes'))));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
@@ -216,4 +248,6 @@ if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
|
||||
$ADMIN->add('server', new admin_externalpage('database', get_string('managedatabase'), "$CFG->wwwroot/$CFG->admin/mysql/frame.php"));
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+10
-7
@@ -6,15 +6,18 @@
|
||||
// are added to them.
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (get_site()) {
|
||||
$hassiteconfig = has_capability('moodle/site:config', $systemcontext);
|
||||
} else {
|
||||
// installation starts - no permission checks
|
||||
$hassiteconfig = true;
|
||||
}
|
||||
|
||||
$ADMIN->add('root', new admin_externalpage('adminnotifications', get_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
|
||||
|
||||
// hidden upgrade script
|
||||
$ADMIN->add('root', new admin_externalpage('upgradesettings', get_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
|
||||
|
||||
// hidden search script
|
||||
$ADMIN->add('root', new admin_externalpage('search', get_string('search', 'admin'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
|
||||
|
||||
$ADMIN->add('root', new admin_category('users', get_string('users','admin')));
|
||||
$ADMIN->add('root', new admin_category('courses', get_string('courses','admin')));
|
||||
$ADMIN->add('root', new admin_category('grades', get_string('grades')));
|
||||
@@ -22,9 +25,6 @@ $ADMIN->add('root', new admin_category('location', get_string('location','admin'
|
||||
$ADMIN->add('root', new admin_category('language', get_string('language')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('modules', get_string('plugins', 'admin')));
|
||||
$ADMIN->add('modules', new admin_externalpage('managemodules', get_string('activities'), "$CFG->wwwroot/$CFG->admin/modules.php"));
|
||||
$ADMIN->add('modules', new admin_externalpage('manageblocks', get_string('blocks'), "$CFG->wwwroot/$CFG->admin/blocks.php"));
|
||||
$ADMIN->add('modules', new admin_externalpage('managefilters', get_string('managefilters'), "$CFG->wwwroot/$CFG->admin/filters.php"));
|
||||
|
||||
$ADMIN->add('root', new admin_category('security', get_string('security','admin')));
|
||||
$ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin')));
|
||||
@@ -33,7 +33,7 @@ $ADMIN->add('root', new admin_category('server', get_string('server','admin')));
|
||||
$ADMIN->add('root', new admin_category('mnet', get_string('net','mnet')));
|
||||
|
||||
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
|
||||
foreach (get_list_of_plugins('admin/report') as $plugin) {
|
||||
foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
|
||||
/// This snippet is temporary until simpletest can be fixed to use xmldb. See MDL-7377 XXX TODO
|
||||
if ($plugin == 'simpletest' && $CFG->dbfamily != 'mysql' && $CFG->dbfamily != 'postgres') {
|
||||
continue;
|
||||
@@ -51,4 +51,7 @@ $ADMIN->add('root', new admin_category('misc', get_string('miscellaneous')));
|
||||
// hidden unsupported category
|
||||
$ADMIN->add('root', new admin_category('unsupported', get_string('unsupported', 'admin'), true));
|
||||
|
||||
// hidden search script
|
||||
$ADMIN->add('root', new admin_externalpage('search', get_string('searchresults'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
|
||||
|
||||
?>
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
// This file defines settingpages and externalpages in the "unsupported" hidden category, use wisely!
|
||||
|
||||
$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php'));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php'));
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php', 'moodle/site:config', true));
|
||||
$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php', 'moodle/site:config', true));
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+142
-94
@@ -2,112 +2,160 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "users" category
|
||||
|
||||
if (has_capability('moodle/site:config',$systemcontext)) { // speedup for non-admins
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:uploadusers', $systemcontext)
|
||||
or has_capability('moodle/user:create', $systemcontext)
|
||||
or has_capability('moodle/user:update', $systemcontext)
|
||||
or has_capability('moodle/user:delete', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
$ADMIN->add('users', new admin_externalpage('userauthentication', get_string('authentication','admin'), "$CFG->wwwroot/$CFG->admin/auth.php"));
|
||||
$ADMIN->add('users', new admin_category('authsettings', get_string('authentication','admin')));
|
||||
|
||||
$temp = new admin_settingpage('manageauths', get_string('authsettings', 'admin'));
|
||||
$temp->add(new admin_setting_manageauths());
|
||||
$temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), ''));
|
||||
$temp->add(new admin_setting_special_registerauth());
|
||||
$temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'),
|
||||
get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show'))));
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', get_string('alternateloginurl', 'auth'),
|
||||
get_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php')), ''));
|
||||
$temp->add(new admin_setting_configtext('forgottenpasswordurl', get_string('forgottenpasswordurl', 'auth'),
|
||||
get_string('forgottenpassword', 'auth'), ''));
|
||||
$temp->add(new admin_setting_configtextarea('auth_instructions', get_string('instructions', 'auth'),
|
||||
get_string('authinstructions', 'auth'), ''));
|
||||
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
|
||||
|
||||
$ADMIN->add('authsettings', $temp);
|
||||
|
||||
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
if ($auths = get_list_of_plugins('auth')) {
|
||||
$authsenabled = get_enabled_auth_plugins();
|
||||
$authbyname = array();
|
||||
|
||||
|
||||
// stuff under the "roles" subcategory
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php"));
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $sitecontext->id));
|
||||
|
||||
|
||||
// "userpolicies" settingpage
|
||||
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (!$guestrole = get_guest_role()) {
|
||||
$guestrole->id = 0;
|
||||
}
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
$studentrole = array_shift($studentroles); /// Take the first one
|
||||
} else {
|
||||
$studentrole->id = 0;
|
||||
}
|
||||
if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
|
||||
$userrole = array_shift($userroles); /// Take the first one
|
||||
} else {
|
||||
$userrole->id = 0;
|
||||
}
|
||||
if (empty($CFG->creatornewroleid)) {
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
set_config('creatornewroleid', $teachereditrole->id);
|
||||
} else {
|
||||
set_config('creatornewroleid', 0);
|
||||
foreach ($auths as $auth) {
|
||||
$strauthname = get_string("auth_{$auth}title", "auth");
|
||||
if ($strauthname == "[[auth_{$auth}title]]") {
|
||||
$strauthname = get_string("auth_{$auth}title", "auth_{$auth}");
|
||||
}
|
||||
$authbyname[$strauthname] = $auth;
|
||||
}
|
||||
}
|
||||
// we must not use assignable roles here:
|
||||
// 1/ unsetting roles as assignable for admin might bork the settings!
|
||||
// 2/ default user role should not be assignable anyway
|
||||
$allroles = array();
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$allroles[$role->id] = strip_tags(format_string($role->name, true));
|
||||
ksort($authbyname);
|
||||
|
||||
foreach ($authbyname as $strauthname=>$authname) {
|
||||
if (file_exists($CFG->dirroot.'/auth/'.$authname.'/settings.php')) {
|
||||
// do not show disabled auths in tree, keep only settings link on manage page
|
||||
$settings = new admin_settingpage('authsetting'.$authname, $strauthname, 'moodle/site:config', !in_array($authname, $authsenabled));
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot.'/auth/'.$authname.'/settings.php');
|
||||
}
|
||||
// TODO: finish implementation of common settings - locking, etc.
|
||||
$ADMIN->add('authsettings', $settings);
|
||||
|
||||
} else {
|
||||
$ADMIN->add('authsettings', new admin_externalpage('authsetting'.$authname, $strauthname, "$CFG->wwwroot/$CFG->admin/auth_config.php?auth=$authname", 'moodle/site:config', !in_array($authname, $authsenabled)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
|
||||
$temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
|
||||
get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
|
||||
get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('nodefaultuserrolelists', get_string('nodefaultuserrolelists', 'admin'), get_string('confignodefaultuserrolelists', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
|
||||
get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
|
||||
get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
|
||||
}
|
||||
|
||||
//$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
|
||||
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
|
||||
get_string('confighiddenuserfields', 'admin'), array(),
|
||||
array('none' => get_string('none'),
|
||||
'description' => get_string('description'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'),
|
||||
'webpage' => get_string('webpage'),
|
||||
'icqnumber' => get_string('icqnumber'),
|
||||
'skypeid' => get_string('skypeid'),
|
||||
'yahooid' => get_string('yahooid'),
|
||||
'aimid' => get_string('aimid'),
|
||||
'msnid' => get_string('msnid'),
|
||||
'lastaccess' => get_string('lastaccess'))));
|
||||
//$temp->add(new admin_setting_special_adminseesall());
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
// stuff under the "accounts" subcategory
|
||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
|
||||
|
||||
$ADMIN->add('roles', $temp);
|
||||
// stuff under the "roles" subcategory
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php"));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id));
|
||||
|
||||
} // end of admin tree capability if
|
||||
|
||||
// "userpolicies" settingpage
|
||||
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (!$guestrole = get_guest_role()) {
|
||||
$guestrole->id = 0;
|
||||
}
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
$studentrole = array_shift($studentroles); /// Take the first one
|
||||
} else {
|
||||
$studentrole->id = 0;
|
||||
}
|
||||
if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
|
||||
$userrole = array_shift($userroles); /// Take the first one
|
||||
} else {
|
||||
$userrole->id = 0;
|
||||
}
|
||||
if (empty($CFG->creatornewroleid)) {
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
|
||||
$teachereditrole = array_shift($teacherroles);
|
||||
set_config('creatornewroleid', $teachereditrole->id);
|
||||
} else {
|
||||
set_config('creatornewroleid', 0);
|
||||
}
|
||||
}
|
||||
// we must not use assignable roles here:
|
||||
// 1/ unsetting roles as assignable for admin might bork the settings!
|
||||
// 2/ default user role should not be assignable anyway
|
||||
$allroles = array();
|
||||
if ($roles = get_all_roles()) {
|
||||
foreach ($roles as $role) {
|
||||
$allroles[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
|
||||
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
|
||||
$temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
|
||||
get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
|
||||
get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('nodefaultuserrolelists', get_string('nodefaultuserrolelists', 'admin'), get_string('confignodefaultuserrolelists', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
|
||||
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
|
||||
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
|
||||
get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
|
||||
|
||||
if (!empty($CFG->rolesactive)) {
|
||||
$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
|
||||
get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
|
||||
get_string('confighiddenuserfields', 'admin'), array(),
|
||||
array('description' => get_string('description'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'),
|
||||
'webpage' => get_string('webpage'),
|
||||
'icqnumber' => get_string('icqnumber'),
|
||||
'skypeid' => get_string('skypeid'),
|
||||
'yahooid' => get_string('yahooid'),
|
||||
'aimid' => get_string('aimid'),
|
||||
'msnid' => get_string('msnid'),
|
||||
'lastaccess' => get_string('lastaccess'))));
|
||||
}
|
||||
|
||||
$ADMIN->add('roles', $temp);
|
||||
|
||||
} // end of speedup
|
||||
|
||||
?>
|
||||
|
||||
+6
-10
@@ -5,10 +5,6 @@
|
||||
require_once($CFG->dirroot.'/lib/pagelib.php');
|
||||
require_once($CFG->dirroot.'/lib/blocklib.php');
|
||||
|
||||
if (!empty($THEME->customcorners)) {
|
||||
require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
|
||||
}
|
||||
|
||||
$pt = optional_param('pt', null, PARAM_SAFEDIR); //alhanumeric and -
|
||||
|
||||
$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
|
||||
@@ -58,12 +54,12 @@
|
||||
echo '<tr valign="top">';
|
||||
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '<td valign="top" id="middle-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
print_container_start();
|
||||
|
||||
} else {
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
@@ -80,12 +76,12 @@
|
||||
|
||||
|
||||
if (!empty($pt)) {
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_start();
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
|
||||
if (!empty($THEME->customcorners)) print_custom_corners_end();
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
print_footer();
|
||||
|
||||
+18
-19
@@ -6,7 +6,7 @@
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/olson.php');
|
||||
|
||||
|
||||
admin_externalpage_setup('timezoneimport');
|
||||
|
||||
$ok = optional_param('ok', 0, PARAM_BOOL);
|
||||
@@ -23,9 +23,9 @@
|
||||
if (!$ok or !confirm_sesskey()) {
|
||||
$message = '<br /><br />';
|
||||
$message .= $CFG->dataroot.'/temp/olson.txt<br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezones.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezones/">http://download.moodle.org/timezones/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezones.txt">'.$CFG->dirroot.'/lib/timezones.txt</a><br />';
|
||||
$message .= $CFG->dataroot.'/temp/timezone.txt<br />';
|
||||
$message .= '<a href="http://download.moodle.org/timezone/">http://download.moodle.org/timezone/</a><br />';
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezone.txt">'.$CFG->dirroot.'/lib/timezone.txt</a><br />';
|
||||
$message .= '<br />';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
/// Next, look for a CSV file locally
|
||||
|
||||
$source = $CFG->dataroot.'/temp/timezones.txt';
|
||||
$source = $CFG->dataroot.'/temp/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) {
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -62,26 +62,22 @@
|
||||
}
|
||||
|
||||
/// Otherwise, let's try moodle.org's copy
|
||||
|
||||
$source = 'http://download.moodle.org/timezones/';
|
||||
if (!$importdone and ini_get('allow_url_fopen')) {
|
||||
if (is_readable($source) && $contents = file_get_contents($source)) { // Grab whole page
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezones.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $contents);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezones.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezones.txt');
|
||||
$source = 'http://download.moodle.org/timezone/';
|
||||
if (!$importdone && ($content=download_file_content($source))) {
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezone.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $content);
|
||||
fclose($file);
|
||||
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezone.txt', 'timezone')) { // Parse it
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
unlink($CFG->dataroot.'/temp/timezone.txt');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Final resort, use the copy included in Moodle
|
||||
|
||||
$source = $CFG->dirroot.'/lib/timezones.txt';
|
||||
$source = $CFG->dirroot.'/lib/timezone.txt';
|
||||
if (!$importdone and is_readable($source)) { // Distribution file
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
@@ -102,6 +98,9 @@
|
||||
|
||||
$timezonelist = array();
|
||||
foreach ($timezones as $timezone) {
|
||||
if (is_array($timezone)) {
|
||||
$timezone = (object)$timezone;
|
||||
}
|
||||
if (isset($timezonelist[$timezone->name])) {
|
||||
$timezonelist[$timezone->name]++;
|
||||
} else {
|
||||
|
||||
+24
-113
@@ -8,17 +8,23 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$return = optional_param('return', '', PARAM_ALPHA);
|
||||
|
||||
/// no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$adminroot =& admin_get_root(); // need all settings
|
||||
admin_externalpage_setup('upgradesettings'); // now hidden page
|
||||
|
||||
// a caveat: we're depending on only having one admin access this page at once. why? the following line
|
||||
// (the function call to find_new_settings) must have the EXACT SAME RETURN VALUE both times that this
|
||||
// page is loaded (i.e. both when we're displaying the form and then when we process the form's input).
|
||||
// if the return values don't match, we could potentially lose changes that the admin is making.
|
||||
// now we'll deal with the case that the admin has submitted the form with new settings
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
$count = admin_write_settings($data);
|
||||
$adminroot =& admin_get_root(true); //reload tree
|
||||
}
|
||||
|
||||
$newsettingshtml = output_new_settings_by_page(admin_get_root());
|
||||
$newsettingshtml = admin_output_new_settings_by_page($adminroot);
|
||||
$focus = '';
|
||||
|
||||
// first we deal with the case where there are no new settings to be set
|
||||
if ($newsettingshtml == '') {
|
||||
if (empty($adminroot->errors) and $newsettingshtml === '') {
|
||||
// there must be either redirect without message or continue button or else upgrade would be sometimes broken
|
||||
if ($return == 'site') {
|
||||
redirect("$CFG->wwwroot/");
|
||||
} else {
|
||||
@@ -26,128 +32,33 @@ if ($newsettingshtml == '') {
|
||||
}
|
||||
}
|
||||
|
||||
// now we'll deal with the case that the admin has submitted the form with new settings
|
||||
if ($data = data_submitted()) {
|
||||
$unslashed = (array)stripslashes_recursive($data);
|
||||
if (confirm_sesskey()) {
|
||||
$newsettings = find_new_settings(admin_get_root());
|
||||
$errors = '';
|
||||
|
||||
foreach($newsettings as $newsetting) {
|
||||
if (isset($unslashed['s_' . $newsetting->name])) {
|
||||
$errors .= $newsetting->write_setting($unslashed['s_' . $newsetting->name]);
|
||||
} else {
|
||||
$errors .= $newsetting->write_setting($newsetting->defaultsetting);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
// there must be either redirect without message or continue button or else upgrade would be sometimes broken
|
||||
if ($return == 'site') {
|
||||
redirect("$CFG->wwwroot/");
|
||||
} else {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||
}
|
||||
} else {
|
||||
$url = "$CFG->wwwroot/$CFG->admin/upgradesettings.php?return=$return";
|
||||
error(get_string('errorwithsettings', 'admin') . ' <br />' . $errors, $url);
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
}
|
||||
|
||||
// and finally, if we get here, then there are new settings and we have to print a form
|
||||
// to modify them
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header($focus);
|
||||
|
||||
print_simple_box(get_string('upgradesettingsintro','admin'),'','100%','',5,'generalbox','');
|
||||
print_box(get_string('upgradesettingsintro','admin'), 'generalbox');
|
||||
|
||||
echo '<form action="upgradesettings.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
echo $newsettingshtml;
|
||||
echo '</fieldset>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
|
||||
/**
|
||||
* Find settings that have not been initialized (e.g. during initial install or an upgrade).
|
||||
*
|
||||
* Tests each setting's get_setting() method. If the result is NULL, we consider the setting
|
||||
* to be uninitialized.
|
||||
*
|
||||
* @param string &$node The node at which to start searching. Should be $ADMIN for all external calls to this function.
|
||||
* @return array An array containing admin_setting objects that haven't yet been initialized
|
||||
*/
|
||||
function find_new_settings(&$node) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$return = array();
|
||||
$entries = array_keys($node->children);
|
||||
foreach ($entries as $entry) {
|
||||
$return = array_merge($return, find_new_settings($node->children[$entry]));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$return = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if ($setting->get_setting() === NULL) {
|
||||
$return[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
if (!empty($CFG->adminusehtmleditor)) {
|
||||
use_html_editor();
|
||||
}
|
||||
|
||||
function output_new_settings_by_page(&$node) {
|
||||
|
||||
if (is_a($node, 'admin_category')) {
|
||||
$entries = array_keys($node->children);
|
||||
$return = '';
|
||||
foreach ($entries as $entry) {
|
||||
$return .= output_new_settings_by_page($node->children[$entry]);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (is_a($node, 'admin_settingpage')) {
|
||||
$newsettings = array();
|
||||
foreach ($node->settings as $setting) {
|
||||
if ($setting->get_setting() === NULL) {
|
||||
$newsettings[] =& $setting;
|
||||
}
|
||||
unset($setting); // needed to prevent odd (imho) reference behaviour
|
||||
// see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
|
||||
}
|
||||
$return = '';
|
||||
if (count($newsettings) > 0) {
|
||||
$return .= print_heading(get_string('upgradesettings','admin').' - '.$node->visiblename, '', 2, 'main', true);
|
||||
$return .= '<fieldset class="adminsettings">' . "\n";
|
||||
foreach ($newsettings as $newsetting) {
|
||||
$return .= '<div class="clearer"><!-- --></div>' . "\n";
|
||||
$return .= $newsetting->output_html();
|
||||
}
|
||||
$return .= '</fieldset>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Copyright (C) 2007 Inaki Arenaza //
|
||||
// //
|
||||
// Based on .../admin/uploaduser.php and .../lib/gdlib.php //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/uploadlib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/gdlib.php');
|
||||
require_once('uploadpicture_form.php');
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
admin_externalpage_setup('uploadpictures', $adminroot);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
}
|
||||
|
||||
$strfile = get_string('file');
|
||||
$struser = get_string('user');
|
||||
$strusersupdated = get_string('usersupdated');
|
||||
$struploadpictures = get_string('uploadpictures','admin');
|
||||
$usersupdated = 0;
|
||||
$userserrors = 0;
|
||||
|
||||
$userfields = array (
|
||||
0 => 'username',
|
||||
1 => 'idnumber',
|
||||
2 => 'id' );
|
||||
|
||||
$userfield = optional_param('userfield', 0, PARAM_INT);
|
||||
$overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
|
||||
|
||||
/// Print the header
|
||||
admin_externalpage_print_header();
|
||||
print_heading_with_help($struploadpictures, 'uploadpictures');
|
||||
|
||||
$mform = new admin_uploadpicture_form();
|
||||
if ($formdata = $mform->get_data()) {
|
||||
if (!array_key_exists($userfield, $userfields)) {
|
||||
notify(get_string('uploadpicture_baduserfield','admin'));
|
||||
} else {
|
||||
// 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("192M");
|
||||
if (function_exists('apache_child_terminate')) {
|
||||
@apache_child_terminate();
|
||||
}
|
||||
|
||||
// Create a unique temporary directory, to process the zip file
|
||||
// contents.
|
||||
$zipdir = my_mktempdir($CFG->dataroot.'/temp/', 'usrpic');
|
||||
|
||||
if (!$mform->save_files($zipdir)) {
|
||||
notify(get_string('uploadpicture_cannotmovezip','admin'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
$dstfile = $zipdir.'/'.$mform->get_new_filename();
|
||||
if(!unzip_file($dstfile, $zipdir, false)) {
|
||||
notify(get_string('uploadpicture_cannotunzip','admin'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
// We don't need the zip file any longer, so delete it to make
|
||||
// it easier to process the rest of the files inside the directory.
|
||||
@unlink($dstfile);
|
||||
if(! ($handle = opendir($zipdir))) {
|
||||
notify(get_string('uploadpicture_cannotprocessdir','admin'));
|
||||
} else {
|
||||
while (false !== ($item = readdir($handle))) {
|
||||
if($item != '.' && $item != '..' && is_file($zipdir.'/'.$item)) {
|
||||
|
||||
// Add additional checks on the filenames, as they are user
|
||||
// controlled and we don't want to open any security holes.
|
||||
$path_parts = pathinfo(cleardoubleslashes($item));
|
||||
$basename = $path_parts['basename'];
|
||||
$extension = $path_parts['extension'];
|
||||
if ($basename != clean_param($basename, PARAM_CLEANFILE)) {
|
||||
// The original picture file name has invalid characters
|
||||
notify(get_string('uploadpicture_invalidfilename', 'admin',
|
||||
clean_param($basename, PARAM_CLEANHTML)));
|
||||
continue;
|
||||
}
|
||||
|
||||
// The picture file name (without extension) must match the
|
||||
// userfield attribute.
|
||||
$uservalue = substr($basename, 0,
|
||||
strlen($basename) -
|
||||
strlen($extension) - 1);
|
||||
// userfield names are safe, so don't quote them.
|
||||
if (!($user = get_record('user', $userfields[$userfield],
|
||||
addslashes($uservalue)))) {
|
||||
$userserrors++;
|
||||
$a = new Object();
|
||||
$a->userfield = clean_param($userfields[$userfield], PARAM_CLEANHTML);
|
||||
$a->uservalue = clean_param($uservalue, PARAM_CLEANHTML);
|
||||
notify(get_string('uploadpicture_usernotfound', 'admin', $a));
|
||||
continue;
|
||||
}
|
||||
$haspicture = get_field('user', 'picture', 'id', $user->id);
|
||||
if ($haspicture && !$overwritepicture) {
|
||||
notify(get_string('uploadpicture_userskipped', 'admin', $user->username));
|
||||
continue;
|
||||
}
|
||||
if (my_save_profile_image($user->id, $zipdir.'/'.$item)) {
|
||||
set_field('user', 'picture', 1, 'id', $user->id);
|
||||
$usersupdated++;
|
||||
notify(get_string('uploadpicture_userupdated', 'admin', $user->username));
|
||||
} else {
|
||||
$userserrors++;
|
||||
notify(get_string('uploadpicture_cannotsave', 'admin', $user->username));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
// Finally remove the temporary directory with all the user images and print some stats.
|
||||
remove_dir($zipdir);
|
||||
notify(get_string('usersupdated', 'admin') . ": $usersupdated");
|
||||
notify(get_string('errors', 'admin') . ": $userserrors");
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$mform->display();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
|
||||
// ----------- Internal functions ----------------
|
||||
|
||||
function my_mktempdir($dir, $prefix='', $mode=0700) {
|
||||
if (substr($dir, -1) != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
do {
|
||||
$path = $dir.$prefix.mt_rand(0, 9999999);
|
||||
} while (!mkdir($path, $mode));
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
function my_save_profile_image($id, $originalfile) {
|
||||
$destination = create_profile_image_destination($id, 'user');
|
||||
if ($destination === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return process_profile_image($originalfile, $destination);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php // $Id$
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploadpicture_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
global $userfields;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$this->set_upload_manager(new upload_manager('userpicturesfile', false, false, null, false, 0, true, true, false));
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
$mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');
|
||||
$mform->addRule('userpicturesfile', null, 'required');
|
||||
|
||||
$choices = $userfields;
|
||||
$mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
|
||||
$mform->setType('userfield', PARAM_INT);
|
||||
|
||||
$choices = array( 0 => get_string('no'), 1 => get_string('yes') );
|
||||
$mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
|
||||
$mform->setType('overwritepicture', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadpictures', 'admin'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
+915
-350
File diff suppressed because it is too large
Load Diff
+263
-63
@@ -1,91 +1,225 @@
|
||||
<?php // $Id$
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploaduser_form extends moodleform {
|
||||
class admin_uploaduser_form1 extends moodleform {
|
||||
function definition (){
|
||||
global $CFG;
|
||||
$templateuser = $this->_customdata;
|
||||
if(empty($templateuser)) {
|
||||
if (!$templateuser = get_admin()) {
|
||||
error('Could not find site admin');
|
||||
}
|
||||
}
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('file', 'userfile', get_string('file'));
|
||||
$this->set_upload_manager(new upload_manager('userfile', false, false, null, false, 0, true, true, false));
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
$mform->addElement('file', 'userfile', get_string('file'), 'size="40"');
|
||||
$mform->addRule('userfile', null, 'required');
|
||||
|
||||
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
|
||||
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
|
||||
|
||||
$modules = get_list_of_plugins('auth');
|
||||
$auth_options = array();
|
||||
foreach ($modules as $module) {
|
||||
$auth_options[$module] = get_string("auth_$module"."title", "auth");
|
||||
$choices = csv_import_reader::get_delimiter_list();
|
||||
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'admin'), $choices);
|
||||
if (array_key_exists('cfg', $choices)) {
|
||||
$mform->setDefault('delimiter_name', 'cfg');
|
||||
} else if (get_string('listsep') == ';') {
|
||||
$mform->setDefault('delimiter_name', 'semicolon');
|
||||
} else {
|
||||
$mform->setDefault('delimiter_name', 'comma');
|
||||
}
|
||||
$mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $auth_options);
|
||||
$mform->setDefault('auth', $templateuser->auth);
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$choices = $textlib->get_encodings();
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'admin'), $choices);
|
||||
$mform->setDefault('encoding', 'UTF-8');
|
||||
|
||||
$choices = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
|
||||
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'admin'), $choices);
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadusers'));
|
||||
}
|
||||
}
|
||||
|
||||
class admin_uploaduser_form2 extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
|
||||
//no editors here - we need proper empty fields
|
||||
$CFG->htmleditor = null;
|
||||
|
||||
$mform =& $this->_form;
|
||||
$columns =& $this->_customdata;
|
||||
|
||||
// I am the template user, why should it be the administrator? we have roles now, other ppl may use this script ;-)
|
||||
$templateuser = $USER;
|
||||
|
||||
// upload settings and file
|
||||
$mform->addElement('header', 'settingsheader', get_string('settings'));
|
||||
|
||||
$choices = array(UU_ADDNEW => get_string('uuoptype_addnew', 'admin'),
|
||||
UU_ADDINC => get_string('uuoptype_addinc', 'admin'),
|
||||
UU_ADD_UPDATE => get_string('uuoptype_addupdate', 'admin'),
|
||||
UU_UPDATE => get_string('uuoptype_update', 'admin'));
|
||||
$mform->addElement('select', 'uutype', get_string('uuoptype', 'admin'), $choices);
|
||||
|
||||
$choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
|
||||
$mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'admin'), $choices);
|
||||
$mform->setDefault('uupasswordnew', 0);
|
||||
$mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_UPDATE);
|
||||
|
||||
$choices = array(0 => get_string('nochanges', 'admin'),
|
||||
1 => get_string('uuupdatefromfile', 'admin'),
|
||||
2 => get_string('uuupdateall', 'admin'),
|
||||
3 => get_string('uuupdatemissing', 'admin'));
|
||||
$mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'admin'), $choices);
|
||||
$mform->setDefault('uuupdatetype', 0);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$choices = array(0 => get_string('nochanges', 'admin'), 1 => get_string('update'));
|
||||
$mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'admin'), $choices);
|
||||
$mform->setDefault('uupasswordold', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDINC);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 3);
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'admin'));
|
||||
$mform->setDefault('uuallowrenames', 0);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'admin'));
|
||||
$mform->setDefault('uuallowdeletes', 0);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDNEW);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'admin'));
|
||||
$mform->setDefault('uunoemailduplicates', 0);
|
||||
|
||||
$choices = array(0 => get_string('no'),
|
||||
1 => get_string('uubulknew', 'admin'),
|
||||
2 => get_string('uubulkupdated', 'admin'),
|
||||
3 => get_string('uubulkall', 'admin'));
|
||||
$mform->addElement('select', 'uubulk', get_string('uubulk', 'admin'), $choices);
|
||||
$mform->setDefault('uubulk', 0);
|
||||
|
||||
// roles selection
|
||||
$showroles = false;
|
||||
foreach ($columns as $column) {
|
||||
if (preg_match('/^type\d+$/', $column)) {
|
||||
$showroles = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($showroles) {
|
||||
$mform->addElement('header', 'rolesheader', get_string('roles'));
|
||||
|
||||
$choices = uu_allowed_roles(true);
|
||||
|
||||
$choices[0] = get_string('uucoursedefaultrole', 'admin');
|
||||
$mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'admin'), $choices);
|
||||
$mform->setDefault('uulegacy1', 0);
|
||||
unset($choices[0]);
|
||||
|
||||
$mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'admin'), $choices);
|
||||
if ($editteacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW)) {
|
||||
$editteacherrole = array_shift($editteacherroles); /// Take the first one
|
||||
$mform->setDefault('uulegacy2', $editteacherrole->id);
|
||||
unset($editteacherroles);
|
||||
} else {
|
||||
$mform->setDefault('uulegacy2', $CFG->defaultcourseroleid);
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'admin'), $choices);
|
||||
if ($teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
|
||||
$teacherrole = array_shift($teacherroles); /// Take the first one
|
||||
$mform->setDefault('uulegacy3', $teacherrole->id);
|
||||
unset($teacherroles);
|
||||
} else {
|
||||
$mform->setDefault('uulegacy3', $CFG->defaultcourseroleid);
|
||||
}
|
||||
}
|
||||
|
||||
// default values
|
||||
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
|
||||
|
||||
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
|
||||
$mform->addRule('username', get_string('requiredtemplate', 'admin'), 'required', null, 'client');
|
||||
|
||||
// only enabled and known to work plugins
|
||||
$choices = uu_allowed_auths();
|
||||
$mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $choices);
|
||||
$mform->setDefault('auth', 'manual'); // manual is a sensible backwards compatible default
|
||||
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod','auth')));
|
||||
$mform->setAdvanced('auth');
|
||||
|
||||
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
|
||||
$choices = array(
|
||||
get_string('emaildisplayno'),
|
||||
get_string('emaildisplayyes'),
|
||||
get_string('emaildisplaycourse'),
|
||||
);
|
||||
|
||||
$choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
|
||||
$mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
|
||||
$mform->setDefault('maildisplay', 2);
|
||||
|
||||
$choices = array(
|
||||
get_string('emailenable'),
|
||||
get_string('emaildisable'),
|
||||
);
|
||||
$choices = array(0 => get_string('emailenable'), 1 => get_string('emaildisable'));
|
||||
$mform->addElement('select', 'emailstop', get_string('emailactive'), $choices);
|
||||
|
||||
$choices = array(
|
||||
get_string('textformat'),
|
||||
get_string('htmlformat'),
|
||||
);
|
||||
$choices = array(0 => get_string('textformat'), 1 => get_string('htmlformat'));
|
||||
$mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
|
||||
$mform->setDefault('mailformat', 1);
|
||||
$mform->setAdvanced('mailformat');
|
||||
|
||||
$choices = array(
|
||||
get_string('autosubscribeyes'),
|
||||
get_string('autosubscribeno'),
|
||||
);
|
||||
$choices = array(0 => get_string('emaildigestoff'), 1 => get_string('emaildigestcomplete'), 2 => get_string('emaildigestsubjects'));
|
||||
$mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
|
||||
$mform->setDefault('maildigest', 0);
|
||||
$mform->setAdvanced('maildigest');
|
||||
|
||||
$choices = array(0 => get_string('autosubscribeyes'), 1 => get_string('autosubscribeno'));
|
||||
$mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
|
||||
$mform->setDefault('autosubscribe', 1);
|
||||
|
||||
if ($CFG->htmleditor) {
|
||||
$choices = array(
|
||||
get_string('texteditor'),
|
||||
get_string('htmleditor'),
|
||||
);
|
||||
$choices = array(0 => get_string('texteditor'), 1 => get_string('htmleditor'));
|
||||
$mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
|
||||
$mform->setDefault('htmleditor', 1);
|
||||
} else {
|
||||
$mform->addElement('static', 'htmleditor', get_string('textediting'), get_string('texteditor'));
|
||||
}
|
||||
$mform->setAdvanced('htmleditor');
|
||||
|
||||
if (empty($CFG->enableajax)) {
|
||||
$mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
|
||||
} else {
|
||||
$choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
|
||||
$mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
|
||||
$mform->setDefault('ajax', 1);
|
||||
}
|
||||
$mform->setAdvanced('ajax');
|
||||
|
||||
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
|
||||
$mform->setType('city', PARAM_MULTILANG);
|
||||
$mform->setDefault('city', $templateuser->city);
|
||||
|
||||
|
||||
$mform->addElement('select', 'country', get_string('selectacountry'), get_list_of_countries());
|
||||
$mform->setDefault('country', $templateuser->country);
|
||||
$mform->setAdvanced('country');
|
||||
|
||||
$choices = get_list_of_timezones();
|
||||
$choices['99'] = get_string('serverlocaltime');
|
||||
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
|
||||
$mform->setDefault('timezone', $templateuser->timezone);
|
||||
$mform->setAdvanced('timezone');
|
||||
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
|
||||
$mform->setDefault('lang', $templateuser->lang);
|
||||
|
||||
$mform->setAdvanced('lang');
|
||||
|
||||
$mform->addElement('htmleditor', 'description', get_string('userdescription'));
|
||||
$mform->setType('description', PARAM_CLEAN);
|
||||
$mform->setHelpButton('description', array('text', get_string('helptext')));
|
||||
$mform->setAdvanced('description');
|
||||
|
||||
$mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
|
||||
$mform->setAdvanced('url');
|
||||
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
|
||||
$mform->setType('idnumber', PARAM_CLEAN);
|
||||
|
||||
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
|
||||
$mform->setType('institution', PARAM_MULTILANG);
|
||||
@@ -97,40 +231,106 @@ class admin_uploaduser_form extends moodleform {
|
||||
|
||||
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
|
||||
$mform->setType('phone1', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone1');
|
||||
|
||||
$mform->addElement('text', 'phone2', get_string('phone'), 'maxlength="20" size="25"');
|
||||
$mform->setType('phone2', PARAM_CLEAN);
|
||||
$mform->setAdvanced('phone2');
|
||||
|
||||
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
|
||||
$mform->setType('address', PARAM_MULTILANG);
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('settings'));
|
||||
$mform->setAdvanced('address');
|
||||
|
||||
$choices = array(
|
||||
get_string('infilefield', 'auth'),
|
||||
get_string('createpasswordifneeded', 'auth'),
|
||||
);
|
||||
$mform->addElement('select', 'createpassword', get_string('passwordhandling', 'auth'), $choices);
|
||||
/// Next the profile defaults
|
||||
profile_definition($mform);
|
||||
|
||||
$mform->addElement('selectyesno', 'updateaccounts', get_string('updateaccounts', 'admin'));
|
||||
$mform->addElement('selectyesno', 'allowrenames', get_string('allowrenames', 'admin'));
|
||||
// hidden fields
|
||||
$mform->addElement('hidden', 'iid');
|
||||
$mform->setType('iid', PARAM_INT);
|
||||
|
||||
$choices = array(
|
||||
get_string('addcounter', 'admin'),
|
||||
get_string('skipuser', 'admin'),
|
||||
);
|
||||
$mform->addElement('select', 'duplicatehandling', get_string('newusernamehandling', 'admin'), $choices);
|
||||
$mform->addElement('hidden', 'previewrows');
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadusers'));
|
||||
$mform->addElement('hidden', 'readcount');
|
||||
$mform->setType('readcount', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(true, get_string('uploadusers'));
|
||||
}
|
||||
|
||||
function get_userfile_name(){
|
||||
if ($this->is_submitted() and $this->is_validated()) {
|
||||
// return the temporary filename to process
|
||||
return $this->_upload_manager->files['userfile']['tmp_name'];
|
||||
}else{
|
||||
return NULL;
|
||||
/**
|
||||
* Form tweaks that depend on current data.
|
||||
*/
|
||||
function definition_after_data() {
|
||||
$mform =& $this->_form;
|
||||
$columns =& $this->_customdata;
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if ($mform->elementExists($column)) {
|
||||
$mform->removeElement($column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Server side validation.
|
||||
*/
|
||||
function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
$columns =& $this->_customdata;
|
||||
$optype = $data['uutype'];
|
||||
|
||||
// detect if password column needed in file
|
||||
if (!in_array('password', $columns)) {
|
||||
switch ($optype) {
|
||||
case UU_UPDATE:
|
||||
if (!empty($data['uupasswordold'])) {
|
||||
$errors['uupasswordold'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
|
||||
case UU_ADD_UPDATE:
|
||||
if (empty($data['uupasswordnew'])) {
|
||||
$errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
if (!empty($data['uupasswordold'])) {
|
||||
$errors['uupasswordold'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
|
||||
case UU_ADDNEW:
|
||||
case UU_ADDINC:
|
||||
if (empty($data['uupasswordnew'])) {
|
||||
$errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// look for other required data
|
||||
if ($optype != UU_UPDATE) {
|
||||
if (!in_array('firstname', $columns)) {
|
||||
$errors['uutype'] = get_string('missingfield', 'error', 'firstname');
|
||||
}
|
||||
|
||||
if (!in_array('lastname', $columns)) {
|
||||
if (isset($errors['uutype'])) {
|
||||
$errors['uutype'] = '';
|
||||
} else {
|
||||
$errors['uutype'] = ' ';
|
||||
}
|
||||
$errors['uutype'] .= get_string('missingfield', 'error', 'lastname');
|
||||
}
|
||||
|
||||
if (!in_array('email', $columns) and empty($data['email'])) {
|
||||
$errors['email'] = get_string('requiredtemplate', 'admin');
|
||||
}
|
||||
|
||||
if (!in_array('city', $columns) and empty($data['city'])) {
|
||||
$errors['city'] = get_string('required');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
+19
-136
@@ -2,6 +2,7 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/user/filters/lib.php');
|
||||
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', '', PARAM_ALPHANUM); //md5 confirmation hash
|
||||
@@ -10,9 +11,6 @@
|
||||
$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 = trim(optional_param('search', '', PARAM_RAW));
|
||||
$lastinitial = optional_param('lastinitial', '', PARAM_CLEAN); // only show students with this last initial
|
||||
$firstinitial = optional_param('firstinitial', '', PARAM_CLEAN); // only show students with this first initial
|
||||
$ru = optional_param('ru', '2', PARAM_INT); // show remote users
|
||||
$lu = optional_param('lu', '2', PARAM_INT); // show local users
|
||||
$acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access)
|
||||
@@ -20,37 +18,7 @@
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
|
||||
// Let's see if we have *any* mnet users. Just ask for a single record
|
||||
$mnet_users = get_records_select('user', " auth='mnet' AND mnethostid != '{$CFG->mnet_localhost_id}' ", '', '*', '0', '1');
|
||||
if(is_array($mnet_users) && count($mnet_users) > 0) {
|
||||
$mnet_auth_users = true;
|
||||
} else {
|
||||
$mnet_auth_users = false;
|
||||
}
|
||||
|
||||
if($mnet_auth_users) {
|
||||
// Determine which users we are looking at (local, remote, or both). Start with both.
|
||||
if (!isset($_SESSION['admin-user-remoteusers'])) {
|
||||
$_SESSION['admin-user-remoteusers'] = 1;
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
}
|
||||
if ($ru == 0 or $ru == 1) {
|
||||
$_SESSION['admin-user-remoteusers'] = $ru;
|
||||
}
|
||||
if ($lu == 0 or $lu == 1) {
|
||||
$_SESSION['admin-user-localusers'] = $lu;
|
||||
}
|
||||
$remoteusers = $_SESSION['admin-user-remoteusers'];
|
||||
$localusers = $_SESSION['admin-user-localusers'];
|
||||
|
||||
// if neither remote nor local, set to sensible local only
|
||||
if (!$remoteusers and !$localusers) {
|
||||
$_SESSION['admin-user-localusers'] = 1;
|
||||
$localusers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$site = get_site();
|
||||
|
||||
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
|
||||
@@ -60,7 +28,6 @@
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$strdeletecheck = get_string('deletecheck');
|
||||
$strsearch = get_string('search');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
@@ -96,8 +63,7 @@
|
||||
error("No such user!", '', true);
|
||||
}
|
||||
|
||||
$primaryadmin = get_admin();
|
||||
if ($user->id == $primaryadmin->id) {
|
||||
if (is_primary_admin($user->id)) {
|
||||
error("You are not allowed to delete the primary admin user!", '', true);
|
||||
}
|
||||
|
||||
@@ -151,6 +117,9 @@
|
||||
. "' access now set to '$accessctrl'.");
|
||||
}
|
||||
|
||||
// create the user filter form
|
||||
$ufiltering = new user_filtering();
|
||||
|
||||
// Carry on with the user listing
|
||||
|
||||
$columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
|
||||
@@ -174,28 +143,19 @@
|
||||
$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\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
|
||||
if ($sort == "name") {
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
// tell the query which users we are looking at (local, remote, or both)
|
||||
$remotewhere = '';
|
||||
if($mnet_auth_users && ($localusers XOR $remoteusers)) {
|
||||
if ($localusers) {
|
||||
$remotewhere .= " and mnethostid = {$CFG->mnet_localhost_id} ";
|
||||
} else {
|
||||
$remotewhere .= " and mnethostid <> {$CFG->mnet_localhost_id} ";
|
||||
}
|
||||
}
|
||||
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
|
||||
|
||||
if ($search or $firstinitial or $lastinitial) {
|
||||
$extrasql = $ufiltering->get_sql_filter();
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '', $extrasql);
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, '', true, "", "", '', '', '', '', '*', $extrasql);
|
||||
|
||||
if ($extrasql !== '') {
|
||||
print_heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
$usercount = $usersearchcount;
|
||||
} else {
|
||||
@@ -205,65 +165,15 @@
|
||||
$alphabet = explode(',', get_string('alphabet'));
|
||||
$strall = get_string('all');
|
||||
|
||||
|
||||
/// Bar of first initials
|
||||
|
||||
echo "<p style=\"text-align:center\">";
|
||||
echo get_string("firstname")." : ";
|
||||
if ($firstinitial) {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $firstinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
|
||||
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
/// Bar of last initials
|
||||
|
||||
echo get_string("lastname")." : ";
|
||||
if ($lastinitial) {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
|
||||
} else {
|
||||
echo " <b>$strall</b> ";
|
||||
}
|
||||
foreach ($alphabet as $letter) {
|
||||
if ($letter == $lastinitial) {
|
||||
echo " <b>$letter</b> ";
|
||||
} else {
|
||||
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
|
||||
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&");
|
||||
|
||||
flush();
|
||||
|
||||
|
||||
if (!$users) {
|
||||
$match = array();
|
||||
if ($search !== '') {
|
||||
$match[] = s($search);
|
||||
}
|
||||
if ($firstinitial) {
|
||||
$match[] = get_string('firstname').": $firstinitial"."___";
|
||||
}
|
||||
if ($lastinitial) {
|
||||
$match[] = get_string('lastname').": $lastinitial"."___";
|
||||
}
|
||||
$matchstring = implode(", ", $match);
|
||||
print_heading(get_string('nousersmatching', '', $matchstring));
|
||||
print_heading(get_string('nousersfound'));
|
||||
|
||||
$table = NULL;
|
||||
|
||||
@@ -367,34 +277,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
if($mnet_auth_users) {
|
||||
echo "<p style=\"text-align:center\">";
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?lu=0">'.get_string('hidelocal','mnet').'</a> | ';
|
||||
} elseif ($localusers == 0) {
|
||||
echo '<a href="?lu=1">'.get_string('showlocal','mnet').'</a> | ';
|
||||
} else {
|
||||
echo get_string('hidelocal','mnet').' | ';
|
||||
}
|
||||
if ($localusers == 1 && $remoteusers == 1) {
|
||||
echo '<a href="?ru=0">'.get_string('hideremote','mnet').'</a>';
|
||||
} elseif ($remoteusers == 0) {
|
||||
echo '<a href="?ru=1">'.get_string('showremote','mnet').'</a>';
|
||||
} else {
|
||||
echo get_string('hideremote','mnet');
|
||||
}
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
|
||||
echo "<form action=\"user.php\" method=\"get\"><fieldset class=\"invisiblefieldset\">";
|
||||
echo "<input type=\"text\" name=\"search\" value=\"".s($search, true)."\" size=\"20\" />";
|
||||
echo "<input type=\"submit\" value=\"$strsearch\" />";
|
||||
if ($search) {
|
||||
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
|
||||
}
|
||||
echo "</fieldset></form>";
|
||||
echo "</td></tr></table>";
|
||||
// add filters
|
||||
$ufiltering->display_add();
|
||||
$ufiltering->display_active();
|
||||
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
@@ -402,14 +287,12 @@
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage&");
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once($CFG->dirroot.'/user/filters/lib.php');
|
||||
|
||||
if (!defined('MAX_BULK_USERS')) {
|
||||
define('MAX_BULK_USERS', 2000);
|
||||
}
|
||||
|
||||
function add_selection_all($ufiltering) {
|
||||
global $SESSION;
|
||||
|
||||
$guest = get_guest();
|
||||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
|
||||
|
||||
if ($rs = get_recordset_select('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname')) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if (! isset($SESSION->bulk_users[$user->id])) {
|
||||
$SESSION->bulk_users[$user->id] = $user->id;
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
}
|
||||
|
||||
function get_selection_data($ufiltering) {
|
||||
global $SESSION;
|
||||
|
||||
// get the SQL filter
|
||||
$guest = get_guest();
|
||||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
|
||||
|
||||
$total = count_records_select('user', "id<>{$guest->id} AND deleted <> 1");
|
||||
$acount = count_records_select('user', $sqlwhere);
|
||||
$scount = count($SESSION->bulk_users);
|
||||
|
||||
$userlist = array('acount'=>$acount, 'scount'=>$scount, 'ausers'=>false, 'susers'=>false, 'total'=>$total);
|
||||
$userlist['ausers'] = get_records_select_menu('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname', 0, MAX_BULK_USERS);
|
||||
|
||||
if ($scount) {
|
||||
if ($scount < MAX_BULK_USERS) {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
} else {
|
||||
$bulkusers = array_slice($SESSION->bulk_users, 0, MAX_BULK_USERS, true);
|
||||
$in = implode(',', $bulkusers);
|
||||
}
|
||||
$userlist['susers'] = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
}
|
||||
|
||||
return $userlist;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
+77
-74
@@ -1,82 +1,85 @@
|
||||
<?php //$Id$
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/dmllib.php');
|
||||
|
||||
require_once($CFG->dirroot.'/user/filters/text.php');
|
||||
require_once($CFG->dirroot.'/user/filters/date.php');
|
||||
require_once($CFG->dirroot.'/user/filters/select.php');
|
||||
require_once($CFG->dirroot.'/user/filters/courserole.php');
|
||||
require_once($CFG->dirroot.'/user/filters/globalrole.php');
|
||||
require_once($CFG->dirroot.'/user/filters/profilefield.php');
|
||||
require_once($CFG->dirroot.'/user/filters/yesno.php');
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/user/lib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/user/user_bulk_forms.php');
|
||||
|
||||
require_once($CFG->dirroot.'/admin/user/user_bulk_form.php');
|
||||
define("MAX_USERS_PER_PAGE", 5000);
|
||||
admin_externalpage_setup('userbulk');
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (!isset($SESSION->bulk_users)) {
|
||||
$SESSION->bulk_users = array();
|
||||
}
|
||||
// create the user filter form
|
||||
$ufiltering = new user_filtering();
|
||||
|
||||
// array of bulk operations
|
||||
$actions = array();
|
||||
$actions[1] = get_string('confirm');
|
||||
if (has_capability('moodle/site:readallmessages', $sitecontext) && !empty($CFG->messaging)) {
|
||||
$actions[2] = get_string('messageselectadd');
|
||||
}
|
||||
$actions[3] = get_string('delete');
|
||||
$actions[4] = get_string('displayonpage');
|
||||
// create the bulk operations form
|
||||
$user_bulk_form =& new user_bulk_form(null, $actions);
|
||||
// array of bulk operations
|
||||
// create the bulk operations form
|
||||
$action_form = new user_bulk_action_form();
|
||||
if ($data = $action_form->get_data(false)) {
|
||||
// check if an action should be performed and do so
|
||||
switch ($user_bulk_form->getAction()) {
|
||||
case 1:
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk_confirm.php');
|
||||
break;
|
||||
case 2:
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk_message.php');
|
||||
break;
|
||||
case 3:
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk_delete.php');
|
||||
break;
|
||||
case 4:
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk_display.php');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch ($data->action) {
|
||||
case 1: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_confirm.php');
|
||||
case 2: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_message.php');
|
||||
case 3: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_delete.php');
|
||||
case 4: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_display.php');
|
||||
case 5: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_download.php');
|
||||
}
|
||||
}
|
||||
|
||||
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
|
||||
|
||||
if ($data = $user_bulk_form->get_data(false)) {
|
||||
if (!empty($data->addall)) {
|
||||
add_selection_all($ufiltering);
|
||||
|
||||
} else if (!empty($data->addsel)) {
|
||||
if (!empty($data->ausers)) {
|
||||
if (in_array(0, $data->ausers)) {
|
||||
add_selection_all($ufiltering);
|
||||
} else {
|
||||
foreach($data->ausers as $userid) {
|
||||
if ($userid == -1) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($SESSION->bulk_users[$userid])) {
|
||||
$SESSION->bulk_users[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!empty($data->removeall)) {
|
||||
$SESSION->bulk_users= array();
|
||||
|
||||
} else if (!empty($data->removesel)) {
|
||||
if (!empty($data->susers)) {
|
||||
if (in_array(0, $data->susers)) {
|
||||
$SESSION->bulk_users= array();
|
||||
} else {
|
||||
foreach($data->susers as $userid) {
|
||||
if ($userid == -1) {
|
||||
continue;
|
||||
}
|
||||
unset($SESSION->bulk_users[$userid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prepare user filter types
|
||||
$filters[] = new user_filter_text('username', get_string('username'), 'username');
|
||||
$filters[] = new user_filter_text('realname', get_string('fullname'), sql_fullname());
|
||||
$filters[] = new user_filter_text('email', get_string('email'), 'email');
|
||||
$filters[] = new user_filter_text('city', get_string('city'), 'city');
|
||||
$filters[] = new user_filter_select('country', get_string('country'), 'country', get_list_of_countries());
|
||||
$filters[] = new user_filter_yesno('confirmed', get_string('confirm'), 'confirmed');
|
||||
$filters[] = new user_filter_profilefield('profile', get_string('profile'));
|
||||
$filters[] = new user_filter_courserole('course', get_string('courserole', 'filters'));
|
||||
$filters[] = new user_filter_globalrole('system', get_string('globalrole', 'role'));
|
||||
$filters[] = new user_filter_date('date', get_string('date'), 'lastaccess', array('lastlogin'=> get_string('lastlogin'), 'firstaccess' => get_string('firstaccess', 'filters'), 'lastaccess' => get_string('lastaccess'), 'timemodified' => get_string('lastmodified')));
|
||||
|
||||
// create the user filter form
|
||||
$user_filter_form =& new user_filter_form(null, $filters);
|
||||
|
||||
// do output
|
||||
admin_externalpage_setup('userbulk');
|
||||
admin_externalpage_print_header();
|
||||
|
||||
// put the user filter form first
|
||||
$user_filter_form->display();
|
||||
// get the SQL filter
|
||||
$where =& $user_filter_form->getSQLFilter('id<>1 AND NOT deleted');
|
||||
$ausercount = count_records_select('user', $where);
|
||||
// limit the number of options
|
||||
$comment = null;
|
||||
if($ausercount <= MAX_USERS_PER_PAGE) {
|
||||
$user_bulk_form->setAvailableUsersSQL($where);
|
||||
} else {
|
||||
$comment = get_string('toomanytoshow');
|
||||
}
|
||||
$user_bulk_form->setUserCount($ausercount, $comment);
|
||||
// display the bulk user form
|
||||
$user_bulk_form->display();
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
// reset the form selections
|
||||
unset($_POST);
|
||||
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
|
||||
}
|
||||
// do output
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$ufiltering->display_add();
|
||||
$ufiltering->display_active();
|
||||
|
||||
$user_bulk_form->display();
|
||||
$action_form->display();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,46 +6,48 @@
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
require_capability('moodle/user:update', $sitecontext);
|
||||
|
||||
// clean-up users list
|
||||
$primaryadmin = get_admin();
|
||||
$userlist = array();
|
||||
foreach ($SESSION->bulk_susers as $k => $v) {
|
||||
$user = get_record('user', 'id', $v, null, null, null, null, 'id,firstname,lastname,username,secret,confirmed,mnethostid,auth');
|
||||
if (!empty($user) && $user->id != $primaryadmin->id && !$user->confirmed && !is_mnet_remote_user($user)) {
|
||||
$userlist[$k] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($userlist)) {
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php');
|
||||
}
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
if (empty($confirm)) {
|
||||
$usernames = array();
|
||||
foreach ($userlist as $user) {
|
||||
$usernames[] =& fullname($user, true);
|
||||
//TODO: add support for large number of users
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)", '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if ($user->confirmed) {
|
||||
continue;
|
||||
}
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
$result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
|
||||
if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
$usernames = implode(', ', $usernames);
|
||||
redirect($return, get_string('changessaved'));
|
||||
|
||||
} else {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
$usernames = implode(', ', $userlist);
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
notice_yesno(get_string('confirmcheckfull', '', $usernames), 'user_bulk_confirm.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
} else {
|
||||
foreach ($userlist as $k => $user) {
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
$result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
|
||||
if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php', get_string('changessaved'));
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -6,46 +6,47 @@
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
require_capability('moodle/user:delete', $sitecontext);
|
||||
|
||||
// clean-up users list
|
||||
$primaryadmin = get_admin();
|
||||
$userlist = array();
|
||||
foreach ($SESSION->bulk_susers as $k => $v) {
|
||||
$user = get_record('user', 'id', $v, null, null, null, null, 'id,firstname,lastname,email,auth');
|
||||
if (!empty($user) && $user->id != $primaryadmin->id) {
|
||||
$userlist[$k] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($userlist)) {
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php');
|
||||
}
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:delete', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
if (empty($confirm)) {
|
||||
$usernames = array();
|
||||
foreach ($userlist as $user) {
|
||||
$usernames[] =& fullname($user, true);
|
||||
|
||||
//TODO: add support for large number of users
|
||||
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
$primaryadmin = get_admin();
|
||||
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)")) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
if ($primaryadmin->id != $user->id and $USER->id != $user->id and delete_user($user)) {
|
||||
unset($SESSION->bulk_users[$user->id]);
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
}
|
||||
$usernames = implode(', ', $usernames);
|
||||
redirect($return, get_string('changessaved'));
|
||||
|
||||
} else {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
$usernames = implode(', ', $userlist);
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
notice_yesno(get_string('deletecheckfull', '', $usernames), 'user_bulk_delete.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
} else {
|
||||
foreach ($userlist as $k => $user) {
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->bulk_susers[$k]);
|
||||
} else {
|
||||
notify(get_string('deletednot', '', fullname($user, true)));
|
||||
}
|
||||
}
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php', get_string('changessaved'));
|
||||
}
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
|
||||
@@ -1,76 +1,81 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
if(empty($SESSION->bulk_susers)) {
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php');
|
||||
$sort = optional_param('sort', 'fullname', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'asc', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
$users = $SESSION->bulk_users;
|
||||
$usertotal = get_users(false);
|
||||
$usercount = count($users);
|
||||
|
||||
$strnever = get_string('never');
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$countries = get_list_of_countries();
|
||||
|
||||
foreach ($users as $key => $id) {
|
||||
$user = get_record('user', 'id', $id, null, null, null, null, 'id, firstname, lastname, username, email, country, lastaccess, city');
|
||||
$user->fullname = fullname($user, true);
|
||||
$user->country = @$countries[$user->country];
|
||||
unset($user->firstname);
|
||||
unset($user->lastname);
|
||||
$users[$key] = $user;
|
||||
}
|
||||
unset($countries);
|
||||
|
||||
// Need to sort by date
|
||||
function sort_compare($a, $b) {
|
||||
global $sort, $dir;
|
||||
if($sort == 'lastaccess') {
|
||||
$rez = $b->lastaccess - $a->lastaccess;
|
||||
} else {
|
||||
$rez = strcasecmp(@$a->$sort, @$b->$sort);
|
||||
}
|
||||
$users = $SESSION->bulk_susers;
|
||||
$usertotal = get_users(false);
|
||||
$usercount = count($users);
|
||||
return $dir == 'desc' ? -$rez : $rez;
|
||||
}
|
||||
usort($users, 'sort_compare');
|
||||
|
||||
$sort = optional_param('sort', 'fullname', PARAM_ALPHA);
|
||||
$dir = optional_param('dir', 'asc', PARAM_ALPHA);
|
||||
|
||||
$strnever = get_string('never');
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$site = get_site();
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$countries =& get_list_of_countries();
|
||||
foreach ($users as $key => $id) {
|
||||
$user =& get_record('user', 'id', $id, null, null, null, null, 'id,firstname,lastname,username,email,country,lastaccess,city');
|
||||
$user->fullname = fullname($user, true);
|
||||
$user->country = @$countries[$user->country];
|
||||
unset($user->firstname);
|
||||
unset($user->lastname);
|
||||
$users[$key] = $user;
|
||||
}
|
||||
unset($countries);
|
||||
|
||||
// Need to sort by data
|
||||
function sort_compare($a, $b) {
|
||||
global $sort, $dir;
|
||||
if($sort == 'lastaccess') {
|
||||
$rez = $b->lastaccess - $a->lastaccess;
|
||||
} else {
|
||||
$rez = strcasecmp(@$a->$sort, @$b->$sort);
|
||||
}
|
||||
return $dir == 'desc' ? -$rez : $rez;
|
||||
}
|
||||
usort($users, 'sort_compare');
|
||||
|
||||
$table->width = "95%";
|
||||
$columns = array('fullname', 'username', 'email', 'city', 'country', 'lastaccess');
|
||||
foreach ($columns as $column) {
|
||||
$strtitle = get_string($column);
|
||||
if ($sort != $column) {
|
||||
$columnicon = '';
|
||||
$columndir = 'asc';
|
||||
} else {
|
||||
$columndir = $dir == 'asc' ? 'desc' : 'asc';
|
||||
$columnicon = ' <img src="' . $CFG->pixpath . '/t/' . ($dir == 'asc' ? 'down' : 'up' ). '.gif" alt="" />';
|
||||
}
|
||||
$table->head[] = '<a href="user_bulk_display.php?sort=' . $column . '&dir=' . $columndir .'">' .$strtitle . '</a>' . $columnicon;
|
||||
$table->align[] = 'left';
|
||||
$table->width = "95%";
|
||||
$columns = array('fullname', /*'username', */'email', 'city', 'country', 'lastaccess');
|
||||
foreach ($columns as $column) {
|
||||
$strtitle = get_string($column);
|
||||
if ($sort != $column) {
|
||||
$columnicon = '';
|
||||
$columndir = 'asc';
|
||||
} else {
|
||||
$columndir = $dir == 'asc' ? 'desc' : 'asc';
|
||||
$columnicon = ' <img src="'.$CFG->pixpath.'/t/'.($dir == 'asc' ? 'down' : 'up' ).'.gif" alt="" />';
|
||||
}
|
||||
$table->head[] = '<a href="user_bulk_display.php?sort='.$column.'&dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon;
|
||||
$table->align[] = 'left';
|
||||
}
|
||||
|
||||
foreach($users as $user) {
|
||||
$table->data[] = array (
|
||||
'<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&course=' . $site->id .'">' . $user->fullname .'</a>',
|
||||
$user->username,
|
||||
$user->email,
|
||||
$user->city,
|
||||
$user->country,
|
||||
$user->lastaccess ? format_time(time() - $user->lastaccess) : $strnever
|
||||
);
|
||||
}
|
||||
foreach($users as $user) {
|
||||
$table->data[] = array (
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.SITEID.'">'.$user->fullname.'</a>',
|
||||
// $user->username,
|
||||
$user->email,
|
||||
$user->city,
|
||||
$user->country,
|
||||
$user->lastaccess ? format_time(time() - $user->lastaccess) : $strnever
|
||||
);
|
||||
}
|
||||
|
||||
print_heading("$usercount / $usertotal ".get_string('users'));
|
||||
print_table($table);
|
||||
print_heading("$usercount / $usertotal ".get_string('users'));
|
||||
print_table($table);
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
print_continue($return);
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
Executable
+160
@@ -0,0 +1,160 @@
|
||||
<?php //$Id$
|
||||
/**
|
||||
* script for downloading of user lists
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$format = optional_param('format', '', PARAM_ALPHA);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
|
||||
if ($format) {
|
||||
$fields = array('id' => 'id',
|
||||
'username' => get_string('username'),
|
||||
'email' => get_string('email'),
|
||||
'firstname' => get_string('firstname'),
|
||||
'lastname' => get_string('lastname'),
|
||||
'idnumber' => get_string('idnumber'),
|
||||
'city' => get_string('city'),
|
||||
'country' => get_string('country'));
|
||||
|
||||
switch ($format) {
|
||||
case 'csv' : user_download_csv($fields);
|
||||
case 'ods' : user_download_ods($fields);
|
||||
case 'xls' : user_download_xls($fields);
|
||||
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading(get_string('download', 'admin'));
|
||||
|
||||
print_box_start();
|
||||
echo '<ul>';
|
||||
echo '<li><a href="user_bulk_download.php?format=csv">'.get_string('downloadtext').'</a></li>';
|
||||
echo '<li><a href="user_bulk_download.php?format=ods">'.get_string('downloadods').'</a></li>';
|
||||
echo '<li><a href="user_bulk_download.php?format=xls">'.get_string('downloadexcel').'</a></li>';
|
||||
echo '</ul>';
|
||||
print_box_end();
|
||||
|
||||
print_continue($return);
|
||||
|
||||
print_footer();
|
||||
|
||||
function user_download_ods($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once("$CFG->libdir/odslib.class.php");
|
||||
|
||||
$filename = clean_filename(get_string('users').'.ods');
|
||||
|
||||
$workbook = new MoodleODSWorkbook('-');
|
||||
$workbook->send($filename);
|
||||
|
||||
$worksheet = array();
|
||||
|
||||
$worksheet[0] =& $workbook->add_worksheet('');
|
||||
$col = 0;
|
||||
foreach ($fields as $fieldname) {
|
||||
$worksheet[0]->write(0, $col, $fieldname);
|
||||
$col++;
|
||||
}
|
||||
|
||||
$row = 1;
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
die;
|
||||
}
|
||||
|
||||
function user_download_xls($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
require_once("$CFG->libdir/excellib.class.php");
|
||||
|
||||
$filename = clean_filename(get_string('users').'.xls');
|
||||
|
||||
$workbook = new MoodleExcelWorkbook('-');
|
||||
$workbook->send($filename);
|
||||
|
||||
$worksheet = array();
|
||||
|
||||
$worksheet[0] =& $workbook->add_worksheet('');
|
||||
$col = 0;
|
||||
foreach ($fields as $fieldname) {
|
||||
$worksheet[0]->write(0, $col, $fieldname);
|
||||
$col++;
|
||||
}
|
||||
|
||||
$row = 1;
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
$col = 0;
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$worksheet[0]->write($row, $col, $user->$field);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
die;
|
||||
}
|
||||
|
||||
function user_download_csv($fields) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
$filename = clean_filename(get_string('users').'.csv');
|
||||
|
||||
header("Content-Type: application/download\n");
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
|
||||
header("Pragma: public");
|
||||
|
||||
$delimiter = get_string('listsep');
|
||||
$encdelim = '&#'.ord($delimiter);
|
||||
|
||||
$row = array();
|
||||
foreach ($fields as $fieldname) {
|
||||
$row[] = str_replace($delimiter, $encdelim, $fieldname);
|
||||
}
|
||||
echo implode($delimiter, $row)."\n";
|
||||
|
||||
foreach ($SESSION->bulk_users as $userid) {
|
||||
$row = array();
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($fields as $field=>$unused) {
|
||||
$row[] = str_replace($delimiter, $encdelim, $user->$field);
|
||||
}
|
||||
echo implode($delimiter, $row)."\n";
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
require_once($CFG->libdir . '/datalib.php');
|
||||
|
||||
class user_bulk_form extends moodleform {
|
||||
/**
|
||||
* Quickform select object for the available users.
|
||||
*/
|
||||
var $ausers;
|
||||
/**
|
||||
* Quickform select object for the selected users.
|
||||
*/
|
||||
var $susers;
|
||||
// form definition
|
||||
function definition() {
|
||||
$mform =& $this->_form;
|
||||
$mform->addElement('header', 'users', get_string('usersinlist', 'bulkusers'));
|
||||
|
||||
$this->ausers =& $mform->createElement('select', 'ausers', get_string('available', 'bulkusers'), null, 'size="15"');
|
||||
$this->ausers->setMultiple(true);
|
||||
$this->susers =& $mform->createElement('select', 'susers', get_string('selected', 'bulkusers'), null, 'size="15"');
|
||||
$this->susers->setMultiple(true);
|
||||
|
||||
$objs = array();
|
||||
$objs[] = &$this->ausers;
|
||||
$objs[] = &$this->susers;
|
||||
|
||||
$grp =& $mform->addElement('group', 'usersgrp', get_string('users'), $objs, ' ', false);
|
||||
$grp->setHelpButton(array('lists','','bulkusers'));
|
||||
|
||||
$mform->addElement('static', 'comment');
|
||||
|
||||
$objs = array();
|
||||
$objs[] =& $mform->createElement('submit', 'addone', get_string('addsel', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'addall', get_string('addall', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'removesel', get_string('removesel', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'removeall', get_string('removeall', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'deletesel', get_string('deletesel', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'deleteall', get_string('deleteall', 'bulkusers'));
|
||||
$grp =& $mform->addElement('group', 'buttonsgrp', get_string('selectedlist', 'bulkusers'), $objs, array(' ', '<br />'), false);
|
||||
$grp->setHelpButton(array('selectedlist','','bulkusers'));
|
||||
|
||||
$objs = array();
|
||||
$objs[] =& $mform->createElement('select', 'action', get_string('withselected'), @$this->_customdata);
|
||||
$objs[] =& $mform->createElement('submit', 'doaction', get_string('go'));;
|
||||
$mform->addElement('group', 'actionsgrp', get_string('withselectedusers'), $objs, ' ', false);
|
||||
|
||||
$renderer =& $mform->defaultRenderer();
|
||||
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
|
||||
$renderer->setGroupElementTemplate($template, 'usersgrp');
|
||||
}
|
||||
|
||||
function setUserCount($count=-1, $comment=null) {
|
||||
global $SESSION;
|
||||
if($count < 0) {
|
||||
$count = count($SESSION->bulk_ausers);
|
||||
}
|
||||
$obj =& $this->_form->getElement('comment');
|
||||
$obj->setLabel($comment);
|
||||
$obj->setText(get_string('usersfound', 'bulkusers', $count) . ' ' .get_string('usersselected', 'bulkusers', count(@$SESSION->bulk_susers)));
|
||||
}
|
||||
|
||||
function definition_after_data() {
|
||||
global $SESSION;
|
||||
$this->_updateSelection($this->get_data());
|
||||
$this->setSelectedUsers($SESSION->bulk_susers);
|
||||
if(empty($SESSION->bulk_susers)) {
|
||||
$this->_form->removeElement('actionsgrp');
|
||||
}
|
||||
//$this->setUserCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the user selection based on the data submited to the form.
|
||||
* @param object $data object with data received by the form
|
||||
*/
|
||||
function _updateSelection($data) {
|
||||
global $SESSION;
|
||||
if(!is_array(@$SESSION->bulk_susers)) {
|
||||
$SESSION->bulk_susers = array();
|
||||
}
|
||||
// if the forms was not submited, then quit
|
||||
if(is_null($data)){
|
||||
return;
|
||||
}
|
||||
if(@$data->addall) {
|
||||
if(!empty($SESSION->bulk_ausers)) {
|
||||
$SESSION->bulk_susers = array_merge($SESSION->bulk_susers, $SESSION->bulk_ausers);
|
||||
}
|
||||
} else if(@$data->addone) {
|
||||
if(!empty($data->ausers)) {
|
||||
$SESSION->bulk_susers = array_merge($SESSION->bulk_susers, array_values($data->ausers));
|
||||
}
|
||||
} else if(@$data->removeall) {
|
||||
if(!empty($SESSION->bulk_ausers)) {
|
||||
$SESSION->bulk_susers = array_diff($SESSION->bulk_susers, $SESSION->bulk_ausers);
|
||||
}
|
||||
} else if(@$data->removesel) {
|
||||
if(!empty($data->susers)) {
|
||||
$SESSION->bulk_susers = array_diff($SESSION->bulk_susers, array_values($data->susers));
|
||||
}
|
||||
} else if(@$data->deletesel) {
|
||||
if(!empty($data->susers)) {
|
||||
$SESSION->bulk_susers = array_diff($SESSION->bulk_susers, array_values($data->susers));
|
||||
}
|
||||
} else if(@$data->deleteall) {
|
||||
$SESSION->bulk_susers = array();
|
||||
}
|
||||
$SESSION->bulk_susers = array_unique($SESSION->bulk_susers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the available users list, based on their ids
|
||||
* @param array $ausers array of user ids
|
||||
*/
|
||||
function setAvailableUsers($ausers) {
|
||||
$sqlwhere = null;
|
||||
if(!empty($ausers)) {
|
||||
$sqlwhere = 'id IN (' . implode(',', $ausers) . ')';
|
||||
}
|
||||
$this->setAvailableUsersSQL($sqlwhere);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the available users list, based on a SQL where condition
|
||||
* @param string $sqlwhere filter for the users
|
||||
*/
|
||||
function setAvailableUsersSQL($sqlwhere=null) {
|
||||
global $SESSION;
|
||||
if(is_null($sqlwhere) || ($users =& $this->getUserData($sqlwhere))===false) {
|
||||
$users = array();
|
||||
}
|
||||
$SESSION->bulk_ausers =& array_keys($users);
|
||||
$this->ausers->load($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected users list, based on their ids
|
||||
* @param array $ausers array of user ids
|
||||
*/
|
||||
function setSelectedUsers($susers) {
|
||||
$sqlwhere = null;
|
||||
if(!empty($susers)) {
|
||||
$sqlwhere = 'id IN (' . implode(',', $susers) . ')';
|
||||
}
|
||||
$this->setSelectedUsersSQL($sqlwhere);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected users list, based on a SQL where condition
|
||||
* @param string $sqlwhere filter for the users
|
||||
*/
|
||||
function setSelectedUsersSQL($sqlwhere=null) {
|
||||
global $SESSION;
|
||||
if(is_null($sqlwhere) || ($users =& $this->getUserData($sqlwhere))===false) {
|
||||
$users = array();
|
||||
}
|
||||
$SESSION->bulk_susers =& array_keys($users);
|
||||
$this->susers->load($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about the users.
|
||||
* @param string $sqlwhere filter for the users
|
||||
*/
|
||||
function getUserData($sqlwhere) {
|
||||
return get_records_select_menu('user', $sqlwhere, 'fullname', 'id,' . sql_fullname() . ' AS fullname');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of ids of selected users.
|
||||
* @return array of selected users' ids
|
||||
*/
|
||||
function getSelectedUsers() {
|
||||
global $SESSION;
|
||||
return $SESSION->bulk_susers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an int code of the action to be performed.
|
||||
* @return int code of the action or false if no action should be performed
|
||||
*/
|
||||
function getAction() {
|
||||
$data =& $this->get_data();
|
||||
if(!$this->is_submitted() || empty($data->doaction)){
|
||||
return false;
|
||||
}
|
||||
return $data->action;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
require_once($CFG->libdir.'/datalib.php');
|
||||
|
||||
class user_bulk_action_form extends moodleform {
|
||||
function definition() {
|
||||
global $CFG;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$actions = array(0=>get_string('choose').'...');
|
||||
if (has_capability('moodle/user:update', $syscontext)) {
|
||||
$actions[1] = get_string('confirm');
|
||||
}
|
||||
if (has_capability('moodle/site:readallmessages', $syscontext) && !empty($CFG->messaging)) {
|
||||
$actions[2] = get_string('messageselectadd');
|
||||
}
|
||||
if (has_capability('moodle/user:delete', $syscontext)) {
|
||||
$actions[3] = get_string('delete');
|
||||
}
|
||||
$actions[4] = get_string('displayonpage');
|
||||
if (has_capability('moodle/user:update', $syscontext)) {
|
||||
$actions[5] = get_string('download', 'admin');
|
||||
}
|
||||
|
||||
$objs = array();
|
||||
$objs[] =& $mform->createElement('select', 'action', null, $actions);
|
||||
$objs[] =& $mform->createElement('submit', 'doaction', get_string('go'));
|
||||
$mform->addElement('group', 'actionsgrp', get_string('withselectedusers'), $objs, ' ', false);
|
||||
}
|
||||
}
|
||||
|
||||
class user_bulk_form extends moodleform {
|
||||
function definition() {
|
||||
|
||||
$mform =& $this->_form;
|
||||
$acount =& $this->_customdata['acount'];
|
||||
$scount =& $this->_customdata['scount'];
|
||||
$ausers =& $this->_customdata['ausers'];
|
||||
$susers =& $this->_customdata['susers'];
|
||||
$total =& $this->_customdata['total'];
|
||||
|
||||
$achoices = array();
|
||||
$schoices = array();
|
||||
|
||||
if (is_array($ausers)) {
|
||||
if ($total == $acount) {
|
||||
$achoices[0] = get_string('allusers', 'bulkusers', $total);
|
||||
} else {
|
||||
$a = new object();
|
||||
$a->total = $total;
|
||||
$a->count = $acount;
|
||||
$achoices[0] = get_string('allfilteredusers', 'bulkusers', $a);
|
||||
}
|
||||
$achoices = $achoices + $ausers;
|
||||
|
||||
if ($acount > MAX_BULK_USERS) {
|
||||
$achoices[-1] = '...';
|
||||
}
|
||||
|
||||
} else {
|
||||
$achoices[-1] = get_string('nofilteredusers', 'bulkusers', $total);
|
||||
}
|
||||
|
||||
if (is_array($susers)) {
|
||||
$a = new object();
|
||||
$a->total = $total;
|
||||
$a->count = $scount;
|
||||
$schoices[0] = get_string('allselectedusers', 'bulkusers', $a);
|
||||
$schoices = $schoices + $susers;
|
||||
|
||||
if ($scount > MAX_BULK_USERS) {
|
||||
$schoices[-1] = '...';
|
||||
}
|
||||
|
||||
} else {
|
||||
$schoices[-1] = get_string('noselectedusers', 'bulkusers');
|
||||
}
|
||||
|
||||
$mform->addElement('header', 'users', get_string('usersinlist', 'bulkusers'));
|
||||
|
||||
$objs = array();
|
||||
$objs[0] =& $mform->createElement('select', 'ausers', get_string('available', 'bulkusers'), $achoices, 'size="15"');
|
||||
$objs[0]->setMultiple(true);
|
||||
$objs[1] =& $mform->createElement('select', 'susers', get_string('selected', 'bulkusers'), $schoices, 'size="15"');
|
||||
$objs[1]->setMultiple(true);
|
||||
|
||||
|
||||
$grp =& $mform->addElement('group', 'usersgrp', get_string('users'), $objs, ' ', false);
|
||||
$grp->setHelpButton(array('lists', get_string('users'), 'bulkusers'));
|
||||
|
||||
$mform->addElement('static', 'comment');
|
||||
|
||||
$objs = array();
|
||||
$objs[] =& $mform->createElement('submit', 'addsel', get_string('addsel', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'removesel', get_string('removesel', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'addall', get_string('addall', 'bulkusers'));
|
||||
$objs[] =& $mform->createElement('submit', 'removeall', get_string('removeall', 'bulkusers'));
|
||||
$grp =& $mform->addElement('group', 'buttonsgrp', get_string('selectedlist', 'bulkusers'), $objs, array(' ', '<br />'), false);
|
||||
$grp->setHelpButton(array('selectedlist', get_string('selectedlist', 'bulkusers'), 'bulkusers'));
|
||||
|
||||
$renderer =& $mform->defaultRenderer();
|
||||
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
|
||||
$renderer->setGroupElementTemplate($template, 'usersgrp');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,48 +1,71 @@
|
||||
<?php //$Id$
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->dirroot.'/message/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:readallmessages', $sitecontext);
|
||||
// fix for MDL-10112
|
||||
if (empty($CFG->messaging)) {
|
||||
error("Messaging is disabled on this site");
|
||||
}
|
||||
|
||||
$users = $SESSION->bulk_susers;
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
require_once($CFG->dirroot.'/message/lib.php');
|
||||
require_once('user_message_form.php');
|
||||
$extradata['userlist'] =& $users;
|
||||
$noteform =& new user_message_form('user_bulk_message.php', $extradata);
|
||||
// if no users or action canceled, return to users page
|
||||
if (empty($users) || $noteform->is_cancelled()) {
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php');
|
||||
}
|
||||
|
||||
$formdata =& $noteform->get_data();
|
||||
// if we have the message and the command, then send it
|
||||
if ($noteform->is_submitted() && !empty($formdata->send)) {
|
||||
if(empty($formdata->messagebody)) {
|
||||
notify(get_string('allfieldsrequired'));
|
||||
} else {
|
||||
foreach ($users as $u) {
|
||||
if ($user = get_record('user', 'id', $u)) {
|
||||
message_post_message($USER, $user, addslashes($formdata->messagebody), $formdata->format, 'direct');
|
||||
}
|
||||
}
|
||||
redirect($CFG->wwwroot . '/admin/user/user_bulk.php');
|
||||
}
|
||||
}
|
||||
$msg = optional_param('msg', '', PARAM_CLEAN);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
admin_externalpage_setup('userbulk');
|
||||
admin_externalpage_print_header();
|
||||
if ($noteform->is_submitted() && !empty($formdata->preview)) {
|
||||
echo '<h3>'.get_string('previewhtml').'</h3>';
|
||||
echo '<div class="messagepreview">'. format_text(stripslashes($formdata->messagebody),$formdata->format). '</div>';
|
||||
require_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
||||
|
||||
if (empty($SESSION->bulk_users)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
$noteform->display();
|
||||
if (empty($CFG->messaging)) {
|
||||
error("Messaging is disabled on this site");
|
||||
}
|
||||
|
||||
//TODO: add support for large number of users
|
||||
|
||||
if ($confirm and !empty($msg) and confirm_sesskey()) {
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
if ($rs = get_recordset_select('user', "id IN ($in)")) {
|
||||
while ($user = rs_fetch_next_record($rs)) {
|
||||
message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
|
||||
}
|
||||
}
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
// disable html editor if not enabled in preferences
|
||||
if (!get_user_preferences('message_usehtmleditor', 0)) {
|
||||
$CFG->htmleditor = '';
|
||||
}
|
||||
|
||||
$msgform = new user_message_form('user_bulk_message.php');
|
||||
|
||||
if ($msgform->is_cancelled()) {
|
||||
redirect($return);
|
||||
|
||||
} else if ($formdata = $msgform->get_data(false)) {
|
||||
$options = new object();
|
||||
$options->para = false;
|
||||
$options->newlines = true;
|
||||
$options->smiley = false;
|
||||
|
||||
$msg = format_text($formdata->messagebody, $formdata->format, $options);
|
||||
|
||||
$in = implode(',', $SESSION->bulk_users);
|
||||
$userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
|
||||
$usernames = implode(', ', $userlist);
|
||||
$optionsyes = array();
|
||||
$optionsyes['confirm'] = 1;
|
||||
$optionsyes['sesskey'] = sesskey();
|
||||
$optionsyes['msg'] = $msg;
|
||||
admin_externalpage_print_header();
|
||||
print_heading(get_string('confirmation', 'admin'));
|
||||
print_box($msg, 'boxwidthnarrow boxaligncenter generalbox', 'preview');
|
||||
notice_yesno(get_string('confirmmessage', 'bulkusers', $usernames), 'user_bulk_message.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
|
||||
admin_externalpage_print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
admin_externalpage_print_header();
|
||||
$msgform->display();
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -5,29 +5,16 @@ require_once($CFG->libdir.'/formslib.php');
|
||||
class user_message_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
$mform =& $this->_form;
|
||||
$mform =& $this->_form;
|
||||
$mform->addElement('header', 'general', get_string('message', 'message'));
|
||||
|
||||
$mform->addElement('textarea', 'messagebody', get_string('messagebody'), array('rows'=>15, 'cols'=>30));
|
||||
$mform->setType('messagebody', PARAM_CLEANHTML);
|
||||
|
||||
$mform->addElement('textarea', 'messagebody', get_string('messagebody'), array('rows'=>15, 'cols'=>60));
|
||||
$mform->addRule('messagebody', '', 'required', null, 'client');
|
||||
$mform->setHelpButton('messagebody', array('writing', 'reading', 'questions', 'richtext'), false, 'editorhelpbutton');
|
||||
|
||||
$mform->addElement('format', 'format', get_string('format'));
|
||||
|
||||
$objs = array();
|
||||
foreach($this->_customdata['userlist'] as $k=>$u) {
|
||||
$user = get_record('user', 'id', $u);
|
||||
$objs[] =& $mform->createElement('static', null, null, '<input type="checkbox" name="userid['. $k .']" checked="checked" value="'.$u . '" />'. fullname($user));
|
||||
}
|
||||
$mform->addElement('group', 'users', 'Users', $objs, '<br />', false);
|
||||
|
||||
$objs = array();
|
||||
$objs[] = &$mform->createElement('submit', 'send', 'Send');
|
||||
$objs[] = &$mform->createElement('submit', 'preview', 'Preview');
|
||||
$objs[] = &$mform->createElement('cancel');
|
||||
$mform->addElement('group', 'buttonar', '', $objs, ' ', false);
|
||||
$mform->closeHeaderBefore('buttonar');
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -70,89 +70,17 @@ class get_db_directories extends XMLDBAction {
|
||||
if (!isset($XMLDB->dbdirs)) {
|
||||
$XMLDB->dbdirs = array();
|
||||
}
|
||||
/// First, the main one (lib/db)
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->libdir . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
|
||||
/// Now, activity modules (mod/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('mod')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/mod/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, assignment submodules (mod/assignment/type/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('mod/assignment/type')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/mod/assignment/type/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, question types (question/type/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('question/type')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/question/type/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, backup/restore stuff (backup/db)
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/backup/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
|
||||
/// Now, block system stuff (blocks/db)
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/blocks/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
|
||||
/// Now, blocks (blocks/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('blocks', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/blocks/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
|
||||
/// Now, enrolment plugins (enrol/xxx/db)
|
||||
if ($plugins = get_list_of_plugins('enrol', 'db')) {
|
||||
foreach ($plugins as $plugin) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $CFG->dirroot . '/enrol/' . $plugin . '/db';
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
}
|
||||
/// get list of all dirs and create objects with status
|
||||
$db_direcotries = get_db_directories();
|
||||
foreach ($db_direcotries as $path) {
|
||||
$dbdir = new stdClass;
|
||||
$dbdir->path = $path;
|
||||
if (!isset($XMLDB->dbdirs[$dbdir->path])) {
|
||||
$XMLDB->dbdirs[$dbdir->path] = $dbdir;
|
||||
}
|
||||
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
|
||||
}
|
||||
|
||||
/// Sort by key
|
||||
ksort($XMLDB->dbdirs);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@@ -214,6 +214,9 @@ class view_structure_php extends XMLDBAction {
|
||||
$result .= ' /// Launch create table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && create_table($table);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -252,6 +255,9 @@ class view_structure_php extends XMLDBAction {
|
||||
$result .= ' /// Launch drop table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_table($table);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -290,10 +296,37 @@ class view_structure_php extends XMLDBAction {
|
||||
$result .= ' /// Launch rename table for ' . $table->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_table($table, ' . "'NEWNAMEGOESHERE'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will generate the PHP code needed to
|
||||
* implement the upgrade_xxxx_savepoint() php calls in
|
||||
* upgrade code generated from the editor
|
||||
*
|
||||
* @param XMLDBStructure structure object containing all the info
|
||||
* @return string PHP code to be used to stabilish a savepoint
|
||||
*/
|
||||
function upgrade_savepoint_php ($structure) {
|
||||
|
||||
$path = $structure->getPath();
|
||||
|
||||
$result = '';
|
||||
|
||||
switch ($path) {
|
||||
case 'lib/db':
|
||||
$result = XMLDB_LINEFEED .
|
||||
' /// Main savepoint reached' . XMLDB_LINEFEED .
|
||||
' upgrade_main_savepoint($result, XXXXXXXXXX);' . XMLDB_LINEFEED;
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
|
||||
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@@ -339,6 +339,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch add field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_field($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -382,6 +385,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch drop field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_field($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -426,6 +432,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch rename field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_field($table, $field, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -479,6 +488,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of type for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_type($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -529,6 +541,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of precision for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_precision($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -575,6 +590,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of sign for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_unsigned($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -621,6 +639,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of nullability for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_notnull($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -668,6 +689,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of list of values for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_enum($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -714,6 +738,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch change of default for field ' . $field->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && change_field_default($table, $field);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -758,6 +785,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch add key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_key($table, $key);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -802,6 +832,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch drop key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_key($table, $key);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -849,6 +882,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch rename key ' . $key->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_key($table, $key, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -893,6 +929,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch add index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && add_index($table, $index);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -937,6 +976,9 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch drop index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && drop_index($table, $index);' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
@@ -984,11 +1026,38 @@ class view_table_php extends XMLDBAction {
|
||||
$result .= ' /// Launch rename index ' . $index->getName() . XMLDB_LINEFEED;
|
||||
$result .= ' $result = $result && rename_index($table, $index, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
|
||||
|
||||
/// Add the proper upgrade_xxxx_savepoint call
|
||||
$result .= $this->upgrade_savepoint_php ($structure);
|
||||
|
||||
/// Add standard PHP footer
|
||||
$result .= XMLDB_PHP_FOOTER;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will generate the PHP code needed to
|
||||
* implement the upgrade_xxxx_savepoint() php calls in
|
||||
* upgrade code generated from the editor
|
||||
*
|
||||
* @param XMLDBStructure structure object containing all the info
|
||||
* @return string PHP code to be used to stabilish a savepoint
|
||||
*/
|
||||
function upgrade_savepoint_php ($structure) {
|
||||
|
||||
$path = $structure->getPath();
|
||||
|
||||
$result = '';
|
||||
|
||||
switch ($path) {
|
||||
case 'lib/db':
|
||||
$result = XMLDB_LINEFEED .
|
||||
' /// Main savepoint reached' . XMLDB_LINEFEED .
|
||||
' upgrade_main_savepoint($result, XXXXXXXXXX);' . XMLDB_LINEFEED;
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
+5
-3
@@ -334,10 +334,12 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
// simplify down to usernames
|
||||
$usernames = array();
|
||||
foreach ($users as $user) {
|
||||
array_push($usernames, $user->username);
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
array_push($usernames, $user->username);
|
||||
}
|
||||
unset($users);
|
||||
}
|
||||
unset($users);
|
||||
|
||||
$add_users = array_diff($userlist, $usernames);
|
||||
unset($usernames);
|
||||
|
||||
+184
-8
@@ -23,6 +23,10 @@ if (!defined('AUTH_AD_ACCOUNTDISABLE')) {
|
||||
if (!defined('AUTH_AD_NORMAL_ACCOUNT')) {
|
||||
define('AUTH_AD_NORMAL_ACCOUNT', 0x0200);
|
||||
}
|
||||
if (!defined('AUTH_NTLMTIMEOUT')) { // timewindow for the NTLM SSO process, in secs...
|
||||
define('AUTH_NTLMTIMEOUT', 10);
|
||||
}
|
||||
|
||||
|
||||
require_once($CFG->libdir.'/authlib.php');
|
||||
|
||||
@@ -85,8 +89,43 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
|
||||
$extpassword = $textlib->convert(stripslashes($password), 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
//
|
||||
// Before we connect to LDAP, check if this is an AD SSO login
|
||||
// if we succeed in this block, we'll return success early.
|
||||
//
|
||||
$key = sesskey();
|
||||
if (!empty($this->config->ntlmsso_enabled) && $key === $password) {
|
||||
$cf = get_cache_flags('auth/ldap/ntlmsess');
|
||||
// We only get the cache flag if we retrieve it before
|
||||
// it expires (AUTH_NTLMTIMEOUT seconds).
|
||||
if (!isset($cf[$key]) || $cf[$key] === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessusername = $cf[$key];
|
||||
if ($username === $sessusername) {
|
||||
unset($sessusername);
|
||||
unset($cf);
|
||||
|
||||
// Check that the user is inside one of the configured LDAP contexts
|
||||
$validuser = false;
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
if ($ldapconnection) {
|
||||
// if the user is not inside the configured contexts,
|
||||
// ldap_find_userdn returns false.
|
||||
if ($this->ldap_find_userdn($ldapconnection, $extusername)) {
|
||||
$validuser = true;
|
||||
}
|
||||
ldap_close($ldapconnection);
|
||||
}
|
||||
|
||||
// Shortcut here - SSO confirmed
|
||||
return $validuser;
|
||||
}
|
||||
} // End SSO processing
|
||||
unset($key);
|
||||
|
||||
$ldapconnection = $this->ldap_connect();
|
||||
if ($ldapconnection) {
|
||||
$ldap_user_dn = $this->ldap_find_userdn($ldapconnection, $extusername);
|
||||
|
||||
@@ -105,7 +144,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
else {
|
||||
@ldap_close($ldapconnection);
|
||||
print_error('auth_ldap_noconnect','auth',$this->config->host_url);
|
||||
print_error('auth_ldap_noconnect','auth','',$this->config->host_url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -569,7 +608,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
do {
|
||||
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
|
||||
$value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8');
|
||||
array_push($fresult, $value);
|
||||
// usernames are __always__ lowercase.
|
||||
array_push($fresult, moodle_strtolower($value));
|
||||
if (count($fresult) >= $bulk_insert_records) {
|
||||
$this->ldap_bulk_insert($fresult, $temptable);
|
||||
$fresult = array();
|
||||
@@ -819,7 +859,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id);
|
||||
if (empty($user)) { // trouble
|
||||
error_log("Cannot update non-existent user: ".stripslashes($username));
|
||||
print_error('auth_dbusernotexist','auth',$username);
|
||||
print_error('auth_dbusernotexist','auth','',$username);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -979,6 +1019,21 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return true; // just change auth and skip update
|
||||
}
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
|
||||
// Before doing anything else, make sure really need to update anything
|
||||
// in the external LDAP server.
|
||||
$update_external = false;
|
||||
foreach ($attrmap as $key => $ldapkeys) {
|
||||
if (!empty($this->config->{'field_updateremote_'.$key})) {
|
||||
$update_external = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$update_external) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$extoldusername = $textlib->convert($olduser->username, 'utf-8', $this->config->ldapencoding);
|
||||
|
||||
@@ -986,7 +1041,6 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$search_attribs = array();
|
||||
|
||||
$attrmap = $this->ldap_attributes();
|
||||
foreach ($attrmap as $key => $values) {
|
||||
if (!is_array($values)) {
|
||||
$values = array($values);
|
||||
@@ -1007,9 +1061,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$user_entry = $this->ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (empty($user_entry)) {
|
||||
$error = 'ldap: Could not find user while updating externally. '.
|
||||
'Details follow: search base: \''.$user_dn.'\'; search filter: \''.
|
||||
$this->config->objectclass.'\'; search attributes: ';
|
||||
foreach ($search_attribs as $attrib) {
|
||||
$error .= $attrib.' ';
|
||||
}
|
||||
error_log($error);
|
||||
return false; // old user not found!
|
||||
} else if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
error_log('ldap: Strange! More than one user record found in ldap. Only using the first one.');
|
||||
return false;
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -1398,8 +1459,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
/**
|
||||
* checks if user belong to specific group(s)
|
||||
* or is in a subtree.
|
||||
*
|
||||
* Returns true if user belongs group in grupdns string.
|
||||
* Returns true if user belongs group in grupdns string OR
|
||||
* if the DN of the user is in a subtree pf the DN provided
|
||||
* as "group"
|
||||
*
|
||||
* @param mixed $username username
|
||||
* @param mixed $groupdns string of group dn separated by ;
|
||||
@@ -1433,6 +1497,15 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
if (empty($group)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check cheaply if the user's DN sits in a subtree
|
||||
// of the "group" DN provided. Granted, this isn't
|
||||
// a proper LDAP group, but it's a popular usage.
|
||||
if (strpos(strrev($memberuser), strrev($group))===0) {
|
||||
$result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "Checking group $group for member $username\n";
|
||||
$search = ldap_read($ldapconnection, $group, '('.$this->config->memberattribute.'='.$this->filter_addslashes($memberuser).')', array($this->config->memberattribute));
|
||||
if (!empty($search) and ldap_count_entries($ldapconnection, $search)) {
|
||||
@@ -1512,7 +1585,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
|
||||
//If any of servers are alive we have already returned connection
|
||||
print_error('auth_ldap_noconnect_all','auth',$this->config->user_type);
|
||||
print_error('auth_ldap_noconnect_all','auth','', $debuginfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1707,6 +1780,103 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will get called before the login page is shown, if NTLM SSO
|
||||
* is enabled, and the user is in the right network, we'll redirect
|
||||
* to the magic NTLM page for SSO...
|
||||
*
|
||||
*/
|
||||
function loginpage_hook() {
|
||||
global $CFG;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET' // Only on initial GET
|
||||
// of loginpage
|
||||
&&!empty($this->config->ntlmsso_enabled)// SSO enabled
|
||||
&& !empty($this->config->ntlmsso_subnet)// have a subnet to test for
|
||||
&& empty($_GET['authldap_skipntlmsso']) // haven't failed it yet
|
||||
&& (isguestuser() || !isloggedin()) // guestuser or not-logged-in users
|
||||
&& address_in_subnet($_SERVER['REMOTE_ADDR'],$this->config->ntlmsso_subnet)) {
|
||||
redirect("{$CFG->wwwroot}/auth/ldap/ntlmsso_attempt.php");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called from a page running under NTLM's
|
||||
* "Integrated Windows Authentication".
|
||||
*
|
||||
* If successful, it will set a special "cookie" (not an HTTP cookie!)
|
||||
* in cache_flags under the "auth/ldap/ntlmsess" "plugin" and return true.
|
||||
* The "cookie" will be picked up by ntlmsso_finish() to complete the
|
||||
* process.
|
||||
*
|
||||
* On failure it will return false for the caller to display an appropriate
|
||||
* error message (probably saying that Integrated Windows Auth isn't enabled!)
|
||||
*
|
||||
* NOTE that this code will execute under the OS user credentials,
|
||||
* so we MUST avoid dealing with files -- such as session files.
|
||||
* (The caller should set $nomoodlecookie before including config.php)
|
||||
*
|
||||
*/
|
||||
function ntlmsso_magic($sesskey) {
|
||||
if (isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) {
|
||||
$username = $_SERVER['REMOTE_USER'];
|
||||
$username = substr(strrchr($username, '\\'), 1); //strip domain info
|
||||
$username = moodle_strtolower($username); //compatibility hack
|
||||
set_cache_flag('auth/ldap/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the session set by ntlmsso_magic(), validate it and
|
||||
* call authenticate_user_login() to authenticate the user through
|
||||
* the auth machinery.
|
||||
*
|
||||
* It is complemented by a similar check in user_login().
|
||||
*
|
||||
* If it succeeds, it never returns.
|
||||
*
|
||||
*/
|
||||
function ntlmsso_finish() {
|
||||
global $CFG, $USER, $SESSION;
|
||||
|
||||
$key = sesskey();
|
||||
$cf = get_cache_flags('auth/ldap/ntlmsess');
|
||||
if (!isset($cf[$key]) || $cf[$key] === '') {
|
||||
return false;
|
||||
}
|
||||
$username = $cf[$key];
|
||||
// Here we want to trigger the whole authentication machinery
|
||||
// to make sure no step is bypassed...
|
||||
$user = authenticate_user_login($username, $key);
|
||||
if ($user) {
|
||||
add_to_log(SITEID, 'user', 'login', "view.php?id=$USER->id&course=".SITEID,
|
||||
$user->id, 0, $user->id);
|
||||
$USER = complete_user_login($user);
|
||||
|
||||
// Cleanup the key to prevent reuse...
|
||||
// and to allow re-logins with normal credentials
|
||||
unset_cache_flag('auth/ldap/ntlmsess', $key);
|
||||
|
||||
/// Redirection
|
||||
if (user_not_fully_set_up($USER)) {
|
||||
$urltogo = $CFG->wwwroot.'/user/edit.php';
|
||||
// We don't delete $SESSION->wantsurl yet, so we get there later
|
||||
} else 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 {
|
||||
// no wantsurl stored or external - go to homepage
|
||||
$urltogo = $CFG->wwwroot.'/';
|
||||
unset($SESSION->wantsurl);
|
||||
}
|
||||
redirect($urltogo);
|
||||
}
|
||||
// Should never reach here.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync roles for this user
|
||||
*
|
||||
@@ -1802,6 +1972,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
{$config->changepasswordurl = ''; }
|
||||
if (!isset($config->removeuser))
|
||||
{$config->removeuser = 0; }
|
||||
if (!isset($config->ntlmsso_enabled))
|
||||
{$config->ntlmsso_enabled = 0; }
|
||||
if (!isset($config->ntlmsso_subnet))
|
||||
{$config->ntlmsso_subnet = ''; }
|
||||
|
||||
// save settings
|
||||
set_config('host_url', $config->host_url, 'auth/ldap');
|
||||
@@ -1832,6 +2006,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
set_config('passtype', $config->passtype, 'auth/ldap');
|
||||
set_config('changepasswordurl', $config->changepasswordurl, 'auth/ldap');
|
||||
set_config('removeuser', $config->removeuser, 'auth/ldap');
|
||||
set_config('ntlmsso_enabled', (int)$config->ntlmsso_enabled, 'auth/ldap');
|
||||
set_config('ntlmsso_subnet', $config->ntlmsso_subnet, 'auth/ldap');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
{$config->changepasswordurl = ''; }
|
||||
if (!isset($config->removeuser))
|
||||
{$config->removeuser = 0; }
|
||||
if (!isset($config->ntlmsso_enabled))
|
||||
{$config->ntlmsso_enabled = 0; }
|
||||
if (!isset($config->ntlmsso_subnet))
|
||||
{$config->ntlmsso_subnet = ''; }
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
@@ -439,6 +443,32 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_ntlmsso', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="ntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled, '0');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ntlmsso_enabled','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key','auth') ?></label></td>
|
||||
<td><input name="ntlmsso_subnet" id="ntlmsso_subnet" type="text" size="30" value="<?php p($config->ntlmsso_subnet) ?>"
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ntlmsso_subnet','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
$help = get_string('auth_ldapextrafields','auth');
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
}
|
||||
|
||||
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
||||
if (!in_array('ldap',$authsequence,true)) {
|
||||
print_error('ldap_isdisabled','auth');
|
||||
}
|
||||
|
||||
$authplugin = get_auth_plugin('ldap');
|
||||
if (empty($authplugin->config->ntlmsso_enabled)) {
|
||||
print_error('ntlmsso_isdisabled','auth');
|
||||
}
|
||||
|
||||
$sesskey = sesskey();
|
||||
|
||||
//print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, '', true);
|
||||
$msg = '<p>'.get_string('ntlmsso_attempting','auth').'</p>'
|
||||
. '<img width="1", height="1" '
|
||||
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
|
||||
. $sesskey . '" />';
|
||||
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
}
|
||||
|
||||
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
||||
if (!in_array('ldap',$authsequence,true)) {
|
||||
print_error('ldap_isdisabled','auth');
|
||||
}
|
||||
|
||||
$authplugin = get_auth_plugin('ldap');
|
||||
if (empty($authplugin->config->ntlmsso_enabled)) {
|
||||
print_error('ntlmsso_isdisabled','auth');
|
||||
}
|
||||
|
||||
// If ntlmsso_finish() succeeds, then the code never returns,
|
||||
// so we only worry about failure.
|
||||
if (!$authplugin->ntlmsso_finish()) {
|
||||
// Redirect to login, saying "don't try again!"
|
||||
redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1',
|
||||
get_string('ntlmsso_failed','auth'), 3);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
// Don't let lib/setup.php set any cookies
|
||||
// as we will be executing under the OS security
|
||||
// context of the user we are trying to login, rather than
|
||||
// of the webserver.
|
||||
$nomoodlecookie=true;
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
||||
if (!in_array('ldap',$authsequence,true)) {
|
||||
print_error('ldap_isdisabled','auth');
|
||||
}
|
||||
|
||||
$authplugin = get_auth_plugin('ldap');
|
||||
if (empty($authplugin->config->ntlmsso_enabled)) {
|
||||
print_error('ntlmsso_isdisabled','auth');
|
||||
}
|
||||
|
||||
$sesskey = required_param('sesskey', PARAM_RAW);
|
||||
$file = $CFG->dirroot . '/pix/spacer.gif';
|
||||
|
||||
if ($authplugin->ntlmsso_magic($sesskey)
|
||||
&& file_exists($file)) {
|
||||
|
||||
// Serve GIF
|
||||
// Type
|
||||
header('Content-Type: image/gif');
|
||||
header('Content-Length: '.filesize($file));
|
||||
|
||||
// Output file
|
||||
$handle=fopen($file,'r');
|
||||
fpassthru($handle);
|
||||
fclose($handle);
|
||||
exit;
|
||||
} else {
|
||||
print_error('ntlmsso_iwamagicnotenabled','auth');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -119,6 +119,31 @@ class auth_plugin_manual extends auth_plugin_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm the new user as registered. This should normally not be used,
|
||||
* but it may be necessary if the user auth_method is changed to manual
|
||||
* before the user is confirmed.
|
||||
*/
|
||||
function user_confirm($username, $confirmsecret = null) {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
} else {
|
||||
if (!set_field("user", "confirmed", 1, "id", $user->id)) {
|
||||
return AUTH_CONFIRM_FAIL;
|
||||
}
|
||||
if (!set_field("user", "firstaccess", time(), "id", $user->id)) {
|
||||
return AUTH_CONFIRM_FAIL;
|
||||
}
|
||||
return AUTH_CONFIRM_OK;
|
||||
}
|
||||
} else {
|
||||
return AUTH_CONFIRM_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// session okay, try getting the user
|
||||
if (!$user = get_complete_user_data('id', $mnet_session->userid)) {
|
||||
if (!$user = get_record('user', 'id', $mnet_session->userid)) {
|
||||
echo mnet_server_fault(3, get_string('authfail_usermismatch', 'mnet'));
|
||||
exit;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// add the remote user to the database if necessary, and if allowed
|
||||
// TODO: refactor into a separate function
|
||||
if (! $localuser->id) {
|
||||
if (empty($localuser) || ! $localuser->id) {
|
||||
if (empty($this->config->auto_add_remote_users)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ $localuser = $mnetauth->confirm_mnet_session($token, $remotewwwroot);
|
||||
|
||||
// log in
|
||||
$USER = get_complete_user_data('id', $localuser->id, $localuser->mnethostid);
|
||||
load_all_capabilities();
|
||||
complete_user_login($USER);
|
||||
|
||||
if (!empty($localuser->mnet_foreign_host_array)) {
|
||||
$USER->mnet_foreign_host_array = $localuser->mnet_foreign_host_array;
|
||||
|
||||
+57
-29
@@ -19,15 +19,16 @@ Changes:
|
||||
- 07. 2007: Fixed a but that caused problems with uppercase usernames
|
||||
- 10. 2007: Removed the requirement for email address, surname and given name
|
||||
attributes on request of Markus Hagman
|
||||
- 11. 2007: Integrated WAYF Service in Moodle
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
1. Protect the directory moodle/auth/shibboleth/ with Shibboleth.
|
||||
1. Protect the directory moodle/auth/shibboleth/index.php 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:
|
||||
|
||||
--
|
||||
<Location ~ "/auth/shibboleth">
|
||||
<Location ~ "/auth/shibboleth/index.php">
|
||||
AuthType shibboleth
|
||||
ShibRequireSession On
|
||||
require valid-user
|
||||
@@ -46,7 +47,7 @@ Moodle Configuration with Dual login
|
||||
Options' and click on the the 'Shibboleth' settings.
|
||||
|
||||
3. Fill in the fields of the form. The fields 'Username', 'First name',
|
||||
'Surname', etc should contain the name of the environment variables of the
|
||||
'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
|
||||
the Shibboleth documentation or the documentation of your Shibboleth
|
||||
@@ -56,38 +57,64 @@ Moodle Configuration with Dual login
|
||||
|
||||
#############################################################################
|
||||
Shibboleth Attributes needed by Moodle:
|
||||
For Moodle to work properly Shibboleth should at least provide the attributes
|
||||
that are used as username, firstname, lastname and email in Moodle.
|
||||
The attribute used for the username has to be unique for all Shibboleth user.
|
||||
All attributes must obey a certain length, otherwise Moodle cuts off the
|
||||
ends. Consult the Moodle documentation for further information on the maximum
|
||||
lengths for each field in the user profile.
|
||||
For Moodle to work properly Shibboleth should at least provide the attribute
|
||||
that is used as username in Moodle. It has to be unique for all Shibboleth
|
||||
Be aware that Moodle converts the username to lowercase. So, the overall
|
||||
behaviour of the username will be case-insensitive.
|
||||
All attributes used for moodle must obey a certain length, otherwise Moodle
|
||||
cuts off the ends. Consult the Moodle documentation for further information
|
||||
on the maximum lengths for each field in the user profile.
|
||||
#############################################################################
|
||||
|
||||
4. Save the changes for the 'Shibboleth settings'.
|
||||
4.a If you want Shibboleth as your only authentication method with an external
|
||||
Where Are You From (WAYF) Service , set the 'Alternate Login URL' in the
|
||||
'Common settings' in 'Administrations >> Users >> Authentication Options'
|
||||
to the the URL of the file 'moodle/auth/shibboleth/index.php'.
|
||||
This will enforce Shibboleth login.
|
||||
|
||||
5.a If you want Shibboleth as your only authentication method, set the
|
||||
'Alternate Login URL' in the 'Common settings' in
|
||||
'Administrations >> Users >> Authentication Options' to the the URL of the
|
||||
file 'moodle/auth/shibboleth/index.php'. This will enforce Shibboleth login.
|
||||
4.b If you want to use the Moodle internal WAYF service, you have to activate it
|
||||
in the Moodle Shibboleth authentication settings by checking the
|
||||
'Moodle WAYF Service' checkbox and providing a list of entity IDs in the
|
||||
'Identity Providers' textarea together with a name and an optional
|
||||
SessionInitiator URL, which usually is an absolute or relative URL pointing
|
||||
to the same host. If no SessionInitiator URL is given, the default one
|
||||
'/Shibboleth.sso' will be used.
|
||||
Also see https://spaces.internet2.edu/display/SHIB/SessionInitiator
|
||||
|
||||
6.b If you want to use another authentication method together with Shibboleth,
|
||||
in parallel, change the 'Instructions' in the 'Common settings' of the
|
||||
'Administrations >> Users >> Authentication Options' to contain a link to the
|
||||
Important Note: If you upgraded from a previous version of Moodle and now
|
||||
want to use the integrated WAYF, you have to make sure that
|
||||
in step 1 only the index.php script in
|
||||
moodle/auth/shibboleth/ is protected but *not* the other
|
||||
scripts and especially not the login.php script.
|
||||
|
||||
5. Save the changes for the 'Shibboleth settings'. T
|
||||
|
||||
Important Note: If you went for 4.b (integrated WAYF service), saving the
|
||||
settings will overwrite the Moodle Alternate Login URL
|
||||
using the Moodle web root URL.
|
||||
|
||||
6. If you want to use Shibboleth in addition to another authentication method
|
||||
not using the integrated WAYF service from 4.b, change the 'Instructions' in
|
||||
'Administrations >> Users >> Manage authentication' to 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.
|
||||
Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.
|
||||
You can also use HTML code in that field, e.g. to include an image as a
|
||||
Shibboleth login button.
|
||||
|
||||
7. Save the changes for the 'Common settings'.
|
||||
Note: As of now you cannot use dual login together with the integrated
|
||||
WAYF service provided by Moodle (4.b).
|
||||
|
||||
7. Save the authentication changes.
|
||||
|
||||
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 5.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 5.b.
|
||||
authentication method (see 4.a), this happens automatically when a user selects
|
||||
his home organization in the Moodle WAYF service or if the alternate login URL
|
||||
is configured to be the protected /auth/shibboleth/index.php
|
||||
Otherwise, the user has to click on the link on the dual login page you
|
||||
provided in step 5.b.
|
||||
|
||||
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
|
||||
@@ -110,12 +137,13 @@ 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
|
||||
form that sends 'username' and 'password' to moodle/login/index.php.
|
||||
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
|
||||
Accounts' 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
|
||||
form that sends 'username' and 'password' to moodle/login/index.php. Set this
|
||||
web page then als alternate login page.
|
||||
Consult the Moodle documentation for further instructions and requirements.
|
||||
|
||||
How to customize the way the Shibboleth user data is used in Moodle
|
||||
@@ -173,4 +201,4 @@ Example file:
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
In case of problems and questions with Shibboleth authentication, contact
|
||||
Lukas Haemmerle <haemmerle@switch.ch> or Markus Hagman <hagman@hytti.uku.fi>
|
||||
Lukas Haemmerle <lukas.haemmerle@switch.ch> or Markus Hagman <hagman@hytti.uku.fi>
|
||||
|
||||
+169
-2
@@ -19,6 +19,8 @@
|
||||
* 2006-10-27 Upstream 1.7 changes merged in, added above credits from lib.php :-)
|
||||
* 2007-03-09 Fixed authentication but may need some other changes
|
||||
* 2007-10-03 Removed requirement for email address, surname and given name on request of Markus Hagman
|
||||
* 2008-01-21 Added WAYF functionality
|
||||
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
@@ -113,8 +115,10 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns array containg attribute mappings between Moodle and Shibboleth.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_attributes() {
|
||||
$configarray = (array) $this->config;
|
||||
@@ -153,6 +157,10 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for login page
|
||||
*
|
||||
*/
|
||||
function loginpage_hook() {
|
||||
global $SESSION, $CFG;
|
||||
|
||||
@@ -193,21 +201,58 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
if (!isset ($config->convert_data)) {
|
||||
$config->convert_data = '';
|
||||
}
|
||||
|
||||
if (!isset($config->changepasswordurl)) {
|
||||
$config->changepasswordurl = '';
|
||||
}
|
||||
|
||||
if (!isset($config->login_name)) {
|
||||
$config->login_name = 'Shibboleth Login';
|
||||
}
|
||||
|
||||
// Clean idp list
|
||||
if (isset($config->organization_selection) && !empty($config->organization_selection) && isset($config->alt_login) && $config->alt_login == 'on') {
|
||||
$idp_list = get_idp_list($config->organization_selection);
|
||||
if (count($idp_list) < 1){
|
||||
return false;
|
||||
}
|
||||
$config->organization_selection = '';
|
||||
foreach ($idp_list as $idp => $value){
|
||||
$config->organization_selection .= $idp.', '.$value[0].', '.$value[1]."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// save settings
|
||||
set_config('user_attribute', $config->user_attribute, 'auth/shibboleth');
|
||||
|
||||
if (isset($config->organization_selection) && !empty($config->organization_selection)) {
|
||||
set_config('organization_selection', $config->organization_selection, 'auth/shibboleth');
|
||||
}
|
||||
set_config('login_name', $config->login_name, 'auth/shibboleth');
|
||||
set_config('convert_data', $config->convert_data, 'auth/shibboleth');
|
||||
set_config('auth_instructions', $config->auth_instructions, 'auth/shibboleth');
|
||||
set_config('changepasswordurl', $config->changepasswordurl, 'auth/shibboleth');
|
||||
|
||||
|
||||
if (isset($config->alt_login) && $config->alt_login == 'on'){
|
||||
set_config('alt_login', $config->alt_login, 'auth/shibboleth');
|
||||
set_config('alternateloginurl', $CFG->wwwroot.'/auth/shibboleth/login.php');
|
||||
} else {
|
||||
set_config('alt_login', 'off', 'auth/shibboleth');
|
||||
set_config('alternateloginurl', '');
|
||||
$config->alt_login = 'off';
|
||||
}
|
||||
|
||||
// Check values and return false if something is wrong
|
||||
// Patch Anyware Technologies (14/05/07)
|
||||
if (($config->convert_data != '')&&(!file_exists($config->convert_data) || !is_readable($config->convert_data))){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there is at least one entry in the IdP list
|
||||
if (isset($config->organization_selection) && empty($config->organization_selection) && isset($config->alt_login) && $config->alt_login == 'on'){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -225,4 +270,126 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the standard SAML domain cookie that is also used to preselect
|
||||
* the right entry on the local wayf
|
||||
*
|
||||
* @param IdP identifiere
|
||||
*/
|
||||
function set_saml_cookie($selectedIDP) {
|
||||
if (isset($_COOKIE['_saml_idp']))
|
||||
{
|
||||
$IDPArray = generate_cookie_array($_COOKIE['_saml_idp']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$IDPArray = array();
|
||||
}
|
||||
$IDPArray = appendCookieValue($selectedIDP, $IDPArray);
|
||||
setcookie ('_saml_idp', generate_cookie_value($IDPArray), time() + (100*24*3600));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the option elements for the select element of the drop down list
|
||||
*
|
||||
*/
|
||||
function print_idp_list(){
|
||||
$config = get_config('auth/shibboleth');
|
||||
|
||||
$IdPs = get_idp_list($config->organization_selection);
|
||||
if (isset($_COOKIE['_saml_idp'])){
|
||||
$idp_cookie = generate_cookie_array($_COOKIE['_saml_idp']);
|
||||
do {
|
||||
$selectedIdP = array_pop($idp_cookie);
|
||||
} while (!isset($IdPs[$selectedIdP]) && count($idp_cookie) > 0);
|
||||
|
||||
} else {
|
||||
$selectedIdP = '-';
|
||||
}
|
||||
|
||||
foreach($IdPs as $IdP => $data){
|
||||
if ($IdP == $selectedIdP){
|
||||
echo '<option value="'.$IdP.'" selected="selected">'.$data[0].'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$IdP.'">'.$data[0].'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate array of IdPs from Moodle Shibboleth settings
|
||||
*
|
||||
* @param string Text containing tuble/triple of IdP entityId, name and (optionally) session initiator
|
||||
* @return array Identifier of IdPs and their name/session initiator
|
||||
*/
|
||||
|
||||
function get_idp_list($organization_selection) {
|
||||
$idp_list = array();
|
||||
|
||||
$idp_raw_list = split("\n", $organization_selection);
|
||||
|
||||
foreach ($idp_raw_list as $idp_line){
|
||||
$idp_data = split(',', $idp_line);
|
||||
if (isset($idp_data[2]))
|
||||
{
|
||||
$idp_list[trim($idp_data[0])] = array(trim($idp_data[1]),trim($idp_data[2]));
|
||||
}
|
||||
elseif(isset($idp_data[1]))
|
||||
{
|
||||
$idp_list[trim($idp_data[0])] = array(trim($idp_data[1]));
|
||||
}
|
||||
}
|
||||
|
||||
return $idp_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array of IDPs using the cookie value
|
||||
*
|
||||
* @param string Value of SAML domain cookie
|
||||
* @return array Identifiers of IdPs
|
||||
*/
|
||||
function generate_cookie_array($value) {
|
||||
|
||||
// Decodes and splits cookie value
|
||||
$CookieArray = split(' ', $value);
|
||||
$CookieArray = array_map('base64_decode', $CookieArray);
|
||||
|
||||
return $CookieArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the value that is stored in the cookie using the list of IDPs
|
||||
*
|
||||
* @param array IdP identifiers
|
||||
* @return string SAML domain cookie value
|
||||
*/
|
||||
function generate_cookie_value($CookieArray) {
|
||||
|
||||
// Merges cookie content and encodes it
|
||||
$CookieArray = array_map('base64_encode', $CookieArray);
|
||||
$value = implode(' ', $CookieArray);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a value to the array of IDPs
|
||||
*
|
||||
* @param string IdP identifier
|
||||
* @param array IdP identifiers
|
||||
* @return array IdP identifiers with appended IdP
|
||||
*/
|
||||
function appendCookieValue($value, $CookieArray) {
|
||||
|
||||
array_push($CookieArray, $value);
|
||||
$CookieArray = array_reverse($CookieArray);
|
||||
$CookieArray = array_unique($CookieArray);
|
||||
$CookieArray = array_reverse($CookieArray);
|
||||
|
||||
return $CookieArray;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
+55
-23
@@ -27,28 +27,6 @@
|
||||
<td><?php print_string("auth_shib_username_description", "auth") ?></td>
|
||||
</tr>
|
||||
|
||||
<!--
|
||||
This is kind of obsolete because the login instructions are now centralized
|
||||
On the other hand it would be great for Shibboleth to have seperate login
|
||||
instructions
|
||||
-->
|
||||
<!--
|
||||
<tr valign="top">
|
||||
<td align="right"><?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("auth_shib_instructions_help", "auth", htmlspecialchars($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
helpbutton("text", get_string("helptext"));
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("auth_shib_convert_data", "auth") ?>:</td>
|
||||
<td>
|
||||
@@ -63,9 +41,61 @@ instructions
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string("auth_shib_convert_data_description", "auth") ?></td>
|
||||
<td><?php print_string("auth_shib_convert_data_description", "auth"); echo $config->alt_login ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">Moodle WAYF Service:</td>
|
||||
<td>
|
||||
<input name="alt_login" type="checkbox" <?php
|
||||
if ( isset($config->alt_login) and $config->alt_login == 'on' ){
|
||||
echo 'checked="checked"';
|
||||
}
|
||||
?> />
|
||||
</td>
|
||||
<td>If you check this, Moodle will use its own WAYF service instead of the one configured for Shibboleth. Moodle will display a drop-down list on this alternative login page where the user has to select his Identity Provider.</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">Identity Providers:</td>
|
||||
<td>
|
||||
<textarea name="organization_selection" rows="10" cols="30" style="overflow: auto;" wrap="off"
|
||||
><?php
|
||||
if (!isset($config->organization_selection)){
|
||||
echo 'urn:mace:organization1:providerID, Example Organization 1
|
||||
https://another.idp-id.com/shibboleth, Other Example Organization
|
||||
urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai';
|
||||
} else {
|
||||
echo $config->organization_selection;
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
<?
|
||||
if (isset($config->organization_selection) && empty($config->organization_selection) && isset($config->alt_login) && $config->alt_login == 'on') {
|
||||
echo '<br/><font color="red">';
|
||||
print_string("auth_shib_no_organizations_warning", "auth");
|
||||
echo '</font>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>Provide a list of Identity Provider entityIDs to let the user choose from on the login page.
|
||||
On each line there must be a comma-separated tuple for entityID of the IdP (see the Shibboleth metadata file) and Name of IdP as it shall be displayed in the drow-down list.
|
||||
As an optional third parameter you can add the location of a Shibboleth session initiator that shall be used in case your Moodle installation is part of a multi federation setup.</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">Authentication Method Name:</td>
|
||||
<td>
|
||||
<input name="login_name" type="text" size="30" value="<?php
|
||||
if ( isset($config->login_name) and !empty($config->login_name)){
|
||||
echo $config->login_name;
|
||||
} else {
|
||||
echo 'Shibboleth Login';
|
||||
}
|
||||
?>" />
|
||||
</td>
|
||||
<td>Provide a name for the Shibboleth authentication method that is familiar to your users. This could be the name of your Shibboleth federation, e.g. "SWITCHaai Login" or "InCommon Login" and so on.</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_shib_changepasswordurl', 'auth') ?>: </td>
|
||||
@@ -82,6 +112,8 @@ instructions
|
||||
<td><?php print_string('changepasswordhelp', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('shibboleth', $user_fields, '<!-- empty help -->', true, false);
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
check_enrolment_plugins($USER);
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
$config = get_config('auth/shibboleth');
|
||||
|
||||
if ($show_instructions) {
|
||||
$columns = 'twocolumns';
|
||||
} else {
|
||||
$columns = 'onecolumn';
|
||||
}
|
||||
?>
|
||||
<div class="loginbox clearfix <?php echo $columns ?>">
|
||||
<div class="loginpanel">
|
||||
<!--<h2><?php print_string("returningtosite") ?></h2>-->
|
||||
|
||||
<h2><?php
|
||||
if (isset($config->login_name) && !empty($config->login_name)){
|
||||
echo $config->login_name;
|
||||
} else {
|
||||
print_string("auth_shibboleth_login_long", "auth");
|
||||
}
|
||||
?></h2>
|
||||
<div class="subcontent loginsub">
|
||||
<div class="desc">
|
||||
<?php
|
||||
if (!empty($errormsg)) {
|
||||
echo '<div class="loginerrors">';
|
||||
formerr($errormsg);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="guestsub">
|
||||
<p><?php print_string("auth_shibboleth_select_organization", "auth"); ?></p>
|
||||
<form action="login.php" method="post" id="guestlogin">
|
||||
<select name="idp">
|
||||
<option value="-" ><?php print_string("auth_shibboleth_select_member", "auth"); ?></option>
|
||||
<?php
|
||||
print_idp_list();
|
||||
?>
|
||||
</select><p><input type="submit" value="<?php print_string("select"); ?>" accesskey="s" /></p>
|
||||
</form>
|
||||
<p>
|
||||
<?php
|
||||
print_string("auth_shibboleth_contact_administrator", "auth");
|
||||
echo '<a href="mailto:'.get_admin()->email.'"> Moodle Administrator</a>.';
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($CFG->guestloginbutton) { ?>
|
||||
<div class="subcontent guestsub">
|
||||
<div class="desc">
|
||||
<?php print_string("someallowguest") ?>
|
||||
</div>
|
||||
<form action="../../login/index.php" method="post" id="guestlogin">
|
||||
<div class="guestform">
|
||||
<input type="hidden" name="username" value="guest" />
|
||||
<input type="hidden" name="password" value="guest" />
|
||||
<input type="hidden" name="testcookies" value="1" />
|
||||
<input type="submit" value="<?php print_string("loginguest") ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if ($show_instructions) { ?>
|
||||
<div class="signuppanel">
|
||||
<h2><?php print_string("firsttime") ?></h2>
|
||||
<div class="subcontent">
|
||||
<?php if (is_enabled_auth('none')) { // instructions override the rest for security reasons
|
||||
print_string("loginstepsnone");
|
||||
} else if ($CFG->registerauth == 'email') {
|
||||
if (!empty($CFG->auth_instructions)) {
|
||||
echo format_text($CFG->auth_instructions);
|
||||
} else {
|
||||
print_string("loginsteps", "", "signup.php");
|
||||
} ?>
|
||||
<div class="signupform">
|
||||
<form action="../../login/signup.php" method="get" id="signup">
|
||||
<div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php } else if (!empty($CFG->registerauth)) {
|
||||
echo format_text($CFG->auth_instructions); ?>
|
||||
<div class="signupform">
|
||||
<form action="../../login/signup.php" method="get" id="signup">
|
||||
<div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php } else {
|
||||
echo format_text($CFG->auth_instructions);
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php // $Id$
|
||||
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once($CFG->dirroot."/auth/shibboleth/auth.php");
|
||||
|
||||
//initialize variables
|
||||
$errormsg = '';
|
||||
|
||||
/// Check for timed out sessions
|
||||
if (!empty($SESSION->has_timed_out)) {
|
||||
$session_has_timed_out = true;
|
||||
$SESSION->has_timed_out = false;
|
||||
} else {
|
||||
$session_has_timed_out = false;
|
||||
}
|
||||
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
}
|
||||
|
||||
if (empty($CFG->langmenu)) {
|
||||
$langmenu = "";
|
||||
} else {
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
$langlabel = get_accesshide(get_string('language'));
|
||||
$langmenu = popup_form ("$CFG->httpswwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true, 'self', $langlabel);
|
||||
}
|
||||
|
||||
$loginsite = get_string("loginsite");
|
||||
|
||||
$loginurl = (!empty($CFG->alternateloginurl)) ? $CFG->alternateloginurl : '';
|
||||
|
||||
|
||||
if (get_moodle_cookie() == '') {
|
||||
set_moodle_cookie('nobody'); // To help search for cookies
|
||||
}
|
||||
|
||||
if (!empty($CFG->registerauth) or is_enabled_auth('none') or !empty($CFG->auth_instructions)) {
|
||||
$show_instructions = true;
|
||||
} else {
|
||||
$show_instructions = false;
|
||||
}
|
||||
|
||||
// Set SAML domain cookie
|
||||
$config = get_config('auth/shibboleth');
|
||||
|
||||
|
||||
$IdPs = get_idp_list($config->organization_selection);
|
||||
if (isset($_POST['idp']) && isset($IdPs[$_POST['idp']])){
|
||||
$selectedIdP = $_POST['idp'];
|
||||
set_saml_cookie($selectedIdP);
|
||||
|
||||
// Redirect to SessionInitiator with providerId as argument
|
||||
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])){
|
||||
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
} else {
|
||||
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
|
||||
}
|
||||
} elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) {
|
||||
$errormsg = get_string('auth_shibboleth_errormsg', 'auth');
|
||||
}
|
||||
|
||||
$loginsite = get_string("loginsite");
|
||||
$navlinks = array(array('name' => $loginsite, 'link' => null, 'type' => 'misc'));
|
||||
$navigation = build_navigation($navlinks);
|
||||
$focus = 'idp';
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $navigation, $focus,
|
||||
'', true, '<div class="langmenu">'.$langmenu.'</div>');
|
||||
|
||||
include("index_form.html");
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
+37
-11
@@ -1,5 +1,4 @@
|
||||
<?php //$Id$
|
||||
require_once("$CFG->dirroot/question/backuplib.php");
|
||||
//This page prints the backup todo list to see everything
|
||||
|
||||
//Check login
|
||||
@@ -66,30 +65,57 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Here we check if backup_users = None. Then, we switch off every module
|
||||
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
|
||||
//inform the user.
|
||||
// TODO: Move this logic to one function to be shared by any (manual, scheduled) backup
|
||||
if ($backupprefs->backup_users == 2) {
|
||||
if ($allmods = get_records("modules") ) {
|
||||
if ($allmods = get_records('modules') ) {
|
||||
foreach ($allmods as $mod) {
|
||||
/// Reset global user_info settings to "no" (0)
|
||||
$modname = $mod->name;
|
||||
$var = "backup_user_info_".$modname;
|
||||
$var = 'backup_user_info_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
$var = "backup_".$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
if ($modname == "exercise" || $modname == "workshop") {
|
||||
/// Reset each instance userinfo settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module userinfo to no (0)
|
||||
$backupprefs->mods[$modname]->userinfo = 0;
|
||||
/// Set the instances to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->userinfo = 0;
|
||||
$var = 'backup_user_info_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
/// If modules are workshop or exercise, disable their backup completely
|
||||
if ($modname == 'exercise' || $modname == 'workshop') {
|
||||
$var = 'backup_'.$modname;
|
||||
if (isset($backupprefs->$var)) {
|
||||
$backupprefs->$var = 0;
|
||||
/// Reset each instance backup settings to "no" (0)
|
||||
if (isset($backupprefs->mods[$modname])) {
|
||||
/// Set the module backup to no (0)
|
||||
$backupprefs->mods[$modname]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instances';
|
||||
$backupprefs->$var = 0;
|
||||
/// Set the instances backup to no (o)
|
||||
foreach ($backupprefs->mods[$modname]->instances as $key => $instance) {
|
||||
$backupprefs->mods[$modname]->instances[$key]->backup = 0;
|
||||
$var = 'backup_' . $modname . '_instance_' . $key;
|
||||
$backupprefs->$var = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
$backupprefs->backuproleassignments = array();
|
||||
}
|
||||
$backupprefs->backup_user_files = 0;
|
||||
$backupprefs->backup_logs = 0;
|
||||
$backupprefs->backup_messages = 0;
|
||||
$backupprefs->backuproleassignments = array();
|
||||
|
||||
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
|
||||
echo "<hr />";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//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") ) {
|
||||
if ($allmods = get_records('modules', 'visible', 1) ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
|
||||
@@ -65,7 +65,7 @@
|
||||
$backup_user_files = optional_param('backup_user_files',1);
|
||||
$backup_course_files = optional_param('backup_course_files',1);
|
||||
$backup_site_files = optional_param('backup_site_files',1);
|
||||
$backup_gradebook_history = optional_param('backup_gradebook_history', 1, PARAM_INT);
|
||||
$backup_gradebook_history = optional_param('backup_gradebook_history', 0, PARAM_INT);
|
||||
$backup_messages = optional_param('backup_messages',1);
|
||||
|
||||
if ($count == 0) {
|
||||
@@ -120,7 +120,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
/// Acummulator for hidden options and proper XHTML output
|
||||
$hidden_options = '';
|
||||
//Now, check modules and info and show posibilities
|
||||
if ($allmods = get_records("modules") ) {
|
||||
if ($allmods = get_records('modules', 'visible', 1) ) {
|
||||
//Print option to select/deselect everything with 1 click.
|
||||
echo "<tr>";
|
||||
echo "<td align=\"right\">";
|
||||
|
||||
+43
-46
@@ -177,7 +177,7 @@ function schedule_backup_cron() {
|
||||
//Reference
|
||||
if ($count_error != 0 || $count_unfinished != 0) {
|
||||
$message .= " ".get_string('backupfailed')."\n\n";
|
||||
$dest_url = $CFG->wwwroot.'/admin/report/backups/index.php';
|
||||
$dest_url = "$CFG->wwwroot/$CFG->admin/report/backups/index.php";
|
||||
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
|
||||
//Set message priority
|
||||
$admin->priority = 1;
|
||||
@@ -404,6 +404,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now set instances
|
||||
if ($coursemods = get_course_mods($course->id)) {
|
||||
foreach ($coursemods as $mod) {
|
||||
@@ -418,6 +419,13 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally, clean all the $preferences->mods[] not having instances. Nothing to backup about them
|
||||
foreach ($preferences->mods as $modname => $mod) {
|
||||
if (!isset($mod->instances)) {
|
||||
unset($preferences->mods[$modname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Convert other parameters
|
||||
@@ -434,53 +442,28 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$preferences->backup_keep = $backup_config->backup_sche_keep;
|
||||
}
|
||||
|
||||
//Calculate the backup string
|
||||
//Calculate various backup preferences
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating backup name");
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",moodle_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 .= moodle_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 file name
|
||||
$backup_name = backup_get_zipfile_name($course);
|
||||
|
||||
//Calculate the string to match the keep preference
|
||||
$keep_name = $backup_word."-";
|
||||
//The shortname
|
||||
$keep_name .= moodle_strtolower($backup_shortname)."-";
|
||||
//And finally, clean everything
|
||||
$keep_name = clean_filename($keep_name);
|
||||
$keep_name = backup_get_keep_name($course);
|
||||
|
||||
//Set them
|
||||
$preferences->backup_name = $backup_name;
|
||||
$preferences->keep_name = $keep_name;
|
||||
|
||||
//Roleasignments
|
||||
$roles = get_records('role', '', '', 'sortorder');
|
||||
foreach ($roles as $role) {
|
||||
$preferences->backuproleassignments[$role->id] = $role;
|
||||
}
|
||||
|
||||
//Another Info
|
||||
backup_add_static_preferences($preferences);
|
||||
}
|
||||
|
||||
//Calculate the backup unique code to allow simultaneus backups (to define
|
||||
@@ -567,6 +550,8 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
return $status;
|
||||
}
|
||||
|
||||
//TODO: Unify this function with backup_execute() to have both backups 100% equivalent. Moodle 2.0
|
||||
|
||||
//This function implements all the needed code to backup a course
|
||||
//copying it to the desired destination (default if not specified)
|
||||
function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
@@ -575,12 +560,6 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
|
||||
$status = true;
|
||||
|
||||
//Another Info to add
|
||||
$preferences->moodle_version = $CFG->version;
|
||||
$preferences->moodle_release = $CFG->release;
|
||||
$preferences->backup_version = $CFG->backup_version;
|
||||
$preferences->backup_release = $CFG->backup_release;
|
||||
|
||||
//Some parts of the backup doesn't know about $preferences, so we
|
||||
//put a copy of it inside that CFG (always global) to be able to
|
||||
//use it. Then, when needed I search for preferences inside CFG
|
||||
@@ -676,6 +655,18 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
$status = backup_groups_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print groupings info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groupings");
|
||||
$status = backup_groupings_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print groupings_groups info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," groupings_groups");
|
||||
$status = backup_groupings_groups_info($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Print events info
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," events");
|
||||
@@ -715,6 +706,12 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
//Backup course format data, if any.
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$preferences->backup_course," course format data");
|
||||
$status = backup_format_data($backup_file,$preferences);
|
||||
}
|
||||
|
||||
//Prints course end
|
||||
if ($status) {
|
||||
$status = backup_course_end($backup_file,$preferences);
|
||||
|
||||
+323
-204
@@ -3,81 +3,77 @@
|
||||
//except the mod-related funtions that are into every backuplib.php inside
|
||||
//every mod directory
|
||||
|
||||
//Calculate the number of users to backup and put their ids in backup_ids
|
||||
//Return an array of info (name,value)
|
||||
function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
//$backup_users=0-->all
|
||||
// 1-->course (needed + enrolled)
|
||||
// 2-->none
|
||||
/**
|
||||
* This function calculates the users to be added to backup based in the
|
||||
* settings defined at backup. All the resulting user ids are sent to
|
||||
* backup_ids for later usage.
|
||||
* @param int $courseid id of the course to backup
|
||||
* @param int $backup_unique_code unique code of the backup being executed
|
||||
* @param int $backup_unique_code setting specifying what users to export (0=all, 1=needed, 2=none)
|
||||
* @param int $backup_messages flag (true/false) defining if messages must be
|
||||
* considered to extract needed users
|
||||
* @return array one array (key, value) sumarizing the result of the function (number of users)
|
||||
*/
|
||||
function user_check_backup($courseid,$backup_unique_code,$backup_users,$backup_messages) {
|
||||
|
||||
global $db, $CFG;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$count_users = 0;
|
||||
$backupable_users = array();
|
||||
|
||||
//If we've selected none, simply return 0
|
||||
if ($backup_users == 0 or $backup_users == 1) {
|
||||
if ($backup_users == 0) { /// All users
|
||||
$backupable_users = backup_get_all_users();
|
||||
|
||||
//Now, depending of parameters, create $backupable_users
|
||||
if ($backup_users == 0) {
|
||||
//Calculate all users (every record in users table)
|
||||
$all_users = backup_get_all_users();
|
||||
} else if ($backup_users == 1) { /// Needed users
|
||||
|
||||
$backupable_users = $all_users;
|
||||
} else {
|
||||
//Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($course, $backup_messages);
|
||||
/// Calculate needed users (calling every xxxx_get_participants function + scales users)
|
||||
$needed_users = backup_get_needed_users($courseid, $backup_messages);
|
||||
|
||||
//Calculate enrolled users (students + teachers)
|
||||
$enrolled_users = backup_get_enrolled_users($course);
|
||||
/// Calculate enrolled users (having course:view cap)
|
||||
$enrolled_users = backup_get_enrolled_users($courseid);
|
||||
|
||||
//Calculate course users (needed + enrolled)
|
||||
//First, needed
|
||||
$course_users = $needed_users;
|
||||
|
||||
//Now, enrolled
|
||||
if ($enrolled_users) {
|
||||
foreach ($enrolled_users as $enrolled_user) {
|
||||
$course_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
}
|
||||
/// Calculate backupable users (needed + enrolled)
|
||||
/// First, needed
|
||||
$backupable_users = $needed_users;
|
||||
|
||||
/// Now, enrolled
|
||||
if ($enrolled_users) {
|
||||
foreach ($enrolled_users as $enrolled_user) {
|
||||
$backupable_users[$enrolled_user->id]->id = $enrolled_user->id;
|
||||
}
|
||||
|
||||
$backupable_users = $course_users;
|
||||
}
|
||||
|
||||
//If we have backupable users
|
||||
if ($backupable_users) {
|
||||
//Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
//Is needed user (exists in needed_users)
|
||||
if (isset($needed_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} else if (isset($course_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} // Yu: also needed because they can view course
|
||||
// might need another variable
|
||||
|
||||
//Now create the backup_id record
|
||||
$backupids_rec = new stdClass;
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
//Insert the record id. backup_users decide it.
|
||||
//When all users
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
//Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
}
|
||||
|
||||
//Prepare Info
|
||||
//Gets the user data
|
||||
/// If we have backupable users
|
||||
if ($backupable_users) {
|
||||
/// Iterate over users putting their roles
|
||||
foreach ($backupable_users as $backupable_user) {
|
||||
$backupable_user->info = "";
|
||||
|
||||
/// Is needed user or enrolled user, mark it as needed
|
||||
if (isset($needed_users[$backupable_user->id]) || isset($enrolled_users[$backupable_user->id])) {
|
||||
$backupable_user->info .= "needed";
|
||||
} /// Yu: also needed because they can view course
|
||||
/// might need another variable
|
||||
|
||||
/// Now create the backup_id record
|
||||
$backupids_rec->backup_code = $backup_unique_code;
|
||||
$backupids_rec->table_name = "user";
|
||||
$backupids_rec->old_id = $backupable_user->id;
|
||||
$backupids_rec->info = $backupable_user->info;
|
||||
|
||||
/// TODO: Change this call inserting to a standard backup_putid() call
|
||||
/// And read data acordingly with backup_getid() when needed.
|
||||
/// TODO: Also analyse it the "needed" info is really needed for anything. Drop if not.
|
||||
/// Insert the user to the backup_ids table. backup_user_info() will use that info
|
||||
$status = insert_record('backup_ids', $backupids_rec, false);
|
||||
$count_users++;
|
||||
}
|
||||
/// Do some output
|
||||
backup_flush(30);
|
||||
}
|
||||
|
||||
/// Prepare Info
|
||||
/// Gets the user data
|
||||
$info[0][0] = get_string("users");
|
||||
$info[0][1] = $count_users;
|
||||
|
||||
@@ -721,7 +717,7 @@
|
||||
/// write local course overrides here?
|
||||
write_role_overrides_xml($bf, $context, 3);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 3, $preferences);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 3);
|
||||
//Print header end
|
||||
fwrite ($bf,end_tag("HEADER",2,true));
|
||||
} else {
|
||||
@@ -806,19 +802,21 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get info from messages
|
||||
$unreads = get_records ('message');
|
||||
$reads = get_records ('message_read');
|
||||
$contacts= get_records ('message_contacts');
|
||||
/// Check we have something to backup
|
||||
$unreads = count_records ('message');
|
||||
$reads = count_records ('message_read');
|
||||
$contacts= count_records ('message_contacts');
|
||||
|
||||
if ($unreads || $reads || $contacts) {
|
||||
$counter = 0;
|
||||
//message open tag
|
||||
/// message open tag
|
||||
fwrite ($bf,start_tag("MESSAGES",2,true));
|
||||
|
||||
if ($unreads) {
|
||||
//Iterate over every unread
|
||||
foreach ($unreads as $unread) {
|
||||
//start message
|
||||
$rs_unreads = get_recordset('message');
|
||||
/// Iterate over every unread
|
||||
while ($unread = rs_fetch_next_record($rs_unreads)) {
|
||||
/// start message
|
||||
fwrite($bf, start_tag("MESSAGE",3,true));
|
||||
fwrite ($bf,full_tag("ID",4,false,$unread->id));
|
||||
fwrite ($bf,full_tag("STATUS",4,false,"UNREAD"));
|
||||
@@ -828,10 +826,10 @@
|
||||
fwrite ($bf,full_tag("FORMAT",4,false,$unread->format));
|
||||
fwrite ($bf,full_tag("TIMECREATED",4,false,$unread->timecreated));
|
||||
fwrite ($bf,full_tag("MESSAGETYPE",4,false,$unread->messagetype));
|
||||
//end message
|
||||
/// end message
|
||||
fwrite ($bf,end_tag("MESSAGE",3,true));
|
||||
|
||||
//Do some output
|
||||
/// Do some output
|
||||
$counter++;
|
||||
if ($counter % 20 == 0) {
|
||||
echo ".";
|
||||
@@ -841,12 +839,14 @@
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
rs_close($rs_unreads);
|
||||
}
|
||||
|
||||
if ($reads) {
|
||||
//Iterate over every read
|
||||
foreach ($reads as $read) {
|
||||
//start message
|
||||
$rs_reads = get_recordset('message_read');
|
||||
/// Iterate over every unread
|
||||
while ($read = rs_fetch_next_record($rs_reads)) {
|
||||
/// start message
|
||||
fwrite($bf, start_tag("MESSAGE",3,true));
|
||||
fwrite ($bf,full_tag("ID",4,false,$read->id));
|
||||
fwrite ($bf,full_tag("STATUS",4,false,"READ"));
|
||||
@@ -858,10 +858,10 @@
|
||||
fwrite ($bf,full_tag("MESSAGETYPE",4,false,$read->messagetype));
|
||||
fwrite ($bf,full_tag("TIMEREAD",4,false,$read->timeread));
|
||||
fwrite ($bf,full_tag("MAILED",4,false,$read->mailed));
|
||||
//end message
|
||||
/// end message
|
||||
fwrite ($bf,end_tag("MESSAGE",3,true));
|
||||
|
||||
//Do some output
|
||||
/// Do some output
|
||||
$counter++;
|
||||
if ($counter % 20 == 0) {
|
||||
echo ".";
|
||||
@@ -871,22 +871,24 @@
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
rs_close($rs_reads);
|
||||
}
|
||||
|
||||
if ($contacts) {
|
||||
fwrite($bf, start_tag("CONTACTS",3,true));
|
||||
//Iterate over every contact
|
||||
foreach ($contacts as $contact) {
|
||||
//start contact
|
||||
$rs_contacts = get_recordset('message_contacts');
|
||||
/// Iterate over every contact
|
||||
while ($contact = rs_fetch_next_record($rs_contacts)) {
|
||||
/// start contact
|
||||
fwrite($bf, start_tag("CONTACT",4,true));
|
||||
fwrite ($bf,full_tag("ID",5,false,$contact->id));
|
||||
fwrite ($bf,full_tag("USERID",5,false,$contact->userid));
|
||||
fwrite ($bf,full_tag("CONTACTID",5,false,$contact->contactid));
|
||||
fwrite ($bf,full_tag("BLOCKED",5,false,$contact->blocked));
|
||||
//end contact
|
||||
/// end contact
|
||||
fwrite ($bf,end_tag("CONTACT",4,true));
|
||||
|
||||
//Do some output
|
||||
/// Do some output
|
||||
$counter++;
|
||||
if ($counter % 20 == 0) {
|
||||
echo ".";
|
||||
@@ -896,9 +898,11 @@
|
||||
backup_flush(300);
|
||||
}
|
||||
}
|
||||
rs_close($rs_contacts);
|
||||
fwrite($bf, end_tag("CONTACTS",3,true));
|
||||
}
|
||||
//messages close tag
|
||||
|
||||
/// messages close tag
|
||||
$status = fwrite ($bf,end_tag("MESSAGES",2,true));
|
||||
}
|
||||
|
||||
@@ -957,8 +961,16 @@
|
||||
if(empty($blocks[$instance->blockid]->name)) {
|
||||
continue;
|
||||
}
|
||||
//Begin Block
|
||||
|
||||
//Give the block a chance to process any links in configdata.
|
||||
if (!isset($blocks[$instance->blockid]->blockobject)) {
|
||||
$blocks[$instance->blockid]->blockobject = block_instance($blocks[$instance->blockid]->name);
|
||||
}
|
||||
$config = unserialize(base64_decode($instance->configdata));
|
||||
$blocks[$instance->blockid]->blockobject->backup_encode_absolute_links_in_config($config);
|
||||
$instance->configdata = base64_encode(serialize($config));
|
||||
|
||||
//Begin Block
|
||||
fwrite ($bf,start_tag('BLOCK',3,true));
|
||||
fwrite ($bf,full_tag('ID', 4, false,$instance->id));
|
||||
fwrite ($bf,full_tag('NAME',4,false,$blocks[$instance->blockid]->name));
|
||||
@@ -972,7 +984,7 @@
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4, $preferences);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End Block
|
||||
fwrite ($bf,end_tag('BLOCK',3,true));
|
||||
}
|
||||
@@ -1110,7 +1122,7 @@
|
||||
// get all the role_capabilities overrides in this mod
|
||||
write_role_overrides_xml($bf, $context, 6);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 6, $preferences);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 6);
|
||||
/// write role_assign code here
|
||||
|
||||
fwrite ($bf,end_tag("MOD",5,true));
|
||||
@@ -1133,6 +1145,7 @@
|
||||
function backup_user_info ($bf,$preferences) {
|
||||
|
||||
global $CFG;
|
||||
require_once ($CFG->dirroot.'/tag/lib.php');
|
||||
|
||||
$status = true;
|
||||
|
||||
@@ -1207,26 +1220,10 @@
|
||||
/// write assign/override code for context_userid
|
||||
|
||||
$user->isneeded = strpos($user->info,"needed");
|
||||
//Output every user role (with its associated info)
|
||||
/*
|
||||
$user->isadmin = strpos($user->info,"admin");
|
||||
$user->iscoursecreator = strpos($user->info,"coursecreator");
|
||||
$user->isteacher = strpos($user->info,"teacher");
|
||||
$user->isstudent = strpos($user->info,"student");
|
||||
|
||||
|
||||
if ($user->isadmin!==false or
|
||||
$user->iscoursecreator!==false or
|
||||
$user->isteacher!==false or
|
||||
$user->isstudent!==false or
|
||||
$user->isneeded!==false) {
|
||||
*/
|
||||
fwrite ($bf,start_tag("ROLES",4,true));
|
||||
if ($user->info != "needed" && $user->info!="") {
|
||||
//Begin ROLES tag
|
||||
|
||||
//PRINT ROLE INFO
|
||||
//Admins
|
||||
$roles = explode(",", $user->info);
|
||||
foreach ($roles as $role) {
|
||||
if ($role!="" && $role!="needed") {
|
||||
@@ -1251,6 +1248,43 @@
|
||||
//End ROLES tag
|
||||
fwrite ($bf,end_tag("ROLES",4,true));
|
||||
|
||||
//Check if we have custom profile fields to backup
|
||||
if ($cpfields = get_records_sql("SELECT uif.shortname, uif.datatype, uid.data
|
||||
FROM {$CFG->prefix}user_info_field uif,
|
||||
{$CFG->prefix}user_info_data uid
|
||||
WHERE uif.id = uid.fieldid
|
||||
AND uid.userid = $user->id")) {
|
||||
//Start USER_CUSTOM_PROFILE_FIELDS tag
|
||||
fwrite ($bf,start_tag("USER_CUSTOM_PROFILE_FIELDS",4,true));
|
||||
//Write custom profile fields
|
||||
foreach ($cpfields as $cpfield) {
|
||||
fwrite ($bf,start_tag("USER_CUSTOM_PROFILE_FIELD",5,true));
|
||||
fwrite ($bf,full_tag("FIELD_NAME",6,false,$cpfield->shortname));
|
||||
fwrite ($bf,full_tag("FIELD_TYPE",6,false,$cpfield->datatype));
|
||||
fwrite ($bf,full_tag("FIELD_DATA",6,false,$cpfield->data));
|
||||
fwrite ($bf,end_tag("USER_CUSTOM_PROFILE_FIELD",5,true));
|
||||
}
|
||||
//End USER_CUSTOM_PROFILE_FIELDS tag
|
||||
fwrite ($bf,end_tag("USER_CUSTOM_PROFILE_FIELDS",4,true));
|
||||
}
|
||||
|
||||
//Check if we have user tags to backup
|
||||
if (!empty($CFG->usetags)) {
|
||||
if ($tags = tag_get_tags('user', $user->id)) { //This return them ordered by default
|
||||
//Start USER_TAGS tag
|
||||
fwrite ($bf,start_tag("USER_TAGS",4,true));
|
||||
//Write user tags fields
|
||||
foreach ($tags as $tag) {
|
||||
fwrite ($bf,start_tag("USER_TAG",5,true));
|
||||
fwrite ($bf,full_tag("NAME",6,false,$tag->name));
|
||||
fwrite ($bf,full_tag("RAWNAME",6,false,$tag->rawname));
|
||||
fwrite ($bf,end_tag("USER_TAG",5,true));
|
||||
}
|
||||
//End USER_TAGS tag
|
||||
fwrite ($bf,end_tag("USER_TAGS",4,true));
|
||||
}
|
||||
}
|
||||
|
||||
//Check if we have user_preferences to backup
|
||||
if ($preferences_data = get_records("user_preferences","userid",$user->old_id)) {
|
||||
//Start USER_PREFERENCES tag
|
||||
@@ -1270,7 +1304,7 @@
|
||||
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $context, 4, $preferences);
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End User tag
|
||||
fwrite ($bf,end_tag("USER",3,true));
|
||||
//Do some output
|
||||
@@ -1405,6 +1439,7 @@
|
||||
}
|
||||
|
||||
$status = backup_gradebook_item_info($bf,$preferences, $backupall);
|
||||
$status = backup_gradebook_grade_letters_info($bf,$preferences);
|
||||
$status = backup_gradebook_outcomes_info($bf, $preferences);
|
||||
$status = backup_gradebook_outcomes_courses_info($bf, $preferences);
|
||||
|
||||
@@ -1487,6 +1522,11 @@
|
||||
// do not restore if this grade_item is a mod, and
|
||||
if ($grade_item->itemtype == 'mod') {
|
||||
// this still needs to be included, though grades can be ignored
|
||||
|
||||
//MDL-12463 - exclude grade_items of instances not chosen for backup
|
||||
if (empty($preferences->mods[$grade_item->itemmodule]->instances[$grade_item->iteminstance]->backup)) {
|
||||
continue;
|
||||
}
|
||||
} else if ($grade_item->itemtype == 'category') {
|
||||
// if not all grade items are being backed up
|
||||
// we ignore this type of grade_item and grades associated
|
||||
@@ -1547,6 +1587,41 @@
|
||||
}
|
||||
//Backup gradebook_item (called from backup_gradebook_info
|
||||
|
||||
function backup_gradebook_grade_letters_info($bf, $preferences) {
|
||||
global $CFG;
|
||||
$status = true;
|
||||
|
||||
// getting grade categories, but make sure parents come before children
|
||||
// because when we do restore, we need to recover the parents first
|
||||
// we do this by getting the lowest depth first
|
||||
$context = get_context_instance(CONTEXT_COURSE, $preferences->backup_course);
|
||||
$grade_letters = get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}grade_letters
|
||||
WHERE contextid = $context->id");
|
||||
if ($grade_letters) {
|
||||
//Begin grade_categories tag
|
||||
fwrite ($bf,start_tag("GRADE_LETTERS",3,true));
|
||||
//Iterate for each category
|
||||
foreach ($grade_letters as $grade_letter) {
|
||||
//Begin grade_category
|
||||
fwrite ($bf,start_tag("GRADE_LETTER",4,true));
|
||||
//Output individual fields
|
||||
fwrite ($bf,full_tag("ID",5,false,$grade_letter->id));
|
||||
|
||||
// not keeping path and depth because they can be derived
|
||||
fwrite ($bf,full_tag("LOWERBOUNDARY",5,false,$grade_letter->lowerboundary));
|
||||
fwrite ($bf,full_tag("LETTER",5,false,$grade_letter->letter));
|
||||
|
||||
//End grade_category
|
||||
fwrite ($bf,end_tag("GRADE_LETTER",4,true));
|
||||
}
|
||||
//End grade_categories tag
|
||||
$status = fwrite ($bf,end_tag("GRADE_LETTERS",3,true));
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
function backup_gradebook_outcomes_info($bf,$preferences) {
|
||||
|
||||
global $CFG;
|
||||
@@ -1574,7 +1649,7 @@
|
||||
fwrite ($bf,full_tag("SCALEID",5,false,$grade_outcome->scaleid));
|
||||
fwrite ($bf,full_tag("DESCRIPTION",5,false,$grade_outcome->description));
|
||||
fwrite ($bf,full_tag("TIMECREATED",5,false,$grade_outcome->timecreated));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",5,false,$grade_outcome->timemodified));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",5,false,$grade_outcome->timemodified));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",5,false,$grade_outcome->usermodified));
|
||||
|
||||
//End grade_outcome
|
||||
@@ -1625,28 +1700,31 @@
|
||||
if ($grades = get_records('grade_grades', 'itemid', $itemid)) {
|
||||
fwrite ($bf,start_tag("GRADE_GRADES",5,true));
|
||||
foreach ($grades as $grade) {
|
||||
fwrite ($bf,start_tag("GRADE",6,true));
|
||||
fwrite ($bf,full_tag("ID",7,false,$grade->id));
|
||||
fwrite ($bf,full_tag("USERID",7,false,$grade->userid));
|
||||
fwrite ($bf,full_tag("RAWGRADE",7,false,$grade->rawgrade));
|
||||
fwrite ($bf,full_tag("RAWGRADEMAX",7,false,$grade->rawgrademax));
|
||||
fwrite ($bf,full_tag("RAWGRADEMIN",7,false,$grade->rawgrademin));
|
||||
fwrite ($bf,full_tag("RAWSCALEID",7,false,$grade->rawscaleid));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",7,false,$grade->usermodified));
|
||||
fwrite ($bf,full_tag("FINALGRADE",7,false,$grade->finalgrade));
|
||||
fwrite ($bf,full_tag("HIDDEN",7,false,$grade->hidden));
|
||||
fwrite ($bf,full_tag("LOCKED",7,false,$grade->locked));
|
||||
fwrite ($bf,full_tag("LOCKTIME",7,false,$grade->locktime));
|
||||
fwrite ($bf,full_tag("EXPORTED",7,false,$grade->exported));
|
||||
fwrite ($bf,full_tag("OVERRIDDEN",7,false,$grade->overridden));
|
||||
fwrite ($bf,full_tag("EXCLUDED",7,false,$grade->excluded));
|
||||
fwrite ($bf,full_tag("FEEDBACK",7,false,$grade->feedback));
|
||||
fwrite ($bf,full_tag("FEEDBACKFORMAT",7,false,$grade->feedbackformat));
|
||||
fwrite ($bf,full_tag("INFORMATION",7,false,$grade->information));
|
||||
fwrite ($bf,full_tag("INFORMATIONFORMAT",7,false,$grade->informationformat));
|
||||
fwrite ($bf,full_tag("TIMECREATED",7,false,$grade->timecreated));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",7,false,$grade->timemodified));
|
||||
fwrite ($bf,end_tag("GRADE",6,true));
|
||||
/// Grades are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $grade->userid)) {
|
||||
fwrite ($bf,start_tag("GRADE",6,true));
|
||||
fwrite ($bf,full_tag("ID",7,false,$grade->id));
|
||||
fwrite ($bf,full_tag("USERID",7,false,$grade->userid));
|
||||
fwrite ($bf,full_tag("RAWGRADE",7,false,$grade->rawgrade));
|
||||
fwrite ($bf,full_tag("RAWGRADEMAX",7,false,$grade->rawgrademax));
|
||||
fwrite ($bf,full_tag("RAWGRADEMIN",7,false,$grade->rawgrademin));
|
||||
fwrite ($bf,full_tag("RAWSCALEID",7,false,$grade->rawscaleid));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",7,false,$grade->usermodified));
|
||||
fwrite ($bf,full_tag("FINALGRADE",7,false,$grade->finalgrade));
|
||||
fwrite ($bf,full_tag("HIDDEN",7,false,$grade->hidden));
|
||||
fwrite ($bf,full_tag("LOCKED",7,false,$grade->locked));
|
||||
fwrite ($bf,full_tag("LOCKTIME",7,false,$grade->locktime));
|
||||
fwrite ($bf,full_tag("EXPORTED",7,false,$grade->exported));
|
||||
fwrite ($bf,full_tag("OVERRIDDEN",7,false,$grade->overridden));
|
||||
fwrite ($bf,full_tag("EXCLUDED",7,false,$grade->excluded));
|
||||
fwrite ($bf,full_tag("FEEDBACK",7,false,$grade->feedback));
|
||||
fwrite ($bf,full_tag("FEEDBACKFORMAT",7,false,$grade->feedbackformat));
|
||||
fwrite ($bf,full_tag("INFORMATION",7,false,$grade->information));
|
||||
fwrite ($bf,full_tag("INFORMATIONFORMAT",7,false,$grade->informationformat));
|
||||
fwrite ($bf,full_tag("TIMECREATED",7,false,$grade->timecreated));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",7,false,$grade->timemodified));
|
||||
fwrite ($bf,end_tag("GRADE",6,true));
|
||||
}
|
||||
}
|
||||
$status = fwrite ($bf,end_tag("GRADE_GRADES",5,true));
|
||||
}
|
||||
@@ -1698,32 +1776,35 @@
|
||||
AND ggh.itemid = gi.id")) {
|
||||
fwrite ($bf,start_tag("GRADE_GRADES_HISTORIES",5,true));
|
||||
foreach ($chs as $ch) {
|
||||
fwrite ($bf,start_tag("GRADE_GRADES_HISTORY",6,true));
|
||||
fwrite ($bf,full_tag("ID",7,false,$ch->id));
|
||||
fwrite ($bf,full_tag("ACTION",7,false,$ch->action));
|
||||
fwrite ($bf,full_tag("OLDID",7,false,$ch->oldid));
|
||||
fwrite ($bf,full_tag("SOURCE",7,false,$ch->source));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",7,false,$ch->timemodified));
|
||||
fwrite ($bf,full_tag("LOGGEDUSER",7,false,$ch->loggeduser));
|
||||
fwrite ($bf,full_tag("ITEMID",7,false,$ch->itemid));
|
||||
fwrite ($bf,full_tag("USERID",7,false,$ch->userid));
|
||||
fwrite ($bf,full_tag("RAWGRADE",7,false,$ch->rawgrade));
|
||||
fwrite ($bf,full_tag("RAWGRADEMAX",7,false,$ch->rawgrademax));
|
||||
fwrite ($bf,full_tag("RAWGRADEMIN",7,false,$ch->rawgrademin));
|
||||
fwrite ($bf,full_tag("RAWSCALEID",7,false,$ch->rawscaleid));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",7,false,$ch->usermodified));
|
||||
fwrite ($bf,full_tag("FINALGRADE",7,false,$ch->finalgrade));
|
||||
fwrite ($bf,full_tag("HIDDEN",7,false,$ch->hidden));
|
||||
fwrite ($bf,full_tag("LOCKED",7,false,$ch->locked));
|
||||
fwrite ($bf,full_tag("LOCKTIME",7,false,$ch->locktime));
|
||||
fwrite ($bf,full_tag("EXPORTED",7,false,$ch->exported));
|
||||
fwrite ($bf,full_tag("OVERRIDDEN",7,false,$ch->overridden));
|
||||
fwrite ($bf,full_tag("EXCLUDED",7,false,$ch->excluded));
|
||||
fwrite ($bf,full_tag("FEEDBACK",7,false,$ch->feedback));
|
||||
fwrite ($bf,full_tag("FEEDBACKFORMAT",7,false,$ch->feedbackformat));
|
||||
fwrite ($bf,full_tag("INFORMATION",7,false,$ch->information));
|
||||
fwrite ($bf,full_tag("INFORMATIONFORMAT",7,false,$ch->informationformat));
|
||||
fwrite ($bf,end_tag("GRADE_GRADES_HISTORY",6,true));
|
||||
/// Grades are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $ch->userid)) {
|
||||
fwrite ($bf,start_tag("GRADE_GRADES_HISTORY",6,true));
|
||||
fwrite ($bf,full_tag("ID",7,false,$ch->id));
|
||||
fwrite ($bf,full_tag("ACTION",7,false,$ch->action));
|
||||
fwrite ($bf,full_tag("OLDID",7,false,$ch->oldid));
|
||||
fwrite ($bf,full_tag("SOURCE",7,false,$ch->source));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",7,false,$ch->timemodified));
|
||||
fwrite ($bf,full_tag("LOGGEDUSER",7,false,$ch->loggeduser));
|
||||
fwrite ($bf,full_tag("ITEMID",7,false,$ch->itemid));
|
||||
fwrite ($bf,full_tag("USERID",7,false,$ch->userid));
|
||||
fwrite ($bf,full_tag("RAWGRADE",7,false,$ch->rawgrade));
|
||||
fwrite ($bf,full_tag("RAWGRADEMAX",7,false,$ch->rawgrademax));
|
||||
fwrite ($bf,full_tag("RAWGRADEMIN",7,false,$ch->rawgrademin));
|
||||
fwrite ($bf,full_tag("RAWSCALEID",7,false,$ch->rawscaleid));
|
||||
fwrite ($bf,full_tag("USERMODIFIED",7,false,$ch->usermodified));
|
||||
fwrite ($bf,full_tag("FINALGRADE",7,false,$ch->finalgrade));
|
||||
fwrite ($bf,full_tag("HIDDEN",7,false,$ch->hidden));
|
||||
fwrite ($bf,full_tag("LOCKED",7,false,$ch->locked));
|
||||
fwrite ($bf,full_tag("LOCKTIME",7,false,$ch->locktime));
|
||||
fwrite ($bf,full_tag("EXPORTED",7,false,$ch->exported));
|
||||
fwrite ($bf,full_tag("OVERRIDDEN",7,false,$ch->overridden));
|
||||
fwrite ($bf,full_tag("EXCLUDED",7,false,$ch->excluded));
|
||||
fwrite ($bf,full_tag("FEEDBACK",7,false,$ch->feedback));
|
||||
fwrite ($bf,full_tag("FEEDBACKFORMAT",7,false,$ch->feedbackformat));
|
||||
fwrite ($bf,full_tag("INFORMATION",7,false,$ch->information));
|
||||
fwrite ($bf,full_tag("INFORMATIONFORMAT",7,false,$ch->informationformat));
|
||||
fwrite ($bf,end_tag("GRADE_GRADES_HISTORY",6,true));
|
||||
}
|
||||
}
|
||||
$status = fwrite ($bf,end_tag("GRADE_GRADES_HISTORIES",5,true));
|
||||
}
|
||||
@@ -2174,26 +2255,30 @@
|
||||
//in temp/backup/$backup_code dir
|
||||
$status = check_and_create_user_files_dir($preferences->backup_unique_code);
|
||||
|
||||
//Now iterate over directories under "users" to check if that user must be
|
||||
//copied to backup
|
||||
//Now iterate over directories under "user" to check if that user must be copied to backup
|
||||
|
||||
$rootdir = $CFG->dataroot."/users";
|
||||
//Check if directory exists
|
||||
if (is_dir($rootdir)) {
|
||||
$list = list_directories ($rootdir);
|
||||
if ($list) {
|
||||
//Iterate
|
||||
foreach ($list as $dir) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = get_record ("backup_ids","backup_code",$preferences->backup_unique_code,
|
||||
"table_name","user",
|
||||
"old_id",$dir);
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$status = backup_copy_file($rootdir."/".$dir,
|
||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/user_files/".$dir);
|
||||
}
|
||||
// Method to get a list of userid=>array(basedir => $basedir, userfolder => $userfolder)
|
||||
$userlist = get_user_directories();
|
||||
|
||||
foreach ($userlist as $userid => $userinfo) {
|
||||
//Look for dir like username in backup_ids
|
||||
$data = count_records("backup_ids","backup_code",$preferences->backup_unique_code, "table_name","user", "old_id",$userid);
|
||||
|
||||
//If exists, copy it
|
||||
if ($data) {
|
||||
$parts = explode('/', $userinfo['userfolder']);
|
||||
$status = true;
|
||||
|
||||
if (is_array($parts)) {
|
||||
$group = $parts[0];
|
||||
$userid = $parts[1];
|
||||
|
||||
// Create group dir first
|
||||
$status = check_dir_exists("$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/". $group, true);
|
||||
}
|
||||
|
||||
$status = $status && backup_copy_file($userinfo['basedir'] . '/' . $userinfo['userfolder'],
|
||||
"$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/{$userinfo['userfolder']}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2610,12 +2695,13 @@
|
||||
}
|
||||
|
||||
/* function to print xml for assignment */
|
||||
function write_role_assignments_xml($bf, $context, $startlevel, $preferences) {
|
||||
function write_role_assignments_xml($bf, $preferences, $context, $startlevel) {
|
||||
/// write role_assign code here
|
||||
fwrite ($bf, start_tag("ROLES_ASSIGNMENTS", $startlevel, true));
|
||||
|
||||
if ($roles = get_roles_with_assignment_on_context($context)) {
|
||||
foreach ($roles as $role) {
|
||||
/// Skip non-selected roles
|
||||
if (!isset($preferences->backuproleassignments[$role->id])) {
|
||||
continue;
|
||||
}
|
||||
@@ -2626,19 +2712,22 @@
|
||||
fwrite ($bf, start_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
if ($assignments = get_users_from_role_on_context($role, $context)) {
|
||||
foreach ($assignments as $assignment) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
/// Role assignments are only sent to backup if the user is one target user
|
||||
if (backup_getid($preferences->backup_unique_code, 'user', $assignment->userid)) {
|
||||
fwrite ($bf, start_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
fwrite ($bf, full_tag("USERID", $startlevel+4, false, $assignment->userid));
|
||||
fwrite ($bf, full_tag("HIDDEN", $startlevel+4, false, $assignment->hidden));
|
||||
fwrite ($bf, full_tag("TIMESTART", $startlevel+4, false, $assignment->timestart));
|
||||
fwrite ($bf, full_tag("TIMEEND", $startlevel+4, false, $assignment->timeend));
|
||||
fwrite ($bf, full_tag("TIMEMODIFIED", $startlevel+4, false, $assignment->timemodified));
|
||||
if (!isset($assignment->modifierid)) {
|
||||
$assignment->modifierid = 0;
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
fwrite ($bf, full_tag("MODIFIERID", $startlevel+4, false, $assignment->modifierid));
|
||||
fwrite ($bf, full_tag("ENROL", $startlevel+4, false, $assignment->enrol));
|
||||
fwrite ($bf, full_tag("SORTORDER", $startlevel+4, false, $assignment->sortorder));
|
||||
fwrite ($bf, end_tag("ASSIGNMENT", $startlevel+3, true));
|
||||
}
|
||||
}
|
||||
fwrite ($bf, end_tag("ASSIGNMENTS", $startlevel+2, true));
|
||||
@@ -3145,30 +3234,38 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generates the default zipfile name for a backup
|
||||
* based on the course id and the unique code.
|
||||
*
|
||||
* @param object $course course object
|
||||
* @param string $backup_unique_code (optional, if left out current timestamp used)
|
||||
*
|
||||
* This function calculates the "backup" part of the file name
|
||||
* from lang files. Used both in manual and scheduled backups
|
||||
*
|
||||
* @param object $course course object
|
||||
* @return string "backup" part of the filename
|
||||
*/
|
||||
function backup_get_backup_string($course) {
|
||||
|
||||
* @return string filename (excluding path information)
|
||||
*/
|
||||
function backup_get_zipfile_name($course, $backup_unique_code='') {
|
||||
|
||||
if (empty($backup_unique_code)) {
|
||||
$backup_unique_code = time();
|
||||
}
|
||||
|
||||
//Calculate the backup word
|
||||
//Take off some characters in the filename !!
|
||||
/// Calculate the backup word
|
||||
/// Take off some characters in the filename !!
|
||||
$takeoff = array(" ", ":", "/", "\\", "|");
|
||||
$backup_word = str_replace($takeoff,"_",moodle_strtolower(get_string("backupfilename")));
|
||||
//If non-translated, use "backup"
|
||||
/// If non-translated, use "backup"
|
||||
if (substr($backup_word,0,1) == "[") {
|
||||
$backup_word= "backup";
|
||||
}
|
||||
|
||||
return $backup_word;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generates the default zipfile name for a backup
|
||||
* based on the course shortname
|
||||
*
|
||||
* @param object $course course object
|
||||
* @return string filename (excluding path information)
|
||||
*/
|
||||
function backup_get_zipfile_name($course) {
|
||||
|
||||
//Calculate the backup word
|
||||
$backup_word = backup_get_backup_string($course);
|
||||
|
||||
//Calculate the date format string
|
||||
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
|
||||
//If non-translated, use "%Y%m%d-%H%M"
|
||||
@@ -3195,9 +3292,31 @@
|
||||
$backup_name = clean_filename($backup_name);
|
||||
|
||||
return $backup_name;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generates the common file substring for a course
|
||||
* used to keep n copies by the scheduled backup
|
||||
*
|
||||
* @param object $course course object
|
||||
* @return string common part of filename in backups of this course
|
||||
*/
|
||||
function backup_get_keep_name($course) {
|
||||
|
||||
//Calculate the backup word
|
||||
$backup_word = backup_get_backup_string($course);
|
||||
|
||||
//Calculate the shortname
|
||||
$backup_shortname = clean_filename($course->shortname);
|
||||
if (empty($backup_shortname) or $backup_shortname == '_' ) {
|
||||
$backup_shortname = $course->id;
|
||||
}
|
||||
|
||||
$keep_name = $backup_word . "-" . moodle_strtolower($backup_shortname)."-";
|
||||
$keep_name = clean_filename($keep_name);
|
||||
|
||||
return $keep_name;
|
||||
}
|
||||
/**
|
||||
* This function adds on the standard items to the preferences
|
||||
* Like moodle version and backup version
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||
|
||||
function get_subdirs($directory){
|
||||
$opendirectory = opendir( $directory );
|
||||
while($filename = readdir($opendirectory)) {
|
||||
while(false !== ($filename = readdir($opendirectory))) {
|
||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||
$subdirs[] = $filename;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user