Compare commits
1376 Commits
main
...
MOODLE_16_STABLE
| Author | SHA1 | Date | |
|---|---|---|---|
| fb1a72d5c2 | |||
| a99a407be6 | |||
| fa797f3a40 | |||
| 8ad0149fa3 | |||
| 1f52eab1c2 | |||
| a4f0dd0725 | |||
| 4861848c62 | |||
| 32e87fb8cc | |||
| a1a2744faa | |||
| 3c818366d0 | |||
| 06d179ba03 | |||
| 22931115b8 | |||
| 0450d2ad6b | |||
| 1dc7d28efd | |||
| 1d474809f0 | |||
| 84bf26c960 | |||
| 30728be868 | |||
| 43a542fab8 | |||
| 39346f4e00 | |||
| c90543941f | |||
| 59061d0628 | |||
| fd7b7b623c | |||
| 43f5d63d99 | |||
| 38756f1b65 | |||
| 95fffd7239 | |||
| d8ef3b94ae | |||
| 75feff1154 | |||
| 4ef4057d19 | |||
| cd78b6a4fd | |||
| b3b7f01ea7 | |||
| 321f304e32 | |||
| 6be96928e0 | |||
| 8b42c7b7f9 | |||
| 619f7e2c16 | |||
| 2de0a3307c | |||
| 7fbff7de54 | |||
| e65ecb0fbf | |||
| a1e444d9f7 | |||
| f60acaa422 | |||
| 7635eb8620 | |||
| b50197a1ee | |||
| 6ff056d87c | |||
| e260bf1c12 | |||
| d45bbc5ab0 | |||
| ec909cb3e5 | |||
| 0b46cf2a3a | |||
| d70d3c3ed5 | |||
| 078e601224 | |||
| ea1738cd2e | |||
| 1b5540ffd1 | |||
| 6d0b28c36c | |||
| 06d0d206dc | |||
| 5bcf0ab5c1 | |||
| 6955865507 | |||
| e15c4f35c4 | |||
| 0260923ace | |||
| 5a5731d75c | |||
| 9ea07e769d | |||
| 3ab9b23c56 | |||
| 3f19182952 | |||
| fa6cbbc1c6 | |||
| f818027ce2 | |||
| 89d5a70f5f | |||
| 585259ad63 | |||
| 284f2e43ec | |||
| c73b015097 | |||
| 4d0279952d | |||
| 0c01d3bdda | |||
| 8470c445c1 | |||
| ae3526d98e | |||
| 3645f5bad3 | |||
| 75d7097d0d | |||
| e4e1020939 | |||
| 613ac4ffae | |||
| d52d91b293 | |||
| a8b0a0d431 | |||
| 9c0ef1c8c8 | |||
| 3e31f4e2e2 | |||
| 56f31bce4f | |||
| 023bf01579 | |||
| 157decabd5 | |||
| a9d90c6ec9 | |||
| 5c2f9d14ac | |||
| f68037cf68 | |||
| 98daf5d749 | |||
| b571bf84a3 | |||
| c8a43d77e5 | |||
| 829facda7c | |||
| 7f43d9852e | |||
| 3af8b37abe | |||
| 0e3cf9d774 | |||
| 86b4781cb4 | |||
| 843d264f26 | |||
| d3a7d918c2 | |||
| e45607b491 | |||
| ebad4013c8 | |||
| c1eea3935a | |||
| 8693848fe2 | |||
| 72ae20b946 | |||
| 7b8a8bc587 | |||
| cb46a969f8 | |||
| f01f112873 | |||
| 232866f6c3 | |||
| a96dff44c3 | |||
| a447229f96 | |||
| ec34bda1fc | |||
| 1899c6567a | |||
| 6ec6c2d156 | |||
| a8bf60a0ab | |||
| 249de4f532 | |||
| 9652995f7d | |||
| f6641be6b7 | |||
| 726d8b5805 | |||
| 04ea70175b | |||
| 4497e89c9f | |||
| 4fc304ca82 | |||
| 8fd3d38509 | |||
| 6e6f33e6f2 | |||
| 5104726b9f | |||
| 97e2fee8d2 | |||
| a9456360f9 | |||
| 376a031f4c | |||
| 2c450e82d9 | |||
| 7658e24915 | |||
| 60ec12e055 | |||
| be074bc3e6 | |||
| 0259eda698 | |||
| cfdfc85ddc | |||
| 6fa56c54f3 | |||
| c14c54c22a | |||
| ae4b11cbfd | |||
| f452e874bc | |||
| 21d1ce8edd | |||
| 45d22afdcc | |||
| 7f33aa0cd4 | |||
| df489b8217 | |||
| f19e9ea7e7 | |||
| 48b31fcc65 | |||
| 6a4fc5046f | |||
| 947d915a8f | |||
| d37502617e | |||
| a22772f8e3 | |||
| 0b2f6d13cf | |||
| 767e292319 | |||
| 2c6041eb5a | |||
| 94e5a9c78f | |||
| 4b4b981562 | |||
| b74bd9ce19 | |||
| 2519a70a19 | |||
| 5ed379d713 | |||
| 5fbb72ba43 | |||
| 7c0be404c8 | |||
| e724611042 | |||
| 5a66d54c05 | |||
| 58b037a501 | |||
| 71dbb2abb0 | |||
| fdebc24f38 | |||
| 761ed63243 | |||
| 378464df6a | |||
| 8720c8d50c | |||
| f7f5109386 | |||
| 71092feb39 | |||
| e216127ee6 | |||
| 9aafb499a7 | |||
| e410c5e2e8 | |||
| 2277a1409c | |||
| 8ef47e0880 | |||
| 1eae77d4f6 | |||
| f1efb1f1c6 | |||
| 89fea782d9 | |||
| d3401c2db5 | |||
| da1aa1b461 | |||
| 2e47a8968e | |||
| 3b9e6de01d | |||
| c313ffa5db | |||
| 1b09c97190 | |||
| d9aff3e8ba | |||
| f238441d45 | |||
| 12e5b3c2b1 | |||
| b7515bca14 | |||
| 9f94e60e36 | |||
| 9ec94a8623 | |||
| e188ec9b1f | |||
| 0165dea2c6 | |||
| a3a940c7fb | |||
| 0227d32dff | |||
| 2fa9af0d78 | |||
| 24f32e4836 | |||
| 9e6ab88530 | |||
| de9eaaac1d | |||
| 9a72d21147 | |||
| a9673e7550 | |||
| 8a3df96e52 | |||
| 3e3a8001b2 | |||
| ae7805aec3 | |||
| 4912fa485e | |||
| 575447dd68 | |||
| 071b220cbb | |||
| 282aeac984 | |||
| af49230f9a | |||
| dae85a4750 | |||
| f622567f6c | |||
| a8c857d3c2 | |||
| 3bd4380e4a | |||
| 9e3e85eb05 | |||
| 91cf2fb230 | |||
| 8acecdb821 | |||
| e29a752173 | |||
| a0001e3a6d | |||
| edbbeb02f2 | |||
| d8e68c5e51 | |||
| c82a4d6d36 | |||
| 9d8453becd | |||
| 52f79e8fd4 | |||
| 3bc52bdb1e | |||
| 8c239c8315 | |||
| 57fead9527 | |||
| 5394e9c99b | |||
| 1dbbbb3118 | |||
| 9cf8933ec3 | |||
| 9b0f6ae71d | |||
| 32993fef61 | |||
| 9cd0ada241 | |||
| 009d136f72 | |||
| 719ef5f313 | |||
| df5039c5ca | |||
| a18c40a892 | |||
| 3281b7d075 | |||
| ea7a090955 | |||
| 788376bb52 | |||
| 1c496238c3 | |||
| cd3f0da747 | |||
| d8720eebc3 | |||
| b7f1aeee3f | |||
| 9c53d3286c | |||
| fc418ee754 | |||
| 8a3043d26d | |||
| 973342ab16 | |||
| 15b10f5cab | |||
| c00bb02c52 | |||
| afccfe8752 | |||
| 78e4c3dd6c | |||
| b4af3c2f48 | |||
| b3f9b5c1c2 | |||
| 81ee42cb0f | |||
| f7fe32525a | |||
| dad0965802 | |||
| 10e2074684 | |||
| 419a0bb0a8 | |||
| 485726e71f | |||
| bc1f84e618 | |||
| fc144c4992 | |||
| 902590a7d1 | |||
| d7a7b5b5db | |||
| 35decbd8be | |||
| 284060cc7e | |||
| 20a37a126e | |||
| 1b6fbd596c | |||
| 17b39b6c95 | |||
| a1cac4a086 | |||
| 09f187c0db | |||
| 1e0a4f87fc | |||
| 9fb8e5ed17 | |||
| ffd9b01913 | |||
| 3c582678cf | |||
| c63af80f85 | |||
| 09bd9bb66b | |||
| 244c10cf84 | |||
| f4959dc939 | |||
| e7a84ec034 | |||
| 00e53e7c36 | |||
| cdf10a35ab | |||
| 561bb4feac | |||
| eaf134b1bb | |||
| f035daedca | |||
| 4e3ee63c2e | |||
| d58e4f8a04 | |||
| 4afc877819 | |||
| 86f4390922 | |||
| cddc532c21 | |||
| cd4858ed49 | |||
| 609618521b | |||
| 123f94ad3a | |||
| 5da4f6bf37 | |||
| 57ba54429f | |||
| 84ef448820 | |||
| 80e2ce03fb | |||
| 812d7e4a29 | |||
| 4c74467eae | |||
| f10bf825df | |||
| 3676309617 | |||
| 8bcbbf13e3 | |||
| 81e7672216 | |||
| 183185d12b | |||
| bdea788034 | |||
| 5c3a0f7cf6 | |||
| 13d1518108 | |||
| a24948b64f | |||
| c6d0697e7a | |||
| 82dd519e4f | |||
| 08da658c0b | |||
| e6fb20e1b4 | |||
| c9bd758adb | |||
| 1bc1ee7884 | |||
| 05318aa55a | |||
| 87577fc045 | |||
| f08799bc80 | |||
| 0f1f94408a | |||
| 61231d5b66 | |||
| d8793bf35c | |||
| d88d4d9309 | |||
| 911812794c | |||
| e29818bf9c | |||
| 8ec981d1eb | |||
| 52a257bb99 | |||
| 4955f652fa | |||
| 39eda5c5e8 | |||
| 3e93268a0a | |||
| a61217d94e | |||
| 7dcc760e18 | |||
| acb6697543 | |||
| 77d6f641ba | |||
| 2cc1083e86 | |||
| 50219aacc1 | |||
| b84d9721c0 | |||
| f466b19ca6 | |||
| 1e1ac99513 | |||
| 6a1596099d | |||
| d827e21645 | |||
| dab8f5a24d | |||
| 7ecfb0c038 | |||
| f5a13d3f08 | |||
| 6317484ca7 | |||
| bd90f02488 | |||
| 3ce0e8274f | |||
| bd2cf8f046 | |||
| 2dd1350d64 | |||
| 55a30b97ad | |||
| e2ea245646 | |||
| 9b2fb1535b | |||
| 8960cc3780 | |||
| 541411b819 | |||
| 0c9a031f46 | |||
| c109bb608a | |||
| cc9232e04f | |||
| 5914b10e9c | |||
| 830f83030c | |||
| 9c08fcb1a3 | |||
| d421c0df1a | |||
| e4f0ab116b | |||
| ead0918c36 | |||
| 73ba657df4 | |||
| 7d11d206b0 | |||
| b19040a294 | |||
| 48026c58cb | |||
| 6172a24c6e | |||
| b5a1d81585 | |||
| ee2c3b4de9 | |||
| 62154f84d7 | |||
| ad8c93de3e | |||
| 88cd5d6f9f | |||
| f733b58e83 | |||
| 3f4df7071b | |||
| fc35fab7ec | |||
| 66be99b9b6 | |||
| c19838ded3 | |||
| f5e90caea6 | |||
| 8bc93dfa68 | |||
| 9ede45bcc1 | |||
| 8f716e31b3 | |||
| 1c0d156bd4 | |||
| 8b1f05f897 | |||
| 348355c4b8 | |||
| 753f1af690 | |||
| 53ab66c884 | |||
| aaba34cc52 | |||
| 326a83e109 | |||
| 182e92853e | |||
| dcd74d318f | |||
| 19874f6151 | |||
| b5bbd35f96 | |||
| c2dd7cadf8 | |||
| 801ec7da79 | |||
| 8ffb888712 | |||
| 7a16844405 | |||
| 11e8c61f48 | |||
| 38d5b701af | |||
| 9201c4146f | |||
| b15b35f6e6 | |||
| 5cdfc06bd3 | |||
| 653d21470d | |||
| 53be4b873f | |||
| 18425af78f | |||
| 795a0d8c34 | |||
| c545000a26 | |||
| 0b5657c765 | |||
| ec354d2a91 | |||
| ea7dee0d8a | |||
| 19fc43f5eb | |||
| d985ae5bdd | |||
| ad4dd3d4b8 | |||
| 0e7b1d7ac7 | |||
| 9d3ea5340d | |||
| 513a01bfaf | |||
| 4ee3d4ac06 | |||
| 696f45ea73 | |||
| 3866b318aa | |||
| da4c604c9d | |||
| 348375da21 | |||
| 337b664176 | |||
| 297b1bd905 | |||
| ff1f958c13 | |||
| 3bdb864d50 | |||
| 192f479e2b | |||
| 24644d6a56 | |||
| 231836a596 | |||
| f9fbfb4659 | |||
| 9b00e4cf72 | |||
| 0bf87d3181 | |||
| 5b77a01ea4 | |||
| f0a7c95b24 | |||
| adec76796a | |||
| d8b440ec76 | |||
| 19ff614093 | |||
| 917a1974a3 | |||
| 2c54796fcb | |||
| fab42b82f3 | |||
| 6886a6fc5b | |||
| 240e3cde63 | |||
| d6751efc2b | |||
| f09a285a6a | |||
| 5480a9bee0 | |||
| 3dd1cc23b6 | |||
| edf174b46a | |||
| 15d0d20614 | |||
| 33a50fa858 | |||
| e9bbfc15fc | |||
| 066f42726a | |||
| e2a93751ff | |||
| b06d0196b4 | |||
| 54ccc96b58 | |||
| ef10728a74 | |||
| 0960421191 | |||
| 7cdd2a596f | |||
| a2f89145fd | |||
| d810bd41cb | |||
| f6f75237a9 | |||
| 5402e5dec3 | |||
| 14a62bfcd5 | |||
| 3a4cd9d998 | |||
| 32fd8433d9 | |||
| f9cd1321ac | |||
| 2718918af5 | |||
| 5c578b2bc2 | |||
| 2357b57391 | |||
| bbf1f5d397 | |||
| 8ef0bbf6c3 | |||
| da70138cfa | |||
| 84f7bcc8ee | |||
| 362c2fd638 | |||
| 440d212f5c | |||
| c7c6c2ea0b | |||
| bc63c4bac3 | |||
| 89edf6b390 | |||
| 5d7a6597c1 | |||
| b13cfe12a6 | |||
| a4495be67a | |||
| 0f7cac279c | |||
| eff26434e0 | |||
| 74fe60674c | |||
| e8e05625ec | |||
| 1040d76e82 | |||
| 4531718527 | |||
| d56eaba132 | |||
| a8c20a1629 | |||
| 12ef3b787b | |||
| 4aeab730e9 | |||
| 18a742f9c6 | |||
| 822d3bfdc4 | |||
| b620f6843b | |||
| 6351bf91c9 | |||
| fffe36691f | |||
| 8327b31057 | |||
| 3080f36495 | |||
| 4bb30981a0 | |||
| 423ffdeda2 | |||
| 3f12881e16 | |||
| 4ca8d4783b | |||
| fee8ca9ee9 | |||
| e22ebd9267 | |||
| 81b65d5a10 | |||
| 272871028e | |||
| 48e8c9562e | |||
| 5f118ae0dd | |||
| 2456a9fbf6 | |||
| 5dc9e87812 | |||
| 2143ce3083 | |||
| 94a7364394 | |||
| dc1b9006e5 | |||
| e6c83418a4 | |||
| 7b6c589a50 | |||
| 745c14145b | |||
| b86e99c98d | |||
| 7bead1ecf8 | |||
| 14400b8274 | |||
| 8f8ac09b6d | |||
| 1e1a04a695 | |||
| 55e677148c | |||
| 2fc775008e | |||
| b204171348 | |||
| 0ee781c85a | |||
| 9af0972fd1 | |||
| 447f9047cd | |||
| d61edeec07 | |||
| 5987855a0a | |||
| 86668a76ec | |||
| 855165f531 | |||
| ee766268a3 | |||
| 0a0c56807c | |||
| 3c4d4cd8e7 | |||
| 3d5690d8b0 | |||
| 2aaed68eee | |||
| ca477ee66a | |||
| d535f143ac | |||
| eec943ef26 | |||
| 24fcdd14c0 | |||
| dd08b0d166 | |||
| 3d365baa65 | |||
| 70a892eb51 | |||
| 6ec0b677e7 | |||
| 224a2b4c05 | |||
| ac9bdaadc1 | |||
| 98b4d4d6a8 | |||
| 914a7bcad3 | |||
| 75ad2e9487 | |||
| 6117074c05 | |||
| 02d62036db | |||
| bb19f33228 | |||
| 6b06e02c33 | |||
| 6a66541391 | |||
| 3f62782cd9 | |||
| c848b76045 | |||
| d75825e75b | |||
| 64d92486a5 | |||
| c049c12abf | |||
| fef4937cb1 | |||
| 375a0ea8de | |||
| d4f098178a | |||
| 268ab771b6 | |||
| cb94fd11d5 | |||
| 8ec2d86edf | |||
| ce422c25d6 | |||
| e4af9c32ff | |||
| 94d52f8f02 | |||
| 46b5cf7cb7 | |||
| 856683e596 | |||
| d4d2a5bc3e | |||
| fbda575645 | |||
| 572badbdce | |||
| bcde80f2b3 | |||
| 6b63e3d905 | |||
| 39cbc2bf7b | |||
| 33f0ea4178 | |||
| 992d6a3a44 | |||
| ea0d8cea76 | |||
| 1b6cc50342 | |||
| 3d2e01f6c8 | |||
| 4ae8c9aca1 | |||
| e1088a97ec | |||
| 80006e6017 | |||
| b9f4f2227c | |||
| 509f5d23e0 | |||
| ffd7d3d7c2 | |||
| eb0208d591 | |||
| a32090a4c1 | |||
| 7b66125271 | |||
| 98632cd3c8 | |||
| 0a60ef6e45 | |||
| 49ebbad5fa | |||
| e873787168 | |||
| fb4990ca39 | |||
| 7032c917e3 | |||
| a4a6aafe48 | |||
| 718647bcb1 | |||
| 14a60a077b | |||
| 14e0fcb120 | |||
| 64422b601f | |||
| 8419513e13 | |||
| f990f10f77 | |||
| 4ab16d477d | |||
| 2e633ad500 | |||
| 00ba27c582 | |||
| 6ca5cf268b | |||
| b9bdd0c7b6 | |||
| 594c911aad | |||
| cfca034aed | |||
| 2c669a7383 | |||
| ca72bce30c | |||
| c8f1d1ca37 | |||
| f18c648ae7 | |||
| 2da3d6983b | |||
| 2a02ff39c6 | |||
| 0a69834d90 | |||
| a8fdaa5c38 | |||
| 1387c879d5 | |||
| dfa4dd740a | |||
| 164c865fc7 | |||
| 1dfae875f2 | |||
| ff5d1865c4 | |||
| 29177c6a0d | |||
| 4454213c7b | |||
| e340d9f14b | |||
| d36d45416f | |||
| 3fc2c3c266 | |||
| 008537d5c3 | |||
| f65b8599b5 | |||
| 80161aad61 | |||
| dc77f7b55c | |||
| c83afe4ec2 | |||
| 8aa18dddc8 | |||
| d0f5c048e2 | |||
| 498ce7e832 | |||
| f329c16428 | |||
| 3398e99d5d | |||
| 158210e49f | |||
| 85fb025135 | |||
| 4fbf8bd7b3 | |||
| 1762e9204c | |||
| 5f57a74789 | |||
| f009e194ec | |||
| 9f686c8a69 | |||
| c630b0ba86 | |||
| 38c1666070 | |||
| debad50603 | |||
| a234a89cc8 | |||
| 8583655bf9 | |||
| 1796aa9fcc | |||
| 7c1376125d | |||
| 1c66afe8f1 | |||
| 2989d4cc7c | |||
| f0db2fe9c3 | |||
| 5679493192 | |||
| d6bddd46c6 | |||
| 7ac61104a3 | |||
| 987e0d3be5 | |||
| 7980ea00c3 | |||
| 02cc013abf | |||
| 01b91ac459 | |||
| 4f70e2756a | |||
| f6965dc685 | |||
| 86218462fc | |||
| 383df89595 | |||
| dc7dd83b88 | |||
| a901d8fd4c | |||
| ea8e7f9936 | |||
| 0d2b4325ec | |||
| b1d70beafa | |||
| 3827e2d359 | |||
| 58d079df96 | |||
| b139f7ae4b | |||
| 0e448ae3c0 | |||
| 79fc4a6726 | |||
| 0d3b042fec | |||
| 2864912fe0 | |||
| 5b3a7e59a8 | |||
| 7b0d235253 | |||
| 22c633e8b7 | |||
| 664f80662e | |||
| ac63de90c6 | |||
| 5f4a37b5b2 | |||
| 666ebd7bcf | |||
| 9b4f94bd92 | |||
| a88c450679 | |||
| 6a973240af | |||
| 3e3c6eec08 | |||
| 8de4f2e23e | |||
| 9d3089562a | |||
| 77ec0e627e | |||
| abf39fb332 | |||
| 2877856383 | |||
| f03e81eb03 | |||
| 75e59b1a22 | |||
| e2eb506371 | |||
| 9f811896b8 | |||
| a12743a49b | |||
| e8131aa214 | |||
| faafe84561 | |||
| df8ac6d2e6 | |||
| c98d228b96 | |||
| 9180b308f4 | |||
| 586e08ac32 | |||
| 13ad4e12e1 | |||
| f83a24b87b | |||
| bf08108c94 | |||
| f610ac5e18 | |||
| bfd5c5d7f6 | |||
| 5decc6f064 | |||
| f598a45f2e | |||
| eb9b7f1a3e | |||
| 4508fdd282 | |||
| 6a2f9ca922 | |||
| a565cb2f8e | |||
| bf9cdc2b90 | |||
| 19660487d0 | |||
| 5ab3937c6e | |||
| 22fa4da34f | |||
| 0ee1574512 | |||
| b02b2f70d7 | |||
| 0679583490 | |||
| 5ba8b19939 | |||
| 4d21686218 | |||
| 79cd394c82 | |||
| 18e2de4313 | |||
| 0eeec1a96f | |||
| 4e2cbb28e5 | |||
| 5a521aa30f | |||
| 01b9db69e2 | |||
| 91bfeb65ea | |||
| 16ae471c30 | |||
| e22b34ec32 | |||
| 7025366210 | |||
| e133c32ff3 | |||
| 84e6ee9c38 | |||
| 4c831b7078 | |||
| cd79115069 | |||
| cd1e684b2c | |||
| d67514acb8 | |||
| 0d4537c796 | |||
| fdb76e639f | |||
| e59fded4ef | |||
| 8529d9b6d8 | |||
| c23339e968 | |||
| 5fc3c306f4 | |||
| 207793f82f | |||
| 2b64c31597 | |||
| f7abe85cc0 | |||
| 5cd1517bc3 | |||
| 7ecefcb090 | |||
| 7a23b4d63c | |||
| 00c5890a15 | |||
| 45cd0cfde8 | |||
| 0a861d4506 | |||
| dcd2895639 | |||
| b88378acb9 | |||
| 06bbfff66e | |||
| da4714358a | |||
| 48e2bf159a | |||
| 48b358ba56 | |||
| 029d0a28bd | |||
| c26ac7924f | |||
| 51034f13f8 | |||
| a1ecd20a19 | |||
| a7ea2d7dcc | |||
| 915db857b8 | |||
| 6c05439a08 | |||
| b5c240e397 | |||
| e8e814e5c7 | |||
| 0fc2503718 | |||
| f5c2ff517f | |||
| 74948bb2e7 | |||
| ec7a860ff5 | |||
| 0f69811d98 | |||
| 0b038e2d43 | |||
| 02f0217c20 | |||
| 105a8f399f | |||
| c071606525 | |||
| dfa8b0f06a | |||
| 8953a3b44f | |||
| 6223b2eb1e | |||
| f4f18fb00c | |||
| 98830278dc | |||
| 2928e3d2d6 | |||
| ea07be815b | |||
| 10d7f1525d | |||
| d51d6583a7 | |||
| 6703e4af2d | |||
| 530c61afe7 | |||
| 58c98fa207 | |||
| beb6c6cdb7 | |||
| 964f6d4f17 | |||
| 905c6f3261 | |||
| e1210ad3c3 | |||
| 2492b30859 | |||
| 8e9f9bec69 | |||
| 47c8660050 | |||
| 8860ceb4d2 | |||
| a45c1d139a | |||
| ecdb04ca06 | |||
| 0f7fcc8377 | |||
| 4b8df782c6 | |||
| 3ad4a1097b | |||
| 21c2f2ef29 | |||
| c58f4f10b3 | |||
| 9978506b11 | |||
| 980b1e04bc | |||
| 0fc71cc508 | |||
| 9a0d8fd2b3 | |||
| d2b00aae1d | |||
| 2a94a64a06 | |||
| d7a5c75f30 | |||
| 54ac3dd31a | |||
| be029bdf25 | |||
| b573d77752 | |||
| db5219aacd | |||
| 9a2539db21 | |||
| dd241f341a | |||
| fe2bc06329 | |||
| 58643a8110 | |||
| 1a10d9049f | |||
| 4221b8647c | |||
| 8fd49aa444 | |||
| d91f79789a | |||
| 5eeebefba9 | |||
| 87cb44ac9f | |||
| 644600315c | |||
| 905fdcaa31 | |||
| a97a4a87bd | |||
| c3d36a923f | |||
| 3cfe476b39 | |||
| 146a1735ac | |||
| 8dc6117433 | |||
| 08f72e477c | |||
| d1c93d9605 | |||
| eede7619ef | |||
| bf6f63ae00 | |||
| 2f1dff3561 | |||
| d0b4e8226f | |||
| 889d2b5ead | |||
| 43935e12c9 | |||
| ad44e5c049 | |||
| 4075eb10da | |||
| 10bafd3d21 | |||
| 605737cdfb | |||
| 595eda8d9c | |||
| 56def90b83 | |||
| 74f6a9fb7e | |||
| 8e764b36b1 | |||
| 93f973f08b | |||
| 4e7d821b34 | |||
| 31c46027aa | |||
| 4e2b4b1bc2 | |||
| 2fa6e1ff26 | |||
| e63dc8ea91 | |||
| 8c251d1a93 | |||
| 4985c39b50 | |||
| 4f1c93d6dc | |||
| 96ef5c792a | |||
| e10e4fdd55 | |||
| f2ea23a1bd | |||
| 6b319a8087 | |||
| 172d326c41 | |||
| 8d6c9a68b1 | |||
| e2337127eb | |||
| 462a25fe75 | |||
| 8a774fddb7 | |||
| 059366fe22 | |||
| 834f10e9b2 | |||
| 14080bd00a | |||
| 23ea06dfbe | |||
| 8d2529e59e | |||
| 8f527a42ee | |||
| f8100e3629 | |||
| 25cbc9d08f | |||
| 88e912b1b1 | |||
| 31222bc4ef | |||
| 34db6d30a0 | |||
| 63d337cf47 | |||
| 285105fbf1 | |||
| b1682ee480 | |||
| 226f066ed5 | |||
| 08a1da2bb9 | |||
| 9b2f93bcf3 | |||
| ec64d5223d | |||
| 6ce20e4d58 | |||
| e48bc9eb25 | |||
| 74b29acec4 | |||
| 613b02036f | |||
| 495f166ec4 | |||
| d0f8a899f8 | |||
| 0183254bc5 | |||
| bbdb1c3815 | |||
| e9dbe49121 | |||
| e714706c42 | |||
| f450edd426 | |||
| 09447862c0 | |||
| 96856b5798 | |||
| 28e58deb41 | |||
| ab6508500c | |||
| 0b32ca3ba0 | |||
| 9a2e6ce88c | |||
| 070a7cc0c2 | |||
| 2277cfb8fb | |||
| 551d2b59bf | |||
| 7203acd306 | |||
| 07f579d0bd | |||
| 732581eb56 | |||
| 344c23c0ef | |||
| b515688ddb | |||
| 76f8821cfc | |||
| 95e34d9299 | |||
| bc77686a08 | |||
| 720669a6db | |||
| d6b7aa9c25 | |||
| 4287b1f51b | |||
| 2dc90eb90e | |||
| 243c0e302a | |||
| f392379a36 | |||
| 8fdaba4020 | |||
| 7e1a25bbdd | |||
| d8b7f70be3 | |||
| ca567fc69b | |||
| ef1c5c394e | |||
| f5a4f9a980 | |||
| 905c4d38ad | |||
| 2044f30ec3 | |||
| 52bf72770c | |||
| 3294198a19 | |||
| 68f039dedf | |||
| 8c68b750a8 | |||
| de288c6099 | |||
| 39c18c39d1 | |||
| 05a289bf1f | |||
| 904bd828c7 | |||
| 27b1d9d581 | |||
| cdc03b2a02 | |||
| 87e2569a2b | |||
| e4f8392813 | |||
| ce4af6df62 | |||
| a520b47745 | |||
| e1ddd943fb | |||
| cb43ec58fb | |||
| c72387b7a0 | |||
| 57ba975b11 | |||
| 2cfa6389c8 | |||
| fc62b3ed36 | |||
| 825eadf070 | |||
| 25e80a87f9 | |||
| fdfffda00f | |||
| 173de2e8fa | |||
| 9f1eaeda4f | |||
| daf27b51b4 | |||
| 2fe6249d41 | |||
| 27e7895379 | |||
| 0b7911a748 | |||
| 92a6edf143 | |||
| 4a4c960d99 | |||
| 2f12aae186 | |||
| 1530745ba6 | |||
| bd93091c8a | |||
| 609784e0aa | |||
| 7c58698a8a | |||
| 0cf39f9160 | |||
| e65b5a1dce | |||
| ec4fda2d3d | |||
| e8b5984085 | |||
| 0dafbf714a | |||
| 381cc85743 | |||
| f59c789b28 | |||
| f6c29f43ae | |||
| e99b6fb404 | |||
| a395180a81 | |||
| ce72ff9018 | |||
| 4314bcdd89 | |||
| d23f9f5d48 | |||
| 1eb6f0cd22 | |||
| fee582844b | |||
| 1c813b4080 | |||
| 993d8956ea | |||
| e067c3a1f0 | |||
| 1a833b5836 | |||
| 48653e6c05 | |||
| 804cc92184 | |||
| e5cf77cd19 | |||
| 0ea68a9cdd | |||
| 6d812d61a2 | |||
| a9f56a8f0d | |||
| 2dc8a5c519 | |||
| 7bd9c89714 | |||
| 24999ce035 | |||
| 31053d630f | |||
| 01ac5c3191 | |||
| 6aeb5a1f35 | |||
| a73a0a6d8c | |||
| d3d91e9a72 | |||
| f64475c360 | |||
| 459154ffbd | |||
| b7504102dc | |||
| 4590fe5598 | |||
| f7c1de925b | |||
| 07ccf0a68d | |||
| 6408f30173 | |||
| bdaee88fac | |||
| 552f0e47dc | |||
| 84331e061f | |||
| de43be04ae | |||
| 54374e63f0 | |||
| 294c6adb0a | |||
| 1c05b46ac2 | |||
| ddc6b0e31d | |||
| 1d9a81c347 | |||
| 262ec64be3 | |||
| 4541181369 | |||
| 4d0036e8be | |||
| 0e83e4f5ca | |||
| d40b3e1034 | |||
| 72343793f6 | |||
| d4e8a03c53 | |||
| 6c979e8a24 | |||
| 794e4a05a3 | |||
| d067b2005b | |||
| c6d79e46d9 | |||
| 2b8a5e83ac | |||
| 2a1e7c302c | |||
| 59b4825741 | |||
| 38d0c10e3c | |||
| 50d2685d0e | |||
| f187b7f98b | |||
| 0726456942 | |||
| 1bf6b1cc18 | |||
| efbd1fc514 | |||
| 9900b2f103 | |||
| 2716e73e9e | |||
| abe51bbed9 | |||
| cd09750495 | |||
| 3377c60427 | |||
| 5242595975 | |||
| 2605a5ba8f | |||
| 1aa43ea576 | |||
| f12b2a7d5d | |||
| 834d5863b9 | |||
| c8825cfd2d | |||
| 380b3b305c | |||
| 2ae294c9d6 | |||
| cb82934b8d | |||
| c1c70a909a | |||
| 541ba098e7 | |||
| c298a8b8e0 | |||
| 94863d1946 | |||
| 6b8155d4a8 | |||
| d9e4f9eb2a | |||
| d864c083c2 | |||
| 80970e2938 | |||
| c196e0f3cb | |||
| 5a6dba91bb | |||
| 4600286cd2 | |||
| 4bbd7130f1 | |||
| b862c77e93 | |||
| 1a149c0d33 | |||
| 84f3391271 | |||
| 1f66b55e6e | |||
| 4339f32452 | |||
| 00b8db5f4f | |||
| b0bba0e704 | |||
| d501331e75 | |||
| ac9ed861a4 | |||
| effa8cd5d1 | |||
| 3dbdb64c89 | |||
| 660e6d5f9d | |||
| 277ea82b49 | |||
| dce99d41f4 | |||
| 44c4e47a1c | |||
| ba4f9b230f | |||
| 2ba777cd5a | |||
| 03b40486ca | |||
| ea257a167e | |||
| a666b9dbcf | |||
| 986a50e26d | |||
| 625c8a70aa | |||
| 66a14b7292 | |||
| 0a265f0fcd | |||
| be8137a81b | |||
| 8bdb6d99a8 | |||
| 07c8c52cbf | |||
| b588ef46f4 | |||
| cdb048acd7 | |||
| dd9a68560e | |||
| c731399ff1 | |||
| c8d483b80c | |||
| 75775efcf7 | |||
| de8c6852d3 | |||
| 36d7c02847 | |||
| 64375cb146 | |||
| 1f7569c38a | |||
| d636096334 | |||
| 1f1a9a809c | |||
| fe19f91525 | |||
| aea38264b5 | |||
| 44e2500992 | |||
| ecf140979f | |||
| 9531202c10 | |||
| a5436ee747 | |||
| 826067335c | |||
| d5306794ec | |||
| 89905101b7 | |||
| f6849778a7 | |||
| c0f904046c | |||
| 23da79eff2 | |||
| 176d1229af | |||
| 6aef11722c | |||
| 5218d67aca | |||
| 9b037d3842 | |||
| 6481349eb3 | |||
| 9abb0f813a | |||
| 914d8f5801 | |||
| 7a553f06a3 | |||
| a9fd047eea | |||
| b225c41b53 | |||
| 2d0ee29b15 | |||
| 0bfac2fe7a | |||
| c7d9b99dae | |||
| f87c87b9ba | |||
| 88c0c27c83 | |||
| 395c75becd | |||
| b02e4ee384 | |||
| fae3f45758 | |||
| 5d46f73a3c | |||
| 1ac7d05730 | |||
| 27f60090f6 | |||
| 28dc928f43 | |||
| 7fe8550e18 | |||
| c9aecec6be | |||
| 69b693dbc9 | |||
| 0803379406 | |||
| 4eb4b874ba | |||
| aff589d128 | |||
| c4c9a5d860 | |||
| 805720ebd3 | |||
| af70ea6a96 | |||
| ae8df5acdf | |||
| 1e900c139d | |||
| ef93a24f23 | |||
| 47737013d3 | |||
| 476b3195fa | |||
| ed7ce12186 | |||
| de78b7e81b | |||
| bf48c7abcd | |||
| 26e6e8c048 | |||
| d0bdb4d3c9 | |||
| 7af4d79611 | |||
| 49f020ec0c | |||
| a4bb593422 | |||
| d799a9aef2 | |||
| 6b611eb82d | |||
| 1e04f3179a | |||
| ec7418d3ce | |||
| 6d895ae5e9 | |||
| b194dfbf15 | |||
| 278bd07a17 | |||
| 2aa86d2d33 | |||
| 74e97cf096 | |||
| d86503c7cf | |||
| ee16e98eb1 | |||
| 800085d9ae | |||
| c8937fb8ea | |||
| 08d1ef9d83 | |||
| 2fd3511227 | |||
| 3abe15dd14 | |||
| 213b568441 | |||
| 91a036b599 | |||
| 5484222182 | |||
| 321a23004b | |||
| 272fecfce4 | |||
| ffccc532c6 | |||
| ad6ae2c4e5 | |||
| 76816913ed | |||
| 4c74601224 | |||
| b4c8301258 | |||
| c446109283 | |||
| b4ab174902 | |||
| 2deb9e2501 | |||
| be02c7520a | |||
| 364f1151a6 | |||
| fb3a583b2b | |||
| 83bf9af99e | |||
| a00095da48 | |||
| 3ed4068ee1 | |||
| 949f570992 | |||
| 2bef2c7dca | |||
| 36e32ba459 | |||
| baa1209e37 | |||
| 4878c5a6d2 | |||
| 5d4353a158 | |||
| 446088fa5d | |||
| 33f519119b | |||
| 7acc6626c5 | |||
| e616f403eb | |||
| b51b3dd05c | |||
| e4fd3f4f06 | |||
| bce3627ed9 | |||
| 567596e8c2 | |||
| f703afe925 | |||
| 6483738028 | |||
| 086018ae01 | |||
| ae04fba0cd | |||
| db9529f65f | |||
| 97ae5efdf0 | |||
| a636a125da | |||
| b3ed98f7ba | |||
| 46941b6043 | |||
| 670cced63a | |||
| f6c74641dd | |||
| 3141843a1a | |||
| 4da8b58b36 | |||
| 7c8304a6c9 | |||
| fee588e503 | |||
| 42e2fba317 | |||
| 48c54e90ce | |||
| dad92a063d | |||
| 9033ed3212 | |||
| 146132bffc | |||
| 331c6f4620 | |||
| ed501d3e98 | |||
| d2780b2594 | |||
| 3054f2faf2 | |||
| 3c0fd35102 | |||
| 67e55d7e0b | |||
| 5b0d565bcd | |||
| ade83600e1 | |||
| b87862b89a | |||
| 30faf003ba | |||
| c9a53bb206 | |||
| 6fb6c9d960 | |||
| 5d502dc3e4 | |||
| 30d36e2f3e | |||
| 989e230b3d | |||
| f45b5a05c0 | |||
| 48cd99809d | |||
| 6ebca3c77e | |||
| 2e311d898c | |||
| a87bbde1a1 | |||
| 71777355b1 | |||
| 01d50616ee | |||
| d44136dee7 | |||
| 5c9fe50894 | |||
| e620c033cb | |||
| d3b5c5f081 | |||
| 6936ef91df | |||
| 3f94709321 | |||
| 6428434a5f | |||
| 9bb14972af | |||
| 01f3128264 | |||
| 3e55705455 | |||
| 889209d1fa | |||
| efc346b5ca | |||
| 5eb64d447e | |||
| 9446d15749 | |||
| dc28278d18 | |||
| d04f1621e8 | |||
| ef38765d91 | |||
| 7c3c8b7249 | |||
| eb676fdf9a | |||
| bf55369e5d | |||
| 56a6a9ff49 | |||
| 91e4976c08 | |||
| 299560a9fc | |||
| 23cb8a304c | |||
| 9c71eb42b8 | |||
| f642809590 | |||
| 3edb646260 | |||
| 7828580904 | |||
| 2711fbb039 | |||
| d226adef8b | |||
| 88aba6189b | |||
| e371190c10 | |||
| dd3b147a87 | |||
| 653c70a063 | |||
| bb75ef114c | |||
| f220d982f2 | |||
| 1db555e84d | |||
| 2c97ca5d59 | |||
| 4a1f1588f0 | |||
| 2b5c23c82b | |||
| e1b8eb512c | |||
| fca3ef18aa | |||
| d2c77a0dc0 | |||
| f76e87652c | |||
| 108145970d | |||
| d4d1873933 | |||
| 52a85b5475 | |||
| 6f1c69ec02 | |||
| f184d1610b | |||
| 7832d94156 | |||
| 289b648803 | |||
| c86c9b30c5 | |||
| a722923c62 | |||
| ae3f15fac1 | |||
| d5b0187a32 | |||
| 100aa1d7be | |||
| 4ff35d69bc | |||
| ec29c403be | |||
| a576feacb8 | |||
| 9c44a6972c | |||
| 1ce5928d35 | |||
| 35c30e915e | |||
| f59139d640 | |||
| b4bdcbe535 | |||
| b6d175eeb7 | |||
| a7084ab10b | |||
| 6a4c28904a | |||
| d0e1fd06c5 | |||
| 287a93580b | |||
| 53fedccb0b | |||
| a08ccf0a61 | |||
| df8baa04c3 | |||
| 3b0e0d4df4 | |||
| 250ea6271e | |||
| f356fbe45e | |||
| 37f401637b | |||
| 13f944bc55 | |||
| 3e21f15895 | |||
| fc410020b8 | |||
| 200460b0c8 | |||
| d1014faf32 | |||
| b692cb65b7 | |||
| 3f566d8f2e | |||
| 46beca01b3 | |||
| 0257c6d6b0 | |||
| b10192c1e4 | |||
| 0772879f24 | |||
| 5563b4e151 | |||
| ffcce04152 | |||
| b374d60430 | |||
| 848e124eab | |||
| a53b09c16b | |||
| 8374432bdb | |||
| 18ab64ef11 | |||
| e1b6fbf2eb | |||
| a37df0735f | |||
| 8b0c3b6551 | |||
| 5ee7e12e26 | |||
| f4aaf2f7b5 | |||
| c385f70296 | |||
| 00fe4b8045 | |||
| 0472d056f6 | |||
| 07f8831194 | |||
| a7f53e74f6 | |||
| 8a6733ead1 | |||
| e5bafac7d2 | |||
| f101e4f736 | |||
| 53b824ef1f | |||
| 672007443c | |||
| 1180c98509 | |||
| 337f36b459 | |||
| be1ed90464 | |||
| 55c0d5b8a4 | |||
| aa912c49e2 | |||
| 8abfee6962 | |||
| f1068df6c6 | |||
| 3b438e0db9 | |||
| 6d699a924d | |||
| f6de1e03d7 | |||
| 0416a3be25 | |||
| 1e4f7f125b | |||
| 1b2472e584 | |||
| 51aca6a92f | |||
| 04803a039d | |||
| 8d101bc522 | |||
| 474c8d3f00 | |||
| e48f4e502d | |||
| 00b9ff724b | |||
| d5be1194cb | |||
| d3176779c8 | |||
| 8e4485c69b | |||
| e565767d24 | |||
| aca29171b4 | |||
| 1710f639ae | |||
| 711d6de23f | |||
| fdee3caacb | |||
| 0c19b8fd99 | |||
| 1bad990a14 | |||
| 155a4e17a2 | |||
| 11a5d6c147 | |||
| ca5b6b6506 | |||
| d0fcd925f9 | |||
| b985f62858 | |||
| e793cddc22 |
+339
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
+8
-9
@@ -26,7 +26,6 @@
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
$config = (array)$config;
|
||||
validate_form($config, $err);
|
||||
|
||||
// extract and sanitize the auth key explicitly
|
||||
$modules = get_list_of_plugins("auth");
|
||||
@@ -36,6 +35,14 @@
|
||||
notify("Error defining the authentication method");
|
||||
}
|
||||
|
||||
// load the auth plugin library
|
||||
require_once("{$CFG->dirroot}/auth/$auth/lib.php");
|
||||
|
||||
$err = array();
|
||||
if (function_exists('auth_validate_form')) {
|
||||
auth_validate_form($config, $err);
|
||||
}
|
||||
|
||||
if (count($err) == 0) {
|
||||
foreach ($config as $name => $value) {
|
||||
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
|
||||
@@ -233,14 +240,6 @@
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
function validate_form(&$form, &$err) {
|
||||
|
||||
// if (empty($form->fullname))
|
||||
// $err["fullname"] = get_string("missingsitename");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Good enough for most auth plugins
|
||||
// but some may want a custom one if they are offering
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@
|
||||
|
||||
// $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/' . $strblockname . '/config';
|
||||
$CFG->pagepath = 'block/' . $block->name() . '/config';
|
||||
|
||||
print_header($site->shortname.': '.$strblockname.": $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
|
||||
+2
-2
@@ -156,7 +156,7 @@
|
||||
|
||||
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'multiple', 'delete', 'settings'));
|
||||
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings));
|
||||
$table->define_baseurl($CFG->wwwroot.'/admin/blocks.php');
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
|
||||
|
||||
$table->set_attribute('cellspacing', '0');
|
||||
$table->set_attribute('id', 'blocks');
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
$table->define_columns(array('block', 'delete'));
|
||||
$table->define_headers(array($strname, $strdelete));
|
||||
$table->define_baseurl($CFG->wwwroot.'/admin/blocks.php');
|
||||
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
|
||||
|
||||
$table->set_attribute('cellspacing', '0');
|
||||
$table->set_attribute('id', 'incompatible');
|
||||
|
||||
+18
-7
@@ -3,6 +3,8 @@
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
$installing = optional_param('installing', 0, PARAM_BOOL);
|
||||
|
||||
$focus = '';
|
||||
|
||||
if ($site = get_site()) { // If false then this is a new installation
|
||||
@@ -34,7 +36,7 @@
|
||||
if (count($err) == 0) {
|
||||
foreach ($config as $name => $value) {
|
||||
if ($name == "sessioncookie") {
|
||||
$value = eregi_replace("[^a-zA-Z]", "", $value);
|
||||
$value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
|
||||
}
|
||||
if ($name == "defaultallowedmodules") {
|
||||
$value = implode(',',$value);
|
||||
@@ -46,7 +48,10 @@
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
}
|
||||
unset($conf);
|
||||
if ($name == "locale") {
|
||||
$value = trim($value);
|
||||
}
|
||||
$conf = new object();
|
||||
$conf->name = $name;
|
||||
$conf->value = $value;
|
||||
if ($current = get_record('config', 'name', $name)) {
|
||||
@@ -60,8 +65,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect('index.php', get_string('changessaved'), 1);
|
||||
exit;
|
||||
if ($installing) {
|
||||
print_header();
|
||||
notify(get_string('changessaved'), 'notifysuccess');
|
||||
print_continue('index.php');
|
||||
exit;
|
||||
} else {
|
||||
// the following redirect was randomly breaking upgrades because it did double redirects,
|
||||
// we must not use it during install/upgrade
|
||||
redirect('index.php', get_string('changessaved'), 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
foreach ($err as $key => $value) {
|
||||
@@ -74,9 +87,6 @@
|
||||
|
||||
if (empty($config)) {
|
||||
$config = $CFG;
|
||||
if (!$config->locale = get_field('config', 'value', 'name', 'locale')) {
|
||||
$config->locale = $CFG->lang;
|
||||
}
|
||||
}
|
||||
|
||||
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
@@ -143,6 +153,7 @@
|
||||
|
||||
}
|
||||
echo '<center>';
|
||||
echo '<input type="hidden" name="installing" value="'.$installing.'" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$sesskey.'" />';
|
||||
echo '<input type="submit" value="'.get_string('savechanges').'" />';
|
||||
echo '</center>';
|
||||
|
||||
+19
-7
@@ -69,7 +69,7 @@ class configvar {
|
||||
|
||||
/// debug
|
||||
unset($options);
|
||||
$options[7] = $strno;
|
||||
$options[5] = $strno;
|
||||
$options[15] = $stryes;
|
||||
|
||||
$misc['debug'] = new configvar (get_string('configdebug', 'admin'),
|
||||
@@ -157,8 +157,8 @@ class configvarrss extends configvar {
|
||||
|
||||
/// slasharguments
|
||||
unset($options);
|
||||
$options[0] = "file.php?file=/pic.jpg";
|
||||
$options[1] = "file.php/pic.jpg";
|
||||
$options[0] = "file.php?file=/1/pic.jpg";
|
||||
$options[1] = "file.php/1/pic.jpg";
|
||||
|
||||
$operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
|
||||
choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
|
||||
@@ -312,17 +312,20 @@ class configvarrss extends configvar {
|
||||
/// language menu
|
||||
$interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
|
||||
|
||||
|
||||
/// locale
|
||||
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
|
||||
'<input name="locale" type="text" size="10" value="'.s($config->locale).'" alt="locale" />' );
|
||||
'<input name="locale" type="text" size="15" value="'.s($config->locale).'" alt="locale" />' );
|
||||
|
||||
/// docroot
|
||||
$interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
|
||||
'<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
|
||||
|
||||
/// doctonewwindow
|
||||
$interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) );
|
||||
|
||||
/// timezone
|
||||
|
||||
$interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
|
||||
choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
|
||||
|
||||
@@ -447,6 +450,9 @@ class configvarrss extends configvar {
|
||||
$security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
|
||||
choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
|
||||
|
||||
$security['protectusernames'] = new configvar (get_string('configprotectusernames', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'protectusernames', $config->protectusernames, '', '', '', true) );
|
||||
|
||||
/// secureforms
|
||||
$security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
|
||||
@@ -455,6 +461,9 @@ class configvarrss extends configvar {
|
||||
$security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
|
||||
choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
|
||||
|
||||
/// profilesforenrolledusersonly
|
||||
$security['profilesforenrolledusersonly'] = new configvar (get_string('configprofilesforenrolledusersonly', 'admin'), choose_from_menu ($noyesoptions, 'profilesforenrolledusersonly', $CFG->profilesforenrolledusersonly, '', '', '', true) );
|
||||
|
||||
/// runclamonupload
|
||||
$security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
|
||||
choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
|
||||
@@ -588,6 +597,7 @@ class configvarrss extends configvar {
|
||||
}
|
||||
|
||||
/// enable stats
|
||||
if (empty($CFG->disablestatsprocessing)) {
|
||||
$stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
|
||||
choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
|
||||
|
||||
@@ -633,7 +643,7 @@ class configvarrss extends configvar {
|
||||
|
||||
$stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
|
||||
'<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -646,6 +656,8 @@ class configvarrss extends configvar {
|
||||
$configvars['permissions'] = $permissions;
|
||||
$configvars['requestedcourse'] = $reqcourse;
|
||||
$configvars['misc'] = $misc;
|
||||
if (empty($CFG->disablestatsprocessing)) {
|
||||
$configvars['stats'] = $stats;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only admins can access this page");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strcourses = get_string("courses");
|
||||
|
||||
print_header("$site->shortname: $stradministration: $strcourses", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> $strcourses");
|
||||
|
||||
print_heading($strcourses);
|
||||
|
||||
$table->align = array ("right", "left");
|
||||
|
||||
$table->data[] = array('<b><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string("managecourses")."</a></b>",
|
||||
get_string("adminhelpcourses"));
|
||||
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolmentplugins")."</a></b>",
|
||||
get_string("adminhelpenrolments"));
|
||||
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
|
||||
get_string("adminhelpassignstudents"));
|
||||
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
|
||||
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" />");
|
||||
$table->data[] = array("<b><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a></b>",
|
||||
get_string("adminhelpassigncreators"));
|
||||
$table->data[] = array("<b><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a></b>",
|
||||
get_string("adminhelpassignadmins"));
|
||||
|
||||
print_table($table);
|
||||
|
||||
print_footer($site);
|
||||
|
||||
?>
|
||||
@@ -64,9 +64,6 @@
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<script type="text/javascript">
|
||||
function
|
||||
</script>
|
||||
<input type="text" name="searchtext" size="30" value="<?php p($searchtext) ?>"
|
||||
onFocus ="document.creatorsform.add.disabled=true;
|
||||
document.creatorsform.remove.disabled=true;
|
||||
|
||||
+30
-14
@@ -26,7 +26,7 @@
|
||||
chdir(dirname($_SERVER['argv'][0]));
|
||||
}
|
||||
|
||||
require_once("../config.php");
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->dirroot.'/lib/adminlib.php');
|
||||
|
||||
if (!$alreadyadmin = isadmin()) {
|
||||
@@ -42,11 +42,23 @@
|
||||
//unset test cookie, user must login again anyway
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
|
||||
|
||||
/// switch to site language and locale
|
||||
if (!empty($CFG->courselang)) {
|
||||
unset ($CFG->courselang);
|
||||
}
|
||||
if (!empty($SESSION->lang)) {
|
||||
unset ($SESSION->lang);
|
||||
}
|
||||
$USER->lang = '';
|
||||
moodle_setlocale();
|
||||
|
||||
/// send mime type and encoding
|
||||
@header('Content-Type: text/plain; charset='.current_charset());
|
||||
|
||||
/// Start output log
|
||||
|
||||
$timenow = time();
|
||||
|
||||
mtrace("<pre>");
|
||||
mtrace("Server Time: ".date('r',$timenow)."\n\n");
|
||||
|
||||
/// Run all cron jobs for each module
|
||||
@@ -129,11 +141,13 @@
|
||||
|
||||
/// Delete users who haven't confirmed within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,11 +157,13 @@
|
||||
|
||||
/// Delete users who haven't completed profile within required period
|
||||
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
if (!empty($CFG->deleteunconfirmed)) {
|
||||
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
|
||||
if ($users = get_users_not_fully_set_up($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records('user', 'id', $user->id)) {
|
||||
mtrace("Deleted not fully setup user $user->username ($user->id)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,10 +278,10 @@
|
||||
unset($enrol);
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
|
||||
|
||||
// check we're not before our runtime
|
||||
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
|
||||
$timetocheck = strtotime("today $CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
|
||||
|
||||
if (time() > $timetocheck) {
|
||||
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
|
||||
|
||||
+1
-1
@@ -43,7 +43,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') {
|
||||
|
||||
@@ -57,10 +57,12 @@
|
||||
$strmoodleversion = get_string('moodleversion');
|
||||
$strupdate = get_string('updatecomponent', 'admin');
|
||||
$strupwards = get_string('upwards', 'admin');
|
||||
$strmisc = get_string('miscellaneous');
|
||||
|
||||
/// Print the header stuff
|
||||
print_header("$SITE->shortname: $strenvironment", $SITE->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".$strenvironment);
|
||||
"<a href=\"index.php\">$stradmin</a> -> <a href=\"misc.php\">$strmisc</a> -> "
|
||||
.$strenvironment);
|
||||
|
||||
/// Print the component download link
|
||||
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
|
||||
|
||||
@@ -34,4 +34,32 @@
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
<MOODLE version="1.7">
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="4.1.16">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="7.4" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="oracle" version="9.0" />
|
||||
</DATABASE>
|
||||
<PHP version="4.3.0" level="required">
|
||||
<RESTRICT function="restrict_php50_version" message="php50restricted" />
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+8
-3
@@ -188,10 +188,15 @@
|
||||
// construct the flexible table ready to display
|
||||
$table = new flexible_table(FILTER_TABLE);
|
||||
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
|
||||
$table->column_style('hideshow', 'text-align', 'center');
|
||||
$table->column_style('order', 'text-align', 'center');
|
||||
$table->column_style('settings', 'text-align', 'center');
|
||||
$table->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
|
||||
$table->define_baseurl("$CFG->wwwroot/admin/filters.php");
|
||||
$table->define_baseurl("$CFG->wwwroot/$CFG->admin/filters.php");
|
||||
$table->set_attribute('id', 'blocks');
|
||||
$table->set_attribute('class', 'flexible generaltable generalbox');
|
||||
$table->set_attribute('style', 'margin:auto;');
|
||||
$table->set_attribute('cellpadding', '5');
|
||||
$table->setup();
|
||||
|
||||
// iterate through filters adding to display table
|
||||
@@ -202,13 +207,13 @@
|
||||
// get hide/show link
|
||||
if (in_array($path, $activefilters)) {
|
||||
$hideshow = "<a href=\"$myurl&action=hide&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"$img/hide.gif\" alt=\"hide\" /></a>";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" height=\"16\" width=\"16\" alt=\"hide\" /></a>";
|
||||
$hidden = false;
|
||||
$displayname = "<span>$name</span>";
|
||||
}
|
||||
else {
|
||||
$hideshow = "<a href=\"$myurl&action=show&filterpath=$upath\">";
|
||||
$hideshow .= "<img src=\"$img/show.gif\" alt=\"show\" /></a>";
|
||||
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" height=\"16\" width=\"16\" alt=\"show\" /></a>";
|
||||
$hidden = true;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
}
|
||||
|
||||
+52
-28
@@ -1,14 +1,23 @@
|
||||
<?php // $Id$
|
||||
|
||||
ob_start(); //for whitespace test
|
||||
require_once('../config.php');
|
||||
|
||||
// extra whitespace test - intentionally breaks cookieless mode
|
||||
$extraws = '';
|
||||
while (true) {
|
||||
$extraws .= ob_get_contents();
|
||||
if (!@ob_end_clean()) { //
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
define('SEVERITY_NOTICE', 'notice');
|
||||
define('SEVERITY_ANNOYANCE', 'annoyance');
|
||||
define('SEVERITY_SIGNIFICANT', 'significant');
|
||||
define('SEVERITY_CRITICAL', 'critical');
|
||||
|
||||
$resetsesserrorcounter = optional_param('resetsesserrorcounter', 0, PARAM_BOOL);
|
||||
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
|
||||
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
|
||||
|
||||
require_login();
|
||||
if (!isadmin()) {
|
||||
@@ -18,9 +27,11 @@
|
||||
$site = get_site();
|
||||
$stradmin = get_string('administration');
|
||||
$strhealthcenter = get_string('healthcenter');
|
||||
$strmisc = get_string('miscellaneous');
|
||||
|
||||
print_header($site->shortname.': '.$strhealthcenter, $site->fullname,
|
||||
'<a href="index.php">'.$stradmin.'</a> -> '.$strhealthcenter);
|
||||
'<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
|
||||
$strhealthcenter);
|
||||
|
||||
echo <<<STYLES
|
||||
<style type="text/css">
|
||||
@@ -216,18 +227,13 @@ class problem_000001 extends problem_base {
|
||||
|
||||
class problem_000002 extends problem_base {
|
||||
function title() {
|
||||
return 'Extra characters at the end of config.php';
|
||||
return 'Extra characters at the end of config.php or other library function';
|
||||
}
|
||||
function exists() {
|
||||
// [pj] When the requirements are raised to PHP 4.3.0 this will be file_get_contents()
|
||||
if($fp = @fopen('../config.php', 'r')) {
|
||||
$contents = fread($fp, 16384); // 16K should be enough
|
||||
$ending = substr($contents, -2);
|
||||
unset($contents);
|
||||
if($ending == '?>') {
|
||||
return false;
|
||||
}
|
||||
fclose($fp);
|
||||
global $extraws;
|
||||
|
||||
if($extraws === '') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -235,11 +241,11 @@ class problem_000002 extends problem_base {
|
||||
return SEVERITY_SIGNIFICANT;
|
||||
}
|
||||
function description() {
|
||||
return 'Your Moodle configuration file, config.php, contains some characters after the closing PHP tag (?>). This could cause Moodle to exhibit several kinds of problems and should be fixed.';
|
||||
return 'Your Moodle configuration file config.php or another library file, contains some characters after the closing PHP tag (?>). This causes Moodle to exhibit several kinds of problems (such as broken downloaded files) and must be fixed.';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return 'You need to edit <strong>'.$CFG->dirroot.'/config.php</strong> and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file.';
|
||||
return 'You need to edit <strong>'.$CFG->dirroot.'/config.php</strong> and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file. The extra trailing whitespace may be also present in other PHP files that are included from lib/setup.php.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,24 +356,41 @@ class problem_000008 extends problem_base {
|
||||
return 'PHP: memory_limit cannot be controlled by Moodle';
|
||||
}
|
||||
function exists() {
|
||||
$memlimit = @ini_get('memory_limit');
|
||||
if(empty($memlimit)) {
|
||||
$oldmemlimit = @ini_get('memory_limit');
|
||||
if(empty($oldmemlimit)) {
|
||||
// PHP not compiled with memory limits, this means that it's
|
||||
// probably limited to 8M so we have a problem...
|
||||
return true;
|
||||
// probably limited to 8M or in case of Windows not at all.
|
||||
// We can ignore it for now - there is not much to test anyway
|
||||
// TODO: add manual test that fills memory??
|
||||
return false;
|
||||
}
|
||||
// Otherwise, raise_memory_limit in setup.php will do the trick
|
||||
$oldmemlimit = get_real_size($oldmemlimit);
|
||||
//now lets change the memory limit to something unique below 128M==134217728
|
||||
@ini_set('memory_limit', 134217720);
|
||||
$testmemlimit = get_real_size(@ini_get('memory_limit'));
|
||||
//verify the change had any effect at all
|
||||
if ($oldmemlimit == $testmemlimit) {
|
||||
//memory limit can not be changed - is it big enough then?
|
||||
if ($oldmemlimit < get_real_size('128M')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ini_set('memory_limit', $oldmemlimit);
|
||||
return false;
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_ANNOYANCE;
|
||||
return SEVERITY_NOTICE;
|
||||
}
|
||||
function description() {
|
||||
return 'The settings for PHP on your server do not allow a script to request more memory during its execution. This means that most likely there is a hard limit of 8MB for each script. It is possible that certain operations within Moodle will require more than this amount in order to complete successfully, especially if there are lots of data to be processed. Therefore, it is recommended that you contact your server administrator to address this issue.';
|
||||
return 'The settings for PHP on your server do not allow a script to request more memory during its execution. '.
|
||||
'This means that there is a hard limit of '.@ini_get('memory_limit').' for each script. '.
|
||||
'It is possible that certain operations within Moodle will require more than this amount in order '.
|
||||
'to complete successfully, especially if there are lots of data to be processed.';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return 'We need a good solution here. Enabling memory limit control means recompiling PHP... maybe this should be SEVERITY_NOTICE instead of SEVERITY_ANNOYANCE?';
|
||||
return 'It is recommended that you contact your web server administrator to address this issue.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +444,7 @@ class problem_000010 extends problem_base {
|
||||
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
|
||||
}
|
||||
if ($this->status() == -1) {
|
||||
$desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a></li>';
|
||||
$desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a> manually</li>';
|
||||
} else if ($this->status() == 0) {
|
||||
$desc .= '<li>slashargument test <strong>failed</strong>, please check server configuration</li>';
|
||||
} else {
|
||||
@@ -462,13 +485,13 @@ class problem_000010 extends problem_base {
|
||||
function status() {
|
||||
global $CFG;
|
||||
$handle = @fopen($CFG->wwwroot.'/file.php?file=/testslasharguments', "r");
|
||||
$contents = trim(@fread($handle, 7));
|
||||
$contents = @trim(fread($handle, 10));
|
||||
@fclose($handle);
|
||||
if ($contents != 'test -1') {
|
||||
return -1;
|
||||
}
|
||||
$handle = @fopen($CFG->wwwroot.'/file.php/testslasharguments', "r");
|
||||
$contents = trim(@fread($handle, 6));
|
||||
$contents = trim(@fread($handle, 10));
|
||||
@fclose($handle);
|
||||
switch ($contents) {
|
||||
case 'test 1': return 1;
|
||||
@@ -499,7 +522,7 @@ class problem_000011 extends problem_base {
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
if (!empty($resetsesserrorcounter)) {
|
||||
if (optional_param('resetsesserrorcounter', 0, PARAM_BOOL)) {
|
||||
if (get_field('config', 'name', 'name', 'session_error_counter')) {
|
||||
delete_records('config', 'name', 'session_error_counter');
|
||||
}
|
||||
@@ -535,6 +558,7 @@ class problem_00000x extends problem_base {
|
||||
TODO:
|
||||
|
||||
session.save_path -- it doesn't really matter because we are already IN a session, right?
|
||||
detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process
|
||||
|
||||
*/
|
||||
|
||||
|
||||
+54
-52
@@ -5,20 +5,28 @@
|
||||
header('Location: ../install.php');
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/// Check that PHP is of a sufficient version
|
||||
/// Moved here because older versions do not allow while(@ob_end_clean());
|
||||
if (version_compare(phpversion(), "4.3.0") < 0) {
|
||||
$phpversion = phpversion();
|
||||
echo "Sorry, Moodle requires PHP 4.3.0 or later (currently using version $phpversion)";
|
||||
die;
|
||||
}
|
||||
|
||||
/// Turn off time limits and try to flush everything all the time, sometimes upgrades can be slow.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
while(@ob_end_clean()); // ob_end_flush prevents sending of headers
|
||||
|
||||
|
||||
require_once('../config.php');
|
||||
include_once($CFG->dirroot.'/lib/adminlib.php'); // Contains various admin-only functions
|
||||
|
||||
$id = optional_param('id', '', PARAM_ALPHANUM);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
|
||||
/// Check that PHP is of a sufficient version
|
||||
|
||||
if (!check_php_version("4.1.0")) { //TODO: should we bump it up to 4.3.0??
|
||||
$phpversion = phpversion();
|
||||
print_heading("Sorry, Moodle requires PHP 4.1.0 or later (currently using version $phpversion)");
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/// Check some PHP server settings
|
||||
@@ -68,13 +76,6 @@
|
||||
$CFG->version = "";
|
||||
}
|
||||
|
||||
/// Turn off time limits and try to flush everything all the time, sometimes upgrades can be slow.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
@ob_end_flush();
|
||||
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
|
||||
if (! $tables = $db->Metatables() ) { // No tables yet at all.
|
||||
@@ -221,7 +222,7 @@
|
||||
/// If any new configurations were found then send to the config page to check
|
||||
|
||||
if (!empty($configchange)) {
|
||||
redirect("config.php");
|
||||
redirect("config.php?installing=1");
|
||||
}
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
@@ -257,7 +258,7 @@
|
||||
|
||||
/// Define the unique site ID code if it isn't already
|
||||
if (empty($CFG->siteidentifier)) { // Unique site identification code
|
||||
set_config('siteidentifier', random_string(32));
|
||||
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
/// Check if the guest user exists. If not, create one.
|
||||
@@ -318,10 +319,13 @@
|
||||
print_spacer(10,10);
|
||||
}
|
||||
|
||||
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
|
||||
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center', '60%');
|
||||
if (ini_get_bool('register_globals')) {
|
||||
print_simple_box(get_string('globalswarning', 'admin'), 'center', '60%');
|
||||
}
|
||||
|
||||
if (is_dataroot_insecure()) {
|
||||
print_simple_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'center', '60%');
|
||||
}
|
||||
|
||||
/// If no recently cron run
|
||||
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
|
||||
@@ -399,38 +403,44 @@
|
||||
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/uploaduser.php?sesskey='.$USER->sesskey.'">'.
|
||||
get_string('uploadusers').'</a> - <span class="explanation">'.get_string('adminhelpuploadusers').'</span></div>';
|
||||
|
||||
$userdata .= '<hr /><div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolmentplugins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="../course/index.php?edit=off&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignstudents').'</a> - <span class="explanation">'.get_string('adminhelpassignstudents').'</span></div>';
|
||||
|
||||
$userdata .= '<div class="adminlink"><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignteachers').'</a> - <span class="explanation">'.get_string('adminhelpassignteachers').
|
||||
' <img src="../pix/t/user.gif" height="11" width="11" alt="" /></span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="creators.php?sesskey='.$USER->sesskey.'">'.get_string('assigncreators').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassigncreators').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="admin.php?sesskey='.$USER->sesskey.'">'.get_string('assignadmins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassignadmins').'</span></div>';
|
||||
|
||||
$table->data[] = array('<strong><a href="users.php">'.get_string('users').'</a></strong>', $userdata);
|
||||
|
||||
$table->data[] = array('<strong><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string('courses').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpcourses').'</div>');
|
||||
$table->data[] = array('<strong><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpsitefiles').'</div>');
|
||||
$table->data[] = array('<strong><a href="stickyblocks.php">'.get_string('stickyblocks','admin').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpstickyblocks').'</div>');
|
||||
$table->data[] = array('<strong><a href="report.php">'.get_string('reports').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpreports').'</div>');
|
||||
$table->data[] = array('<strong><a href="environment.php">'.get_string('environment','admin').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpenvironment').'</div>');
|
||||
$coursedata = '<div class="adminlink"><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string('managecourses').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpcourses').'</span></div>';
|
||||
$coursedata .= '<div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolmentplugins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
|
||||
$coursedata .= '<div class="adminlink"><a href="../course/index.php?edit=off&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignstudents').'</a> - <span class="explanation">'.get_string('adminhelpassignstudents').'</span></div>';
|
||||
$coursedata .= '<div class="adminlink"><a href="../course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.
|
||||
get_string('assignteachers').'</a> - <span class="explanation">'.get_string('adminhelpassignteachers').
|
||||
' <img src="../pix/t/user.gif" height="11" width="11" alt="" /></span></div>';
|
||||
$coursedata .= '<div class="adminlink"><a href="creators.php?sesskey='.$USER->sesskey.'">'.get_string('assigncreators').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassigncreators').'</span></div>';
|
||||
$coursedata .= '<div class="adminlink"><a href="admin.php?sesskey='.$USER->sesskey.'">'.get_string('assignadmins').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpassignadmins').'</span></div>';
|
||||
|
||||
$table->data[] = array('<strong><a href="courses.php">'.get_string('courses').'</a></strong>', $coursedata);
|
||||
|
||||
$miscdata = '<div class="adminlink"><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpsitefiles').'</span></div>';
|
||||
$miscdata .= '<div class="adminlink"><a href="stickyblocks.php">'.get_string('stickyblocks','admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpstickyblocks').'</span></div>';
|
||||
$miscdata .= '<div class="adminlink"><a href="report.php">'.get_string('reports').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpreports').'</span></div>';
|
||||
//to be enabled later
|
||||
/* $miscdata .= '<div class="adminlink"><a href="health.php">'.get_string('healthcenter').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelphealthcenter').'</span></div>';*/
|
||||
$miscdata .= '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
|
||||
/// Optional stuff
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
|
||||
$table->data[] = array("<strong><a href=\"$CFG->dbtype/frame.php\">".get_string('managedatabase').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpmanagedatabase').'</div>');
|
||||
$miscdata .= '<div class="adminlink"><a href="'.$CFG->dbtype.'/frame.php">'.get_string('managedatabase').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpmanagedatabase').'</span></div>';
|
||||
}
|
||||
|
||||
$table->data[] = array('<strong><a href="misc.php">'.get_string('miscellaneous').'</a></strong>', $miscdata);
|
||||
|
||||
|
||||
/// Hooks for Matt Oquists contrib code for repositories and portfolio.
|
||||
/// The eventual official versions may not look like this
|
||||
if (isset($CFG->portfolio) && file_exists("$CFG->dirroot/$CFG->portfolio")) {
|
||||
@@ -468,14 +478,6 @@ epository').'</a></strong>',
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
if (optional_param('dbmigrate')) { // ??? Is this actually used?
|
||||
print_simple_box_start('center','60%');
|
||||
require_once($CFG->dirroot.'/admin/utfdbmigrate.php');
|
||||
db_migrate2utf8();
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
|
||||
print_footer($site);
|
||||
|
||||
|
||||
+381
-126
@@ -1,9 +1,59 @@
|
||||
<?PHP // $Id$
|
||||
/**
|
||||
* Display the admin/language menu and process strings translation.
|
||||
*
|
||||
* CHANGES
|
||||
*
|
||||
* 2006/06/08 mudrd8mz
|
||||
* 1) Fixed bug 5745 reported by Harry Smith so now can edit en_utf8_local pack
|
||||
* 2) More notification messages included
|
||||
*
|
||||
* 2006/05/30 mudrd8mz
|
||||
* Merged with version by Mitsuhiro Yoshida - display icon links instead of text links
|
||||
* (I have changed the position of arrow icons to not to be so close each other)
|
||||
*
|
||||
* 2006/05/19 mudrd8mz
|
||||
* A lot of changes to support translation of *_utf8_local langugage packs. Needs testing
|
||||
*
|
||||
* 2006/05/16 mudrd8mz
|
||||
* 1) LANG_DEFAULT_FILE can be now set. moodle.php used to be opened automatically.
|
||||
* As it was (and still is) one of the biggest files it usually took a long time to load the page
|
||||
* even if you just want to choose the file to translate.
|
||||
* 2) added links from "missing" to "compare" mode page
|
||||
* 3) english strings are now key-sorted in "missing" mode
|
||||
* 4) list of files with missing strings is now displayed at the top of "missing" page
|
||||
*
|
||||
* 2006/05/14 mudrd8mz Improvements of lang.php,v 1.65 2006/04/10 22:15:57 stronk7 Exp
|
||||
* 1) "go to first missing string" link can be displayed (see LANG_DISPLAY_MISSING_LINKS)
|
||||
* 2) "go to next missing" link can be displayed (see LANG_DISPLAY_MISSING_LINKS)
|
||||
* 3) submit button may be repeated (see LANG_SUBMIT_REPEAT*)
|
||||
* 4) added (empty) "summary" attribute for the <table>'s
|
||||
* 5) added error_reporting(E_ALL ^ E_NOTICE); in "compare" mode (even in debug environment
|
||||
* we know that missing keys are missing strings here, not bugs ;-)
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button?
|
||||
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_LINK_MISSING_STRINGS', 1); // create links from "missing" page to "compare" page?
|
||||
define('LANG_DEFAULT_USELOCAL', 0); // should *_utf8_local be used by default?
|
||||
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
$currentfile = optional_param('currentfile', 'moodle.php', PARAM_FILE);
|
||||
$currentfile = optional_param('currentfile', LANG_DEFAULT_FILE, PARAM_FILE);
|
||||
$uselocal = optional_param('uselocal', -1, PARAM_INT);
|
||||
|
||||
if ($uselocal == -1) {
|
||||
if (isset($SESSION->langtranslateintolocal)) {
|
||||
$uselocal = $SESSION->langtranslateintolocal;
|
||||
} else {
|
||||
$uselocal = LANG_DEFAULT_USELOCAL;
|
||||
}
|
||||
} else {
|
||||
$SESSION->langtranslateintolocal = $uselocal;
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -23,9 +73,30 @@
|
||||
$streditstrings = get_string("editstrings", 'admin');
|
||||
$stredithelpdocs = get_string("edithelpdocs", 'admin');
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$strgotofirst = get_string('gotofirstmissing','admin');
|
||||
$strfilestoredin = get_string('langstorein', 'admin');
|
||||
$strfilestoredinhelp = get_string('langstoreinhelp', 'admin');
|
||||
$strswitchlangdirbtn = get_string('langstoreswitch', 'admin');
|
||||
$strchoosefiletoedit = get_string('langchoosefile', 'admin');
|
||||
$streditennotallowed = get_string('langnoeditenglish', 'admin');
|
||||
$strfilecreated = get_string('langfilecreated', 'admin');
|
||||
|
||||
// FIXME / TODO
|
||||
// remove following lines after adding string into proper english lang pack
|
||||
$strgotofirst = 'go to first missing string';
|
||||
$strfilestoredin = 'Save file into folder :';
|
||||
$strfilestoredinhelp = 'Where the file will be stored';
|
||||
$strswitchlangdirbtn = 'switch';
|
||||
$strchoosefiletoedit = 'Choose file to edit from the box above';
|
||||
$streditennotallowed = 'Language en_utf8 cannot be edited with this page - switch to local';
|
||||
$strfilecreated = 'New file created';
|
||||
|
||||
$currentlang = current_language();
|
||||
|
||||
switch ($mode) {
|
||||
case "missing":
|
||||
// Missing array keys are not bugs here but missing strings
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $strmissingstrings";
|
||||
$title = $strmissingstrings;
|
||||
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
@@ -46,7 +117,6 @@
|
||||
break;
|
||||
}
|
||||
|
||||
$currentlang = current_language();
|
||||
|
||||
print_header("$site->shortname: $title", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
@@ -55,7 +125,7 @@
|
||||
|
||||
if (!$mode) {
|
||||
print_simple_box_start('center','80%');
|
||||
echo '<table align="center" width="100%"><tr><td width="50%" align="center">';
|
||||
echo '<table summary="" align="center" width="100%"><tr><td width="50%" align="center">';
|
||||
print_string('managelang','admin');
|
||||
echo '</td><td align="center" width="50%">';
|
||||
print_string('editlang','admin');
|
||||
@@ -65,7 +135,7 @@
|
||||
echo '</td><td>';
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
echo "<table align=\"center\"><tr><td align=\"right\">";
|
||||
echo "<table summary=\"\" align=\"center\"><tr><td align=\"right\">";
|
||||
echo "<b>$strcurrentlanguage:</b>";
|
||||
echo "</td><td>";
|
||||
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
@@ -84,8 +154,13 @@
|
||||
|
||||
// Get a list of all the root files in the English directory
|
||||
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
$enlangdir = "$CFG->dirroot/lang/en_utf8";
|
||||
if ($currentlang == 'en_utf8') {
|
||||
$langdir = $enlangdir;
|
||||
} else {
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
}
|
||||
$locallangdir = "$CFG->dataroot/lang/{$currentlang}_local";
|
||||
|
||||
if (! $stringfiles = get_directory_list($enlangdir, "", false)) {
|
||||
error("Could not find English language pack!");
|
||||
@@ -105,20 +180,31 @@
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
}
|
||||
|
||||
// Following variables store the HTML output to be echo-ed
|
||||
$m = '';
|
||||
$o = '';
|
||||
|
||||
// For each file, check that a counterpart exists, then check all the strings
|
||||
foreach ($stringfiles as $file) {
|
||||
unset($string);
|
||||
include("$enlangdir/$file");
|
||||
$enstring = $string;
|
||||
|
||||
ksort($enstring);
|
||||
|
||||
unset($string);
|
||||
|
||||
if (file_exists("$langdir/$file")) {
|
||||
include("$langdir/$file");
|
||||
$fileismissing = 0;
|
||||
} else {
|
||||
notify(get_string("filemissing", "", "$langdir/$file"));
|
||||
$fileismissing = 1;
|
||||
// notify(get_string("filemissing", "", "$langdir/$file"));
|
||||
$o .= '<div class="notifyproblem" align="center">'.get_string("filemissing", "", "$langdir/$file").'</div><br />';
|
||||
$string = array();
|
||||
}
|
||||
|
||||
$missingcounter = 0;
|
||||
|
||||
$first = true;
|
||||
foreach ($enstring as $key => $value) {
|
||||
@@ -127,18 +213,39 @@
|
||||
$value = str_replace("$"."a", "\\$"."a", $value);
|
||||
$value = str_replace("%%","%",$value);
|
||||
if ($first) {
|
||||
echo "<p><b>".get_string("stringsnotset","","$langdir/$file")."</b></p><pre>";
|
||||
$m .= "<a href=\"lang.php?mode=missing#$file\">$file";
|
||||
$m .= $fileismissing ? '*' : '';
|
||||
$m .= '</a> ';
|
||||
$o .= "<p><a name=\"$file\"></a><b>".get_string("stringsnotset","","$langdir/$file")."</b></p><pre>";
|
||||
$first = false;
|
||||
$somethingfound = true;
|
||||
}
|
||||
echo "$"."string['$key'] = \"$value\";<br />";
|
||||
$missingcounter++;
|
||||
if (LANG_LINK_MISSING_STRINGS) {
|
||||
$missinglinkstart = "<a href=\"lang.php?mode=compare&currentfile=$file#missing$missingcounter\">";
|
||||
$missinglinkend = '</a>';
|
||||
} else {
|
||||
$missinglinkstart = '';
|
||||
$missinglinkend = '';
|
||||
}
|
||||
$o .= "$"."string['".$missinglinkstart.$key.$missinglinkend."'] = \"$value\";<br />";
|
||||
}
|
||||
}
|
||||
if (!$first) {
|
||||
echo '</pre><hr />';
|
||||
$o .= '</pre><hr />';
|
||||
}
|
||||
}
|
||||
|
||||
if ($m <> '') {
|
||||
echo '<br />';
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center><font size="2">';
|
||||
echo $m;
|
||||
echo '</font></center>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
echo $o;
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
}
|
||||
@@ -169,12 +276,26 @@
|
||||
}
|
||||
|
||||
} else if ($mode == "compare") {
|
||||
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
|
||||
if (!$uselocal && !file_exists($langdir)) {
|
||||
if (!lang_make_directory($langdir)) {
|
||||
error('ERROR: Could not create directory '.$langdir);
|
||||
} else {
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$langdir .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($uselocal && !file_exists($locallangdir)) {
|
||||
if (!lang_make_directory($locallangdir)) {
|
||||
echo '<div class="notifyproblem" align="center">ERROR: Could not create directory '.
|
||||
$locallangdir .'</div>'."<br />\n";
|
||||
$uselocal = 0;
|
||||
} else {
|
||||
echo '<div class="notifysuccess" align="center">Created directory '.
|
||||
$locallangdir .'</div>'."<br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['currentfile'])){ // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
@@ -188,12 +309,28 @@
|
||||
}
|
||||
|
||||
unset($newstrings['currentfile']);
|
||||
if (lang_save_file($langdir, $currentfile, $newstrings)) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
|
||||
if ($uselocal) {
|
||||
include("$langdir/$currentfile");
|
||||
if (isset($string)) {
|
||||
$packstring = $string;
|
||||
} else {
|
||||
$packstring = array();
|
||||
}
|
||||
unset($string);
|
||||
$saveinto = $locallangdir;
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile");
|
||||
$packstring = array();
|
||||
$saveinto = $langdir;
|
||||
}
|
||||
}
|
||||
|
||||
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
|
||||
notify(get_string("changessaved")." ($saveinto/$currentfile)", "green");
|
||||
} else {
|
||||
error("Could not save the file '$saveinto/$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile");
|
||||
}
|
||||
unset($packstring);
|
||||
}
|
||||
|
||||
print_heading_with_help($streditstrings, "langedit");
|
||||
|
||||
@@ -209,133 +346,213 @@
|
||||
echo '</font></center>';
|
||||
print_simple_box_end();
|
||||
|
||||
|
||||
print_heading("$currentfile", "center", 4);
|
||||
|
||||
if (!file_exists("$langdir/$currentfile")) {
|
||||
if (!touch("$langdir/$currentfile")) {
|
||||
echo "<p><font color=\"red\">".get_string("filemissing", "", "$langdir/$currentfile")."</font></p>";
|
||||
continue;
|
||||
print_simple_box_start("center", "80%");
|
||||
echo '<center>'.$strfilestoredin.' <strong>';
|
||||
echo $uselocal ? "{$currentlang}_local" : $currentlang;
|
||||
echo '</strong> ';
|
||||
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
|
||||
|
||||
echo '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
|
||||
'<input type="hidden" name="mode" value="compare" />'.
|
||||
'<input type="hidden" name="currentfile" value="'.$currentfile.'" />'.
|
||||
'<input type="hidden" name="uselocal" value="'.(1 - $uselocal % 2).'" />'.
|
||||
'<input type="submit" value="'.$strswitchlangdirbtn.'" />'.
|
||||
'</form></center>';
|
||||
print_simple_box_end();
|
||||
|
||||
if ($currentfile <> '') {
|
||||
$saveto = $uselocal ? $locallangdir : $langdir;
|
||||
error_reporting(0);
|
||||
if (!file_exists("$saveto/$currentfile")) {
|
||||
if (!@touch("$saveto/$currentfile")) {
|
||||
print_heading(get_string("filemissing", "", "$saveto/$currentfile"), "center", 4, "error");
|
||||
} else {
|
||||
print_heading($strfilecreated, "center", 4, "notifysuccess");
|
||||
}
|
||||
}
|
||||
if ($currentlang == "en_utf8" && !$uselocal) {
|
||||
$editable = false;
|
||||
print_heading($streditennotallowed, 'center', 4);
|
||||
} elseif ($f = fopen("$saveto/$currentfile","r+")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
} else {
|
||||
$editable = false;
|
||||
echo "<p><font size=\"1\">".get_string("makeeditable", "", "$saveto/$currentfile")."</font></p>";
|
||||
}
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
print_heading("$currentfile", "center", 4);
|
||||
if (LANG_DISPLAY_MISSING_LINKS && $editable) {
|
||||
print_heading('<a href="#missing1">'.$strgotofirst.'</a>', "center", 4);
|
||||
}
|
||||
}
|
||||
|
||||
error_reporting(0);
|
||||
if ($f = fopen("$langdir/$currentfile","r+") && ($currentlang != "en_utf8")) {
|
||||
$editable = true;
|
||||
fclose($f);
|
||||
} else {
|
||||
$editable = false;
|
||||
echo "<p><font size=\"1\">".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
|
||||
}
|
||||
///added code here to prevent en_utf8 being edited
|
||||
|
||||
error_reporting(7);
|
||||
unset($string);
|
||||
include("$enlangdir/$currentfile");
|
||||
$enstring = $string;
|
||||
if ($currentlang != 'en' and $currentfile == 'moodle.php') {
|
||||
$enstring['thislanguage'] = "<< TRANSLATORS: Specify the name of your language here. If possible use Unicode Numeric Character References >>";
|
||||
$enstring['thischarset'] = "<< TRANSLATORS: Specify the character set of your language here. Note that all text created while this language is active will be stored using this character set, so don't change it once you have set it. Example: iso-8859-1 >>";
|
||||
$enstring['thisdirection'] = "<< TRANSLATORS: This string specifies the direction of your text, either left-to-right or right-to-left. Insert either 'ltr' or 'rtl' here. >>";
|
||||
$enstring['parentlanguage'] = "<< TRANSLATORS: If your language has a Parent Language that Moodle should use when strings are missing from your language pack, then specify the code for it here. If you leave this blank then English will be used. Example: nl >>";
|
||||
}
|
||||
ksort($enstring);
|
||||
|
||||
unset($string);
|
||||
|
||||
unset($string);
|
||||
include("$enlangdir/$currentfile");
|
||||
$enstring = $string;
|
||||
if ($currentlang != 'en' and $currentfile == 'moodle.php') {
|
||||
$enstring['thislanguage'] = "<< TRANSLATORS: Specify the name of your language here. If possible use Unicode Numeric Character References >>";
|
||||
$enstring['thischarset'] = "<< TRANSLATORS: Specify the character set of your language here. Note that all text created while this language is active will be stored using this character set, so don't change it once you have set it. Example: iso-8859-1 >>";
|
||||
$enstring['thisdirection'] = "<< TRANSLATORS: This string specifies the direction of your text, either left-to-right or right-to-left. Insert either 'ltr' or 'rtl' here. >>";
|
||||
$enstring['parentlanguage'] = "<< TRANSLATORS: If your language has a Parent Language that Moodle should use when strings are missing from your language pack, then specify the code for it here. If you leave this blank then English will be used. Example: nl >>";
|
||||
}
|
||||
ksort($enstring);
|
||||
|
||||
unset($string);
|
||||
include("$langdir/$currentfile");
|
||||
|
||||
if ($editable) {
|
||||
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
|
||||
}
|
||||
echo "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"3\" border=\"0\" class=\"generalbox\">";
|
||||
foreach ($enstring as $key => $envalue) {
|
||||
$envalue = nl2br(htmlspecialchars($envalue));
|
||||
$envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
|
||||
$envalue = str_replace("%%","%",$envalue);
|
||||
$envalue = str_replace("\\","",$envalue); // Delete all slashes
|
||||
|
||||
echo "\n\n".'<tr>';
|
||||
echo '<td dir="ltr" lang="en" width="20%" nowrap="nowrap" valign="top">'.$key.'</td>'."\n";
|
||||
echo '<td dir="ltr" lang="en" width="40%" valign="top">'.$envalue.'</td>'."\n";
|
||||
|
||||
$value = $string[$key];
|
||||
$value = str_replace("\r","",$value); // Bad character caused by Windows
|
||||
$value = preg_replace("/\n{3,}/", "\n\n", $value); // Collapse runs of blank lines
|
||||
$value = trim($value, "\n"); // Delete leading/trailing lines
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = str_replace("<","<",$value);
|
||||
$value = str_replace(">",">",$value);
|
||||
$value = str_replace('"',""",$value);
|
||||
|
||||
$cellcolour = $value ? '': 'class="highlight"';
|
||||
@include("$locallangdir/$currentfile");
|
||||
$localstring = isset($string) ? $string : array();
|
||||
unset($string);
|
||||
|
||||
@include("$langdir/$currentfile");
|
||||
|
||||
if ($editable) {
|
||||
echo '<td width="40%" '.$cellcolour.' valign="top">'."\n";
|
||||
if (isset($string[$key])) {
|
||||
$valuelen = strlen($value);
|
||||
} else {
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=50;
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
echo '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 2;
|
||||
}
|
||||
echo '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td width="40%" bgcolor="'.$cellcolour.'" valign="top">'.$value.'</td>';
|
||||
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
|
||||
}
|
||||
}
|
||||
if ($editable) {
|
||||
echo '<tr><td colspan="2"> <td><br />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo ' <input type="hidden" name="currentfile" value="'.$currentfile.'" />';
|
||||
echo ' <input type="hidden" name="mode" value="compare" />';
|
||||
echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
echo "<table summary=\"\" width=\"100%\" cellpadding=\"2\" cellspacing=\"3\" border=\"0\" class=\"generalbox\">";
|
||||
$linescounter = 0;
|
||||
$missingcounter = 0;
|
||||
foreach ($enstring as $key => $envalue) {
|
||||
$linescounter++ ;
|
||||
if (LANG_SUBMIT_REPEAT && $editable && $linescounter % LANG_SUBMIT_REPEAT_EVERY == 0) {
|
||||
echo '<tr><td colspan="2"> <td><br />';
|
||||
echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
|
||||
echo '<br /> </td></tr>';
|
||||
}
|
||||
$envalue = nl2br(htmlspecialchars($envalue));
|
||||
$envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
|
||||
$envalue = str_replace("%%","%",$envalue);
|
||||
$envalue = str_replace("\\","",$envalue); // Delete all slashes
|
||||
|
||||
echo "\n\n".'<tr>';
|
||||
echo '<td dir="ltr" lang="en" width="20%" nowrap="nowrap" valign="top">'.$key.'</td>'."\n";
|
||||
echo '<td dir="ltr" lang="en" width="40%" valign="top">'.$envalue.'</td>'."\n";
|
||||
|
||||
// Missing array keys are not bugs here but missing strings
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
if ($uselocal) {
|
||||
$value = lang_fix_value_from_file($localstring[$key]);
|
||||
$value2 = lang_fix_value_from_file($string[$key]);
|
||||
if ($value == '') {
|
||||
$value = $value2;
|
||||
}
|
||||
} else {
|
||||
$value = lang_fix_value_from_file($string[$key]);
|
||||
$value2 = lang_fix_value_from_file($localstring[$key]);
|
||||
}
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
// Color highlighting:
|
||||
// red #ef6868 - translation missing in both system and local pack
|
||||
// yellow #feff7f - translation missing in system pack but is translated in local
|
||||
// green #AAFFAA - translation present in both system and local but is different
|
||||
if (!$value) {
|
||||
if (!$value2) {
|
||||
$cellcolour = 'style="background-color: #ef6868"'; // TODO: replace by CSS class
|
||||
} else {
|
||||
$cellcolour = 'style="background-color: #feff7f"'; // TODO: replace by CSS class
|
||||
}
|
||||
$missingcounter++;
|
||||
if (LANG_DISPLAY_MISSING_LINKS) {
|
||||
$missingtarget = '<a name="missing'.$missingcounter.'"></a>';
|
||||
$missingnext = '<a href="#missing'.($missingcounter+1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/down.gif" height="11" width="11" border="0" alt="" /></a>';
|
||||
$missingprev = '<a href="#missing'.($missingcounter-1).'">'.
|
||||
'<img src="' . $CFG->pixpath . '/t/up.gif" height="11" width="11" border="0" alt="" /></a>';
|
||||
} else {
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
$missingprev = '';
|
||||
}
|
||||
} else {
|
||||
if ($value <> $value2 && $value2 <> '') {
|
||||
$cellcolour = 'style="background-color: #AAFFAA"'; // TODO: replace by CSS class
|
||||
} else {
|
||||
$cellcolour = '';
|
||||
}
|
||||
$missingtarget = '';
|
||||
$missingnext = '';
|
||||
$missingprev = '';
|
||||
}
|
||||
|
||||
if ($editable) {
|
||||
echo '<td width="40%" '.$cellcolour.' valign="top">'. $missingprev . $missingtarget."\n";
|
||||
if (isset($string[$key])) {
|
||||
$valuelen = strlen($value);
|
||||
} else {
|
||||
$valuelen = strlen($envalue);
|
||||
}
|
||||
$cols=50;
|
||||
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
|
||||
$rows = ceil($valuelen / $cols);
|
||||
echo '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
|
||||
} else {
|
||||
if ($valuelen) {
|
||||
$cols = $valuelen + 5;
|
||||
}
|
||||
echo '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
|
||||
}
|
||||
if ($value2 <> '' && $value <> $value2) {
|
||||
echo '<br /><span style="font-size:small">'.$value2.'</span>';
|
||||
}
|
||||
echo $missingnext . '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td width="40%" bgcolor="'.$cellcolour.'" valign="top">'.$value.'</td>';
|
||||
}
|
||||
}
|
||||
if ($editable) {
|
||||
echo '<tr><td colspan="2"> <td><br />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
echo ' <input type="hidden" name="currentfile" value="'.$currentfile.'" />';
|
||||
echo ' <input type="hidden" name="mode" value="compare" />';
|
||||
echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
// no $currentfile specified
|
||||
print_heading($strchoosefiletoedit, "center", 4);
|
||||
}
|
||||
}
|
||||
|
||||
print_footer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lang_save_file($path, $file, $strings) {
|
||||
// Thanks to Petri Asikainen for the original version of code
|
||||
// used to save language files.
|
||||
//
|
||||
// $path is a full pathname to the file
|
||||
// $file is the file to overwrite.
|
||||
// $strings is an array of strings to write
|
||||
|
||||
/**
|
||||
* Save language translation file.
|
||||
*
|
||||
* Thanks to Petri Asikainen for the original version of code
|
||||
* used to save language files.
|
||||
*
|
||||
* @uses $CFG
|
||||
* @uses $USER
|
||||
* @param string $path Full pathname to the directory to use
|
||||
* @param string $file File to overwrite
|
||||
* @param array $strings Array of strings to write
|
||||
* @param bool $local Should *_local version be saved?
|
||||
* @param array $packstrings Array of default langpack strings (needed if $local)
|
||||
* @return bool Created successfully?
|
||||
*/
|
||||
function lang_save_file($path, $file, $strings, $local, $packstrings) {
|
||||
global $CFG, $USER;
|
||||
|
||||
error_reporting(0);
|
||||
if (!$f = fopen("$path/$file","w")) {
|
||||
if (!$f = @fopen("$path/$file","w")) {
|
||||
return false;
|
||||
}
|
||||
error_reporting(7);
|
||||
|
||||
|
||||
fwrite($f, "<?PHP // \$Id\$ \n");
|
||||
fwrite($f, " // $file - created with Moodle $CFG->release ($CFG->version)\n\n\n");
|
||||
|
||||
fwrite($f, " // $file - created with Moodle $CFG->release ($CFG->version)\n");
|
||||
if ($local) {
|
||||
fwrite($f, " // local modifications from $CFG->wwwroot\n");
|
||||
}
|
||||
fwrite($f, "\n\n");
|
||||
ksort($strings);
|
||||
|
||||
foreach ($strings as $key => $value) {
|
||||
list($id, $stringname) = explode('XXX',$key);
|
||||
@list($id, $stringname) = explode('XXX',$key);
|
||||
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
}
|
||||
@@ -343,16 +560,55 @@ function lang_save_file($path, $file, $strings) {
|
||||
$value = str_replace('"', "\\\"", $value); // Add slashes for "
|
||||
$value = str_replace("%","%%",$value); // Escape % characters
|
||||
$value = str_replace("\r", "",$value); // Remove linefeed characters
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
if ($id == "string" and $value != ""){
|
||||
fwrite($f,"\$string['$stringname'] = '$value';\n");
|
||||
if ((!$local) || (lang_fix_value_from_file($packstrings[$stringname]) <> lang_fix_value_from_file($value))) {
|
||||
fwrite($f,"\$string['$stringname'] = '$value';\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite($f,"\n?>\n");
|
||||
fclose($f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix value of string to translate.
|
||||
*
|
||||
* @param string $value Original string from the file
|
||||
* @return string Fixed value
|
||||
*/
|
||||
function lang_fix_value_from_file($value='') {
|
||||
$value = str_replace("\r","",$value); // Bad character caused by Windows
|
||||
$value = preg_replace("/\n{3,}/", "\n\n", $value); // Collapse runs of blank lines
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = str_replace("<","<",$value);
|
||||
$value = str_replace(">",">",$value);
|
||||
$value = str_replace('"',""",$value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and create a new language directory.
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param string $directory directory name under $CFG->dataroot/lang eg cs_utf8_local
|
||||
* @return string|false Returns full path to directory if successful, false if not
|
||||
*/
|
||||
function lang_make_directory($dir, $shownotices=true) {
|
||||
global $CFG;
|
||||
umask(0000);
|
||||
if (! file_exists($dir)) {
|
||||
if (! @mkdir($dir, $CFG->directorypermissions)) {
|
||||
return false;
|
||||
}
|
||||
//@chmod($dir, $CFG->directorypermissions); // Just in case mkdir didn't do it
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Following functions are required because '.' in form input names
|
||||
@@ -362,7 +618,6 @@ function lang_form_string_key($keyfromfile) {
|
||||
return str_replace('.', '##46#', $keyfromfile); /// Derived from ., the ascii value for a period.
|
||||
}
|
||||
|
||||
|
||||
function lang_file_string_key($keyfromform) {
|
||||
return str_replace('##46#', '.', $keyfromform);
|
||||
}
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ $langdir/$currentfile")."</font></p>";
|
||||
|
||||
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
|
||||
if (file_exists("$langdir/$currentfile")) {
|
||||
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
|
||||
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
|
||||
} else {
|
||||
echo ($filetemplate);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only admins can access this page");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strmisc = get_string("miscellaneous");
|
||||
|
||||
print_header("$site->shortname: $stradministration: $strmisc", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> $strmisc");
|
||||
|
||||
print_heading($strmisc);
|
||||
|
||||
$table->align = array ("right", "left");
|
||||
|
||||
$table->data[] = array('<b><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').'</a></b>',
|
||||
get_string("adminhelpsitefiles"));
|
||||
$table->data[] = array('<b><a href="stickyblocks.php">'.get_string('stickyblocks','admin')."</a></b>",
|
||||
get_string('adminhelpstickyblocks'));
|
||||
$table->data[] = array('<b><a href="report.php">'.get_string('reports')."</a></b>",
|
||||
get_string('adminhelpreports'));
|
||||
// to be enabled later
|
||||
/* $table->data[] = array('<b><a href="health.php">'.get_string('healthcenter')."</a></b>",
|
||||
get_string('adminhelphealthcenter'));*/
|
||||
$table->data[] = array('<b><a href="environment.php">'.get_string('environment', 'admin')."</a></b>",
|
||||
get_string('adminhelpenvironment'));
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
|
||||
$table->data[] = array('<b><a href="'.$CFG->dbtype.'/frame.php">'.get_string('managedatabase')."</a></b>",
|
||||
get_string('adminhelpmanagedatabase'));
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
print_footer($site);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@
|
||||
|
||||
print_heading($strmanagemodules);
|
||||
|
||||
$courseaffected = false;
|
||||
$coursesaffected = false;
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
@@ -149,10 +149,10 @@
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$strmodulename = get_string("modulename", "$module->name");
|
||||
// Deal with modules which are lacking the language string
|
||||
if ($strmodulename == '[[modulename]]') {
|
||||
$strmodulename = $module->name;
|
||||
}
|
||||
// Deal with modules which are lacking the language string
|
||||
if ($strmodulename == '[[modulename]]') {
|
||||
$strmodulename = $module->name;
|
||||
}
|
||||
$modulebyname[$strmodulename] = $module;
|
||||
}
|
||||
ksort($modulebyname);
|
||||
@@ -177,7 +177,7 @@
|
||||
$settings = "";
|
||||
}
|
||||
|
||||
$count = count_records("$module->name");
|
||||
$count = count_records_select("$module->name",'course<>0');
|
||||
|
||||
if ($module->visible) {
|
||||
$visible = "<a href=\"modules.php?hide=$module->name&sesskey=$USER->sesskey\" title=\"$strhide\">".
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
if (empty($CFG->siteidentifier)) { // Unique site identification code
|
||||
set_config('siteidentifier', random_string(32));
|
||||
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -9,9 +9,11 @@
|
||||
|
||||
$stradmin = get_string('administration');
|
||||
$strreports = get_string('reports');
|
||||
$strmisc = get_string('miscellaneous');
|
||||
|
||||
print_header($strreports, $strreports,
|
||||
'<a href="index.php">'.$stradmin.'</a> -> '.$strreports);
|
||||
'<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
|
||||
$strreports);
|
||||
|
||||
$directories = get_list_of_plugins('admin/report');
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
$strreports = get_string('reports');
|
||||
$strcourseoverview = get_string('courseoverview');
|
||||
|
||||
$strnav = '<a href="'.$CFG->wwwroot.'/admin/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/admin/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
|
||||
$strnav = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
|
||||
|
||||
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
|
||||
|
||||
@@ -75,10 +75,14 @@
|
||||
$courses = get_records_sql($sql);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/report/courseoverview/index.php');
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/index.php');
|
||||
}
|
||||
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/admin/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "<center>(".get_string("gdneed").")</center>";
|
||||
} else {
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
|
||||
}
|
||||
|
||||
$table = new object();
|
||||
$table->align = array('left','center','center','center');
|
||||
@@ -93,12 +97,13 @@
|
||||
foreach ($courses as $c) {
|
||||
$a = array();
|
||||
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
|
||||
$a[] = print_numeric_value($c->line1);
|
||||
|
||||
$a[] = $c->line1;
|
||||
if (isset($c->line2)) {
|
||||
$a[] = print_numeric_value($c->line2);
|
||||
$a[] = $c->line2;
|
||||
}
|
||||
if (isset($c->line3)) {
|
||||
$a[] = print_numeric_value($c->line3);
|
||||
$a[] = $c->line3;
|
||||
}
|
||||
$table->data[] = $a;
|
||||
}
|
||||
@@ -107,12 +112,4 @@
|
||||
|
||||
print_footer();
|
||||
|
||||
function print_numeric_value($value) {
|
||||
list($whole, $decimals) = split ('[.,]', $value, 2);
|
||||
if (intval($decimals) > 0)
|
||||
return number_format($value,2,".",",");
|
||||
else
|
||||
return $value;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,53 @@
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
echo '<a href="'.$CFG->wwwroot.'/admin/report/courseoverview/index.php">'.get_string('courseoverview').'</a>';
|
||||
|
||||
$strreports = get_string('reports');
|
||||
$strcourseoverview = get_string('courseoverview');
|
||||
|
||||
print_heading("$strcourseoverview:");
|
||||
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
|
||||
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
$course = get_site();
|
||||
$statsstatus = stats_check_uptodate($course->id);
|
||||
|
||||
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
|
||||
|
||||
$tableprefix = $CFG->prefix.'stats_';
|
||||
|
||||
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
|
||||
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
|
||||
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
|
||||
|
||||
if (empty($earliestday)) $earliestday = time();
|
||||
if (empty($earliestweek)) $earliestweek = time();
|
||||
if (empty($earliestmonth)) $earliestmonth = time();
|
||||
|
||||
$now = stats_get_base_daily();
|
||||
$lastweekend = stats_get_base_weekly();
|
||||
$lastmonthend = stats_get_base_monthly();
|
||||
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
$table->width = '*';
|
||||
$table->align = array('left','left','left','left','left','left');
|
||||
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
|
||||
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
|
||||
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
|
||||
'<input type="submit" value="'.get_string('view').'" />') ;
|
||||
|
||||
echo '<form action="report/courseoverview/index.php" method="post">'."\n";
|
||||
print_table($table);
|
||||
echo '</form>';
|
||||
if ($statsstatus !== NULL) {
|
||||
notify ($statsstatus);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
$courses = get_records_sql($sql);
|
||||
|
||||
if (empty($courses)) {
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/report/course/index.php');
|
||||
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Executable
+397
@@ -0,0 +1,397 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Spam Cleaner
|
||||
*
|
||||
* Helps an admin to clean up spam in Moodle
|
||||
*
|
||||
* @version $Id$
|
||||
* @authors Dongsheng Cai, Martin Dougiamas, Amr Hourani
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
*/
|
||||
|
||||
// Configuration
|
||||
|
||||
// List of known spammy keywords, please add more here
|
||||
|
||||
$autokeywords = array(
|
||||
"<img",
|
||||
"fuck",
|
||||
"casino",
|
||||
"porn",
|
||||
"xxx",
|
||||
"cialis",
|
||||
"viagra",
|
||||
"poker",
|
||||
"warcraft"
|
||||
);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
function delete_user($user) {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = 1;
|
||||
$updateuser->username = addslashes("$user->email.".time());
|
||||
$updateuser->email = '';
|
||||
$updateuser->idnumber = '';
|
||||
$updateuser->timemodified = time();
|
||||
if (update_record('user', $updateuser)) {
|
||||
role_unassign(0, $user->id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$keyword = optional_param('keyword', '', PARAM_RAW);
|
||||
$autodetect = optional_param('autodetect', '', PARAM_RAW);
|
||||
$del = optional_param('del', '', PARAM_RAW);
|
||||
$delall = optional_param('delall', '', PARAM_RAW);
|
||||
$ignore = optional_param('ignore', '', PARAM_RAW);
|
||||
$reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
// Implement some AJAX calls
|
||||
|
||||
// Delete one user
|
||||
if (!empty($del) && confirm_sesskey() && ($id != $USER->id)) {
|
||||
if (isset($SESSION->users_result[$id])) {
|
||||
$user = $SESSION->users_result[$id];
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete lots of users
|
||||
if (!empty($delall) && confirm_sesskey()) {
|
||||
if (!empty($SESSION->users_result)) {
|
||||
foreach ($SESSION->users_result as $userid => $user) {
|
||||
if ($userid != $USER->id) {
|
||||
if (delete_user($user)) {
|
||||
unset($SESSION->users_result[$userid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($ignore)) {
|
||||
unset($SESSION->users_result[$id]);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
$strspamcleaner = get_string('spamcleaner', 'admin');
|
||||
$strnav = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'. get_string('reports') .'</a> -> '.$strspamcleaner;
|
||||
// Print headers and things
|
||||
print_header($strspamcleaner, $strspamcleaner, $strnav);
|
||||
|
||||
print_spamcleaner_javascript();
|
||||
|
||||
print_simple_box(get_string('spamcleanerintro', 'report_spamcleaner'));
|
||||
|
||||
?>
|
||||
|
||||
<div class="mdl-align">
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'report_spamcleaner')?>" />
|
||||
</div>
|
||||
</form>
|
||||
<p><?php echo get_string('spameg', 'report_spamcleaner');?></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'report_spamcleaner');?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
echo '<div id="result" class="mdl-align">';
|
||||
|
||||
// Print list of resulting profiles
|
||||
|
||||
if (!empty($keyword)) { // Use the keyword(s) supplied by the user
|
||||
$keywords = explode(',', $keyword);
|
||||
foreach ($keywords as $key => $keyword) {
|
||||
$keywords[$key] = trim($keyword);
|
||||
}
|
||||
search_spammers($keywords);
|
||||
|
||||
} else if (!empty($autodetect)) { // Use the inbuilt keyword list to detect users
|
||||
search_spammers($autokeywords);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/// Functions
|
||||
|
||||
|
||||
function search_spammers($keywords) {
|
||||
|
||||
global $CFG, $USER, $DB;
|
||||
|
||||
if (!is_array($keywords)) {
|
||||
$keywords = array($keywords); // Make it into an array
|
||||
}
|
||||
|
||||
$like = sql_ilike();
|
||||
|
||||
$keywordfull = array();
|
||||
foreach ($keywords as $keyword) {
|
||||
$keyword = addslashes($keyword); // Just to be safe
|
||||
$keywordfull[] = " description $like '%$keyword%' ";
|
||||
$keywordfull2[] = " p.summary $like '%$keyword%' ";
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
|
||||
$sql = "SELECT * FROM {$CFG->prefix}user WHERE deleted = 0 AND id <> {$USER->id} AND $conditions"; // Exclude oneself
|
||||
$sql2= "SELECT u.*, p.summary FROM {$CFG->prefix}user AS u, {$CFG->prefix}post AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> {$USER->id}";
|
||||
$spamusers_desc = get_recordset_sql($sql);
|
||||
$spamusers_blog = get_recordset_sql($sql2);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
print_simple_box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
}
|
||||
|
||||
function print_user_list($users_rs, $keywords) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
// reset session everytime this function is called
|
||||
$SESSION->users_result = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ($users_rs as $key=>$rs) {
|
||||
while(!$rs->EOF) {
|
||||
$user = (object)$rs->fields;
|
||||
if (!$count) {
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'report_spamcleaner').'</th><th>'.get_string('spamoperation', 'report_spamcleaner').'</th></tr>';
|
||||
}
|
||||
$rs->MoveNext();
|
||||
$count++;
|
||||
filter_user($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$count) {
|
||||
echo get_string('spamcannotfinduser', 'report_spamcleaner');
|
||||
|
||||
} else {
|
||||
echo '</table>';
|
||||
echo '<div class="mld-align">
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'report_spamcleaner').'</button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
function filter_user($user, $keywords, $count) {
|
||||
global $CFG;
|
||||
$image_search = false;
|
||||
if (in_array('<img', $keywords)) {
|
||||
$image_search = true;
|
||||
}
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
}
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->pixpath.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
foreach ($keywords as $keyword) {
|
||||
if (preg_match('#'.$keyword.'#', $user->description)
|
||||
&& ($keyword != '<img')) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
} else {
|
||||
unset($user);
|
||||
}
|
||||
} else {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function print_user_entry($user, $keywords, $count) {
|
||||
|
||||
global $SESSION, $CFG;
|
||||
|
||||
$smalluserobject = new object; // All we need to delete them later
|
||||
$smalluserobject->id = $user->id;
|
||||
$smalluserobject->email = $user->email;
|
||||
$smalluserobject->auth = $user->auth;
|
||||
$smalluserobject->firstname = $user->firstname;
|
||||
$smalluserobject->lastname = $user->lastname;
|
||||
|
||||
if (empty($SESSION->users_result[$user->id])) {
|
||||
$SESSION->users_result[$user->id] = $smalluserobject;
|
||||
$html = '<tr valign="top" id="row-'.$user->id.'" class="result-row">';
|
||||
$html .= '<td width="10">'.$count.'</td>';
|
||||
$html .= '<td width="30%" align="left"><a href="'.$CFG->wwwroot."/user/view.php?course=1&id=".$user->id.'" title="'.s($user->username).'">'.fullname($user).'</a>';
|
||||
|
||||
$html .= "<ul>";
|
||||
$profile_set = array('city'=>true, 'country'=>true, 'email'=>true);
|
||||
foreach ($profile_set as $key=>$value) {
|
||||
if (isset($user->$key)){
|
||||
$html .= '<li>'.$user->$key.'</li>';
|
||||
}
|
||||
}
|
||||
$html .= "</ul>";
|
||||
$html .= '</td>';
|
||||
|
||||
foreach ($keywords as $keyword) {
|
||||
$user->description = highlight($keyword, $user->description);
|
||||
}
|
||||
|
||||
$html .= '<td align="left">'.format_text($user->description, FORMAT_MOODLE).'</td>';
|
||||
$html .= '<td width="100px" align="center">';
|
||||
$html .= '<button onclick="del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function print_spamcleaner_javascript() {
|
||||
global $CFG;
|
||||
|
||||
$sesskey = sesskey();
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/lib/yui/connection/connection-min.js"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var service_url = '<?php echo $CFG->wwwroot;?>/admin/report/spamcleaner/index.php';
|
||||
function ajax(url, callback)
|
||||
{
|
||||
method = 'POST';
|
||||
if (window.XMLHttpRequest) {
|
||||
var req = new XMLHttpRequest();
|
||||
} else {
|
||||
var MSXML = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
|
||||
for(var n = 0; n < MSXML.length; n ++) {
|
||||
try {
|
||||
var req = new ActiveXObject(MSXML[n]);
|
||||
break;
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
with(req) {
|
||||
try {
|
||||
open(method, url, true);
|
||||
setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||
send(null);
|
||||
} catch(e) {
|
||||
alert(e);
|
||||
}
|
||||
onreadystatechange = function()
|
||||
{
|
||||
if (req.readyState == 4)
|
||||
{
|
||||
callback(req.responseText, req.status);
|
||||
delete(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var row = null;
|
||||
function delall_cb (text) {
|
||||
if(text){
|
||||
window.location.href=window.location.href;
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
var remove_all = document.getElementById('removeall_btn');
|
||||
if(remove_all){
|
||||
remove_all.onclick = function(){
|
||||
var yes = confirm('<?php echo get_string('spamdeleteallconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
ajax(service_url + '?delall=yes&sesskey=<?php echo $sesskey;?>', delall_cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_cb (text) {
|
||||
if(row) {
|
||||
if(text){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
} else {
|
||||
alert('<?php echo get_string('spamcannotdelete', 'report_spamcleaner');?>');
|
||||
}
|
||||
}
|
||||
}
|
||||
function ignore_cb (text) {
|
||||
if(row) {
|
||||
if(text){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_user(obj, id) {
|
||||
var yes = confirm('<?php echo get_string('spamdeleteconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
row = obj;
|
||||
ajax(service_url + '?del=yes&sesskey=<?php echo $sesskey;?>&id='+id, del_cb);
|
||||
}
|
||||
}
|
||||
function ignore_user(obj, id) {
|
||||
row = obj;
|
||||
ajax(service_url + '?ignore=yes&sesskey=<?php echo $sesskey;?>&id='+id, ignore_cb);
|
||||
}
|
||||
window.onload = function(){
|
||||
init();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
print_footer();
|
||||
?>
|
||||
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
$keyword = optional_param('keyword', '', PARAM_RAW);
|
||||
$autodetect = optional_param('autodetect', '', PARAM_RAW);
|
||||
$reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
// List of known spammy keywords, please add more here
|
||||
|
||||
$autokeywords = array(
|
||||
"<img",
|
||||
"fuck",
|
||||
"casino",
|
||||
"porn",
|
||||
"xxx",
|
||||
"cialis",
|
||||
"viagra",
|
||||
"poker",
|
||||
"warcraft"
|
||||
);
|
||||
|
||||
// Print headers and things
|
||||
|
||||
print_heading(get_string('spamcleaner', 'admin'));
|
||||
print_spamcleaner_javascript();
|
||||
|
||||
print_simple_box(get_string('spamcleanerintro', 'report_spamcleaner'));
|
||||
|
||||
?>
|
||||
|
||||
<div class="mdl-align">
|
||||
|
||||
<form method="post" action="report.php">
|
||||
<div>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'report_spamcleaner')?>" />
|
||||
</div>
|
||||
</form>
|
||||
<p><?php echo get_string('spameg', 'report_spamcleaner');?></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<form method="post" action="report.php">
|
||||
<div>
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'report_spamcleaner');?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
echo '<div id="result" class="mdl-align">';
|
||||
|
||||
// Print list of resulting profiles
|
||||
|
||||
if (!empty($keyword)) { // Use the keyword(s) supplied by the user
|
||||
$keywords = explode(',', $keyword);
|
||||
foreach ($keywords as $key => $keyword) {
|
||||
$keywords[$key] = trim($keyword);
|
||||
}
|
||||
search_spammers($keywords);
|
||||
|
||||
} else if (!empty($autodetect)) { // Use the inbuilt keyword list to detect users
|
||||
search_spammers($autokeywords);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/// Functions
|
||||
|
||||
|
||||
function search_spammers($keywords) {
|
||||
|
||||
global $CFG, $USER, $DB;
|
||||
|
||||
if (!is_array($keywords)) {
|
||||
$keywords = array($keywords); // Make it into an array
|
||||
}
|
||||
|
||||
$like = sql_ilike();
|
||||
|
||||
$keywordfull = array();
|
||||
foreach ($keywords as $keyword) {
|
||||
$keyword = addslashes($keyword); // Just to be safe
|
||||
$keywordfull[] = " description $like '%$keyword%' ";
|
||||
$keywordfull2[] = " p.summary $like '%$keyword%' ";
|
||||
}
|
||||
$conditions = '( '.implode(' OR ', $keywordfull).' )';
|
||||
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
|
||||
|
||||
$sql = "SELECT * FROM {$CFG->prefix}user WHERE deleted = 0 AND id <> {$USER->id} AND $conditions"; // Exclude oneself
|
||||
$sql2= "SELECT u.*, p.summary FROM {$CFG->prefix}user AS u, {$CFG->prefix}post AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> {$USER->id}";
|
||||
$spamusers_desc = get_recordset_sql($sql);
|
||||
$spamusers_blog = get_recordset_sql($sql2);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
print_simple_box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
}
|
||||
|
||||
function print_user_list($users_rs, $keywords) {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
// reset session everytime this function is called
|
||||
$SESSION->users_result = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ($users_rs as $key=>$rs) {
|
||||
while(!$rs->EOF) {
|
||||
$user = (object)$rs->fields;
|
||||
if (!$count) {
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'report_spamcleaner').'</th><th>'.get_string('spamoperation', 'report_spamcleaner').'</th></tr>';
|
||||
}
|
||||
$rs->MoveNext();
|
||||
$count++;
|
||||
filter_user($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$count) {
|
||||
echo get_string('spamcannotfinduser', 'report_spamcleaner');
|
||||
|
||||
} else {
|
||||
echo '</table>';
|
||||
echo '<div class="mld-align">
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'report_spamcleaner').'</button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
function filter_user($user, $keywords, $count) {
|
||||
global $CFG;
|
||||
$image_search = false;
|
||||
if (in_array('<img', $keywords)) {
|
||||
$image_search = true;
|
||||
}
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
}
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->pixpath.')#', $user->description, $matches)
|
||||
&& $image_search) {
|
||||
$result = false;
|
||||
foreach ($keywords as $keyword) {
|
||||
if (preg_match('#'.$keyword.'#', $user->description)
|
||||
&& ($keyword != '<img')) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
} else {
|
||||
unset($user);
|
||||
}
|
||||
} else {
|
||||
echo print_user_entry($user, $keywords, $count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function print_user_entry($user, $keywords, $count) {
|
||||
|
||||
global $SESSION, $CFG;
|
||||
|
||||
$smalluserobject = new object; // All we need to delete them later
|
||||
$smalluserobject->id = $user->id;
|
||||
$smalluserobject->email = $user->email;
|
||||
$smalluserobject->auth = $user->auth;
|
||||
$smalluserobject->firstname = $user->firstname;
|
||||
$smalluserobject->lastname = $user->lastname;
|
||||
|
||||
if (empty($SESSION->users_result[$user->id])) {
|
||||
$SESSION->users_result[$user->id] = $smalluserobject;
|
||||
$html = '<tr valign="top" id="row-'.$user->id.'" class="result-row">';
|
||||
$html .= '<td width="10">'.$count.'</td>';
|
||||
$html .= '<td width="30%" align="left"><a href="'.$CFG->wwwroot."/user/view.php?course=1&id=".$user->id.'" title="'.s($user->username).'">'.fullname($user).'</a>';
|
||||
|
||||
$html .= "<ul>";
|
||||
$profile_set = array('city'=>true, 'country'=>true, 'email'=>true);
|
||||
foreach ($profile_set as $key=>$value) {
|
||||
if (isset($user->$key)){
|
||||
$html .= '<li>'.$user->$key.'</li>';
|
||||
}
|
||||
}
|
||||
$html .= "</ul>";
|
||||
$html .= '</td>';
|
||||
|
||||
foreach ($keywords as $keyword) {
|
||||
$user->description = highlight($keyword, $user->description);
|
||||
}
|
||||
|
||||
$html .= '<td align="left">'.format_text($user->description, FORMAT_MOODLE).'</td>';
|
||||
$html .= '<td width="100px" align="center">';
|
||||
$html .= '<button onclick="del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function print_spamcleaner_javascript() {
|
||||
global $CFG;
|
||||
|
||||
$sesskey = sesskey();
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var service_url = '<?php echo $CFG->wwwroot;?>/admin/report/spamcleaner/index.php';
|
||||
function ajax(url, callback)
|
||||
{
|
||||
method = 'POST';
|
||||
if (window.XMLHttpRequest) {
|
||||
var req = new XMLHttpRequest();
|
||||
} else {
|
||||
var MSXML = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
|
||||
for(var n = 0; n < MSXML.length; n ++) {
|
||||
try {
|
||||
var req = new ActiveXObject(MSXML[n]);
|
||||
break;
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
with(req) {
|
||||
try {
|
||||
open(method, url, true);
|
||||
setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||
send(null);
|
||||
} catch(e) {
|
||||
alert(e);
|
||||
}
|
||||
onreadystatechange = function()
|
||||
{
|
||||
if (req.readyState == 4)
|
||||
{
|
||||
callback(req.responseText, req.status);
|
||||
delete(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var row = null;
|
||||
function delall_cb (text) {
|
||||
if(text){
|
||||
window.location.href=window.location.href;
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
var remove_all = document.getElementById('removeall_btn');
|
||||
if(remove_all){
|
||||
remove_all.onclick = function(){
|
||||
var yes = confirm('<?php echo get_string('spamdeleteallconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
ajax(service_url + '?delall=yes&sesskey=<?php echo $sesskey;?>', delall_cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_cb (text) {
|
||||
if(row) {
|
||||
if(text){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
} else {
|
||||
alert('<?php echo get_string('spamcannotdelete', 'report_spamcleaner');?>');
|
||||
}
|
||||
}
|
||||
}
|
||||
function ignore_cb (text) {
|
||||
if(row) {
|
||||
if(text){
|
||||
while(row.tagName != 'TR') {
|
||||
row = row.parentNode;
|
||||
}
|
||||
row.parentNode.removeChild(row);
|
||||
row = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_user(obj, id) {
|
||||
var yes = confirm('<?php echo get_string('spamdeleteconfirm', 'report_spamcleaner');?>');
|
||||
if(yes){
|
||||
row = obj;
|
||||
ajax(service_url + '?del=yes&sesskey=<?php echo $sesskey;?>&id='+id, del_cb);
|
||||
}
|
||||
}
|
||||
function ignore_user(obj, id) {
|
||||
row = obj;
|
||||
ajax(service_url + '?ignore=yes&sesskey=<?php echo $sesskey;?>&id='+id, ignore_cb);
|
||||
}
|
||||
window.onload = function(){
|
||||
init();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
require_once($CFG->dirroot.'/course/report/stats/lib.php');
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
error("Stats is not enabled.");
|
||||
}
|
||||
|
||||
$courseid = required_param('course', PARAM_INT);
|
||||
$report = optional_param('report', 0, PARAM_INT);
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
|
||||
if ($report == STATS_REPORT_USER_LOGINS) {
|
||||
$courseid = SITEID; //override
|
||||
}
|
||||
|
||||
if ($mode == STATS_MODE_RANKED) {
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time);
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!empty($userid)) {
|
||||
if (!$user = get_record('user','id',$userid)) {
|
||||
error("That's an invalid user id");
|
||||
}
|
||||
}
|
||||
|
||||
require_login();
|
||||
if (!isteacher($course->id)) {
|
||||
error("You need to be a teacher to use this page");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
|
||||
|
||||
$strreports = get_string("reports");
|
||||
$strstats = get_string('stats');
|
||||
|
||||
$menu = report_stats_mode_menu($course, $mode, $time);
|
||||
|
||||
|
||||
$crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
|
||||
<a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
|
||||
$strstats";
|
||||
|
||||
print_header("$course->shortname: $strstats", "$course->fullname",
|
||||
$crumb, '', '', true, ' ', $menu);
|
||||
|
||||
|
||||
require_once($CFG->dirroot.'/course/report/stats/report.php');
|
||||
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php //$Id$
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
echo '<p style="text-align:center;">';
|
||||
echo '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
|
||||
echo '</p>';
|
||||
$statsstatus = stats_check_uptodate($course->id);
|
||||
if ($statsstatus !== NULL) {
|
||||
notify ($statsstatus);
|
||||
}
|
||||
}
|
||||
?>
|
||||
+29
-9
@@ -33,26 +33,46 @@
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<?php
|
||||
$coursecount = (count_records('course') <= FRONTPAGECOURSELIMIT);
|
||||
$options = array(FRONTPAGENEWS => get_string("frontpagenews"),
|
||||
FRONTPAGECOURSELIST => get_string("frontpagecourselist"),
|
||||
FRONTPAGECATEGORYNAMES => get_string("frontpagecategorynames"),
|
||||
FRONTPAGECATEGORYCOMBO => get_string("frontpagecategorycombo"),
|
||||
);
|
||||
$values = array(get_string('hide'), get_string('order1', 'admin'), get_string('order2', 'admin'));
|
||||
$values = array(get_string('hide'), get_string('order1', 'admin'), get_string('order2', 'admin'), get_string('order3', 'admin'), get_string('order4', 'admin'));
|
||||
$seq = array_flip(explode(',',$form->frontpage));
|
||||
foreach ($seq as $k => $s) {
|
||||
$seq[$k]++;
|
||||
}
|
||||
if (count_records("course") > 200) {
|
||||
unset($options[FRONTPAGECOURSELIST]);
|
||||
if (isset($seq[FRONTPAGECOURSELIST])) {
|
||||
$form->frontpage = 2;
|
||||
}
|
||||
} else {
|
||||
$values[] = get_string('order3', 'admin');
|
||||
if (!$coursecount and isset($seq[FRONTPAGECOURSELIST])) {
|
||||
unset($seq[FRONTPAGECOURSELIST]); //disable course list option when too many course present
|
||||
}
|
||||
|
||||
foreach ($options as $key => $option) {
|
||||
$disabled = (!$coursecount and ($key == FRONTPAGECOURSELIST));
|
||||
echo "<td>$option<br />";
|
||||
choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, '', '', 0, false, $disabled);
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("frontpageformatloggedin") ?>:</td>
|
||||
<td>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<?php
|
||||
$seq = array_flip(explode(',',$form->frontpageloggedin));
|
||||
foreach ($seq as $k => $s) {
|
||||
$seq[$k]++;
|
||||
}
|
||||
|
||||
foreach ($options as $key => $option) {
|
||||
echo "<td>$option<br />";
|
||||
choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, "");
|
||||
choose_from_menu ($values, "frontpageloggedin[$key]", isset($seq[$key])?$seq[$key]:0, '');
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
|
||||
+14
-1
@@ -37,6 +37,13 @@
|
||||
$form->numsections = 1; // Force the topic display for this format
|
||||
}
|
||||
|
||||
$form->frontpageloggedin = array_flip($form->frontpageloggedin);
|
||||
unset($form->frontpageloggedin[0]);
|
||||
$form->frontpageloggedin = array_flip($form->frontpageloggedin);
|
||||
asort($form->frontpageloggedin);
|
||||
$form->frontpageloggedin = implode(',',array_flip($form->frontpageloggedin));
|
||||
set_config("frontpageloggedin", $form->frontpageloggedin);
|
||||
|
||||
$form->timemodified = time();
|
||||
|
||||
if ($form->id) {
|
||||
@@ -98,12 +105,18 @@
|
||||
|
||||
if (isset($CFG->frontpage)) {
|
||||
$form->frontpage = $CFG->frontpage;
|
||||
|
||||
} else {
|
||||
$form->frontpage = FRONTPAGECOURSELIST; // Show course list by default
|
||||
set_config("frontpage", $form->frontpage);
|
||||
}
|
||||
|
||||
if (isset($CFG->frontpageloggedin)) {
|
||||
$form->frontpageloggedin = $CFG->frontpageloggedin;
|
||||
} else {
|
||||
$form->frontpageloggedin = $form->frontpage;
|
||||
set_config("frontpageloggedin", $form->frontpageloggedin);
|
||||
}
|
||||
|
||||
$stradmin = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strsitesettings = get_string("sitesettings");
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
$strheading = get_string('adminhelpstickyblocks');
|
||||
|
||||
print_header($strtitle,$strtitle,'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.
|
||||
get_string('admin').'</a> -> '.$strtitle);
|
||||
get_string('admin').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/misc.php">'.
|
||||
get_string('miscellaneous').'</a> ->'.$strtitle);
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
|
||||
echo '<tr valign="top">';
|
||||
@@ -62,7 +63,7 @@
|
||||
echo '<td valign="top" width="*" id="middle-column">';
|
||||
print_simple_box_start('center');
|
||||
print_heading($strheading);
|
||||
echo '<form method="post" action="'.$CFG->wwwroot.'/admin/stickyblocks.php">'
|
||||
echo '<form method="post" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/stickyblocks.php">'
|
||||
.'<p align="center">'.get_string('stickyblockspagetype','admin').': ';
|
||||
choose_from_menu($options,'pt',$pt,'choose','this.form.submit();');
|
||||
echo '</p></form>';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
|
||||
@@ -264,7 +264,6 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
} else { // new user
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->deleted = "1";
|
||||
$updateuser->username = "$user->email.".time(); // Remember it just in case
|
||||
$updateuser->username = addslashes("$user->email.".time()); // Remember it just in case
|
||||
$updateuser->email = ""; // Clear this field to free it up
|
||||
$updateuser->idnumber = ""; // Clear this field to free it up
|
||||
$updateuser->timemodified = time();
|
||||
|
||||
+1
-13
@@ -24,27 +24,15 @@
|
||||
|
||||
$table->data[] = array("<b><a href=\"auth.php?sesskey=$USER->sesskey\">".get_string("authentication")."</a></b>",
|
||||
get_string("adminhelpauthentication"));
|
||||
|
||||
$table->data[] = array("<b><a href=\"user.php\">".get_string("edituser")."</a></b>",
|
||||
get_string("adminhelpedituser"));
|
||||
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a></b>",
|
||||
get_string("adminhelpaddnewuser"));
|
||||
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")."</a></b>",
|
||||
get_string("adminhelpuploadusers"));
|
||||
$table->data[] = array('', '<hr />');
|
||||
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolmentplugins")."</a></b>",
|
||||
get_string("adminhelpenrolments"));
|
||||
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
|
||||
get_string("adminhelpassignstudents"));
|
||||
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
|
||||
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" />");
|
||||
$table->data[] = array("<b><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a></b>",
|
||||
get_string("adminhelpassigncreators"));
|
||||
$table->data[] = array("<b><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a></b>",
|
||||
get_string("adminhelpassignadmins"));
|
||||
|
||||
print_table($table);
|
||||
|
||||
|
||||
print_footer($site);
|
||||
|
||||
?>
|
||||
|
||||
+417
-335
@@ -1,12 +1,54 @@
|
||||
<?php //$Id$
|
||||
|
||||
///dummy field names are used to help adding and dropping indexes. There's only 1 case now, in scorm_scoes_track
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_login();
|
||||
|
||||
// decalre once
|
||||
global $enc;
|
||||
|
||||
$customlang = array();
|
||||
|
||||
$enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'is' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
|
||||
|
||||
/**************************************
|
||||
* Custom lang pack handling *
|
||||
**************************************/
|
||||
|
||||
// scan list of langs, including customs packs
|
||||
$langs = get_list_of_languages();
|
||||
|
||||
// foreach lang
|
||||
foreach ($langs as $lang => $lang1) {
|
||||
|
||||
if (in_array($lang, array_keys($enc))) {
|
||||
// if already in array, ignore
|
||||
continue;
|
||||
}
|
||||
|
||||
// if this lang has got a charset
|
||||
|
||||
if ($result = get_string_from_file('thischarset',$CFG->dirroot.'/lang/'.$lang.'/moodle.php', "\$resultstring")) {
|
||||
eval($result);
|
||||
$enc[$lang] = $resultstring;
|
||||
} else if ($result = get_string_from_file('parentlanguage',$CFG->dirroot.'/lang/'.$lang.'/moodle.php',"\$resultstring")) {
|
||||
// else if there's a parent lang we can use
|
||||
eval($result);
|
||||
$enc[$lang] = $enc[$resultstring];
|
||||
} else {
|
||||
notify ('unknown lang pack detected '.$lang);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**************************************
|
||||
* End custom lang pack handling *
|
||||
**************************************/
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only admins can access this page');
|
||||
}
|
||||
@@ -45,9 +87,12 @@
|
||||
print_simple_box_end();
|
||||
db_migrate2utf8();
|
||||
print_heading('db unicode migration has been completed!');
|
||||
unlink($filename); //no longer in maintenance mode
|
||||
if (!get_config('', 'migrate_maintmode')) { // already in maint mode
|
||||
unlink($filename); //no longer in maintenance mode
|
||||
}
|
||||
delete_records('config', 'name', 'migrate_maintmode');
|
||||
@require_logout();
|
||||
print_continue($CFG->wwwroot.'/admin/langimport.php');
|
||||
print_continue($CFG->wwwroot.'/'.$CFG->admin.'/langimport.php');
|
||||
}
|
||||
|
||||
//else if $migrate
|
||||
@@ -73,12 +118,16 @@
|
||||
//put the site in maintenance mode
|
||||
check_dir_exists($CFG->dataroot.'/'.SITEID, true);
|
||||
|
||||
if (touch($filename)) {
|
||||
$file = fopen($filename, 'w');
|
||||
fwrite($file, get_string('maintinprogress','admin'));
|
||||
fclose($file);
|
||||
if (file_exists($filename)) {
|
||||
set_config('migrate_maintmode', 1); // already in maintenance mode
|
||||
} else {
|
||||
notify (get_string('maintfileopenerror','admin'));
|
||||
if (touch($filename)) {
|
||||
$file = fopen($filename, 'w');
|
||||
fwrite($file, get_string('maintinprogress','admin'));
|
||||
fclose($file);
|
||||
} else {
|
||||
notify (get_string('maintfileopenerror','admin'));
|
||||
}
|
||||
}
|
||||
//print second confirmation box
|
||||
echo '<form name="migratefrom" action="utfdbmigrate.php" method="POST">';
|
||||
@@ -107,7 +156,6 @@
|
||||
}
|
||||
|
||||
//print the "i-know-what-lang-to-use" menu
|
||||
$enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
|
||||
|
||||
echo '<br />The whole site is in this encoding: (leave blank if you are not sure)';
|
||||
echo '<select name="globallang"><option value="">I am not sure</option>';
|
||||
@@ -178,8 +226,12 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
//mtrace() and return 0. (showing the current
|
||||
//table/field/recordid)
|
||||
|
||||
global $db, $CFG, $dbtablename, $fieldname, $record;
|
||||
global $db, $CFG, $dbtablename, $fieldname, $record, $processedrecords;
|
||||
$debug = ($CFG->debug > 7);
|
||||
|
||||
//echo date("H:i:s");
|
||||
|
||||
ignore_user_abort(false); // see bug report 5352. This should kill this thread as soon as user aborts.
|
||||
|
||||
@set_time_limit(0);
|
||||
@ob_implicit_flush(true);
|
||||
@@ -191,8 +243,22 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
|
||||
$ignoretables = array(); //list of tables to ignore, optional
|
||||
|
||||
//one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
|
||||
require_once($CFG->dirroot.'/lib/xmlize.php');
|
||||
$xmls = utf_get_xml(1);
|
||||
$tablestoconvert = 0; // total number of tables to convert
|
||||
foreach ($xmls as $xml) { ///foreach xml file, we must get a list of tables
|
||||
$dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE']; //real db tables
|
||||
foreach ($dbtables as $dbtable) {
|
||||
$tablestoconvert++;
|
||||
}
|
||||
}
|
||||
// progress bar handling
|
||||
// first let's find out how many tables there are
|
||||
|
||||
$done = 0;
|
||||
print_progress($done, 158, 5, 1);
|
||||
print_progress($done, $tablestoconvert, 5, 1);
|
||||
|
||||
|
||||
$textlib = textlib_get_instance(); //only 1 reference
|
||||
|
||||
@@ -279,18 +345,10 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
$crash->table = $crashdata[0];
|
||||
$crash->field = $crashdata[1];
|
||||
$crash->record = $crashdata[2];
|
||||
|
||||
print_heading('Resume information :');
|
||||
echo '<br>Resuming from @ table : '.$crash->table;
|
||||
echo '<br>Resuming from @ field : '.$crash->field;
|
||||
echo '<br>Resuming from @ record : '.$crash->record;
|
||||
|
||||
notify("Resuming migration from: $crash->table / .$crash->field, Record: $crash->record");
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot.'/lib/xmlize.php');
|
||||
|
||||
//one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
|
||||
$xmls = utf_get_xml(1);
|
||||
|
||||
/************************************************************************
|
||||
* Now we got all our tables in order *
|
||||
************************************************************************/
|
||||
@@ -302,7 +360,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
foreach ($dbtables as $dbtable) {
|
||||
|
||||
$done++;
|
||||
print_progress($done, 158, 5, 1);
|
||||
print_progress($done, $tablestoconvert, 5, 1);
|
||||
|
||||
$dbtablename = $dbtable['@']['name'];
|
||||
|
||||
@@ -315,6 +373,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
}
|
||||
|
||||
if ($crash && ($dbtablename != $crash->table)) { //resuming from crash
|
||||
$done++; // need to update progress bar
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -322,348 +381,372 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
print_heading("<br><b>Processsing db table ".$dbtablename.'...</b>');
|
||||
}
|
||||
|
||||
if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
|
||||
/**********************************************************
|
||||
* This is the by pass structure. It allows us to process *
|
||||
* tables on row basis instead of column/field basis *
|
||||
* It relies on a single function in migrate2utf8.php *
|
||||
**********************************************************/
|
||||
|
||||
$colnames = array();
|
||||
$coltypes = array(); //array to hold all column types for the table
|
||||
$collengths = array(); //array to hold all column lengths for the table
|
||||
$defaults = array(); //array to hold defaults, if any
|
||||
//reset holders
|
||||
$addindexarray = array();
|
||||
$adduniqueindexarray = array();
|
||||
$addprimaryarray = array();
|
||||
/// first, check to see if there's a function for the whole table. By pass point (1)
|
||||
if (file_exists($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php')) {
|
||||
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
|
||||
// this is a function to process table on role basis, e.g. user table in moodorg
|
||||
$tablefunction = 'migrate2utf8_'.$dbtablename;
|
||||
}
|
||||
if ($CFG->dbtype=='mysql' && function_exists($tablefunction)) {
|
||||
$tablefunction($dbtable['#']['FIELDS'][0]['#']['FIELD'], $crash, $debug, $maxrecords, $done, $tablestoconvert); // execute it.
|
||||
} else {
|
||||
|
||||
foreach ($fields as $field){
|
||||
/******************************************************
|
||||
* No function for converting whole table, we proceed *
|
||||
******************************************************/
|
||||
|
||||
if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
|
||||
|
||||
//if in crash state, and field name is not the same as crash field name
|
||||
$colnames = array();
|
||||
$coltypes = array(); //array to hold all column types for the table
|
||||
$collengths = array(); //array to hold all column lengths for the table
|
||||
$defaults = array(); //array to hold defaults, if any
|
||||
//reset holders
|
||||
$addindexarray = array();
|
||||
$adduniqueindexarray = array();
|
||||
$addprimaryarray = array();
|
||||
|
||||
$fieldname = isset($field['@']['name'])?$field['@']['name']:"";
|
||||
$method = isset($field['@']['method'])?$field['@']['method']:"";
|
||||
$type = isset($field['@']['type'])?$field['@']['type']:"";
|
||||
$length = isset($field['@']['length'])?$field['@']['length']:"";
|
||||
foreach ($fields as $field){
|
||||
|
||||
if ($crash && ($crash->field != $fieldname)) {
|
||||
continue;
|
||||
}
|
||||
//if in crash state, and field name is not the same as crash field name
|
||||
|
||||
$dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
|
||||
$addindex = isset($field['@']['addindex'])?$field['@']['addindex']:"";
|
||||
$adduniqueindex = isset($field['@']['adduniqueindex'])?$field['@']['adduniqueindex']:"";
|
||||
$fieldname = isset($field['@']['name'])?$field['@']['name']:"";
|
||||
$method = isset($field['@']['method'])?$field['@']['method']:"";
|
||||
$type = isset($field['@']['type'])?$field['@']['type']:"";
|
||||
$length = isset($field['@']['length'])?$field['@']['length']:"";
|
||||
|
||||
$dropprimary = isset($field['@']['dropprimary'])?$field['@']['dropprimary']:"";
|
||||
$addprimary = isset($field['@']['addprimary'])?$field['@']['addprimary']:"";
|
||||
$default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
|
||||
|
||||
if ($fieldname != 'dummy') {
|
||||
$colnames[] = $fieldname;
|
||||
$coltypes[] = $type;
|
||||
$collengths[]= $length;
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
echo "<br>--><b>processing db field ".$fieldname.'</b>';
|
||||
echo "<br>---><b>method ".$method.'</b>';
|
||||
}
|
||||
|
||||
|
||||
if ($CFG->dbtype == 'mysql') {
|
||||
|
||||
/* Drop the index, because with index on, you can't change it to longblob */
|
||||
|
||||
if ($dropindex){ //drop index if index is varchar, text etc type
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
|
||||
$SQL1 = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, false); // see bug 5205
|
||||
execute_sql($SQL1, false); // see bug 5205
|
||||
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
} else if ($dropprimary) { // drop primary key
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP PRIMARY KEY;';
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, $debug);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
if ($crash && ($crash->field != $fieldname)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Change to longblob, serves 2 purposes:
|
||||
1. column loses encoding, so when we finally change it to unicode,
|
||||
mysql does not do a double convertion
|
||||
2. longblobs puts no limit (ok, not really but it's large enough)
|
||||
to handle most of the problems such as in bug 5194
|
||||
*/
|
||||
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
|
||||
$dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
|
||||
$addindex = isset($field['@']['addindex'])?$field['@']['addindex']:"";
|
||||
$adduniqueindex = isset($field['@']['adduniqueindex'])?$field['@']['adduniqueindex']:"";
|
||||
|
||||
$dropprimary = isset($field['@']['dropprimary'])?$field['@']['dropprimary']:"";
|
||||
$addprimary = isset($field['@']['addprimary'])?$field['@']['addprimary']:"";
|
||||
$default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
|
||||
|
||||
/*
|
||||
if ($length > 0) {
|
||||
$SQL.='('.$length.') ';
|
||||
}
|
||||
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
|
||||
*/
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
$colnames[] = $fieldname;
|
||||
$coltypes[] = $type;
|
||||
$collengths[]= $length;
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
echo "<br>--><b>processing db field ".$fieldname.'</b>';
|
||||
echo "<br>---><b>method ".$method.'</b>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$patterns[]='/RECORDID/'; //for preg_replace
|
||||
$patterns[]='/\{\$CFG\-\>prefix\}/i'; //same here
|
||||
|
||||
if ($method == 'PLAIN_SQL_UPDATE') {
|
||||
$sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
|
||||
$sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
|
||||
}
|
||||
else if ($method == 'PHP_FUNCTION') {
|
||||
$phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
|
||||
}
|
||||
|
||||
///get the total number of records for this field
|
||||
|
||||
// could not use count_records because it addes prefix to adodb_logsql
|
||||
$totalrecords = count_records_sql("select count(*) from {$prefix}$dbtablename");
|
||||
$counter = 0;
|
||||
$recordsetsize = 4;
|
||||
if ($CFG->dbtype == 'mysql') {
|
||||
|
||||
if ($crash) { //if resuming from crash
|
||||
//find the number of records with id smaller than the crash id
|
||||
$indexSQL = 'SELECT COUNT(*) FROM '.$prefix.$dbtablename.' WHERE id < '.$crash->record;
|
||||
$counter = count_records_sql($indexSQL);
|
||||
}
|
||||
/* Drop the index, because with index on, you can't change it to longblob */
|
||||
|
||||
if ($debug) {
|
||||
echo "<br>Total number of records is ..".$totalrecords;
|
||||
echo "<br/>Counter is $counter";
|
||||
}
|
||||
|
||||
if ($dropindex){ //drop index if index is varchar, text etc type
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
|
||||
$SQL1 = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, false); // see bug 5205
|
||||
execute_sql($SQL1, false); // see bug 5205
|
||||
|
||||
/**************************
|
||||
* converting each record *
|
||||
**************************/
|
||||
while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) { //while there is still something
|
||||
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC '.sql_paging_limit($counter, $recordsetsize);
|
||||
if ($records = get_records_sql($SQL)) {
|
||||
foreach ($records as $record) {
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
} else if ($dropprimary) { // drop primary key
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP PRIMARY KEY;';
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, $debug);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
}
|
||||
|
||||
//if we are up this far, either no crash, or crash with same table, field name.
|
||||
if ($crash){
|
||||
if ($crash->record != $record->id) { //might set to < just in case record is deleted
|
||||
continue;
|
||||
} else {
|
||||
$crash = 0;
|
||||
print_heading('recovering from '.$dbtablename.'--'.$fieldname.'--'.$record->id);
|
||||
/* Change to longblob, serves 2 purposes:
|
||||
1. column loses encoding, so when we finally change it to unicode,
|
||||
mysql does not do a double convertion
|
||||
2. longblobs puts no limit (ok, not really but it's large enough)
|
||||
to handle most of the problems such as in bug 5194
|
||||
*/
|
||||
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
|
||||
|
||||
/*
|
||||
if ($length > 0) {
|
||||
$SQL.='('.$length.') ';
|
||||
}
|
||||
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
|
||||
*/
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$patterns[]='/RECORDID/'; //for preg_replace
|
||||
$patterns[]='/\{\$CFG\-\>prefix\}/i'; //same here
|
||||
|
||||
if ($method == 'PLAIN_SQL_UPDATE') {
|
||||
$sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
|
||||
$sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
|
||||
}
|
||||
else if ($method == 'PHP_FUNCTION') {
|
||||
$phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
|
||||
}
|
||||
|
||||
///get the total number of records for this field
|
||||
|
||||
// could not use count_records because it addes prefix to adodb_logsql
|
||||
$totalrecords = count_records_sql("select count(*) from {$prefix}$dbtablename");
|
||||
$counter = 0;
|
||||
$recordsetsize = 50;
|
||||
|
||||
if ($crash) { //if resuming from crash
|
||||
//find the number of records with id smaller than the crash id
|
||||
$indexSQL = 'SELECT COUNT(*) FROM '.$prefix.$dbtablename.' WHERE id < '.$crash->record;
|
||||
$counter = count_records_sql($indexSQL);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
echo "<br>Total number of records is ..".$totalrecords;
|
||||
echo "<br/>Counter is $counter";
|
||||
}
|
||||
|
||||
|
||||
/**************************
|
||||
* converting each record *
|
||||
**************************/
|
||||
while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) { //while there is still something
|
||||
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC '.sql_paging_limit($counter, $recordsetsize);
|
||||
if ($records = get_records_sql($SQL)) {
|
||||
foreach ($records as $record) {
|
||||
|
||||
//if we are up this far, either no crash, or crash with same table, field name.
|
||||
if ($crash){
|
||||
if ($crash->record != $record->id) { //might set to < just in case record is deleted
|
||||
continue;
|
||||
} else {
|
||||
$crash = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$migrationconfig = get_record('config','name','dbmigration');
|
||||
$migrationconfig->name = 'dbmigration';
|
||||
$migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
|
||||
update_record('config',$migrationconfig);
|
||||
|
||||
$replacements = array(); //manual refresh
|
||||
$replacements[] = $record->id;
|
||||
$replacements[] = $prefix;
|
||||
|
||||
if (!empty($record->{$fieldname})) { //only update if not empty
|
||||
switch ($method){
|
||||
case 'PLAIN_SQL_UPDATE': //use the 2 statements to update
|
||||
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
|
||||
//if global lang is set, we just use that
|
||||
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
|
||||
$courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang(isset($courseid->course)?$courseid->course:1);
|
||||
$userlang = get_user_lang(isset($userid->userid)?$userid->userid:1);
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
//only update if non utf8
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($record->{$fieldname}, $fromenc);
|
||||
$newrecord = new object;
|
||||
$newrecord->id = $record->id;
|
||||
$newrecord->{$fieldname} = $result;
|
||||
migrate2utf8_update_record($dbtablename,$newrecord);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'PHP_FUNCTION': //use the default php function to execute
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
|
||||
$phpfunction($record->id);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
break;
|
||||
|
||||
default: //no_conv, don't do anything ;-)
|
||||
break;
|
||||
}
|
||||
}
|
||||
$counter++;
|
||||
if ($maxrecords) {
|
||||
if ($processedrecords == $maxrecords) {
|
||||
notify($maxrecords.' records processed. Migration Process halted');
|
||||
print_continue('utfdbmigrate.php?confirm=1&maxrecords='.$maxrecords.'&sesskey='.sesskey());
|
||||
print_footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$processedrecords++;
|
||||
//print some output once in a while
|
||||
if (($processedrecords) % 1000 == 0) {
|
||||
print_progress($done, $tablestoconvert, 5, 1,
|
||||
'Processing: '.$dbtablename.'/'.$fieldname.' ');
|
||||
}
|
||||
}
|
||||
|
||||
$migrationconfig = get_record('config','name','dbmigration');
|
||||
$migrationconfig->name = 'dbmigration';
|
||||
$migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
|
||||
update_record('config',$migrationconfig);
|
||||
|
||||
$replacements = array(); //manual refresh
|
||||
$replacements[] = $record->id;
|
||||
$replacements[] = $prefix;
|
||||
|
||||
switch ($method){
|
||||
case 'PLAIN_SQL_UPDATE': //use the 2 statements to update
|
||||
|
||||
if (!empty($record->{$fieldname})) { //only update if not empty
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
|
||||
//if global lang is set, we just use that
|
||||
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
|
||||
$courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang(isset($courseid->course)?$courseid->course:1);
|
||||
$userlang = get_user_lang(isset($userid->userid)?$userid->userid:1);
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
//only update if non utf8
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($record->{$fieldname}, $fromenc);
|
||||
$newrecord = new object;
|
||||
$newrecord->id = $record->id;
|
||||
$newrecord->{$fieldname} = $result;
|
||||
migrate2utf8_update_record($dbtablename,$newrecord);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'PHP_FUNCTION': //use the default php function to execute
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
|
||||
$phpfunction($record->id);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
break;
|
||||
|
||||
default: //no_conv, don't do anything ;-)
|
||||
break;
|
||||
}
|
||||
$counter++;
|
||||
if ($maxrecords) {
|
||||
if ($processedrecords == $maxrecords) {
|
||||
notify($maxrecords.' records processed. Migration Process halted');
|
||||
print_continue('utfdbmigrate.php?confirm=1&maxrecords='.$maxrecords.'&sesskey='.sesskey());
|
||||
print_footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$processedrecords++;
|
||||
//print some output once in a while
|
||||
if (($processedrecords) % 5000 == 0) {
|
||||
echo 'Processing...'.$dbtablename.'...'.$fieldname.'...'.$record->id;
|
||||
}else {
|
||||
if ($debug) {
|
||||
notify('no records found!');
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} //close the while loop
|
||||
|
||||
/********************
|
||||
* Drop index here **
|
||||
********************/
|
||||
|
||||
if ($CFG->dbtype == 'mysql') {
|
||||
|
||||
/*********************************
|
||||
* Change column encoding 2 phase*
|
||||
*********************************/
|
||||
|
||||
/*
|
||||
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGTEXT';
|
||||
// if ($length > 0) {
|
||||
// $SQL.='('.$length.') ';
|
||||
// }
|
||||
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
|
||||
if ($debug) {
|
||||
notify('no records found!');
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}*/
|
||||
//phase 2
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' '.$type;
|
||||
if ($length > 0) {
|
||||
$SQL.='('.$length.') ';
|
||||
}
|
||||
$SQL.=' CHARACTER SET utf8 NOT NULL DEFAULT '.$default.';';
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
/********************************************
|
||||
* build an array to add index back together*
|
||||
********************************************/
|
||||
if ($addindex){
|
||||
$addindexarray[] = $addindex;
|
||||
} else if ($adduniqueindex) {
|
||||
$adduniqueindexarray[] = $adduniqueindex;
|
||||
} else if ($addprimary) {
|
||||
$addprimaryarray[] = $addprimary;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//posgresql code here
|
||||
//No we don't need to do anything here
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Adding the index back *
|
||||
********************************/
|
||||
$alter = 0;
|
||||
|
||||
if ($CFG->dbtype=='mysql'){
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
|
||||
if (!empty($addindexarray)) {
|
||||
foreach ($addindexarray as $aidx){
|
||||
$SQL .= ' ADD INDEX '.$aidx.',';
|
||||
$alter++;
|
||||
}
|
||||
}
|
||||
} //close the while loop
|
||||
|
||||
/********************
|
||||
* Drop index here **
|
||||
********************/
|
||||
if (!empty($adduniqueindexarray)) {
|
||||
foreach ($adduniqueindexarray as $auidx){
|
||||
$SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
|
||||
$alter++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($CFG->dbtype == 'mysql') {
|
||||
if (!empty($addprimaryarray)) {
|
||||
foreach ($addprimaryarray as $apm){
|
||||
$SQL .= ' ADD PRIMARY KEY '.$apm.',';
|
||||
$alter++;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* Change column encoding 2 phase*
|
||||
*********************************/
|
||||
|
||||
/*
|
||||
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGTEXT';
|
||||
// if ($length > 0) {
|
||||
// $SQL.='('.$length.') ';
|
||||
// }
|
||||
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}*/
|
||||
//phase 2
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' '.$type;
|
||||
if ($length > 0) {
|
||||
$SQL.='('.$length.') ';
|
||||
}
|
||||
$SQL.=' CHARACTER SET utf8 NOT NULL DEFAULT '.$default.';';
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
if ($fieldname != 'dummy') {
|
||||
execute_sql($SQL, $debug);
|
||||
}
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
/********************************************
|
||||
* build an array to add index back together*
|
||||
********************************************/
|
||||
if ($addindex){
|
||||
$addindexarray[] = $addindex;
|
||||
} else if ($adduniqueindex) {
|
||||
$adduniqueindexarray[] = $adduniqueindex;
|
||||
} else if ($addprimary) {
|
||||
$addprimaryarray[] = $addprimary;
|
||||
}
|
||||
$SQL = rtrim($SQL, ', ');
|
||||
$SQL.=';';
|
||||
|
||||
} else {
|
||||
///posgresql code here
|
||||
///No we don't need to do anything here
|
||||
|
||||
//posgresql code here
|
||||
//No we don't need to do anything here
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Adding the index back *
|
||||
********************************/
|
||||
$alter = 0;
|
||||
|
||||
if ($CFG->dbtype=='mysql'){
|
||||
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
|
||||
|
||||
if (!empty($addindexarray)) {
|
||||
foreach ($addindexarray as $aidx){
|
||||
$SQL .= ' ADD INDEX '.$aidx.',';
|
||||
$alter++;
|
||||
if ($alter) {
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, $debug);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($adduniqueindexarray)) {
|
||||
foreach ($adduniqueindexarray as $auidx){
|
||||
$SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
|
||||
$alter++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($addprimaryarray)) {
|
||||
foreach ($addprimaryarray as $apm){
|
||||
$SQL .= ' ADD PRIMARY KEY '.$apm.',';
|
||||
$alter++;
|
||||
}
|
||||
}
|
||||
|
||||
$SQL = rtrim($SQL, ', ');
|
||||
$SQL.=';';
|
||||
|
||||
} else {
|
||||
///posgresql code here
|
||||
///No we don't need to do anything here
|
||||
|
||||
}
|
||||
|
||||
if ($alter) {
|
||||
if ($debug) {
|
||||
$db->debug=999;
|
||||
}
|
||||
execute_sql($SQL, $debug);
|
||||
if ($debug) {
|
||||
$db->debug=0;
|
||||
}
|
||||
}
|
||||
|
||||
} //if there are fields
|
||||
} //if there are fields
|
||||
|
||||
|
||||
} /// Point 1 - bypass should end here.
|
||||
|
||||
|
||||
/************************************
|
||||
* now we modify the table encoding *
|
||||
************************************/
|
||||
@@ -723,8 +806,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
}
|
||||
|
||||
//finish the javascript bar
|
||||
$done=159;
|
||||
print_progress($done, 158, 5, 1);
|
||||
$done = $tablestoconvert;
|
||||
print_progress($done, $tablestoconvert, 5, 1);
|
||||
|
||||
//prints the list of langs used in this site
|
||||
print_simple_box_start('center','50%');
|
||||
@@ -737,7 +820,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
echo $lang.', ';
|
||||
}
|
||||
}
|
||||
echo '</b><br/><a href="'.$CFG->wwwroot.'/admin/langimport.php">Language Import Utility</a></div>';
|
||||
echo '</b><br/><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/langimport.php">Language Import Utility</a></div>';
|
||||
print_simple_box_end();
|
||||
delete_records('config','name','langsused');
|
||||
|
||||
@@ -756,7 +839,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
|
||||
|
||||
//set the final flag
|
||||
migrate2utf8_set_config('unicodedb','true'); //this is the main flag for unicode db
|
||||
|
||||
|
||||
//echo date("H:i:s");
|
||||
}
|
||||
|
||||
|
||||
@@ -809,7 +893,7 @@ function get_main_teacher_lang($courseid) {
|
||||
|
||||
function get_original_encoding($sitelang, $courselang, $userlang){
|
||||
|
||||
global $CFG;
|
||||
global $CFG, $enc;
|
||||
|
||||
$lang = '';
|
||||
if ($courselang) {
|
||||
@@ -825,8 +909,6 @@ function get_original_encoding($sitelang, $courselang, $userlang){
|
||||
error ('no language found!');
|
||||
}
|
||||
|
||||
$enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
|
||||
|
||||
if ($enc[$lang]) {
|
||||
return $enc[$lang];
|
||||
} else {
|
||||
@@ -862,7 +944,7 @@ function log_the_problem_somewhere() { //Eloy: Nice function, perhaps we could
|
||||
}
|
||||
}
|
||||
|
||||
//only this function should be used during db migraton, because of addslashes at the end of the convertion
|
||||
// only this function should be used during db migraton, because of addslashes at the end of the convertion
|
||||
function utfconvert($string, $enc, $slash=true) {
|
||||
global $textlib;
|
||||
if ($result = $textlib->convert($string, $enc)) {
|
||||
@@ -1020,7 +1102,7 @@ function utf_get_xml ($mode=0) { // if mode is 1, do not perform check for scrip
|
||||
|
||||
foreach ($enrols as $enrol){
|
||||
if (file_exists($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml')) {
|
||||
$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
|
||||
$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,14 @@ Optional:
|
||||
Userinformation in array ( name => value, ....
|
||||
or false in case of error
|
||||
|
||||
auth_validate_form(&$form, &$err)
|
||||
|
||||
Validate form data.
|
||||
|
||||
Returns:
|
||||
Bool. Manipulates $form and $err arrays in place
|
||||
|
||||
|
||||
COURSE CREATING
|
||||
|
||||
auth_iscreator($username)
|
||||
|
||||
@@ -36,14 +36,9 @@
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($CFG->changepassword or is_internal_auth() ) {
|
||||
if (is_internal_auth()) {
|
||||
$changepassword = "forgot_password.php";
|
||||
$changebuttonname = get_string("senddetails");
|
||||
} else {
|
||||
$changepassword = $CFG->changepassword;
|
||||
$changebuttonname = get_string("passwordrecovery");
|
||||
}
|
||||
<?php if (is_internal_auth() ) {
|
||||
$changepassword = "forgot_password.php";
|
||||
$changebuttonname = get_string("senddetails");
|
||||
?>
|
||||
<hr width="80%" />
|
||||
<p><?php print_string("forgotten") ?></p>
|
||||
|
||||
+3
-9
@@ -18,7 +18,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$wwwroot = str_replace('http','https',$CFG->wwwroot);
|
||||
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
}
|
||||
@@ -109,10 +109,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
//Select password change url
|
||||
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
} elseif($CFG->changepassword) {
|
||||
$passwordchangeurl=$CFG->changepassword;
|
||||
}
|
||||
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)){
|
||||
@@ -219,10 +216,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
//Select password change url
|
||||
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
} elseif($CFG->changepassword) {
|
||||
$passwordchangeurl=$CFG->changepassword;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)){
|
||||
@@ -319,4 +313,4 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
// No footer on this page
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+51
-2
@@ -118,6 +118,16 @@ function auth_get_userinfo($username){
|
||||
}
|
||||
|
||||
|
||||
function auth_user_update_password($username, $newpassword) {
|
||||
global $CFG;
|
||||
if ($CFG->auth_dbpasstype === 'internal') {
|
||||
return set_field('user', 'password', md5($newpassword), 'username', $username);
|
||||
} else {
|
||||
// we should have never been called!
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* syncronizes user fron external db to moodle user table
|
||||
*
|
||||
@@ -201,7 +211,7 @@ function auth_sync_users ($do_updates=0) {
|
||||
$updatekeys = array();
|
||||
foreach ($all_keys as $key) {
|
||||
if (preg_match('/^field_updatelocal_(.+)$/',$key, $match)) {
|
||||
if ($pcfg->{$match[0]}) { // if it has a true value
|
||||
if ($pcfg->{$key} === 'onlogin') {
|
||||
array_push($updatekeys, $match[1]); // the actual key name
|
||||
}
|
||||
}
|
||||
@@ -409,4 +419,43 @@ function auth_db_update_user_record($username, $updatekeys=false) {
|
||||
return get_record_select("user", "username = '$username' AND deleted <> '1'");
|
||||
}
|
||||
|
||||
?>
|
||||
// A chance to validate form data, and last chance to
|
||||
// do stuff before it is inserted in config_plugin
|
||||
function auth_validate_form(&$form, &$err) {
|
||||
|
||||
// compat until we rework auth a bit
|
||||
if ($form['auth_dbpasstype'] === 'internal') {
|
||||
$CFG->auth_db_stdchangepassword = true;
|
||||
if ($conf = get_record('config', 'name', 'auth_db_stdchangepassword')) {
|
||||
$conf->value = 1;
|
||||
if (! update_record('config', $conf)) {
|
||||
notify("Could not update $name to $value");
|
||||
}
|
||||
} else {
|
||||
$conf = new StdClass;
|
||||
$conf->name = 'auth_db_stdchangepassword';
|
||||
$conf->value = 1;
|
||||
if (! insert_record('config', $conf)) {
|
||||
notify("Error: could not add new variable $name !");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$CFG->auth_db_stdchangepassword = false;
|
||||
if ($conf = get_record('config', 'name', 'auth_db_stdchangepassword')) {
|
||||
$conf->value = 0;
|
||||
if (! update_record('config', $conf)) {
|
||||
notify("Could not update $name to $value");
|
||||
}
|
||||
} else {
|
||||
$conf = new StdClass;
|
||||
$conf->name = 'auth_db_stdchangepassword';
|
||||
$conf->value = 0;
|
||||
if (! insert_record('config', $conf)) {
|
||||
notify("Error: could not add new variable $name !");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
+5
-3
@@ -16,7 +16,8 @@
|
||||
/* */
|
||||
/* This program is free software. You can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 2 of the License. */
|
||||
/* the Free Software Foundation; either version 2 of the License or any */
|
||||
/* later version. */
|
||||
/************************************************************************/
|
||||
/* Author: Torsten Anderson, torsten.anderson@skeria.skelleftea.se
|
||||
*/
|
||||
@@ -111,7 +112,8 @@ class fcFPP
|
||||
$this->_user = $userid;
|
||||
$this->_pwd = $passwd;
|
||||
return TRUE;
|
||||
} elseif (preg_match ("/^\Sorry/",$line)){ //Denied access but a valid user and password
|
||||
} elseif (strpos($line, 'You are not allowed')){ // Denied access but a valid user and password
|
||||
// "Sorry. You are not allowed to login with the FPP interface"
|
||||
return TRUE;
|
||||
} else { //Invalid user or password
|
||||
return FALSE;
|
||||
@@ -215,4 +217,4 @@ class fcFPP
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+7
-5
@@ -144,7 +144,9 @@ function auth_get_userinfo($username){
|
||||
$ldapval = $newval;
|
||||
}
|
||||
}
|
||||
$result[$key] = $ldapval;
|
||||
if (!is_null($ldapval)) {
|
||||
$result[$key] = $ldapval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +711,7 @@ function auth_ldap_bulk_insert($users){
|
||||
// bulk insert -- superfast with $bulk_insert_records
|
||||
$sql = 'INSERT INTO '.$CFG->prefix.'extuser (idnumber) VALUES ';
|
||||
// make those values safe
|
||||
array_map('addslashes', $users);
|
||||
$users = array_map('addslashes', $users);
|
||||
// join and quote the whole lot
|
||||
$sql = $sql . '(\'' . join('\'),(\'', $users) . '\')';
|
||||
print "+ " . count($users) . " users\n";
|
||||
@@ -838,7 +840,7 @@ function auth_user_update($olduser, $newuser) {
|
||||
if ($user_info_result){
|
||||
|
||||
$user_entry = auth_ldap_get_entries($ldapconnection, $user_info_result);
|
||||
if (count($user_entry)) {
|
||||
if (count($user_entry) > 1) {
|
||||
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
|
||||
}
|
||||
$user_entry = $user_entry[0];
|
||||
@@ -1080,8 +1082,8 @@ function auth_ldap_getdefaults(){
|
||||
);
|
||||
$default['ldap_memberattribute_isdn'] = array(
|
||||
'edir' => '1',
|
||||
'rfs2307' => '0',
|
||||
'rfs2307bis' => '1',
|
||||
'rfc2307' => '0',
|
||||
'rfc2307bis' => '1',
|
||||
'samba' => '0', //is this right?
|
||||
'ad' => '1',
|
||||
'default' => '0'
|
||||
|
||||
@@ -19,8 +19,8 @@ Changes:
|
||||
|
||||
Moodle Configuration with Dual login
|
||||
-------------------------------------------------------------------------------
|
||||
1. Protect the file moodle/auth/shibboleth/ directory with Shibboleth.
|
||||
The page index.php actually logs in a Shibboleth user.
|
||||
1. Protect the directory moodle/auth/shibboleth/ with Shibboleth.
|
||||
The page index.php in that directory actually logs in a Shibboleth user.
|
||||
For Apache you have to define a rule like the following in the Apache config:
|
||||
|
||||
--
|
||||
@@ -63,7 +63,7 @@ Moodle Configuration with Dual login
|
||||
4. The large text field 'Instructions' must contain a link to the
|
||||
moodle/auth/shibboleth/index.php file which is protected by
|
||||
Shibboleth (see step 1) and causes the Shibboleth login procedure to start.
|
||||
You also could use HTML code in that field, e.g. to create your own
|
||||
You could also use HTML code in that field, e.g. to create your own
|
||||
Shibboleth login button.
|
||||
|
||||
5. Save the changes for the Shibboleth authentication method.
|
||||
@@ -79,11 +79,11 @@ described in the dual login section above and do the following steps:
|
||||
|
||||
How the Shibboleth authentication works
|
||||
--------------------------------------------------------------------------------
|
||||
For a user to get Shibboleth authenticated in Moodle he basically must go to the
|
||||
To get Shibboleth authenticated in Moodle a user basically must access the
|
||||
Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only
|
||||
authentication method (see 4.a), this happens automatically when a user wants to
|
||||
login. Otherwise the user has to click on the link on the login page you
|
||||
provided in step 4.
|
||||
login in Moodle. Otherwise, the user has to click on the link on the login page
|
||||
you provided in step 4.
|
||||
|
||||
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
|
||||
@@ -98,19 +98,16 @@ these are checked by Shibboleth itself. Only users who met these rules
|
||||
actually can access /auth/shibboleth/index.php and get logged in.
|
||||
|
||||
You can use Shibboleth AND another authentication method (it was tested with
|
||||
manual login). So if there are a few users that don't have a Shibboleth
|
||||
manual login). So, if there are a few users that don't have a Shibboleth
|
||||
login, you could create manual accounts for them and they could use the manual
|
||||
login. For other authentication methods you first have to configure them and
|
||||
then set Shibboleth as your authentication method. Users can log in only via one
|
||||
authentication method unless they have two accounts in Moodle.
|
||||
Users that provide a non-existing login name for non-Shibboleth authentication
|
||||
methods are automatically redirected to auth/shibboleth/index.php and it is
|
||||
tried to authenticate them via Shibboleth.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
|
||||
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
|
||||
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/index.php');
|
||||
}
|
||||
|
||||
if (!isset ($pluginconfig->user_attribute)) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
redirect($urltogo);
|
||||
}
|
||||
|
||||
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
|
||||
// Check whether Shibboleth is configured properly
|
||||
|
||||
+16
-4
@@ -1,6 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
//CHANGELOG:
|
||||
//28.10.2004 SHIBBOLETH Authentication functions v.0.1
|
||||
//2005-2006 Various extensions and fixes by Lukas Haemmerle
|
||||
//Distributed under GPL (c)Markus Hagman 2004-
|
||||
|
||||
function auth_user_login($username, $password) {
|
||||
@@ -41,9 +42,9 @@ function auth_get_userinfo($username) {
|
||||
|
||||
foreach ($attrmap as $key=>$value) {
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
$result[$key]=$_SERVER[$value];
|
||||
$result[$key]=get_first_string($_SERVER[$value]);
|
||||
} else {
|
||||
$result[$key]=utf8_decode($_SERVER[$value]);
|
||||
$result[$key]=utf8_decode(get_first_string($_SERVER[$value]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ function auth_get_userinfo($username) {
|
||||
|
||||
function auth_shib_attributes(){
|
||||
//returns array containg attribute mappings between Moodle and shibboleth
|
||||
global $CFG;
|
||||
global $CFG;
|
||||
|
||||
$pluginconfig = get_config('auth/shibboleth');
|
||||
$pluginconfig = (array) $pluginconfig;
|
||||
@@ -82,6 +83,17 @@ function auth_shib_attributes(){
|
||||
}
|
||||
$moodleattributes['username']=$pluginconfig["shib_user_attribute"];
|
||||
|
||||
return $moodleattributes;
|
||||
return $moodleattributes;
|
||||
}
|
||||
|
||||
|
||||
function get_first_string($string){
|
||||
// Cleans and returns first of potential many values (multi-valued attributes)
|
||||
|
||||
$list = split( ';', $string);
|
||||
$clean_string = rtrim($list[0]);
|
||||
|
||||
return $clean_string;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+11
-9
@@ -17,13 +17,7 @@
|
||||
|
||||
if (!empty($id)) {
|
||||
if (!isteacheredit($id)) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!isteacheredit($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!isadmin()) {
|
||||
@@ -31,6 +25,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($to)) {
|
||||
if (!isteacheredit($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
@@ -117,7 +117,9 @@
|
||||
//Call the form, depending the step we are
|
||||
if (!$launch) {
|
||||
// if we're at the start, clear the cache of prefs
|
||||
unset($SESSION->backupprefs[$course->id]);
|
||||
if (isset($SESSION->backupprefs[$course->id])) {
|
||||
unset($SESSION->backupprefs[$course->id]);
|
||||
}
|
||||
include_once("backup_form.html");
|
||||
} else if ($launch == "check") {
|
||||
include_once("backup_check.html");
|
||||
@@ -126,7 +128,7 @@
|
||||
}
|
||||
print_simple_box_end();
|
||||
|
||||
//Print footer
|
||||
//Print footer
|
||||
print_footer();
|
||||
|
||||
?>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
if (isset($backupprefs->$var) && $backupprefs->$var) {
|
||||
$var = "backup_".$modname;
|
||||
//Only if selected
|
||||
if ($backupprefs->$var == 1) {
|
||||
if (!empty($backupprefs->$var) and ($backupprefs->$var == 1)) {
|
||||
//Print the full tr
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"2\">";
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
//If we have selected to backup quizzes, backup categories and
|
||||
//questions structure (step 1). See notes on mod/quiz/backuplib.php
|
||||
if ($status and $preferences->mods['quiz']->backup) {
|
||||
if ($status and !empty($preferences->mods['quiz']->backup)) {
|
||||
echo "<li>".get_string("writingcategoriesandquestions").'</li>';
|
||||
require_once($CFG->dirroot.'/mod/quiz/backuplib.php');
|
||||
if (!$status = backup_question_categories($backup_file,$preferences)) {
|
||||
|
||||
+23
-14
@@ -98,18 +98,19 @@ function schedule_backup_cron() {
|
||||
if (!$backup_course) {
|
||||
mtrace(" ERROR (in backup_courses detection)");
|
||||
$status = false;
|
||||
continue;
|
||||
}
|
||||
//Now we backup every course with nextstarttime < now
|
||||
if ($backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
|
||||
// Skip backup of unavailable courses that have remained unmodified in a month
|
||||
$skipped = false;
|
||||
if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
|
||||
mtrace(" SKIPPING - hidden+unmodified");
|
||||
set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
|
||||
$skipped = true;
|
||||
}
|
||||
//Now we backup every non skipped course with nextstarttime < now
|
||||
if (!$skipped && $backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
|
||||
//We have to send a email because we have included at least one backup
|
||||
$emailpending = true;
|
||||
// Skip backup of unavailable courses that have remained unmodified in a month
|
||||
if (!$course->visible && ($now - $course->timemodified) > 31) { //Hidden + unmodified last month
|
||||
//if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
|
||||
mtrace(" SKIPPING - hidden+unmodified");
|
||||
set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
|
||||
continue;
|
||||
}
|
||||
//Only make the backup if laststatus isn't 2-UNFINISHED (uncontrolled error)
|
||||
if ($backup_course->laststatus != 2) {
|
||||
//Set laststarttime
|
||||
@@ -334,7 +335,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
$backup_config->backup_sche_coursefiles = 1;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_messages)) {
|
||||
$backup_config->backup_sche_messages = 1;
|
||||
$backup_config->backup_sche_messages = 0;
|
||||
}
|
||||
if (!isset($backup_config->backup_sche_active)) {
|
||||
$backup_config->backup_sche_active = 0;
|
||||
@@ -407,8 +408,8 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
if (empty($preferences->mods[$mod->modname]->instances)) {
|
||||
$preferences->mods[$mod->modname]->instances = array(); // avoid warnings
|
||||
}
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->backup = $preferences->mods[$modname]->backup;
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->userinfo = $preferences->mods[$modname]->userinfo;
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->backup = $preferences->mods[$mod->modname]->backup;
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->userinfo = $preferences->mods[$mod->modname]->userinfo;
|
||||
// there isn't really a nice way to do this...
|
||||
$preferences->mods[$mod->modname]->instances[$mod->instance]->name = get_field($mod->modname,'name','id',$mod->instance);
|
||||
}
|
||||
@@ -513,7 +514,13 @@ function schedule_backup_course_configure($course,$starttime = 0) {
|
||||
//Now calculate the users
|
||||
if ($status) {
|
||||
schedule_backup_log($starttime,$course->id," calculating users");
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$preferences->backup_messages);
|
||||
//Decide about include users with messages, based on SITEID
|
||||
if ($preferences->backup_messages && $preferences->backup_course == SITEID) {
|
||||
$include_message_users = true;
|
||||
} else {
|
||||
$include_message_users = false;
|
||||
}
|
||||
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$include_message_users);
|
||||
}
|
||||
|
||||
//Now calculate the logs
|
||||
@@ -765,7 +772,9 @@ function schedule_backup_course_delete_old_files($preferences,$starttime=0) {
|
||||
$dirtocheck = $CFG->dataroot."/".$preferences->backup_course."/backupdata";
|
||||
}
|
||||
schedule_backup_log($starttime,$preferences->backup_course," checking $dirtocheck");
|
||||
mtrace(" Keeping backup files in $dirtocheck");
|
||||
if ($CFG->debug > 7) {
|
||||
mtrace(" Keeping backup files in $dirtocheck");
|
||||
}
|
||||
|
||||
//Get all the files in $dirtocheck
|
||||
$files = get_directory_list($dirtocheck,"",false);
|
||||
|
||||
+11
-8
@@ -460,10 +460,11 @@
|
||||
|
||||
function xml_tag_safe_content($content) {
|
||||
global $CFG;
|
||||
//If enabled, we strip all the control chars from the text but tabs, newlines and returns
|
||||
//If enabled, we strip all the control chars (\x0-\x1f) from the text but tabs (\x9),
|
||||
//newlines (\xa) and returns (\xd). The delete control char (\x7f) is also included.
|
||||
//because they are forbiden in XML 1.0 specs. The expression below seems to be
|
||||
//UTF-8 safe too because it simply ignores the rest of characters.
|
||||
$content = preg_replace("/(?(?=[[:cntrl:]])[^\n\r\t])/is","",$content);
|
||||
$content = preg_replace("/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is","",$content);
|
||||
if (!empty($CFG->unicodedb)) {
|
||||
// Don't perform the conversion. Contents are Unicode.
|
||||
$content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
|
||||
@@ -520,7 +521,8 @@
|
||||
fwrite ($bf,full_tag("INCLUDED",4,false,$included));
|
||||
fwrite ($bf,full_tag("USERINFO",4,false,$userinfo));
|
||||
|
||||
if (is_array($preferences->mods[$element->name]->instances)
|
||||
if (isset($preferences->mods[$element->name]->instances)
|
||||
&& is_array($preferences->mods[$element->name]->instances)
|
||||
&& count($preferences->mods[$element->name]->instances)) {
|
||||
fwrite ($bf, start_tag("INSTANCES",4,true));
|
||||
foreach ($preferences->mods[$element->name]->instances as $id => $object) {
|
||||
@@ -1001,7 +1003,6 @@
|
||||
fwrite ($bf,full_tag("TYPE",6,false,$moduletype));
|
||||
fwrite ($bf,full_tag("INSTANCE",6,false,$course_module[$tok]->instance));
|
||||
fwrite ($bf,full_tag("ADDED",6,false,$course_module[$tok]->added));
|
||||
fwrite ($bf,full_tag("DELETED",6,false,$course_module[$tok]->deleted));
|
||||
fwrite ($bf,full_tag("SCORE",6,false,$course_module[$tok]->score));
|
||||
fwrite ($bf,full_tag("INDENT",6,false,$course_module[$tok]->indent));
|
||||
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module[$tok]->visible));
|
||||
@@ -1048,7 +1049,6 @@
|
||||
//Output all user data
|
||||
fwrite ($bf,full_tag("ID",4,false,$user_data->id));
|
||||
fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
|
||||
fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
|
||||
fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
|
||||
fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
|
||||
fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
|
||||
@@ -1078,7 +1078,7 @@
|
||||
fwrite ($bf,full_tag("LASTACCESS",4,false,$user_data->lastaccess));
|
||||
fwrite ($bf,full_tag("LASTLOGIN",4,false,$user_data->lastlogin));
|
||||
fwrite ($bf,full_tag("CURRENTLOGIN",4,false,$user_data->currentlogin));
|
||||
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastIP));
|
||||
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastip));
|
||||
fwrite ($bf,full_tag("SECRET",4,false,$user_data->secret));
|
||||
fwrite ($bf,full_tag("PICTURE",4,false,$user_data->picture));
|
||||
fwrite ($bf,full_tag("URL",4,false,$user_data->url));
|
||||
@@ -1240,7 +1240,8 @@
|
||||
//See if it is a valid module to backup
|
||||
if ($log->module == "course" or
|
||||
$log->module == "user" or
|
||||
$preferences->mods[$log->module]->backup == 1) {
|
||||
(array_key_exists($log->module, $preferences->mods) and $preferences->mods[$log->module]->backup == 1)) {
|
||||
// logs with 'upload' in module field are ignored, there is no restore code anyway
|
||||
//Begin log tag
|
||||
fwrite ($bf,start_tag("LOG",3,true));
|
||||
|
||||
@@ -1662,7 +1663,8 @@
|
||||
|
||||
require_once($CFG->dirroot.'/mod/'.$module.'/backuplib.php');
|
||||
|
||||
if (is_array($preferences->mods[$module]->instances)) {
|
||||
if (isset($preferences->mods[$module]->instances)
|
||||
&& is_array($preferences->mods[$module]->instances)) {
|
||||
$onemodbackup = $module.'_backup_one_mod';
|
||||
if (function_exists($onemodbackup)) {
|
||||
foreach ($preferences->mods[$module]->instances as $instance => $object) {
|
||||
@@ -1719,6 +1721,7 @@
|
||||
|
||||
foreach ($mypreferences->mods as $name => $info) {
|
||||
//Check if the xxxx_encode_content_links exists
|
||||
include_once("$CFG->dirroot/mod/$name/backuplib.php");
|
||||
$function_name = $name."_encode_content_links";
|
||||
if (function_exists($function_name)) {
|
||||
$result = $function_name($result,$mypreferences);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,17 @@ function backup_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2006042801) {
|
||||
table_column('backup_log', 'time', 'time', 'integer', '', '', '0');
|
||||
table_column('backup_log', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
|
||||
table_column('backup_log', 'courseid', 'courseid', 'integer', '', '', '0');
|
||||
|
||||
table_column('backup_courses', 'lastendtime', 'lastendtime', 'integer', '', '', '0');
|
||||
table_column('backup_courses', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
|
||||
table_column('backup_courses', 'courseid', 'courseid', 'integer', '', '', '0');
|
||||
table_column('backup_courses', 'nextstarttime', 'nextstarttime', 'integer', '', '', '0');
|
||||
}
|
||||
|
||||
//Finally, return result
|
||||
return $result;
|
||||
|
||||
|
||||
+10
-6
@@ -118,7 +118,7 @@
|
||||
}
|
||||
|
||||
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
|
||||
while($entry = readdir($handle)) {
|
||||
while(false !== ($entry = readdir($handle))) {
|
||||
if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
|
||||
$dir_subdirs[] = $dir. $slash .$entry;
|
||||
}
|
||||
@@ -195,7 +195,7 @@
|
||||
$results = null;
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -214,7 +214,7 @@
|
||||
$results = "";
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -293,13 +293,15 @@
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true; // Initialize this, next code will change its value if needed
|
||||
|
||||
if (!is_dir($to_file)) {
|
||||
//echo "<br />Creating ".$to_file; //Debug
|
||||
umask(0000);
|
||||
$status = mkdir($to_file,$CFG->directorypermissions);
|
||||
}
|
||||
$dir = opendir($from_file);
|
||||
while ($file=readdir($dir)) {
|
||||
while (false !== ($file=readdir($dir))) {
|
||||
if ($file=="." || $file=="..") {
|
||||
continue;
|
||||
}
|
||||
@@ -411,8 +413,10 @@
|
||||
$rec->old_id = $old_id;
|
||||
$rec->new_id = ($new_id === null? 0 : $new_id);
|
||||
$rec->info = $info_to_save;
|
||||
|
||||
$status = insert_record('backup_ids', $rec, false);
|
||||
|
||||
if (!insert_record('backup_ids', $rec, false)) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@
|
||||
if (!$launch) {
|
||||
include_once("restore_precheck.html");
|
||||
} else if ($launch == "form") {
|
||||
if ($SESSION->restore->importing) {
|
||||
if (!empty($SESSION->restore->importing)) {
|
||||
// set up all the config stuff and skip asking the user about it.
|
||||
restore_setup_for_check($SESSION->restore,$backup_unique_code);
|
||||
include_once("restore_execute.html");
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
$$var = optional_param( $var,0);
|
||||
$var = "restore_user_info_".$modname;
|
||||
$$var = optional_param( $var,0);
|
||||
$instances = $info->mods[$mod->name]->instances;
|
||||
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
|
||||
if ($instances === NULL) {
|
||||
continue;
|
||||
}
|
||||
@@ -86,7 +86,7 @@
|
||||
$restore->mods[$modname]->restore=$$var;
|
||||
$var = "restore_user_info_".$modname;
|
||||
$restore->mods[$modname]->userinfo=$$var;
|
||||
$instances = $info->mods[$mod->name]->instances;
|
||||
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
|
||||
if ($instances === NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -48,12 +48,20 @@
|
||||
error ("An error has occurred and the restore could not be completed!");
|
||||
}
|
||||
|
||||
if (!$restore->importing) {
|
||||
echo $output;
|
||||
if (empty($restore->importing)) {
|
||||
//Print final message
|
||||
print_simple_box(get_string("restorefinished"),"center");
|
||||
} else {
|
||||
print_simple_box(get_string("importdatafinished"),"center");
|
||||
$file = $CFG->dataroot . '/'
|
||||
. $SESSION->import_preferences->backup_course
|
||||
. '/backupdata/' . $SESSION->import_preferences->backup_name;
|
||||
if (is_readable($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
else {
|
||||
error_log("import course data: couldn't unlink $file");
|
||||
}
|
||||
unset($SESSION->restore);
|
||||
}
|
||||
print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id);
|
||||
|
||||
+74
-40
@@ -63,6 +63,8 @@
|
||||
//from backup format to destination site/course in order to mantain inter-activities
|
||||
//working in the backup/restore process
|
||||
function restore_decode_content_links($restore) {
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
@@ -72,6 +74,7 @@
|
||||
//If the module is being restored
|
||||
if ($info->restore == 1) {
|
||||
//Check if the xxxx_decode_content_links_caller exists
|
||||
include_once("$CFG->dirroot/mod/$name/restorelib.php");
|
||||
$function_name = $name."_decode_content_links_caller";
|
||||
if (function_exists($function_name)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
@@ -477,7 +480,8 @@
|
||||
$suffixshort = "";
|
||||
}
|
||||
$currentfullname = $fullname.$suffixfull;
|
||||
$currentshortname = $shortname.$suffixshort;
|
||||
// Limit the size of shortname - database column accepts <= 15 chars
|
||||
$currentshortname = substr($shortname, 0, 15 - strlen($suffixshort)).$suffixshort;
|
||||
$coursefull = get_record("course","fullname",addslashes($currentfullname));
|
||||
$courseshort = get_record("course","shortname",addslashes($currentshortname));
|
||||
$counter++;
|
||||
@@ -889,7 +893,6 @@
|
||||
$course_module->module = $module->id;
|
||||
$course_module->section = $newid;
|
||||
$course_module->added = $mod->added;
|
||||
$course_module->deleted = $mod->deleted;
|
||||
$course_module->score = $mod->score;
|
||||
$course_module->indent = $mod->indent;
|
||||
$course_module->visible = $mod->visible;
|
||||
@@ -962,7 +965,7 @@
|
||||
//Process info about metacourse
|
||||
if ($status and $info) {
|
||||
//Process child records
|
||||
if ($info->childs) {
|
||||
if (!empty($info->childs)) {
|
||||
foreach ($info->childs as $child) {
|
||||
$dbcourse = false;
|
||||
$dbmetacourse = false;
|
||||
@@ -994,7 +997,7 @@
|
||||
sync_metacourse($restore->course_id);
|
||||
}
|
||||
//Process parent records
|
||||
if ($info->parents) {
|
||||
if (!empty($info->parents)) {
|
||||
foreach ($info->parents as $parent) {
|
||||
$dbcourse = false;
|
||||
$dbmetacourse = false;
|
||||
@@ -1074,7 +1077,7 @@
|
||||
if (!$preferencescount) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grade').'</li>';
|
||||
echo '<li>'.get_string('backupwithoutgradebook','grades').'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,7 +1088,7 @@
|
||||
if ($pref_rec->value == 0) {
|
||||
$continue = false;
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('respectingcurrentdata','grade').'</li>';
|
||||
echo '<li>'.get_string('respectingcurrentdata','grades').'</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1268,7 +1271,11 @@
|
||||
$itemid = insert_record('grade_item',$item);
|
||||
|
||||
//Now process grade_exceptions
|
||||
$exceptions = $ite_info['#']['GRADE_EXCEPTIONS']['0']['#']['GRADE_EXCEPTION'];
|
||||
if (!empty($ite_info['#']['GRADE_EXCEPTIONS'])) {
|
||||
$exceptions = $ite_info['#']['GRADE_EXCEPTIONS']['0']['#']['GRADE_EXCEPTION'];
|
||||
} else {
|
||||
$exceptions = array();
|
||||
}
|
||||
|
||||
//Iterate over exceptions
|
||||
for($j = 0; $j < sizeof($exceptions); $j++) {
|
||||
@@ -1375,6 +1382,19 @@
|
||||
$user->lang = 'mi_nt';
|
||||
}
|
||||
|
||||
//Country list updates - MDL-13060
|
||||
//Any user whose country code has been deleted or modified needs to be assigned a valid one.
|
||||
$country_update_map = array(
|
||||
'ZR' => 'CD',
|
||||
'TP' => 'TL',
|
||||
'FX' => 'FR',
|
||||
'KO' => 'RS',
|
||||
'CS' => 'RS',
|
||||
'WA' => 'GB');
|
||||
if (array_key_exists($user->country, $country_update_map)) {
|
||||
$user->country = $country_update_map[$user->country];
|
||||
}
|
||||
|
||||
//Check if it's admin and coursecreator
|
||||
$is_admin = !empty($user->roles['admin']);
|
||||
$is_coursecreator = !empty($user->roles['coursecreator']);
|
||||
@@ -1851,14 +1871,7 @@
|
||||
foreach ($info as $category) {
|
||||
//Skip empty categories (some backups can contain them)
|
||||
if (!empty($category->id)) {
|
||||
$catrestore = "restore_question_categories";
|
||||
if (function_exists($catrestore)) {
|
||||
//print_object ($category); //Debug
|
||||
$status = $catrestore($category,$restore);
|
||||
} else {
|
||||
//Something was wrong. Function should exist.
|
||||
$status = false;
|
||||
}
|
||||
$status = restore_question_categories($category,$restore);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2196,19 +2209,6 @@
|
||||
//Assign it to admin
|
||||
$eve->userid = $adminid;
|
||||
}
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
if (!empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$max_rec = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$eve->repeatid = empty($max_rec) ? 1 : $max_rec->repeatid + 1;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
}
|
||||
|
||||
//We have to recode the groupid field
|
||||
$group = backup_getid($restore->backup_unique_code,"groups",$eve->groupid);
|
||||
@@ -2221,6 +2221,22 @@
|
||||
|
||||
//The structure is equal to the db, so insert the event
|
||||
$newid = insert_record ("event",$eve);
|
||||
|
||||
//We must recode the repeatid if the event has it
|
||||
//The repeatid now refers to the id of the original event. (see Bug#5956)
|
||||
if ($newid && !empty($eve->repeatid)) {
|
||||
$repeat_rec = backup_getid($restore->backup_unique_code,"event_repeatid",$eve->repeatid);
|
||||
if ($repeat_rec) { //Exists, so use it...
|
||||
$eve->repeatid = $repeat_rec->new_id;
|
||||
} else { //Doesn't exists, calculate the next and save it
|
||||
$oldrepeatid = $eve->repeatid;
|
||||
$eve->repeatid = $newid;
|
||||
backup_putid($restore->backup_unique_code,"event_repeatid", $oldrepeatid, $eve->repeatid);
|
||||
}
|
||||
$eve->id = $newid;
|
||||
// update the record to contain the correct repeatid
|
||||
update_record('event',$eve);
|
||||
}
|
||||
} else {
|
||||
//get current event id
|
||||
$newid = $eve_db->id;
|
||||
@@ -2483,7 +2499,7 @@
|
||||
$modrestore = $mod->modtype."_restore_mods";
|
||||
if (function_exists($modrestore)) {
|
||||
//print_object ($mod); //Debug
|
||||
$status &= $modrestore($mod,$restore);
|
||||
$status = $status and $modrestore($mod,$restore); //bit operator & not reliable here!
|
||||
} else {
|
||||
//Something was wrong. Function should exist.
|
||||
$status = false;
|
||||
@@ -2732,6 +2748,31 @@
|
||||
$log->info = "";
|
||||
$toinsert = true;
|
||||
break;
|
||||
case "report log":
|
||||
$log->url = "report/log/index.php?id=".$log->course;
|
||||
$log->info = $log->course;
|
||||
$toinsert = true;
|
||||
break;
|
||||
case "report live":
|
||||
$log->url = "report/log/live.php?id=".$log->course;
|
||||
$log->info = $log->course;
|
||||
$toinsert = true;
|
||||
break;
|
||||
case "report outline":
|
||||
$log->url = "report/outline/index.php?id=".$log->course;
|
||||
$log->info = $log->course;
|
||||
$toinsert = true;
|
||||
break;
|
||||
case "report participation":
|
||||
$log->url = "report/participation/index.php?id=".$log->course;
|
||||
$log->info = $log->course;
|
||||
$toinsert = true;
|
||||
break;
|
||||
case "report stats":
|
||||
$log->url = "report/stats/index.php?id=".$log->course;
|
||||
$log->info = $log->course;
|
||||
$toinsert = true;
|
||||
break;
|
||||
default:
|
||||
echo "action (".$log->module."-".$log->action.") unknown. Not restored<br />"; //Debug
|
||||
break;
|
||||
@@ -3591,8 +3632,6 @@
|
||||
$this->info->tempmod->instance;
|
||||
$this->info->tempsection->mods[$this->info->tempmod->id]->added =
|
||||
$this->info->tempmod->added;
|
||||
$this->info->tempsection->mods[$this->info->tempmod->id]->deleted =
|
||||
$this->info->tempmod->deleted;
|
||||
$this->info->tempsection->mods[$this->info->tempmod->id]->score =
|
||||
$this->info->tempmod->score;
|
||||
$this->info->tempsection->mods[$this->info->tempmod->id]->indent =
|
||||
@@ -3618,9 +3657,6 @@
|
||||
case "ADDED":
|
||||
$this->info->tempmod->added = $this->getContents();
|
||||
break;
|
||||
case "DELETED":
|
||||
$this->info->tempmod->deleted = $this->getContents();
|
||||
break;
|
||||
case "SCORE":
|
||||
$this->info->tempmod->score = $this->getContents();
|
||||
break;
|
||||
@@ -3847,9 +3883,6 @@
|
||||
case "AUTH":
|
||||
$this->info->tempuser->auth = $this->getContents();
|
||||
break;
|
||||
case "GUID":
|
||||
$this->info->tempuser->guid = $this->getContents();
|
||||
break;
|
||||
case "CONFIRMED":
|
||||
$this->info->tempuser->confirmed = $this->getContents();
|
||||
break;
|
||||
@@ -4819,7 +4852,7 @@
|
||||
}
|
||||
|
||||
function restore_execute(&$restore,$info,$course_header,&$errorstr) {
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
$status = true;
|
||||
//Checks for the required files/functions to restore every module
|
||||
//and include them
|
||||
@@ -5218,6 +5251,7 @@
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.get_string('creatingblocks').'</li>';
|
||||
}
|
||||
$course_header->blockinfo = !empty($course_header->blockinfo) ? $course_header->blockinfo : NULL;
|
||||
if (!$status = restore_create_blocks($restore, $info->backup_block_format, $course_header->blockinfo, $xml_file)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
notify('Error while creating the course blocks');
|
||||
@@ -5281,9 +5315,9 @@
|
||||
}
|
||||
if (!$status = restore_decode_content_links($restore)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
notify("Could not refresh events for activities!");
|
||||
notify("Could not decode content links!");
|
||||
} else {
|
||||
$errorstr = "Could not refresh events for activities!";
|
||||
$errorstr = "Could not decode content links!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -5,6 +5,8 @@
|
||||
// database (backup_version) to determine whether upgrades should
|
||||
// be performed (see db/backup_*.php)
|
||||
|
||||
$backup_version = 2006042800; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_version = 2006082300; // The current version is a date (YYYYMMDDXX)
|
||||
|
||||
$backup_release = "1.6beta4"; // User-friendly version number
|
||||
$backup_release = "1.6.2"; // User-friendly version number
|
||||
|
||||
?>
|
||||
|
||||
-1232
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,9 @@ class block_activity_modules extends block_list {
|
||||
// data from db if the course format has already fetched them
|
||||
if(!isset($GLOBALS['modnamesplural']) || !isset($GLOBALS['modnamesused'])) {
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
if (!empty($this->instance)) {
|
||||
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$modnamesplural = $GLOBALS['modnamesplural'];
|
||||
@@ -30,7 +32,7 @@ class block_activity_modules extends block_list {
|
||||
$this->content->icons = array();
|
||||
$this->content->footer = '';
|
||||
|
||||
if ($modnamesused) {
|
||||
if (isset($modnamesused) && $modnamesused) {
|
||||
foreach ($modnamesused as $modname => $modfullname) {
|
||||
if ($modname != 'label') {
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modnamesplural[$modname].'</a>';
|
||||
|
||||
@@ -56,10 +56,8 @@ class block_admin extends block_list {
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/log.gif" alt="" />';
|
||||
|
||||
|
||||
if (!empty($CFG->enablestats)) {
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/report/stats/index.php?course='.SITEID.'">'.get_string('stats').'</a>';
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" alt="" />';
|
||||
}
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'.get_string('reports').'</a>';
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" alt="" />';
|
||||
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'">'.get_string('sitefiles').'</a>';
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/files.gif" alt="" />';
|
||||
@@ -92,6 +90,12 @@ class block_admin extends block_list {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
if (isteacher($this->instance->pageid)) {
|
||||
@@ -111,9 +115,9 @@ class block_admin extends block_list {
|
||||
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
$editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
$editmyprofile = '<a title="'.$fullname.'" href="'.$securewwwroot.'/user/edit.php?id='.$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
if (empty($USER->description)) {
|
||||
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
$text = get_string('profile').' '.get_string('missingdescription');
|
||||
$this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
|
||||
} else {
|
||||
@@ -186,7 +190,9 @@ class block_admin extends block_list {
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
|
||||
}
|
||||
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->instance->pageid.'&file=teacher.html">'.get_string('help').'</a>';
|
||||
$lang = str_replace('_utf8', '', current_language());
|
||||
|
||||
$this->content->items[]='<a href="http://docs.moodle.org/'.$lang.'/Teacher_documentation">'.get_string('help').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/resource/icon.gif" alt="" />';
|
||||
|
||||
if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
|
||||
@@ -206,10 +212,10 @@ class block_admin extends block_list {
|
||||
}
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
$editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.
|
||||
$editmyprofile = '<a title="'.$fullname.'" href="'.$securewwwroot.'/user/edit.php?id='.
|
||||
$USER->id.'&course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
|
||||
if (empty($USER->description)) {
|
||||
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
|
||||
$text = get_string('profile').' '.get_string('missingdescription');
|
||||
$this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
|
||||
} else {
|
||||
@@ -218,12 +224,10 @@ class block_admin extends block_list {
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
if (is_internal_auth() && !is_restricted_user($USER->username)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
|
||||
$this->content->items[]='<a href="'.$securewwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
} else if ($CFG->changepassword && !is_restricted_user($USER->username)) {
|
||||
$this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
if ($CFG->allowunenroll && !$course->metacourse) {
|
||||
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php //$Id$
|
||||
|
||||
require_once($CFG->dirroot .'/blog/lib.php');
|
||||
|
||||
class block_blog_menu extends block_base {
|
||||
|
||||
function init() {
|
||||
@@ -15,13 +17,13 @@ class block_blog_menu extends block_base {
|
||||
$course = SITEID;
|
||||
}
|
||||
|
||||
if ($CFG->bloglevel < 1) {
|
||||
if ($CFG->bloglevel < BLOG_USER_LEVEL) {
|
||||
$this->content->text = '';
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
// don't display menu block if block is set at site level, and user is not logged in
|
||||
if ($CFG->bloglevel < 5 && !(isloggedin() && !isguest())) {
|
||||
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguest())) {
|
||||
$this->content->text = '';
|
||||
return $this->content;
|
||||
}
|
||||
@@ -48,15 +50,13 @@ class block_blog_menu extends block_base {
|
||||
$this->content->text = $output;
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot .'/blog/lib.php');
|
||||
|
||||
//if ( blog_isLoggedIn() && !isguest() ) {
|
||||
$courseviewlink = '';
|
||||
$addentrylink = '';
|
||||
|
||||
$coursearg = '';
|
||||
if((isloggedin() && !isguest()) && isset($course) && isset($course->id) && $course->id !=0 && $course->id!=SITEID && $CFG->bloglevel >=3 ) {
|
||||
if((isloggedin() && !isguest()) && isset($course) && isset($course->id) && $course->id !=0 && $course->id!=SITEID && $CFG->bloglevel >= BLOG_COURSE_LEVEL) {
|
||||
$coursearg = '&courseid='. $course->id;
|
||||
// a course is specified
|
||||
|
||||
@@ -66,10 +66,10 @@ class block_blog_menu extends block_base {
|
||||
|
||||
$blogmodon = false;
|
||||
|
||||
if ((isloggedin() && !isguest()) && (isadmin() || !$blogmodon || ($blogmodon && $coursearg != '')) && $CFG->bloglevel >= 1) {
|
||||
if ((isloggedin() && !isguest()) && (isadmin() || !$blogmodon || ($blogmodon && $coursearg != '')) && $CFG->bloglevel >= BLOG_USER_LEVEL) {
|
||||
|
||||
// show Add entry link - user is not admin, moderation is off, or moderation is on and the user is viewing the block within the context of a course
|
||||
$addentrylink = '<a href="'. $CFG->wwwroot. '/blog/edit.php?userid='. $userBlog->userid . $coursearg .'">'. get_string('addnewentry', 'blog') .'</a><br />';
|
||||
$addentrylink = '<a href="'. $CFG->wwwroot. '/blog/edit.php?userid='. $userBlog->userid . $coursearg .'">'. get_string('addnewentry', 'blog') .'</a><br />';
|
||||
|
||||
// show View my entries link
|
||||
$addentrylink .= '<a href="'. $CFG->wwwroot .'/blog/index.php?userid='. $userBlog->userid.'">';
|
||||
@@ -83,7 +83,7 @@ class block_blog_menu extends block_base {
|
||||
}
|
||||
|
||||
// show View site entries link
|
||||
if ($CFG->bloglevel >= 4) {
|
||||
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
|
||||
$output .= '<a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=site&">';
|
||||
$output .= get_string('viewsiteentries', 'blog') .'</a><br />';
|
||||
}
|
||||
|
||||
@@ -4,13 +4,7 @@ define('BLOGDEFAULTTIMEWITHIN', 90);
|
||||
define('BLOGDEFAULTNUMBEROFTAGS', 20);
|
||||
define('BLOGDEFAULTSORT', 'text');
|
||||
|
||||
if (!defined('BLOG_USER_LEVEL')) {
|
||||
define ('BLOG_USER_LEVEL', 1);
|
||||
define ('BLOG_GROUP_LEVEL', 2);
|
||||
define ('BLOG_COURSE_LEVEL', 3);
|
||||
define ('BLOG_SITE_LEVEL', 4);
|
||||
define ('BLOG_GLOBAL_LEVEL', 5);
|
||||
}
|
||||
require_once($CFG->dirroot .'/blog/lib.php');
|
||||
|
||||
class block_blog_tags extends block_base {
|
||||
function init() {
|
||||
@@ -47,7 +41,7 @@ class block_blog_tags extends block_base {
|
||||
|
||||
function get_content() {
|
||||
|
||||
global $CFG;
|
||||
global $CFG, $SITE, $COURSE;
|
||||
|
||||
if (empty($this->config->timewithin)) {
|
||||
$this->config->timewithin = BLOGDEFAULTTIMEWITHIN;
|
||||
@@ -77,13 +71,13 @@ class block_blog_tags extends block_base {
|
||||
|
||||
$timewithin = $this->config->timewithin * 24 * 60 * 60; /// convert to seconds
|
||||
|
||||
$sql = 'SELECT t.*, COUNT(DISTINCT bt.id) as ct ';
|
||||
$sql = 'SELECT t.id, t.type, t.text, COUNT(DISTINCT bt.id) as ct ';
|
||||
$sql .= "FROM {$CFG->prefix}tags as t, {$CFG->prefix}blog_tag_instance as bt, {$CFG->prefix}post as p ";
|
||||
$sql .= 'WHERE t.id = bt.tagid ';
|
||||
$sql .= 'AND p.id = bt.entryid ';
|
||||
$sql .= 'AND (p.publishstate = "site" or p.publishstate="public") ';
|
||||
$sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') ';
|
||||
$sql .= "AND bt.timemodified > {$timewithin} ";
|
||||
$sql .= 'GROUP BY bt.tagid ';
|
||||
$sql .= 'GROUP BY t.id, t.type, t.text ';
|
||||
$sql .= 'ORDER BY ct DESC, t.text ASC ';
|
||||
$sql .= "LIMIT {$this->config->numberoftags} ";
|
||||
|
||||
@@ -137,17 +131,21 @@ class block_blog_tags extends block_base {
|
||||
|
||||
case BLOG_COURSE_LEVEL:
|
||||
$filtertype = 'course';
|
||||
global $course; // Need to do this unfortunately for pages like blog pages
|
||||
if (isset($course->id)) {
|
||||
$filterselect = $course->id;
|
||||
if (isset($COURSE->id)) {
|
||||
$filterselect = $COURSE->id;
|
||||
} else {
|
||||
$filterselect = $this->instance->pageid;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$filtertype = 'site';
|
||||
$filterselect = SITEID;
|
||||
if (isset($COURSE->id) && $COURSE->id != SITEID) {
|
||||
$filtertype = 'course';
|
||||
$filterselect = $COURSE->id;
|
||||
} else {
|
||||
$filtertype = 'site';
|
||||
$filterselect = SITEID;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class block_calendar_month extends block_base {
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $USER, $CFG, $SESSION;
|
||||
global $USER, $CFG, $SESSION, $COURSE;
|
||||
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
|
||||
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
|
||||
|
||||
@@ -28,12 +28,7 @@ class block_calendar_month extends block_base {
|
||||
// [pj] To me it looks like this if would never be needed, but Penny added it
|
||||
// when committing the /my/ stuff. Reminder to discuss and learn what it's about.
|
||||
// It definitely needs SOME comment here!
|
||||
if (!empty($this->instance->pageid)) {
|
||||
$courseshown = $this->instance->pageid;
|
||||
}
|
||||
else {
|
||||
$courseshown = SITEID;
|
||||
}
|
||||
$courseshown = $COURSE->id;
|
||||
|
||||
if($courseshown == SITEID) {
|
||||
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
|
||||
@@ -58,13 +53,12 @@ class block_calendar_month extends block_base {
|
||||
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
|
||||
// No filters for now
|
||||
|
||||
} elseif (!empty($courseshown)) {
|
||||
} else {
|
||||
// For any other course
|
||||
$this->content->text .= calendar_overlib_html();
|
||||
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
|
||||
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $course).'</div>';
|
||||
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class block_calendar_upcoming extends block_base {
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $USER, $CFG, $SESSION;
|
||||
global $USER, $CFG, $SESSION, $COURSE;
|
||||
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
|
||||
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
|
||||
|
||||
@@ -27,12 +27,7 @@ class block_calendar_upcoming extends block_base {
|
||||
$this->content->footer = '';
|
||||
|
||||
} else {
|
||||
if (!empty($this->instance->pageid)) {
|
||||
$courseshown = $this->instance->pageid;
|
||||
}
|
||||
else {
|
||||
$courseshown = SITEID;
|
||||
}
|
||||
$courseshown = $COURSE->id;
|
||||
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
|
||||
'/calendar/view.php?view=upcoming&course='.$courseshown.'">'.
|
||||
get_string('gotocalendar', 'calendar').'</a>...';
|
||||
|
||||
@@ -34,7 +34,7 @@ class block_course_list extends block_list {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
|
||||
if (empty($CFG->disablemycourses) and isset($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
|
||||
if ($courses = get_my_courses($USER->id)) {
|
||||
foreach ($courses as $course) {
|
||||
if ($course->id == SITEID) {
|
||||
|
||||
@@ -7,13 +7,14 @@ class block_course_summary extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
if($this->instance->pagetype == PAGE_COURSE_VIEW && $this->instance->pageid != SITEID) {
|
||||
global $COURSE;
|
||||
if($this->instance->pagetype == PAGE_COURSE_VIEW && $COURSE->id != SITEID) {
|
||||
$this->title = get_string('coursesummary', 'block_course_summary');
|
||||
}
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $THEME;
|
||||
global $CFG, $COURSE;
|
||||
|
||||
if($this->content !== NULL) {
|
||||
return $this->content;
|
||||
@@ -23,19 +24,14 @@ class block_course_summary extends block_base {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (empty($this->instance->pageid)) {
|
||||
$this->instance->pageid = SITEID;
|
||||
}
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
$this->content = New stdClass;
|
||||
$options->noclean = true; // Don't clean Javascripts etc
|
||||
$this->content->text = format_text($course->summary, FORMAT_HTML, $options);
|
||||
if(isediting($this->instance->pageid)) {
|
||||
if($this->instance->pageid == SITEID) {
|
||||
$this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
|
||||
if(isediting($COURSE->id)) {
|
||||
if($COURSE->id == SITEID) {
|
||||
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/site.php';
|
||||
} else {
|
||||
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid;
|
||||
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$COURSE->id;
|
||||
}
|
||||
$this->content->text .= "<div align=\"right\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"\" /></a></div>";
|
||||
}
|
||||
|
||||
@@ -61,6 +61,35 @@ function migrate2utf8_block_instance_configdata($recordid){
|
||||
|
||||
return $blah;
|
||||
|
||||
} else if ($blocktype -> name == 'glossary_random'){
|
||||
|
||||
///find course
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
$blah = unserialize(base64_decode($blockinstance->configdata));
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
$blah->title = utfconvert($blah->title, $fromenc, false);
|
||||
$blah->addentry = utfconvert($blah->addentry, $fromenc, false);
|
||||
$blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
|
||||
$blah->invisible = utfconvert($blah->invisible, $fromenc, false);
|
||||
|
||||
$blockinstance->configdata = base64_encode(serialize($blah));
|
||||
|
||||
migrate2utf8_update_record('block_instance',$blockinstance);
|
||||
|
||||
return $blah;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,6 +156,35 @@ global $CFG, $globallang;
|
||||
|
||||
return $blah;
|
||||
|
||||
} else if ($blocktype -> name == 'glossary_random'){
|
||||
|
||||
///find course
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($blockpinned->pageid); //Non existing!
|
||||
$userlang = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
$blah = unserialize(base64_decode($blockpinned->configdata));
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
$blah->title = utfconvert($blah->title, $fromenc, false);
|
||||
$blah->addentry = utfconvert($blah->addentry, $fromenc, false);
|
||||
$blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
|
||||
$blah->invisible = utfconvert($blah->invisible, $fromenc, false);
|
||||
|
||||
$blockinstance->configdata = base64_encode(serialize($blah));
|
||||
|
||||
migrate2utf8_update_record('block_instance',$blockinstance);
|
||||
|
||||
return $blah;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -13,8 +13,8 @@ class block_glossary_random extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
global $CFG;
|
||||
$this->course = get_record('course', 'id', $this->instance->pageid);
|
||||
global $CFG, $COURSE;
|
||||
$this->course = $COURSE;
|
||||
|
||||
// load userdefined title and make sure it's never empty
|
||||
if (empty($this->config->title)) {
|
||||
|
||||
@@ -12,26 +12,26 @@
|
||||
<td><input type="text" name="title" size="50" value="<?php p($this->config->title) ?>" /></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("select_glossary","block_glossary_random") ?>:</td>
|
||||
<td><?php choose_from_menu($glossaries,"glossary",$this->config->glossary) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("refresh","block_glossary_random") ?>:</td>
|
||||
<td><input type="text" name="refresh" size="5" value="<?php p($this->config->refresh) ?>" /></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("type","block_glossary_random") ?>:</td>
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("type","block_glossary_random") ?>:</td>
|
||||
<td><?php
|
||||
choose_from_menu($type, "type", $this->config->type, "");
|
||||
helpbutton("",get_string("type","block_glossary_random"),"moodle",true,false,get_string("typehelp","block_glossary_random"));
|
||||
?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("showconcept","block_glossary_random") ?>:</td>
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("showconcept","block_glossary_random") ?>:</td>
|
||||
<td>
|
||||
<input type="hidden" name="showconcept" value="0" />
|
||||
<input type="checkbox" name="showconcept" value="1" <?php if(!empty($this->config->showconcept)) echo 'checked="checked"'; ?> /></td>
|
||||
|
||||
@@ -12,7 +12,7 @@ class block_html extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
$this->title = isset($this->config->title) ? $this->config->title : get_string('newhtmlblock', 'block_html');
|
||||
$this->title = isset($this->config->title) ? format_string($this->config->title) : get_string('newhtmlblock', 'block_html');
|
||||
}
|
||||
|
||||
function instance_allow_multiple() {
|
||||
@@ -24,8 +24,13 @@ class block_html extends block_base {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$filteropt = new stdClass;
|
||||
$filteropt->noclean = true;
|
||||
if (!empty($this->instance->pinned) or $this->instance->pagetype === 'course-view') {
|
||||
// fancy html allowed only on course page and in pinned blocks for security reasons
|
||||
$filteropt = new stdClass;
|
||||
$filteropt->noclean = true;
|
||||
} else {
|
||||
$filteropt = null;
|
||||
}
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = isset($this->config->text) ? format_text($this->config->text, FORMAT_HTML, $filteropt) : '';
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
<?php $usehtmleditor = can_use_html_editor(); ?>
|
||||
<?php
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
$text = isset($this->config->text) ? $this->config->text : '';
|
||||
if (empty($this->instance->pinned) and $this->instance->pagetype !== 'course-view') {
|
||||
$text = clean_text($text, FORMAT_HTML);
|
||||
}
|
||||
?>
|
||||
<table cellpadding="9" cellspacing="0">
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('configtitle', 'block_html'); ?>:</td>
|
||||
<td><input type="text" name="title" size="30" value="<?php echo isset($this->config->title)?$this->config->title:''; ?>" /> (<?php print_string('leaveblanktohide', 'block_html'); ?>)</td>
|
||||
<td><input type="text" name="title" size="30" value="<?php echo isset($this->config->title)?p($this->config->title):''; ?>" /> (<?php print_string('leaveblanktohide', 'block_html'); ?>)</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('configcontent', 'block_html'); ?>:</td>
|
||||
<td><?php print_textarea($usehtmleditor, 25, 50, 0, 0, 'text', isset($this->config->text)?$this->config->text:'') ?></td>
|
||||
<td><?php print_textarea($usehtmleditor, 25, 50, 0, 0, 'text', $text) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
|
||||
@@ -198,6 +198,7 @@ function comp(v) { // general entry point for all cases
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
$this->content->footer = '';
|
||||
|
||||
return $this->content;
|
||||
|
||||
|
||||
@@ -32,13 +32,12 @@ class block_login extends block_base {
|
||||
$forgot = $wwwroot . '/login/forgot_password.php';
|
||||
} else {
|
||||
if (!empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})
|
||||
|| $CFG->changepassword
|
||||
|| is_internal_auth() ) {
|
||||
if (is_internal_auth() || !empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})) {
|
||||
$forgot = $wwwroot . '/login/forgot_password.php';
|
||||
}
|
||||
else {
|
||||
$forgot = $CFG->changepassword;
|
||||
$forgot = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +52,7 @@ class block_login extends block_base {
|
||||
$this->content->text .= '<table align="center" cellpadding="2" cellspacing="0" class="logintable">';
|
||||
|
||||
$this->content->text .= '<tr><td class="c0 r0" align="right">'.get_string('username').':</td>';
|
||||
$this->content->text .= '<td class="c1 r0"><input type="text" name="username" size="10" value="'.$username.'" /></td></tr>';
|
||||
$this->content->text .= '<td class="c1 r0"><input type="text" name="username" size="10" value="'.s($username).'" /></td></tr>';
|
||||
|
||||
$this->content->text .= '<tr><td class="c0 r1" align="right">'.get_string('password').':</td>';
|
||||
$this->content->text .= '<td class="c1 r1"><input type="password" name="password" size="10" value="" /></td></tr>';
|
||||
|
||||
@@ -7,7 +7,7 @@ class block_news_items extends block_base {
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $USER;
|
||||
global $CFG, $USER, $COURSE;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
@@ -22,44 +22,39 @@ class block_news_items extends block_base {
|
||||
}
|
||||
|
||||
|
||||
if ($this->instance->pageid == 0) {
|
||||
$this->instance->pageid = SITEID;
|
||||
}
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
if ($course->newsitems) { // Create a nice listing of recent postings
|
||||
if ($COURSE->newsitems) { // Create a nice listing of recent postings
|
||||
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php'); // We'll need this
|
||||
|
||||
$text = '';
|
||||
|
||||
if (!$forum = forum_get_course_forum($course->id, 'news')) {
|
||||
if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
|
||||
/// First work out whether we can post to this group and if so, include a link
|
||||
|
||||
if (isteacheredit($course->id)) { /// Teachers can always post
|
||||
if (isteacheredit($COURSE->id)) { /// Teachers can always post
|
||||
$visiblegroups = -1;
|
||||
|
||||
$text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
|
||||
get_string('addanewtopic', 'forum').'</a>...</div>';
|
||||
|
||||
} else { /// Check the group situation
|
||||
$currentgroup = get_current_group($course->id);
|
||||
$currentgroup = get_current_group($COURSE->id);
|
||||
|
||||
if (forum_user_can_post_discussion($forum, $currentgroup)) {
|
||||
$text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
|
||||
get_string('addanewtopic', 'forum').'</a>...</div>';
|
||||
}
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
|
||||
$this->content->text = $text;
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$groupmode = groupmode($course, $cm);
|
||||
$groupmode = groupmode($COURSE, $cm);
|
||||
|
||||
/// Decides if current user is allowed to see ALL the current discussions or not
|
||||
|
||||
@@ -73,7 +68,7 @@ class block_news_items extends block_base {
|
||||
/// Get all the recent discussions we're allowed to see
|
||||
|
||||
if (! $discussions = forum_get_discussions($forum->id, 'p.modified DESC', 0, false,
|
||||
$visiblegroups, $course->newsitems) ) {
|
||||
$visiblegroups, $COURSE->newsitems) ) {
|
||||
$text .= '('.get_string('nonews', 'forum').')';
|
||||
$this->content->text = $text;
|
||||
return $this->content;
|
||||
@@ -119,7 +114,7 @@ class block_news_items extends block_base {
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
$this->content->footer .= '<br />'.rss_get_link($course->id, $userid, 'forum', $forum->id, $tooltiptext);
|
||||
$this->content->footer .= '<br />'.rss_get_link($COURSE->id, $userid, 'forum', $forum->id, $tooltiptext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class block_online_users extends block_base {
|
||||
function has_config() {return true;}
|
||||
|
||||
function get_content() {
|
||||
global $USER, $CFG;
|
||||
global $USER, $CFG, $COURSE;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
@@ -23,8 +23,6 @@ class block_online_users extends block_base {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
$timetoshowusers = 300; //Seconds default
|
||||
if (isset($CFG->block_online_users_timetosee)) {
|
||||
$timetoshowusers = $CFG->block_online_users_timetosee * 60;
|
||||
@@ -32,10 +30,10 @@ class block_online_users extends block_base {
|
||||
$timefrom = time()-$timetoshowusers;
|
||||
|
||||
//Calculate if we are in separate groups
|
||||
$isseparategroups = ($course->groupmode == SEPARATEGROUPS && $course->groupmodeforce && !isteacheredit($this->instance->pageid));
|
||||
$isseparategroups = ($COURSE->groupmode == SEPARATEGROUPS && $COURSE->groupmodeforce && !isteacheredit($COURSE->id));
|
||||
|
||||
//Get the user current group
|
||||
$currentgroup = $isseparategroups ? get_current_group($this->instance->pageid) : NULL;
|
||||
$currentgroup = $isseparategroups ? get_current_group($COURSE->id) : NULL;
|
||||
|
||||
$groupmembers = "";
|
||||
$groupselect = "";
|
||||
@@ -46,11 +44,11 @@ class block_online_users extends block_base {
|
||||
$groupselect .= " AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
|
||||
}
|
||||
|
||||
if ($this->instance->pageid == SITEID) { // Site-level
|
||||
if ($COURSE->id == SITEID) { // Site-level
|
||||
$courseselect = '';
|
||||
$timeselect = "AND (s.timeaccess > $timefrom OR u.lastaccess > $timefrom)";
|
||||
} else {
|
||||
$courseselect = "AND s.course = '".$this->instance->pageid."'";
|
||||
$courseselect = "AND s.course = '".$COURSE->id."'";
|
||||
$timeselect = "AND s.timeaccess > $timefrom";
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ class block_online_users extends block_base {
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->instance->pageid == SITEID && $CFG->allusersaresitestudents) {
|
||||
if ($COURSE->id == SITEID && $CFG->allusersaresitestudents) {
|
||||
if ($siteusers = get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess
|
||||
FROM {$CFG->prefix}user u
|
||||
WHERE u.lastaccess > $timefrom AND u.username <> 'guest'
|
||||
@@ -88,7 +86,7 @@ class block_online_users extends block_base {
|
||||
$groupmembers
|
||||
WHERE u.id = s.userid $courseselect $groupselect $timeselect ";
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
if (!isteacher($COURSE->id)) {
|
||||
// Hide hidden teachers from students.
|
||||
$findteacherssql .= 'AND s.authority > 0 ';
|
||||
}
|
||||
@@ -110,17 +108,17 @@ class block_online_users extends block_base {
|
||||
//Now, we have in users, the list of users to show
|
||||
//Because they are online
|
||||
if (!empty($users)) {
|
||||
//Accessibility: Don't want 'Alt' text for the user picture; DO want it for the envelope/message link (existing lang string).
|
||||
//Accessibility: Converted <div> to <ul>, inherit existing classes & styles.
|
||||
$this->content->text .= "<ul class='list'>\n";
|
||||
//Accessibility: Don't want 'Alt' text for the user picture; DO want it for the envelope/message link (existing lang string).
|
||||
//Accessibility: Converted <div> to <ul>, inherit existing classes & styles.
|
||||
$this->content->text .= "<ul class='list'>\n";
|
||||
foreach ($users as $user) {
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$this->content->text .= '<li class="listentry">';
|
||||
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
|
||||
$this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 16, true).' ';
|
||||
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
|
||||
$this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
|
||||
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">'.$user->fullname.'</a>';
|
||||
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and !isguest()) { // Only when logged in
|
||||
$this->content->text .= "\n".' <a title="'.get_string('messageselectadd').'" target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">'
|
||||
.'<img class="icon message" src="'.$CFG->pixpath.'/t/message.gif" alt="'. get_string('messageselectadd') .'" /></a>';
|
||||
.'<img class="messageicon" src="'.$CFG->pixpath.'/t/message.gif" alt="'. get_string('messageselectadd') .'" /></a>';
|
||||
}
|
||||
$this->content->text .= "</li>\n";
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class block_participants extends block_list {
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $USER, $CFG;
|
||||
global $USER, $CFG, $COURSE;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
@@ -27,13 +27,14 @@ class block_participants extends block_list {
|
||||
$this->instance->pageid = SITEID;
|
||||
}
|
||||
|
||||
if ($this->instance->pageid != SITEID ||
|
||||
/// MDL-13252 Always get the course page id or else the id may be incorrect in the user/index.php
|
||||
if ($COURSE->id != SITEID ||
|
||||
$CFG->showsiteparticipantslist > 1 ||
|
||||
($CFG->showsiteparticipantslist == 1 && isteacherinanycourse()) ||
|
||||
isteacher(SITEID)) {
|
||||
|
||||
$this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'.
|
||||
$CFG->wwwroot.'/user/index.php?id='.$this->instance->pageid.'">'.get_string('participants').'</a>';
|
||||
$CFG->wwwroot.'/user/index.php?id='.$COURSE->id.'">'.get_string('participants').'</a>';
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ class block_recent_activity extends block_base {
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $COURSE;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
@@ -21,11 +22,9 @@ class block_recent_activity extends block_base {
|
||||
$this->content->text = '';
|
||||
$this->content->footer = '';
|
||||
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
// Slightly hacky way to do it but...
|
||||
ob_start();
|
||||
print_recent_activity($course);
|
||||
print_recent_activity($COURSE);
|
||||
$this->content->text = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $editing;
|
||||
global $CFG, $editing, $COURSE;
|
||||
|
||||
require_once($CFG->libdir .'/rsslib.php');
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
$isteacher = false;
|
||||
$this->courseid = SITEID;
|
||||
if ($this->instance->pagetype == PAGE_COURSE_VIEW) {
|
||||
$this->courseid = $this->instance->pageid;
|
||||
$this->courseid = $COURSE->id;
|
||||
$isteacher = isteacher($this->courseid);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
$numids = count($rssidarray);
|
||||
$count = 0;
|
||||
foreach ($rssidarray as $rssid) {
|
||||
$output .= $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
|
||||
$output .= clean_text($this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false), FORMAT_HTML);
|
||||
if ($numids > 1 && $count != $numids -1 && !empty($rssfeedstring)) {
|
||||
$output .= '<hr width="80%" />';
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
}
|
||||
|
||||
$url = optional_param('url','',PARAM_URL);
|
||||
|
||||
if (!empty($url)) {
|
||||
// attempting to replace feed and rss url types with http
|
||||
@@ -41,7 +42,7 @@ if (!empty($url)) {
|
||||
$act = optional_param('act', NULL, PARAM_ALPHA);
|
||||
$rssid = optional_param('rssid', NULL, PARAM_INT);
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$url = clean_param($url, PARAM_URL);
|
||||
//$url = clean_param($url, PARAM_URL);
|
||||
$preferredtitle = optional_param('preferredtitle', '', PARAM_ALPHA);
|
||||
|
||||
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
|
||||
|
||||
@@ -12,6 +12,12 @@ function rss_client_upgrade($oldversion) {
|
||||
table_column('block_rss_client','description','description','text');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005090201) {
|
||||
modify_database('', 'ALTER TABLE prefix_block_rss_client
|
||||
ALTER COLUMN title SET DEFAULT \'\',
|
||||
ALTER COLUMN description SET DEFAULT \'\'');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class block_section_links extends block_base {
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return (array('course-view-weeks' => true, 'course-view-topics' => true));
|
||||
return (array('course-view-weeks' => true, 'course-view-topics' => true, 'course-edit-weeks' => true, 'course-edit-topics' => true));
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@
|
||||
// database (blocks_version) to determine whether upgrades should
|
||||
// be performed (see db/backup_*.php)
|
||||
|
||||
$blocks_version = 2005090200; // The current version is a date (YYYYMMDDXX)
|
||||
$blocks_version = 2005090201; // The current version is a date (YYYYMMDDXX)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php // $Id$
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition of blog page type.
|
||||
*/
|
||||
|
||||
+6
-16
@@ -115,8 +115,8 @@ if ($editid) { // User is editing a post
|
||||
$blogEntry = get_record('post','id',$editid);
|
||||
|
||||
//using an unformatted entry body here so that extra formatting information is not stored in the db
|
||||
$post->body = stripslashes_safe($blogEntry->summary);
|
||||
$post->etitle = stripslashes_safe($blogEntry->subject);
|
||||
$post->body = $blogEntry->summary;
|
||||
$post->etitle = $blogEntry->subject;
|
||||
$post->postid = $editid;
|
||||
$post->userid = $blogEntry->userid;
|
||||
$post->format = $blogEntry->format;
|
||||
@@ -137,16 +137,6 @@ print_simple_box_start("center");
|
||||
require('edit.html');
|
||||
print_simple_box_end();
|
||||
|
||||
// Janne comment: Let's move this in here
|
||||
// so IE gets more time to load the
|
||||
// Page.
|
||||
if ($usehtmleditor) {
|
||||
// Janne comment: there are two text fields in form
|
||||
// so lets try to replace them both with
|
||||
// HTMLArea editors
|
||||
use_html_editor();
|
||||
}
|
||||
|
||||
include($CFG->dirroot .'/blog/footer.php');
|
||||
|
||||
|
||||
@@ -204,8 +194,8 @@ function do_save($post) {
|
||||
|
||||
/// Write a blog entry into database
|
||||
$blogEntry = new object;
|
||||
$blogEntry->subject = addslashes($post->etitle);
|
||||
$blogEntry->summary = addslashes($post->body);
|
||||
$blogEntry->subject = $post->etitle;
|
||||
$blogEntry->summary = $post->body;
|
||||
$blogEntry->module = 'blog';
|
||||
$blogEntry->userid = $USER->id;
|
||||
$blogEntry->format = $post->format;
|
||||
@@ -277,8 +267,8 @@ function do_update($post) {
|
||||
// echo "id id ".$post->postid;
|
||||
// print_object($blogentry); //debug
|
||||
|
||||
$blogEntry->subject = addslashes($post->etitle);
|
||||
$blogEntry->summary = addslashes($post->body);
|
||||
$blogEntry->subject = $post->etitle;
|
||||
$blogEntry->summary = $post->body;
|
||||
if ($blogEntry->summary == '<br />') {
|
||||
$blogEntry->summary = '';
|
||||
}
|
||||
|
||||
@@ -21,6 +21,17 @@ if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
|
||||
|
||||
<?php
|
||||
|
||||
// Janne comment: Let's move this in here
|
||||
// so IE gets more time to load the
|
||||
// Page.
|
||||
|
||||
if (isset($usehtmleditor) && $usehtmleditor) {
|
||||
// Janne comment: there are two text fields in form
|
||||
// so lets try to replace them both with
|
||||
// HTMLArea editors
|
||||
use_html_editor();
|
||||
}
|
||||
|
||||
if (isset($course) && ($course->id)) {
|
||||
print_footer($course);
|
||||
} else {
|
||||
|
||||
+25
-22
@@ -15,9 +15,6 @@ $blockid = optional_param('blockid', 0, PARAM_INT);
|
||||
/// If user has never visited this page before, install 2 blocks for him
|
||||
blog_check_and_install_blocks();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect($CFG->wwwroot.'/index.php');
|
||||
}
|
||||
|
||||
// now check that they are logged in and allowed into the course (if specified)
|
||||
if ($courseid != SITEID) {
|
||||
@@ -26,7 +23,7 @@ if ($courseid != SITEID) {
|
||||
}
|
||||
require_login($course->id);
|
||||
} else {
|
||||
$course = get_site();
|
||||
$course = $SITE;
|
||||
}
|
||||
|
||||
// Bounds for block widths within this page
|
||||
@@ -92,7 +89,7 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
$formHeading = get_string('addnewentry', 'blog');
|
||||
}
|
||||
|
||||
print_header("$site->shortname: $blogstring", "$site->fullname",
|
||||
print_header("$SITE->shortname: $blogstring", "$SITE->fullname",
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '. $formHeading,'','',true);
|
||||
|
||||
@@ -103,20 +100,20 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
switch ($filtertype) {
|
||||
case 'site':
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header("$site->shortname: $blogstring", "",
|
||||
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
|
||||
'<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
} else {
|
||||
print_header("$site->shortname: $blogstring", "",
|
||||
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
|
||||
$blogstring,'','',true,$PAGE->get_extra_header_string());
|
||||
}
|
||||
break;
|
||||
|
||||
case 'course':
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header_simple("$course->shortname: $blogstring", "",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="index.php?filtertype=course&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
} else {
|
||||
print_header_simple("$course->shortname: $blogstring", "",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
$blogstring,'','',true,$PAGE->get_extra_header_string());
|
||||
}
|
||||
break;
|
||||
@@ -126,11 +123,11 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
$thisgroup = get_record('groups', 'id', $filterselect);
|
||||
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header_simple("$course->shortname: $blogstring", "$course->fullname",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name.'</a> ->
|
||||
<a href="index.php?filtertype=group&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
} else {
|
||||
print_header_simple("$course->shortname: $blogstring", "$course->fullname",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name."</a> ->
|
||||
$blogstring",'','',true,$PAGE->get_extra_header_string());
|
||||
|
||||
@@ -144,14 +141,14 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
|
||||
if (isset($course->id) && $course->id && $course->id != SITEID) {
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header("$course->shortname: $blogstring", "$course->fullname",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&course='.$course->id.'">'.fullname($user).'</a> ->
|
||||
<a href="index.php?courseid='.optional_param('courseid', 0, PARAM_INT).'&filtertype=user&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
|
||||
} else {
|
||||
print_header("$course->shortname: $blogstring", "$course->fullname",
|
||||
print_header("$course->shortname: $blogstring", $course->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&course='.$course->id.'">'.fullname($user).'</a> ->
|
||||
@@ -163,12 +160,12 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
else {
|
||||
|
||||
if ($tagid || !empty($tag)) {
|
||||
print_header("$site->shortname: $blogstring", "$site->fullname",
|
||||
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
|
||||
<a href="index.php?filtertype=user&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
|
||||
|
||||
} else {
|
||||
print_header("$site->shortname: $blogstring", "$site->fullname",
|
||||
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
|
||||
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
|
||||
|
||||
@@ -178,7 +175,7 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
break;
|
||||
|
||||
default: //user click on add from block
|
||||
print_header("$site->shortname: $blogstring", "$site->fullname",
|
||||
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
|
||||
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
|
||||
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '.get_string('addentry','blog'),'','',true,$PAGE->get_extra_header_string());
|
||||
break;
|
||||
@@ -186,18 +183,24 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
|
||||
|
||||
} /// close switch
|
||||
|
||||
// prints the tabs
|
||||
$currenttab = 'blogs';
|
||||
$user = $USER;
|
||||
if (!$course) {
|
||||
$course = get_record('course','id',optional_param('courseid', SITEID, PARAM_INT));
|
||||
}
|
||||
require_once($CFG->dirroot .'/user/tabs.php');
|
||||
|
||||
$editing = false;
|
||||
if ($PAGE->user_allowed_editing()) {
|
||||
$editing = $PAGE->user_is_editing();
|
||||
}
|
||||
|
||||
// Calculate the preferred width for left, right and center (both center positions will use the same)
|
||||
$preferred_width_left = optional_param('preferred_width_left', blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), PARAM_INT);
|
||||
$preferred_width_right = optional_param('preferred_width_right', blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), PARAM_INT);
|
||||
$preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
|
||||
$preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
|
||||
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
|
||||
$preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
BLOCK_L_MAX_WIDTH);
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
// Display the blocks and allow blocklib to handle any block action requested
|
||||
$pageblocks = blocks_get_by_page($PAGE);
|
||||
|
||||
+2
-10
@@ -20,7 +20,7 @@ $limit = optional_param('limit', 0, PARAM_INT);
|
||||
$start = optional_param('formstart', 0, PARAM_INT);
|
||||
$userid = optional_param('userid',0,PARAM_INT);
|
||||
$courseid = optional_param('courseid',SITEID,PARAM_INT);
|
||||
$tag = s(urldecode(optional_param('tag', '', PARAM_NOTAGS)));
|
||||
$tag = optional_param('tag', '', PARAM_NOTAGS);
|
||||
$tagid = optional_param('tagid', 0, PARAM_INT);
|
||||
$postid = optional_param('postid',0,PARAM_INT);
|
||||
$filtertype = optional_param('filtertype', '', PARAM_ALPHA);
|
||||
@@ -139,19 +139,11 @@ if ($limit == 'none') {
|
||||
|
||||
include($CFG->dirroot .'/blog/header.php');
|
||||
|
||||
// prints the tabs
|
||||
$currenttab = 'blogs';
|
||||
$user = $USER;
|
||||
if (!$course) {
|
||||
$course = get_record('course','id',optional_param('courseid', SITEID, PARAM_INT));
|
||||
}
|
||||
require_once($CFG->dirroot .'/user/tabs.php');
|
||||
|
||||
$blogpage = optional_param('blogpage',0,PARAM_INT);
|
||||
|
||||
blog_print_html_formatted_entries($userid, $postid, $limit, ($blogpage * $limit) ,$filtertype, $filterselect, $tagid, $tag, $filtertype, $filterselect);
|
||||
|
||||
add_to_log($site->id, 'blog', 'view', 'index.php?filtertype='.$filtertype.'&filterselect='.$filterselect.'&postid='.$postid.'&tagid='.$tagid.'&tag='.$tag, 'view blog entry');
|
||||
add_to_log($courseid, 'blog', 'view', 'index.php?filtertype='.$filtertype.'&filterselect='.$filterselect.'&postid='.$postid.'&tagid='.$tagid.'&tag='.$tag, 'view blog entry');
|
||||
|
||||
include($CFG->dirroot .'/blog/footer.php');
|
||||
|
||||
|
||||
+32
-18
@@ -119,6 +119,9 @@
|
||||
blog_print_entry($blogEntry, 'list', $filtertype, $filterselect); //print this entry.
|
||||
$count++;
|
||||
}
|
||||
|
||||
print_paging_bar(get_viewable_entry_count($userid, $postid, $limit, $start,$filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC'), $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');
|
||||
|
||||
if (!$count) {
|
||||
print '<br /><center>'. get_string('noentriesyet', 'blog') .'</center><br />';
|
||||
|
||||
@@ -151,10 +154,10 @@
|
||||
|
||||
global $USER, $CFG, $course, $ME;
|
||||
|
||||
$template['body'] = get_formatted_entry_body(stripslashes_safe($blogEntry->summary), $blogEntry->format);
|
||||
$template['title'] = '<a name="'. $blogEntry->subject .'"></a>';
|
||||
$template['body'] = get_formatted_entry_body($blogEntry->summary, $blogEntry->format);
|
||||
$template['title'] = '<a name="'. s($blogEntry->subject, true) .'"></a>';
|
||||
//enclose the title in nolink tags so that moodle formatting doesn't autolink the text
|
||||
$template['title'] .= '<span class="nolink">'. stripslashes_safe($blogEntry->subject);
|
||||
$template['title'] .= '<span class="nolink">'. strip_tags(format_string($blogEntry->subject, true));
|
||||
$template['title'] .= '</span>';
|
||||
$template['userid'] = $blogEntry->userid;
|
||||
$template['author'] = fullname(get_record('user','id',$blogEntry->userid));
|
||||
@@ -339,7 +342,7 @@
|
||||
if ($format) {
|
||||
return format_text($body, $format);
|
||||
}
|
||||
return stripslashes_safe($body);
|
||||
return $body;
|
||||
}
|
||||
|
||||
/// Main filter function
|
||||
@@ -408,8 +411,8 @@
|
||||
|
||||
case 'site':
|
||||
|
||||
if (!isguest() && isloggedin()) {
|
||||
|
||||
if (isloggedin()) {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
@@ -469,22 +472,33 @@
|
||||
|
||||
case 'group':
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = m.userid '.$tagquerysql.'
|
||||
AND u.id = p.userid
|
||||
AND m.groupid = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
|
||||
WHERE p.userid = m.userid '.$tagquerysql.'
|
||||
AND u.id = p.userid
|
||||
AND m.groupid = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
|
||||
if (isloggedin()) {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
|
||||
} else {
|
||||
|
||||
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
|
||||
.$CFG->prefix.'user u
|
||||
WHERE p.userid = u.id '.$tagquerysql.'
|
||||
AND u.id = '.$filterselect.'
|
||||
AND p.publishstate = \'public\'';
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<input type="submit" value="<?php print_string("savechanges"); ?>" />
|
||||
<input type="submit" value="<?php print_string("savechanges"); ?>" />
|
||||
<input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($post = data_submitted()) {
|
||||
if ($post = data_submitted()) {
|
||||
|
||||
$pagesize = optional_param('pagesize', 10, PARAM_INT);
|
||||
if ($pagesize < 1 ) {
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
print_simple_box_start('center', '', '');
|
||||
|
||||
include('./preferences.html');
|
||||
include('./preferences.html');
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
|
||||
+25
-19
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
if($form = data_submitted()) {
|
||||
|
||||
$form->name = clean_text(strip_tags($form->name,'<lang><span>'));
|
||||
$form->name = clean_param(strip_tags($form->name,'<lang><span>'), PARAM_CLEAN);
|
||||
|
||||
$form->timestart = make_timestamp($form->startyr, $form->startmon, $form->startday, $form->starthr, $form->startmin);
|
||||
if($form->duration == 1) {
|
||||
@@ -205,13 +205,14 @@
|
||||
if (count($err) == 0) {
|
||||
$form->timemodified = time();
|
||||
|
||||
if ($form->repeat) {
|
||||
$fetch = get_record_sql('SELECT 1, MAX(repeatid) AS repeatid FROM '.$CFG->prefix.'event');
|
||||
$form->repeatid = empty($fetch) ? 1 : $fetch->repeatid + 1;
|
||||
}
|
||||
|
||||
/// Get the event id for the log record.
|
||||
$eventid = insert_record('event', $form, true);
|
||||
|
||||
/// Use the event id as the repeatid to link repeat entries together
|
||||
if ($form->repeat) {
|
||||
$form->repeatid = $form->id = $eventid;
|
||||
update_record('event', $form); // update the row, to set its repeatid
|
||||
}
|
||||
|
||||
/// Log the event entry.
|
||||
add_to_log($form->courseid, 'calendar', 'add', 'event.php?action=edit&id='.$eventid, stripslashes($form->name));
|
||||
@@ -262,7 +263,7 @@
|
||||
}
|
||||
|
||||
print_header($site->shortname.': '.$strcalendar.': '.$title, $strcalendar, $nav.' -> '.$title,
|
||||
$focus, '', true, '', user_login_string($site));
|
||||
'eventform.name', '', true, 'new.name', user_login_string($site));
|
||||
|
||||
echo calendar_overlib_html();
|
||||
|
||||
@@ -378,7 +379,7 @@
|
||||
$form->timestart = make_timestamp($cal_y, $cal_m, 1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if($form->timestart < 0) {
|
||||
if(!isset($form->timestart) or $form->timestart < 0) {
|
||||
$form->timestart = time();
|
||||
}
|
||||
|
||||
@@ -484,15 +485,20 @@
|
||||
echo '<div class="header">'.get_string('newevent', 'calendar').$header.'</div>';
|
||||
|
||||
if($eventtype == 'select') {
|
||||
$defaultcourse = $SESSION->cal_course_referer;
|
||||
if(isteacheredit($defaultcourse, $USER->id)) {
|
||||
$defaultgroup = $groupid = 0;
|
||||
$courseid = optional_param('courseid', $SESSION->cal_course_referer, PARAM_INT);
|
||||
if ($courseid == 0) { // workaround by Dan for bug #6130
|
||||
$courseid = SITEID;
|
||||
}
|
||||
else {
|
||||
$defaultgroup = user_group($defaultcourse, $USER->id);
|
||||
$groupid = optional_param('groupid', $defaultgroup->id, PARAM_INT);
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Incorrect course ID');
|
||||
}
|
||||
$courseid = optional_param('courseid', $defaultcourse, PARAM_INT);
|
||||
if ($groupmode = groupmode($course)) { // Groups are being used
|
||||
$changegroup = optional_param('group', -1, PARAM_INT);
|
||||
$groupid = get_and_set_current_group($course, $groupmode, $changegroup);
|
||||
} else {
|
||||
$groupid = 0;
|
||||
}
|
||||
|
||||
echo '<h2>'.get_string('eventkind', 'calendar').':</h2>';
|
||||
echo '<div id="selecteventtype">';
|
||||
include('event_select.html');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form method="post" action="event.php" name="edit">
|
||||
<form method="post" action="event.php" name="eventform">
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td style="vertical-align: top; text-align: right;">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// The following is a hack to fix bug 1488
|
||||
$course = get_record('course', 'id', ($form->courseid) ? $form->courseid : $site->id);
|
||||
?>
|
||||
<form method="post" action="event.php" name="new">
|
||||
<form method="post" action="event.php" name="eventform">
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
<td style="vertical-align: top; text-align: right;">
|
||||
@@ -29,9 +29,9 @@
|
||||
<?php print_string('eventdate', 'calendar'); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php print_date_selector('startday', 'startmon', 'startyr', $form->timestart);?>
|
||||
<?php print_date_selector('startday', 'startmon', 'startyr', (int)$form->timestart);?>
|
||||
<?php print_string('eventtime', 'calendar');?>
|
||||
<?php print_time_selector('starthr', 'startmin', $form->timestart) ?>
|
||||
<?php print_time_selector('starthr', 'startmin', (int)$form->timestart) ?>
|
||||
<?php if (isset($err['timestart'])) formerr($err['timestart']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+29
-18
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -104,9 +104,15 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
|
||||
$display->maxdays = calendar_days_in_month($m, $y);
|
||||
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
if (get_user_timezone_offset() < 99) {
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
} else {
|
||||
// no timezone info specified
|
||||
$display->tstart = mktime(0, 0, 0, $m, 1, $y);
|
||||
$display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
|
||||
}
|
||||
|
||||
$startwday = dayofweek(1, $m, $y);
|
||||
|
||||
@@ -236,14 +242,14 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
$popupicon = $CFG->pixpath.'/c/user.gif';
|
||||
$popupalt = '';
|
||||
}
|
||||
$popupcontent .= '<div><img height="16" width="16" src="'.$popupicon.'" style="vertical-align: middle; margin-right: 4px;" alt="'.$popupalt.'" /><a href="'.$dayhref.'">'.format_string($event->name,true).'</a></div>';
|
||||
$popupcontent .= '<div><img height="16" width="16" src="'.$popupicon.'" style="vertical-align: middle; margin-right: 4px;" alt="'.$popupalt.'" /><a href="'.$dayhref.'#event_'.$event->id.'">'.format_string($event->name,true).'</a></div>';
|
||||
}
|
||||
|
||||
//Accessibility: functionality moved to calendar_get_popup.
|
||||
if($display->thismonth && $day == $d) {
|
||||
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
|
||||
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
|
||||
} else {
|
||||
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
|
||||
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
|
||||
}
|
||||
|
||||
// Class and cell content
|
||||
@@ -279,15 +285,15 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
|
||||
}
|
||||
|
||||
// Special visual fx for today
|
||||
//Accessibility: hidden text for today, and popup.
|
||||
//Accessibility: hidden text for today, and popup.
|
||||
if($display->thismonth && $day == $d) {
|
||||
$class .= ' today';
|
||||
$today = get_string('today', 'calendar').' '.userdate(time(), get_string('strftimedayshort'));
|
||||
|
||||
if(! isset($eventsbyday[$day])) {
|
||||
$class .= ' eventnone';
|
||||
$popup = calendar_get_popup(true, false);
|
||||
$cell = '<a href="#" '.$popup.'>'.$day.'</a>';
|
||||
$class .= ' eventnone';
|
||||
$popup = calendar_get_popup(true, false);
|
||||
$cell = '<a href="#" '.$popup.'>'.$day.'</a>';
|
||||
}
|
||||
$cell = '<span class="accesshide">'.$today.' </span>'.$cell;
|
||||
}
|
||||
@@ -327,13 +333,14 @@ function calendar_get_popup($is_today, $event_timestart, $popupcontent='') {
|
||||
if (false === $event_timestart) {
|
||||
$popupcaption .= userdate(time(), get_string('strftimedayshort'));
|
||||
$popupcontent = get_string('eventnone', 'calendar');
|
||||
|
||||
|
||||
} else {
|
||||
$popupcaption .= get_string('eventsfor', 'calendar', userdate($event_timestart, get_string('strftimedayshort')));
|
||||
}
|
||||
$popupcontent = str_replace("'", "\'", htmlspecialchars($popupcontent));
|
||||
$popupcaption = str_replace("'", "\'", htmlspecialchars($popupcaption));
|
||||
$popup = 'onmouseover="return overlib(\''.$popupcontent.'\', CAPTION, \''.$popupcaption.'\');" onmouseout="return nd();"';
|
||||
return $popup;
|
||||
return $popup;
|
||||
}
|
||||
|
||||
function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxevents, $fromtime=0) {
|
||||
@@ -449,7 +456,7 @@ function calendar_print_event($event) {
|
||||
static $strftimetime;
|
||||
|
||||
$event = calendar_add_event_metadata($event);
|
||||
echo '<table class="event" cellspacing="0">';
|
||||
echo '<a name="event_'.$event->id.'"></a><table class="event" cellspacing="0">';
|
||||
echo '<tr><td class="picture">';
|
||||
if (!empty($event->icon)) {
|
||||
echo $event->icon;
|
||||
@@ -862,7 +869,7 @@ function calendar_get_sideblock_upcoming($events, $linkhref = NULL) {
|
||||
if(!empty($linkhref)) {
|
||||
$ed = usergetdate($events[$i]->timestart);
|
||||
$href = calendar_get_link_href(CALENDAR_URL.$linkhref, $ed['mday'], $ed['mon'], $ed['year']);
|
||||
$content .= '<a href="'.$href.'">'.$events[$i]->name.'</a>';
|
||||
$content .= '<a href="'.$href.'#event_'.$events[$i]->id.'">'.$events[$i]->name.'</a>';
|
||||
}
|
||||
else {
|
||||
$content .= $events[$i]->name;
|
||||
@@ -1087,6 +1094,10 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
|
||||
else {
|
||||
$courses = false;
|
||||
}
|
||||
//BUG 6130 clean $courses array as SESSION has bad entries.
|
||||
foreach ($courses as $index => $value) {
|
||||
if (empty($value)) unset($courses[$index]);
|
||||
}
|
||||
|
||||
if($SESSION->cal_show_user || $ignorefilters) {
|
||||
// This doesn't work for arrays yet (maybe someday it will)
|
||||
|
||||
+4
-4
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
|
||||
+26
-12
@@ -9,14 +9,14 @@
|
||||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
||||
// //
|
||||
// Designed by: //
|
||||
// Avgoustos Tsinakos (tsinakos@uom.gr) //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// Programming and development: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// For bugs, suggestions, etc contact: //
|
||||
// Jon Papaioannou (pj@uom.gr) //
|
||||
// Jon Papaioannou (pj@moodle.org) //
|
||||
// //
|
||||
// The current module was developed at the University of Macedonia //
|
||||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
||||
@@ -44,8 +44,8 @@
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
|
||||
$course = optional_param('course', 0);
|
||||
$view = optional_param('view', 'upcoming');
|
||||
$courseid = optional_param('course', 0, PARAM_INT);
|
||||
$view = optional_param('view', 'upcoming', PARAM_ALPHA);
|
||||
$day = optional_param('cal_d', 0, PARAM_INT);
|
||||
$mon = optional_param('cal_m', 0, PARAM_INT);
|
||||
$yr = optional_param('cal_y', 0, PARAM_INT);
|
||||
@@ -54,6 +54,12 @@
|
||||
redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php');
|
||||
}
|
||||
|
||||
if ($courseid) {
|
||||
require_login($courseid);
|
||||
} else if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
|
||||
//add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");
|
||||
$now = usergetdate(time());
|
||||
$pagetitle = '';
|
||||
@@ -83,8 +89,8 @@
|
||||
}
|
||||
|
||||
// If a course has been supplied in the URL, change the filters to show that one
|
||||
if (!empty($course)) {
|
||||
if ($course = get_record('course', 'id', $course)) {
|
||||
if (!empty($courseid)) {
|
||||
if ($course = get_record('course', 'id', $courseid)) {
|
||||
if ($course->id == SITEID) {
|
||||
// If coming from the home page, show all courses
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
@@ -96,6 +102,8 @@
|
||||
calendar_set_referring_course($SESSION->cal_courses_shown);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$course = null;
|
||||
}
|
||||
|
||||
if (empty($USER->id) or isguest()) {
|
||||
@@ -298,9 +306,15 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
|
||||
$display->maxdays = calendar_days_in_month($m, $y);
|
||||
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
if (get_user_timezone_offset() < 99) {
|
||||
// We 'll keep these values as GMT here, and offset them when the time comes to query the db
|
||||
$display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
|
||||
$display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
|
||||
} else {
|
||||
// no timezone info specified
|
||||
$display->tstart = mktime(0, 0, 0, $m, 1, $y);
|
||||
$display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
|
||||
}
|
||||
|
||||
$startwday = gmdate('w', $display->tstart); // $display->tstart is already GMT, so don't use date(): messes with server's TZ
|
||||
|
||||
@@ -436,7 +450,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
|
||||
if(isset($eventsbyday[$day])) {
|
||||
echo '<ul class="events-new">';
|
||||
foreach($eventsbyday[$day] as $eventindex) {
|
||||
echo '<li><a href="'.$dayhref.'">'.format_string($events[$eventindex]->name,true).'</a></li>';
|
||||
echo '<li><a href="'.$dayhref.'#event_'.$events[$eventindex]->id.'">'.format_string($events[$eventindex]->name, true).'</a></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
@@ -139,6 +139,9 @@ $CFG->admin = 'admin';
|
||||
// Useful for webhost operators who have alternate methods of backups
|
||||
// $CFG->disablescheduledbackups = true;
|
||||
//
|
||||
// Prevent stats processing and hide the GUI
|
||||
// $CFG->disablestatsprocessing = true;
|
||||
//
|
||||
// Restrict certain usernames from doing things that may mess up a site
|
||||
// This is especially useful for demonstration teacher accounts
|
||||
// $CFG->restrictusers = 'teacher,fred,jim';
|
||||
@@ -281,6 +284,9 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// $CFG->emailconnectionerrorsto = 'your@emailaddress.com';
|
||||
//
|
||||
// Restore pre-1.6 behaviour where courses could still be available
|
||||
// even if the category they were in was hidden
|
||||
// $CFG->allowvisiblecoursesinhiddencategories = true;
|
||||
//
|
||||
// NOTE: if you are using custompix in your theme, see /fixpix.php.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user