Compare commits
874 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31059fd653 | |||
| cbdde9a495 | |||
| ce65706ceb | |||
| 65f8dc31d8 | |||
| 779303d869 | |||
| 28c9a1993d | |||
| 8f866fa1c3 | |||
| a556c4d02c | |||
| 87c0820260 | |||
| 0444bcffc7 | |||
| 15990b65ac | |||
| 1f3066f197 | |||
| 532c25d5bd | |||
| c256614eab | |||
| 0f67177a54 | |||
| 2e6e70ccd2 | |||
| a13ae2ac2d | |||
| e19f164fc7 | |||
| 702c4b1206 | |||
| 17a31c7a1f | |||
| 7b258d7186 | |||
| 609a129b84 | |||
| ecd01922e9 | |||
| c8782c56d7 | |||
| 4deed68f49 | |||
| 40b705e153 | |||
| 3b35ea4686 | |||
| 5a9dde69b1 | |||
| a02ad260e0 | |||
| 15f15ccddd | |||
| 346e41d042 | |||
| 36bf61e152 | |||
| bc180cd111 | |||
| b10d7c59ae | |||
| 6aee251874 | |||
| d1e9bdfbc8 | |||
| 0c18577317 | |||
| 255221acdf | |||
| 93bd10c300 | |||
| 03bdfbd37b | |||
| d7de792dac | |||
| 763e5d6c83 | |||
| 436c7825b1 | |||
| 9074f5914f | |||
| 62ff078fcf | |||
| df174952fd | |||
| 9d97806c7e | |||
| e6f1c141bf | |||
| 687f244a6f | |||
| 461532ecfc | |||
| 16b6239a88 | |||
| 8121a2fad0 | |||
| d78e72a940 | |||
| 16a175de06 | |||
| ec4f31f984 | |||
| 323a7a151b | |||
| 14eb0c478d | |||
| e8b487e010 | |||
| 641351118e | |||
| 12e42d2246 | |||
| 0a668af390 | |||
| 22290d726a | |||
| 03fc135cb6 | |||
| 0459ed43e1 | |||
| 928f531307 | |||
| 767dfb307d | |||
| 3efe531af4 | |||
| ef54b1272a | |||
| 2e97e57edb | |||
| 2f64ea2a2e | |||
| 3fda0a9736 | |||
| 0047e4612c | |||
| 44088a5aeb | |||
| 2507ecbd3e | |||
| 439f2e7e83 | |||
| b523d5bc33 | |||
| 63e0fee364 | |||
| 063c6e23d4 | |||
| 5c1f1690bb | |||
| b46ad4bdd5 | |||
| 8001ddd8b2 | |||
| b9894e1e9f | |||
| 0e26b1d309 | |||
| 5cc6700f27 | |||
| 090f8f300d | |||
| fc36873f61 | |||
| 315392626b | |||
| c27add8d87 | |||
| ae18cf2461 | |||
| deab7fda59 | |||
| af3085d2d5 | |||
| 55a8f72251 | |||
| af02385d49 | |||
| c5b3017b49 | |||
| 5ec684b353 | |||
| 0a03803081 | |||
| 6527b097e8 | |||
| 8f5c4f6b34 | |||
| b1325427ec | |||
| 5de6795ec0 | |||
| 0dc138d47c | |||
| f367cfcbef | |||
| c2b526c484 | |||
| b01092111c | |||
| 8ef945280c | |||
| fbfeb98d39 | |||
| 24276da9ce | |||
| 1f316df7d9 | |||
| 467aefd1a6 | |||
| f354a67357 | |||
| 32193155f5 | |||
| b3f6c093aa | |||
| 82a678c91e | |||
| f3f21f18c4 | |||
| 05c7b75672 | |||
| 39c01271f0 | |||
| c09f63c5ac | |||
| 9f9bcb251c | |||
| 39864d9e88 | |||
| 2a46808ed3 | |||
| 4221300426 | |||
| d14fe6017f | |||
| cdc0a8db3f | |||
| 9ddb811866 | |||
| 29dd7397e2 | |||
| bef5900bdb | |||
| 623379d82b | |||
| 8480fd9364 | |||
| 5faaf18173 | |||
| d23d771071 | |||
| 5f690a9be6 | |||
| 95dae00235 | |||
| 7c4e3db7c0 | |||
| 0ed1b7d277 | |||
| 690988d958 | |||
| 26b3b4e80e | |||
| a5e67c5bcc | |||
| 01327cfcf5 | |||
| 1b775e96c1 | |||
| ef467ee957 | |||
| 247b756248 | |||
| 1eedfdf2c0 | |||
| d4bbbedbde | |||
| c8abe81b99 | |||
| 7943aabfbe | |||
| 2de77919d8 | |||
| 5094443f65 | |||
| 9ec65dc485 | |||
| 068ef548de | |||
| bad563d2f4 | |||
| 50eb74065b | |||
| febd8afc8e | |||
| cac959739b | |||
| cef5600303 | |||
| 63a2e24bc2 | |||
| 35eefad6b3 | |||
| c8121c53d1 | |||
| 74f6a6ae5b | |||
| d560fb3e26 | |||
| 213220c159 | |||
| baa476ce92 | |||
| 795dc143c2 | |||
| a18e060c5b | |||
| 84ebf61b82 | |||
| 300dff939f | |||
| 2aa6dd4c60 | |||
| e59d25c944 | |||
| a86531f20b | |||
| 239bfa31b0 | |||
| 9056ee506a | |||
| 5a8fdd1c27 | |||
| be14be6175 | |||
| 0b09c8e48f | |||
| 90e4b26229 | |||
| 8b9c45b666 | |||
| 2c3eea86fa | |||
| 39259ea58b | |||
| 3ce36f6ac1 | |||
| 6a9a7005b0 | |||
| 2d9145638c | |||
| 531b675632 | |||
| c41d4355ac | |||
| ac4bf23c02 | |||
| 51c59e8b9f | |||
| 606db83726 | |||
| a62801941e | |||
| 0282c20862 | |||
| 915e21170c | |||
| 11b6abd02c | |||
| 6005337c33 | |||
| ea2833bc35 | |||
| 2271f1845c | |||
| b4875aa348 | |||
| 3b4cc68ff4 | |||
| 2f0d26c522 | |||
| 3dd8bd5069 | |||
| eede6aae43 | |||
| a623fdf11b | |||
| 617144f163 | |||
| 61d3898de9 | |||
| ec297cc65b | |||
| 5e33ee65e5 | |||
| 3bf4cc3887 | |||
| 4f88c9f38d | |||
| 096ef13c79 | |||
| c49e848571 | |||
| 25a0be8b27 | |||
| b760c63189 | |||
| b3569fb6fa | |||
| db14163584 | |||
| c58559191a | |||
| d86be9c53e | |||
| 7de6a916a2 | |||
| cf93e03ea0 | |||
| f2774239cb | |||
| 5049dfceca | |||
| 186af5a430 | |||
| 7a4826bc3e | |||
| 1b1432ab88 | |||
| 5bfbec5521 | |||
| eee25b4a13 | |||
| a175c5d1ba | |||
| d209e7161a | |||
| ef494edcd6 | |||
| 20ada5de55 | |||
| c21c4761d1 | |||
| 9ab9793c53 | |||
| 4a106a5759 | |||
| b5256231a6 | |||
| b29e02d57e | |||
| 95bb29b902 | |||
| 59fe1b009f | |||
| ab8571d19a | |||
| 90ff64881e | |||
| 1818308bca | |||
| b47604e938 | |||
| c1ee5cf31b | |||
| 18f802f85a | |||
| ea8c5bdc74 | |||
| 6b7a5f86a0 | |||
| f28ce6eb2e | |||
| 5bb55eeb21 | |||
| ddb652c706 | |||
| 648cc055c2 | |||
| 0fbda60bb3 | |||
| 486ad6e842 | |||
| 74980995b4 | |||
| 33c3193f06 | |||
| 95924516fa | |||
| 1663aa1fb9 | |||
| 970536b659 | |||
| b6fadf63d4 | |||
| f1213f3a75 | |||
| adac041f8c | |||
| acadd22a65 | |||
| acafcb18f5 | |||
| 71f4cb812c | |||
| b1f78408a5 | |||
| 1669cf37f0 | |||
| 71e7387f43 | |||
| 4eb9f7dd72 | |||
| 568e9560af | |||
| dc7fe6acca | |||
| 786a6227d0 | |||
| fd9ee7dd8b | |||
| 8ba664e245 | |||
| b88a31a654 | |||
| 76dc0848c1 | |||
| c838cb15d8 | |||
| 3b1fec6fb2 | |||
| 4939d0d71a | |||
| d61604b455 | |||
| ec085021f2 | |||
| 4c6481694e | |||
| fdeb6af76e | |||
| ee7af1e19d | |||
| 7561f3d64a | |||
| a65c0da40d | |||
| 1e07291026 | |||
| 1215c112c0 | |||
| 0e37d94b67 | |||
| 3264dcece0 | |||
| cc1dc858c0 | |||
| 6ca7efb157 | |||
| 72d49e8419 | |||
| cd2f4a87a4 | |||
| b8ba7f3619 | |||
| aa8ae42d24 | |||
| 1c7509bc86 | |||
| 7ed94cbe9c | |||
| 7c7d086ae1 | |||
| 725ce55546 | |||
| 1f55a12bf8 | |||
| ee0f0b3986 | |||
| 92d4bcd9f7 | |||
| e7215ce5b7 | |||
| 6dc0b5482b | |||
| 45d7ec6123 | |||
| a7e348e937 | |||
| eba7490c31 | |||
| a4798ada52 | |||
| 0cc8a0b4b2 | |||
| 6d32f6300e | |||
| 08348b8f86 | |||
| 519eec044c | |||
| ab156686ff | |||
| 1fc8ebf085 | |||
| 0086364857 | |||
| 05cc5bf052 | |||
| 8bd3dfd6f5 | |||
| 1c9e079b7c | |||
| 8b90e93c94 | |||
| 94f0349745 | |||
| 50cc7daa0f | |||
| 0a841ac85c | |||
| 28d6752d07 | |||
| 1d0f235097 | |||
| 93d7596d3f | |||
| aa9f17df92 | |||
| d251180b31 | |||
| 67a77fa36f | |||
| c3cf035fad | |||
| 8a52ccea0c | |||
| d35f49ba45 | |||
| 38748c6ada | |||
| 68fb3969e1 | |||
| 527afcfb8c | |||
| c62f8bc71f | |||
| d3c034f8e8 | |||
| 5f399d0c52 | |||
| a9e0505fde | |||
| 96d73266ef | |||
| 66a0fea650 | |||
| a4bba406ad | |||
| 20914ba26a | |||
| 8b5520877b | |||
| 7cacba3db3 | |||
| f4c37747dc | |||
| 3e65f72a40 | |||
| d613a0db57 | |||
| 26f004f29b | |||
| 0ed87e5063 | |||
| 87cc899c44 | |||
| e1661a6346 | |||
| 3ba2b5c925 | |||
| 7c5d28c26c | |||
| 67711964d1 | |||
| bf394372d8 | |||
| d927f222a9 | |||
| bbcbbcd130 | |||
| cc0b20ba9d | |||
| 8f15eebc22 | |||
| d8b6437fa9 | |||
| e257ad8372 | |||
| ba03dc18ad | |||
| 7c15d3b34c | |||
| 1c76803ec1 | |||
| 5660ceba8d | |||
| ae59c35eb9 | |||
| 3c129829ce | |||
| 050720be90 | |||
| 7573d5ff21 | |||
| b3656b26be | |||
| 804c22b8f1 | |||
| 8716b6c89f | |||
| 8b3d19c2f5 | |||
| cf9ed67a4e | |||
| 417b6921d5 | |||
| f72a23d69b | |||
| ca602b6beb | |||
| 2b8647034a | |||
| 956ec418c6 | |||
| 31d453f735 | |||
| b4d0a4479c | |||
| 3e07b8a2f3 | |||
| 383776876b | |||
| 91c8d4da71 | |||
| 1721c8eb85 | |||
| ad3d9452bf | |||
| c5f351435e | |||
| 03b06dedbc | |||
| da80885cc6 | |||
| 94ac7a87fa | |||
| 10b02d6d41 | |||
| ebb6f3e80b | |||
| 7f4db6f4d9 | |||
| 4fc5861cba | |||
| 40b205197c | |||
| cb914a71aa | |||
| 85f376892d | |||
| e0708141f8 | |||
| 76b012d611 | |||
| 53ca351f7a | |||
| ea9f3057da | |||
| f1406d3b39 | |||
| 91251e4889 | |||
| 8994593332 | |||
| 67b3704318 | |||
| 37e7d91b8c | |||
| 3fe64cbd7d | |||
| 22051a4e34 | |||
| e7cd680765 | |||
| 84d2c6f761 | |||
| f97581eda7 | |||
| 2c0b608cda | |||
| eb1381de1d | |||
| c7bfbb01c6 | |||
| 4eacb77012 | |||
| 93835758f3 | |||
| a238e7ed72 | |||
| 98ac33bcb0 | |||
| 0caa8c60d2 | |||
| 2dbdaedc3e | |||
| 30a264540b | |||
| 6d05bee940 | |||
| 2535dfaf64 | |||
| 35186e3725 | |||
| bfe4417cb7 | |||
| 6b6affec1f | |||
| 9e13649c89 | |||
| 1465b22f7d | |||
| f549deed15 | |||
| ab59b7db71 | |||
| 200a2b7fad | |||
| 9945bcec41 | |||
| b4ac5653ed | |||
| 0207466e77 | |||
| 2ca9e09dab | |||
| 6eaf5ec8e3 | |||
| 1d110af2d6 | |||
| 2d121036cc | |||
| 61961447c2 | |||
| 867f40990b | |||
| da6ce47102 | |||
| 78ba7d9e6b | |||
| 63010978b4 | |||
| c5e9bc48f0 | |||
| cd90445d4a | |||
| 0052796dbb | |||
| b522356839 | |||
| 1d45b926f3 | |||
| 0ba5f02b15 | |||
| a31fdfb145 | |||
| d019ffd21f | |||
| a93f8344ae | |||
| 2d7617aa18 | |||
| 84acc68175 | |||
| 38d8b7b703 | |||
| 69ddeb42e2 | |||
| 2bd9cd1077 | |||
| 35588aa876 | |||
| fc415ee908 | |||
| 10b4bda916 | |||
| 3708e1bb7c | |||
| e7e79055e1 | |||
| 3d4cf404df | |||
| 31c0efeac7 | |||
| 3571cd46d2 | |||
| fa6db7b8c1 | |||
| 947a90339a | |||
| dc30afaafc | |||
| 03a5278a38 | |||
| d683942c6a | |||
| 24c0432bbc | |||
| c16de45a14 | |||
| 9d19781014 | |||
| ab6ae906cd | |||
| f45b59d427 | |||
| 3add7d878f | |||
| c9bd902bd3 | |||
| 366124d222 | |||
| 89203e11a7 | |||
| dd83fbfbbc | |||
| 1fb374121a | |||
| f3163a2002 | |||
| 65764352dd | |||
| 2c7b800f2f | |||
| ed7d676329 | |||
| b23bc0a148 | |||
| df9a669791 | |||
| b1ab535efa | |||
| 1e9dce0df4 | |||
| 8dd0756226 | |||
| 8458e3d2c2 | |||
| 951a64f6ef | |||
| b336cf98b4 | |||
| b6ac868d71 | |||
| 57ce05c631 | |||
| f0538cee92 | |||
| f4f4965a1c | |||
| 93a593daab | |||
| c8c1a2cb10 | |||
| 793ab11d95 | |||
| 47221d5fdd | |||
| 1affa3ea22 | |||
| 70971d43eb | |||
| 99e0bb23bf | |||
| d95453d903 | |||
| 53fb01aef0 | |||
| cfd5ba4101 | |||
| 5eb386fd09 | |||
| 594848bb15 | |||
| 64fea720ce | |||
| 83d08fcc21 | |||
| 01e7204646 | |||
| 3152864fd5 | |||
| 2997bd6dce | |||
| 083d5a6f0c | |||
| c1ee80fef5 | |||
| 0a9815d14e | |||
| 3ac5a3544c | |||
| b7cb9c60c1 | |||
| 6f5ca6613f | |||
| a16755314a | |||
| a4919abf4f | |||
| 022a58af8d | |||
| 6480ec0c48 | |||
| 1e4e4a05d7 | |||
| 9dc9608795 | |||
| e08d290469 | |||
| 80bb90c3ca | |||
| a3ddcab336 | |||
| a839769c23 | |||
| 1eb503b379 | |||
| cc5f8bd53f | |||
| bb512f7c1f | |||
| 5b5a73019d | |||
| ce0b9bb7ca | |||
| 38063e7d1b | |||
| ee5b9e137d | |||
| 55103810f0 | |||
| e5b111f26b | |||
| 7c2e2133cc | |||
| 3352ffcfa2 | |||
| 8e74bfa8e8 | |||
| 9f630b6cc4 | |||
| c2779c9f29 | |||
| 7fecbba80b | |||
| 80b81e5094 | |||
| 6e977fcdd6 | |||
| 9c8c5f2d01 | |||
| 9134f3f0df | |||
| b093752289 | |||
| bd87c3e225 | |||
| 7bea1ea240 | |||
| afd6e7d542 | |||
| e29eef4bde | |||
| 63dd180030 | |||
| 8eacbd5a32 | |||
| 680ff52414 | |||
| 884e310a3b | |||
| 7eac026a02 | |||
| deaddfb6b8 | |||
| 85b40b18d5 | |||
| 3b6987cea3 | |||
| 14ff3d59b3 | |||
| dd02a787d8 | |||
| cefe7c7f59 | |||
| d9fc73dc7a | |||
| 3bc1e345ca | |||
| 5d3fe21ab2 | |||
| 17db3e8af1 | |||
| a0da864ac2 | |||
| 0978aab839 | |||
| 7d947ad66c | |||
| 5e63c8e57e | |||
| 34bcea8159 | |||
| 2a56e3c8b9 | |||
| 1fb1c6d456 | |||
| 469e7dd82d | |||
| 1461f9d664 | |||
| 8791525d88 | |||
| a0f39f2b57 | |||
| 6fc2264a8a | |||
| 8893b111c2 | |||
| 3362673173 | |||
| 49703ecf1d | |||
| d56f3531b4 | |||
| 902a36137a | |||
| 19e4d5ada8 | |||
| d81917322f | |||
| b657f6db05 | |||
| abd980d36d | |||
| 7b27045680 | |||
| e4a56bd9dd | |||
| 5807b224d9 | |||
| 8b1596c257 | |||
| 2649eefe1c | |||
| b3bb3a4422 | |||
| 6e10f195c5 | |||
| ab7c329acf | |||
| 95d39aabc7 | |||
| 6e515be94f | |||
| b3b4f9a4a4 | |||
| c71d8267ed | |||
| 1742e76777 | |||
| 2797fcc75e | |||
| 2538e2dab1 | |||
| 6bf5eeed56 | |||
| c14d87daaa | |||
| cb201e866b | |||
| cc6a8bc792 | |||
| fa71841e9d | |||
| be7809f5fd | |||
| 655cdde2dc | |||
| 7f75f1507e | |||
| 3fbf089303 | |||
| 8a453265d2 | |||
| 807d45073a | |||
| 253bbbb668 | |||
| 8fbc1919df | |||
| c41ace2f7a | |||
| 3be351cabc | |||
| 53bd21e7d8 | |||
| 217530dfca | |||
| 30271d87aa | |||
| f271df32ec | |||
| 77ae35faba | |||
| 32d746479b | |||
| b18fd23232 | |||
| bbd644ea34 | |||
| c4bfba91c2 | |||
| 6e7a7aecf3 | |||
| 635493f6dd | |||
| 0f583e0c91 | |||
| 1a7ded8989 | |||
| 159e18c977 | |||
| 801dea3298 | |||
| d468b949f1 | |||
| a0881872c7 | |||
| a9e9cd31e1 | |||
| 0085d95576 | |||
| e4226ddc26 | |||
| 4c7169437b | |||
| b2cdd35a46 | |||
| aa0fad65e3 | |||
| 4c06cef684 | |||
| 6871df272d | |||
| 40a4427420 | |||
| f76b5133a5 | |||
| d5a7b7873e | |||
| ffa71ca45e | |||
| 5248eb8831 | |||
| 5468d02e60 | |||
| 251fd097bb | |||
| 3ac721e5a3 | |||
| ecd99dc88a | |||
| 3097fca71c | |||
| bc1c896692 | |||
| 6a927661f2 | |||
| 601d32ae66 | |||
| 2dde0b96da | |||
| d420bf952f | |||
| a02d7831b6 | |||
| 604db7d557 | |||
| 41ab96e7ff | |||
| 9dfb59fa28 | |||
| ad94e63238 | |||
| 82c0485aab | |||
| 4524454ff2 | |||
| 658bba713a | |||
| 238c388016 | |||
| 5e10e88673 | |||
| 7b6bad24ee | |||
| 11be1e8b2b | |||
| 42126ff6a5 | |||
| f12f99241c | |||
| 8fde6e8ef9 | |||
| 36bd6f3319 | |||
| 0f52f263ca | |||
| b9e1842e02 | |||
| 99261fdf05 | |||
| 07388eaded | |||
| d983601e46 | |||
| fd85f4eeb9 | |||
| c11ac48868 | |||
| 0d5c68bfd8 | |||
| a6b91c8407 | |||
| f6cac05e9c | |||
| 9a2938c57c | |||
| f4d6bab1b4 | |||
| ebfbd63b3c | |||
| 9ec7228b03 | |||
| 0a1f0c4b1f | |||
| 7180fb19c1 | |||
| ac2015f2ce | |||
| 6fc8187375 | |||
| 81e433d505 | |||
| 9fbdee633a | |||
| f1dee5ce23 | |||
| 1ffce0c735 | |||
| 3e307259ac | |||
| 8455124070 | |||
| a1d932bd82 | |||
| d9ef98fc80 | |||
| 4affd3c42e | |||
| 8771f49c0a | |||
| b018b44b49 | |||
| 3d4f5c6bf8 | |||
| 6bbdb16bb1 | |||
| 07783f9c20 | |||
| b19370bd35 | |||
| 9d18c714b8 | |||
| 474dd3da66 | |||
| 5095725a00 | |||
| 02da49597c | |||
| 5f86aa9d14 | |||
| ae916b5d6a | |||
| ea66859873 | |||
| 23f43bb4c4 | |||
| 108d281f6b | |||
| 4a0e272c5b | |||
| 647a688de3 | |||
| 3f9ea21ae3 | |||
| 34a46904c2 | |||
| d73b1f3e71 | |||
| 2c356d8ecd | |||
| 62c7d543f6 | |||
| 008cfb2a1f | |||
| 243f766222 | |||
| 2b9259ed7f | |||
| c5d9d36e79 | |||
| 296029fadf | |||
| 7e78f9c4a5 | |||
| 83bc3ccfdf | |||
| 6a001a3223 | |||
| 1974f5ade7 | |||
| 837e3741fd | |||
| 4bdb702918 | |||
| e588f20b6c | |||
| ad7d8edf0c | |||
| 9f4a69a8cd | |||
| fd4c7d7b69 | |||
| e77b4ac0de | |||
| 4fe4fbba9d | |||
| 331298218b | |||
| db52d4058d | |||
| b5d1353575 | |||
| fb3663ae5c | |||
| 6825f882e2 | |||
| 04b949a8f5 | |||
| 86976c5bd9 | |||
| 33238bb24b | |||
| 2b548c27ee | |||
| e0cd7e44db | |||
| 184cdf0d52 | |||
| 472896acdd | |||
| 1ff977a5e5 | |||
| 68a1c2a8d9 | |||
| db77228155 | |||
| 8a0dcb91cc | |||
| 11b5d9b763 | |||
| dc195425ee | |||
| 72cf8ec5eb | |||
| 1130c181f9 | |||
| 443d4dae06 | |||
| a2720952c2 | |||
| 89262fa9f1 | |||
| bc3c2a8eed | |||
| fb7e5c42cd | |||
| 2e2a229f58 | |||
| d12b20d022 | |||
| 5ce5bc6bdd | |||
| 54c9048405 | |||
| 7b04f1fa49 | |||
| eebd7f8964 | |||
| 871af2ebc5 | |||
| 0d4b11ff88 | |||
| e342149a37 | |||
| 9054cd2a25 | |||
| 7d5e56cffd | |||
| 137c0261ee | |||
| 1c500e2157 | |||
| 46021b98b2 | |||
| 55739cdfb6 | |||
| 63e5416f5b | |||
| 689a8f383c | |||
| 10f981a794 | |||
| 556a760d0c | |||
| 2ba0565d7d | |||
| 16d5729223 | |||
| 38ef7ab379 | |||
| 740cb942ce | |||
| 3725adf852 | |||
| b9c49aefb2 | |||
| 60f8e19ce1 | |||
| d0f43772fb | |||
| 106be68e82 | |||
| f12ad8521f | |||
| 9efa210e32 | |||
| 79b146cb5c | |||
| 8711ce1f4a | |||
| 417fa07162 | |||
| 1910d01a86 | |||
| c9c530fd6e | |||
| dadeff80c9 | |||
| cc41096ad5 | |||
| db9987c267 | |||
| 8d8a5e8035 | |||
| b60373f3e4 | |||
| 1d8bebfeaf | |||
| 41d178f9da | |||
| d144e53188 | |||
| 49b50ef5ab | |||
| 4fac06549a | |||
| 7141921ad4 | |||
| 70e78a4315 | |||
| 520592c43d | |||
| 553b1e6f6d | |||
| bb5652829f | |||
| 288a79ccd4 | |||
| 8f6d8a5653 | |||
| c64368bb1d | |||
| 177beaf23a | |||
| 147d7af758 | |||
| 20bd24b70d | |||
| 7c75924319 | |||
| d90846033b | |||
| da02a3c472 | |||
| 61609ec274 | |||
| 228fc821e0 | |||
| d44071ee09 | |||
| 91fae7e9b4 | |||
| 3e7b9158f4 | |||
| 95f9c8f716 | |||
| 170392d4a0 | |||
| 3724b3aa8d | |||
| 9af90f03bb | |||
| 64a2dfba1f | |||
| 043cf8bab7 | |||
| 832393cfc9 | |||
| d8e7fa9196 | |||
| 075e999c1a | |||
| 8efb66741f | |||
| fa348b5d46 | |||
| ac2eafee91 | |||
| e6c69d835d | |||
| 1468444f42 | |||
| 3a34659252 | |||
| bfa6c5080e | |||
| 0f0729b157 | |||
| f75d82450a | |||
| 9389ff572b | |||
| 3dd33e3862 | |||
| e3b98ac6b6 | |||
| 3951213860 | |||
| 24b81e0566 | |||
| 0ab271dcfd | |||
| b9cb39eaf6 | |||
| c83407f033 | |||
| da75ffce68 | |||
| ee9f6db7a2 | |||
| d46979ec3a | |||
| d48b1de9f7 | |||
| da6b4b9bf9 | |||
| 38d1c9a886 | |||
| 1c48d7e188 | |||
| 11b39253d2 | |||
| 56e84a7985 | |||
| 133f83d557 | |||
| 1d20cf37cb | |||
| 17e57aa07d | |||
| 710b364b44 | |||
| d277c441da | |||
| b993411de1 | |||
| 81d72831b8 | |||
| 3cfabf7190 | |||
| 0e5791a6cd | |||
| da3e5e0c5c | |||
| ae3b9e1e1f | |||
| 3485ecf225 | |||
| 83e8f495f2 | |||
| ba4e81d249 | |||
| c3af87ac64 |
@@ -142,14 +142,14 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
|
||||
$fieldname = $field;
|
||||
if ($fieldname === 'lang') {
|
||||
$fieldname = get_string('language');
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} elseif (!empty($customfields) && in_array($field, $customfields)) {
|
||||
// If custom field then pick name from database.
|
||||
$fieldshortname = str_replace('profile_field_', '', $fieldname);
|
||||
$fieldname = $customfieldname[$fieldshortname]->name;
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} else {
|
||||
$fieldname = get_string($fieldname);
|
||||
}
|
||||
|
||||
+19
-20
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* This file is used to display a categories sub categories, external pages, and settings.
|
||||
*
|
||||
* @since 2.3
|
||||
* @since Moodle 2.3
|
||||
* @package admin
|
||||
* @copyright 2011 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@@ -97,27 +97,26 @@ foreach ($settingspage->children as $childpage) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link($childpage->url, $childpage->visiblename), 3);
|
||||
} else if ($childpage instanceof admin_settingpage) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/settings.php', array('section' => $childpage->name)), $childpage->visiblename), 3);
|
||||
// If its a settings page and has settings lets display them.
|
||||
if (!empty($childpage->settings)) {
|
||||
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
|
||||
foreach ($childpage->settings as $setting) {
|
||||
if (empty($setting->nosave)) {
|
||||
$savebutton = true;
|
||||
}
|
||||
$fullname = $setting->get_full_name();
|
||||
if (array_key_exists($fullname, $adminroot->errors)) {
|
||||
$data = $adminroot->errors[$fullname]->data;
|
||||
} else {
|
||||
$data = $setting->get_setting();
|
||||
}
|
||||
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
|
||||
$outputhtml .= $setting->output_html($data);
|
||||
}
|
||||
$outputhtml .= html_writer::end_tag('fieldset');
|
||||
}
|
||||
} else if ($childpage instanceof admin_category) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/category.php', array('category' => $childpage->name)), get_string('admincategory', 'admin', $childpage->visiblename)), 3);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (!empty($childpage->settings)) {
|
||||
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
|
||||
foreach ($childpage->settings as $setting) {
|
||||
if (empty($setting->nosave)) {
|
||||
$savebutton = true;
|
||||
}
|
||||
$fullname = $setting->get_full_name();
|
||||
if (array_key_exists($fullname, $adminroot->errors)) {
|
||||
$data = $adminroot->errors[$fullname]->data;
|
||||
} else {
|
||||
$data = $setting->get_setting();
|
||||
}
|
||||
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
|
||||
$outputhtml .= $setting->output_html($data);
|
||||
}
|
||||
$outputhtml .= html_writer::end_tag('fieldset');
|
||||
}
|
||||
}
|
||||
if ($savebutton) {
|
||||
|
||||
@@ -201,17 +201,9 @@ if (defined('COMPONENT_CLASSLOADER')) {
|
||||
require($CFG->dirroot.'/version.php');
|
||||
$CFG->target_release = $release;
|
||||
|
||||
$_SESSION = array();
|
||||
$_SESSION['SESSION'] = new stdClass();
|
||||
$_SESSION['SESSION']->lang = $CFG->lang;
|
||||
$_SESSION['USER'] = new stdClass();
|
||||
$_SESSION['USER']->id = 0;
|
||||
$_SESSION['USER']->mnethostid = 1;
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
global $SESSION;
|
||||
global $USER;
|
||||
$SESSION = &$_SESSION['SESSION'];
|
||||
$USER = &$_SESSION['USER'];
|
||||
|
||||
global $COURSE;
|
||||
$COURSE = new stdClass();
|
||||
|
||||
@@ -102,7 +102,7 @@ if ($contents = load_environment_xml()) {
|
||||
}
|
||||
|
||||
// Get the results of the environment check.
|
||||
list($envstatus, $environment_results) = check_moodle_environment($version);
|
||||
list($envstatus, $environment_results) = check_moodle_environment($version, ENV_SELECT_NEWER);
|
||||
|
||||
// Display the page.
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
+12
-6
@@ -378,9 +378,6 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
if (!$PAGE->headerprinted) {
|
||||
// means core upgrade or installation was not already done
|
||||
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
if (!$confirmplugins) {
|
||||
$strplugincheck = get_string('plugincheck');
|
||||
|
||||
@@ -398,6 +395,9 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
$deployer = \core\update\deployer::instance();
|
||||
if ($deployer->enabled()) {
|
||||
$deployer->initialize($PAGE->url, $PAGE->url);
|
||||
@@ -421,6 +421,8 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
// Make sure plugin dependencies are always checked.
|
||||
$failed = array();
|
||||
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$reloadurl = new moodle_url('/admin/index.php', array('cache' => 0));
|
||||
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
|
||||
die();
|
||||
@@ -587,10 +589,14 @@ $availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
|
||||
//check if the site is registered on Moodle.org
|
||||
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
|
||||
// Check if there are any cache warnings.
|
||||
$cachewarnings = cache_helper::warnings();
|
||||
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
|
||||
/* @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered);
|
||||
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
|
||||
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered, $cachewarnings);
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
/**
|
||||
* This file contains functions used by the admin pages
|
||||
*
|
||||
* @since 2.1
|
||||
* @since Moodle 2.1
|
||||
* @package admin
|
||||
* @copyright 2011 Andrew Davis
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
||||
+26
-7
@@ -303,12 +303,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @param bool $buggyiconvnomb warn iconv problems
|
||||
* @param array|null $availableupdates array of \core\update\info objects or null
|
||||
* @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
|
||||
* @param string[] $cachewarnings An array containing warnings from the Cache API.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
|
||||
$buggyiconvnomb, $registered) {
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array()) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
@@ -321,6 +322,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->cron_overdue_warning($cronoverdue);
|
||||
$output .= $this->db_problems($dbproblems);
|
||||
$output .= $this->maintenance_mode_warning($maintenancemode);
|
||||
$output .= $this->cache_warnings($cachewarnings);
|
||||
$output .= $this->registration_warning($registered);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -595,6 +597,19 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->warning($dbproblems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders cache warnings if there are any.
|
||||
*
|
||||
* @param string[] $cachewarnings
|
||||
* @return string
|
||||
*/
|
||||
public function cache_warnings(array $cachewarnings) {
|
||||
if (!count($cachewarnings)) {
|
||||
return '';
|
||||
}
|
||||
return join("\n", array_map(array($this, 'warning'), $cachewarnings));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an appropriate message if the site in in maintenance mode.
|
||||
* @param bool $maintenancemode
|
||||
@@ -1370,7 +1385,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* configuration and how it suits Moodle needs.
|
||||
*
|
||||
* @param boolean $result final result of the check (true/false)
|
||||
* @param array $environment_results array of results gathered
|
||||
* @param environment_results[] $environment_results array of results gathered
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function environment_check_table($result, $environment_results) {
|
||||
@@ -1382,9 +1397,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('name'),
|
||||
get_string('info'),
|
||||
get_string('report'),
|
||||
get_string('plugin'),
|
||||
get_string('status'),
|
||||
);
|
||||
$servertable->colclasses = array('centeralign name', 'centeralign status', 'leftalign report', 'centeralign info');
|
||||
$servertable->colclasses = array('centeralign name', 'centeralign info', 'leftalign report', 'leftalign plugin', 'centeralign status');
|
||||
$servertable->attributes['class'] = 'admintable environmenttable generaltable';
|
||||
$servertable->id = 'serverstatus';
|
||||
|
||||
@@ -1394,9 +1410,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$othertable->head = array(
|
||||
get_string('info'),
|
||||
get_string('report'),
|
||||
get_string('plugin'),
|
||||
get_string('status'),
|
||||
);
|
||||
$othertable->colclasses = array('aligncenter info', 'alignleft report', 'aligncenter status');
|
||||
$othertable->colclasses = array('aligncenter info', 'alignleft report', 'alignleft plugin', 'aligncenter status');
|
||||
$othertable->attributes['class'] = 'admintable environmenttable generaltable';
|
||||
$othertable->id = 'otherserverstatus';
|
||||
|
||||
@@ -1412,6 +1429,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$type = $environment_result->getPart();
|
||||
$info = $environment_result->getInfo();
|
||||
$status = $environment_result->getStatus();
|
||||
$plugin = $environment_result->getPluginName();
|
||||
$error_code = $environment_result->getErrorCode();
|
||||
// Process Report field
|
||||
$rec = new stdClass();
|
||||
@@ -1488,7 +1506,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
if (!empty($info)){
|
||||
$linkparts[] = $info;
|
||||
}
|
||||
if (empty($CFG->docroot)) {
|
||||
// Plugin environments do not have docs pages yet.
|
||||
if (empty($CFG->docroot) or $environment_result->plugin) {
|
||||
$report = get_string($stringtouse, 'admin', $rec);
|
||||
} else {
|
||||
$report = $this->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
|
||||
@@ -1514,9 +1533,9 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
// Add the row to the table
|
||||
if ($environment_result->getPart() == 'custom_check'){
|
||||
$otherdata[$messagetype][] = array ($info, $report, $status);
|
||||
$otherdata[$messagetype][] = array ($info, $report, $plugin, $status);
|
||||
} else {
|
||||
$serverdata[$messagetype][] = array ($type, $info, $report, $status);
|
||||
$serverdata[$messagetype][] = array ($type, $info, $report, $plugin, $status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ if ($roleid) {
|
||||
// Show UI for assigning a particular role to users.
|
||||
// Print a warning if we are assigning system roles.
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
echo $OUTPUT->box(get_string('globalroleswarning', 'core_role'));
|
||||
echo $OUTPUT->notification(get_string('globalroleswarning', 'core_role'));
|
||||
}
|
||||
|
||||
// Print the form.
|
||||
@@ -251,7 +251,7 @@ if ($roleid) {
|
||||
|
||||
// Print a warning if we are assigning system roles.
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
echo $OUTPUT->box(get_string('globalroleswarning', 'core_role'));
|
||||
echo $OUTPUT->notification(get_string('globalroleswarning', 'core_role'));
|
||||
}
|
||||
|
||||
// Print instruction.
|
||||
|
||||
@@ -74,8 +74,16 @@ abstract class core_role_capability_table_base {
|
||||
public function display() {
|
||||
if (count($this->capabilities) > self::NUM_CAPS_FOR_SEARCH) {
|
||||
global $PAGE;
|
||||
$PAGE->requires->strings_for_js(array('filter', 'clear'), 'moodle');
|
||||
$PAGE->requires->js_init_call('M.core_role.init_cap_table_filter', array($this->id, $this->context->id));
|
||||
$jsmodule = array(
|
||||
'name' => 'rolescapfilter',
|
||||
'fullpath' => '/admin/roles/module.js',
|
||||
'strings' => array(
|
||||
array('filter', 'moodle'),
|
||||
array('clear', 'moodle'), ),
|
||||
'requires' => array('node', 'cookie', 'escape')
|
||||
);
|
||||
$PAGE->requires->js_init_call('M.core_role.init_cap_table_filter', array($this->id, $this->context->id), false,
|
||||
$jsmodule);
|
||||
}
|
||||
echo '<table class="' . implode(' ', $this->classes) . '" id="' . $this->id . '">' . "\n<thead>\n";
|
||||
echo '<tr><th class="name" align="left" scope="col">' . get_string('capability', 'core_role') . '</th>';
|
||||
|
||||
@@ -75,7 +75,8 @@ switch ($action) {
|
||||
$a->id = $roleid;
|
||||
$a->name = $roles[$roleid]->name;
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
$a->count = $DB->count_records('role_assignments', array('roleid'=>$roleid));
|
||||
$a->count = $DB->count_records_select('role_assignments',
|
||||
'roleid = ?', array($roleid), 'COUNT(DISTINCT userid)');
|
||||
|
||||
$formcontinue = new single_button(new moodle_url($baseurl, $optionsyes), get_string('yes'));
|
||||
$formcancel = new single_button(new moodle_url($baseurl), get_string('no'), 'get');
|
||||
|
||||
@@ -51,7 +51,7 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
|
||||
marginRight : 'auto'
|
||||
});
|
||||
// Create the capability search input.
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+filtervalue+'" />');
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
|
||||
// Create a label for the search input.
|
||||
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.str.moodle.filter+' </label>');
|
||||
// Create a clear button to clear the input.
|
||||
|
||||
@@ -139,7 +139,6 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
||||
array(
|
||||
'context' => $context,
|
||||
'objectid' => $roleid,
|
||||
'courseid' => $courseid
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ class behat_admin extends behat_base {
|
||||
// Single element settings.
|
||||
try {
|
||||
$fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" .
|
||||
"[@id=//label[contains(normalize-space(.), $label)]/@for]";
|
||||
"[@id=//label[contains(normalize-space(.), $label)]/@for or " .
|
||||
"@id=//span[contains(normalize-space(.), $label)]/preceding-sibling::label[1]/@for]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
|
||||
|
||||
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" .
|
||||
@@ -89,7 +90,7 @@ class behat_admin extends behat_base {
|
||||
} catch (ElementNotFoundException $e) {
|
||||
|
||||
// Multi element settings, interacting only the first one.
|
||||
$fieldxpath = "//descendant::label[.= $label]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
|
||||
$fieldxpath = "//*[label[.= $label]|span[.= $label]]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
|
||||
"/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath);
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@core @core_admin
|
||||
Feature: Set admin settings value
|
||||
In order to set admin settings value
|
||||
As an admin
|
||||
I need to set admin setting value and verify it is applied
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
And I should see "Course fullname"
|
||||
And I should not see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with full name
|
||||
Given I set the following administration settings values:
|
||||
| Display extended course names | 1 |
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with short name
|
||||
Given I set the following administration settings values:
|
||||
| courselistshortnames | 1 |
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
@@ -27,6 +27,11 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/behat/locallib.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
|
||||
// This page usually takes an exceedingly long time to load, so we need to
|
||||
// increase the time limit. At present it takes about a minute on some
|
||||
// systems, but let's allow room for expansion.
|
||||
core_php_time_limit::raise(300);
|
||||
|
||||
$filter = optional_param('filter', '', PARAM_ALPHANUMEXT);
|
||||
$type = optional_param('type', false, PARAM_ALPHAEXT);
|
||||
$component = optional_param('component', '', PARAM_ALPHAEXT);
|
||||
|
||||
@@ -252,3 +252,25 @@ Feature: Set up contextual data for tests
|
||||
And the "members" select box should contain "Student 1"
|
||||
And I set the field "groups" to "Group 2 (1)"
|
||||
And the "members" select box should contain "Student 2"
|
||||
|
||||
Scenario: Add cohorts with data generator
|
||||
Given the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| System cohort 1 | CH01 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber | contextlevel | reference |
|
||||
| System cohort 2 | CH02 | System | |
|
||||
| Cohort in category 1 | CH1 | Category | CAT1 |
|
||||
When I log in as "admin"
|
||||
And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
|
||||
Then I should see "System cohort 1"
|
||||
And I should see "System cohort 2"
|
||||
And I should not see "Cohort in category"
|
||||
And I follow "Courses"
|
||||
And I follow "Cat 1"
|
||||
And I follow "Cohorts"
|
||||
And I should see "Cohort in category 1"
|
||||
And I should not see "System cohort"
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
* @var array Number of sections in course
|
||||
*/
|
||||
private static $paramsections = array(1, 10, 100, 500, 1000, 2000);
|
||||
/**
|
||||
* @var array Number of assignments in course
|
||||
*/
|
||||
private static $paramassignments = array(1, 10, 100, 500, 1000, 2000);
|
||||
/**
|
||||
* @var array Number of Page activities in course
|
||||
*/
|
||||
@@ -179,6 +183,7 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
// Make course.
|
||||
$this->course = $this->create_course();
|
||||
$this->create_users();
|
||||
$this->create_assignments();
|
||||
$this->create_pages();
|
||||
$this->create_small_files();
|
||||
$this->create_big_files();
|
||||
@@ -318,6 +323,26 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
$this->end_log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a number of Assignment activities.
|
||||
*/
|
||||
private function create_assignments() {
|
||||
// Set up generator.
|
||||
$assigngenerator = $this->generator->get_plugin_generator('mod_assign');
|
||||
|
||||
// Create assignments.
|
||||
$number = self::$paramassignments[$this->size];
|
||||
$this->log('createassignments', $number, true);
|
||||
for ($i = 0; $i < $number; $i++) {
|
||||
$record = array('course' => $this->course);
|
||||
$options = array('section' => $this->get_target_section());
|
||||
$assigngenerator->create_instance($record, $options);
|
||||
$this->dot($i, $number);
|
||||
}
|
||||
|
||||
$this->end_log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a number of Page activities.
|
||||
*/
|
||||
|
||||
@@ -71,6 +71,7 @@ $string['pluginname'] = 'Development data generator';
|
||||
$string['progress_checkaccounts'] = 'Checking user accounts ({$a})';
|
||||
$string['progress_coursecompleted'] = 'Course completed ({$a}s)';
|
||||
$string['progress_createaccounts'] = 'Creating user accounts ({$a->from} - {$a->to})';
|
||||
$string['progress_createassignments'] = 'Creating assignments ({$a})';
|
||||
$string['progress_createbigfiles'] = 'Creating big files ({$a})';
|
||||
$string['progress_createcourse'] = 'Creating course {$a}';
|
||||
$string['progress_createforum'] = 'Creating forum ({$a} posts)';
|
||||
|
||||
@@ -28,20 +28,20 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$string['acknowledgement'] = 'Acknowledgement';
|
||||
$string['acknowledgementmust'] = 'You must acknowledge this';
|
||||
$string['acknowledgementtext'] = 'I understand that it is my responsibility to have full backups of this site prior to installing add-ons. I accept and understand that add-ons (especially but not only those originating in unofficial sources) may contain security holes, can make the site unavailable, or cause private data leaks or loss.';
|
||||
$string['featuredisabled'] = 'The add-on installer is disabled on this site.';
|
||||
$string['installaddon'] = 'Install add-on!';
|
||||
$string['installaddons'] = 'Install add-ons';
|
||||
$string['installexception'] = 'Oops... An error occurred while trying to install the add-on. Turn debugging mode on to see details of the error.';
|
||||
$string['installfromrepo'] = 'Install add-ons from the Moodle plugins directory';
|
||||
$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install an add-on. Note that your site full name, URL and Moodle version will be sent as well, to make the installation process easier for you.';
|
||||
$string['installfromzip'] = 'Install add-on from ZIP file';
|
||||
$string['installfromzip_help'] = 'An alternative to installing an add-on directly from the Moodle plugins directory is to upload a ZIP package of the add-on. The ZIP package should have the same structure as a package downloaded from the Moodle plugins directory.';
|
||||
$string['acknowledgementtext'] = 'I understand that it is my responsibility to have full backups of this site prior to installing additional plugins. I accept and understand that plugins (especially but not only those originating in unofficial sources) may contain security holes, can make the site unavailable, or cause private data leaks or loss.';
|
||||
$string['featuredisabled'] = 'The plugin installer is disabled on this site.';
|
||||
$string['installaddon'] = 'Install plugin!';
|
||||
$string['installaddons'] = 'Install plugins';
|
||||
$string['installexception'] = 'Oops... An error occurred while trying to install the plugin. Turn debugging mode on to see details of the error.';
|
||||
$string['installfromrepo'] = 'Install plugins from the Moodle plugins directory';
|
||||
$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install a plugin. Note that your site full name, URL and Moodle version will be sent as well, to make the installation process easier for you.';
|
||||
$string['installfromzip'] = 'Install plugin from ZIP file';
|
||||
$string['installfromzip_help'] = 'An alternative to installing a plugin directly from the Moodle plugins directory is to upload a ZIP package of the plugin. The ZIP package should have the same structure as a package downloaded from the Moodle plugins directory.';
|
||||
$string['installfromzipfile'] = 'ZIP package';
|
||||
$string['installfromzipfile_help'] = 'The plugin ZIP package must contain just one directory, named to match the plugin. The ZIP will be extracted into an appropriate location for the plugin type. If the package has been downloaded from the Moodle plugins directory then it will have this structure.';
|
||||
$string['installfromziprootdir'] = 'Rename the root directory';
|
||||
$string['installfromziprootdir_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. If so, the correct name may be entered here.';
|
||||
$string['installfromzipsubmit'] = 'Install add-on from the ZIP file';
|
||||
$string['installfromzipsubmit'] = 'Install plugin from the ZIP file';
|
||||
$string['installfromziptype'] = 'Plugin type';
|
||||
$string['installfromziptype_help'] = 'Choose the correct type of plugin you are about to install. Warning: The installation procedure can fail badly if an incorrect plugin type is specified.';
|
||||
$string['permcheck'] = 'Make sure the plugin type root location is writable by the web server process.';
|
||||
@@ -49,54 +49,54 @@ $string['permcheckerror'] = 'Error while checking for write permission';
|
||||
$string['permcheckprogress'] = 'Checking for write permission ...';
|
||||
$string['permcheckresultno'] = 'Plugin type location <em>{$a->path}</em> is not writable';
|
||||
$string['permcheckresultyes'] = 'Plugin type location <em>{$a->path}</em> is writable';
|
||||
$string['pluginname'] = 'Add-on installer';
|
||||
$string['remoterequestalreadyinstalled'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, this plugin is <strong>already installed</strong> on the site.';
|
||||
$string['remoterequestconfirm'] = 'There is a request to install add-on <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. If you continue, the add-on ZIP package will be downloaded for validation. Nothing will be installed yet.';
|
||||
$string['remoterequestinvalid'] = 'There is a request to install an add-on from the Moodle plugins directory on this site. Unfortunately the request is not valid and so the add-on cannot be installed.';
|
||||
$string['remoterequestpermcheck'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, the plugin type location <strong>{$a->typepath}</strong> is <strong>not writable</strong>. You need to give write access for the web server user to the plugin type location, then press the continue button to repeat the check.';
|
||||
$string['remoterequestpluginfoexception'] = 'Oops... An error occurred while trying to obtain information about the add-on {$a->name} ({$a->component}) version {$a->version}. The add-on cannot be installed. Turn debugging mode on to see details of the error.';
|
||||
$string['validation'] = 'Add-on package validation';
|
||||
$string['pluginname'] = 'Plugin installer';
|
||||
$string['remoterequestalreadyinstalled'] = 'There is a request to install plugin {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, this plugin is <strong>already installed</strong> on the site.';
|
||||
$string['remoterequestconfirm'] = 'There is a request to install plugin <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. If you continue, the plugin ZIP package will be downloaded for validation. Nothing will be installed yet.';
|
||||
$string['remoterequestinvalid'] = 'There is a request to install a plugin from the Moodle plugins directory on this site. Unfortunately the request is not valid and so the plugin cannot be installed.';
|
||||
$string['remoterequestpermcheck'] = 'There is a request to install plugin {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, the location <strong>{$a->typepath}</strong> is <strong>not writable</strong>. You need to give write access for the web server user to the location, then press the continue button to repeat the check.';
|
||||
$string['remoterequestpluginfoexception'] = 'Oops... An error occurred while trying to obtain information about the plugin {$a->name} ({$a->component}) version {$a->version}. The plugin cannot be installed. Turn debugging mode on to see details of the error.';
|
||||
$string['validation'] = 'Plugin package validation';
|
||||
$string['validationmsg_componentmatch'] = 'Full component name';
|
||||
$string['validationmsg_componentmismatchname'] = 'Add-on name mismatch';
|
||||
$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the declared add-on name.';
|
||||
$string['validationmsg_componentmismatchname_info'] = 'The add-on declares its name is \'{$a}\' but that does not match the name of the root directory.';
|
||||
$string['validationmsg_componentmismatchtype'] = 'Add-on type mismatch';
|
||||
$string['validationmsg_componentmismatchtype_info'] = 'You have selected the type \'{$a->expected}\' but the add-on declares its type is \'{$a->found}\'.';
|
||||
$string['validationmsg_componentmismatchname'] = 'Plugin name mismatch';
|
||||
$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the declared plugin name.';
|
||||
$string['validationmsg_componentmismatchname_info'] = 'The plugin declares its name is \'{$a}\' but that does not match the name of the root directory.';
|
||||
$string['validationmsg_componentmismatchtype'] = 'Plugin type mismatch';
|
||||
$string['validationmsg_componentmismatchtype_info'] = 'You have selected the type \'{$a->expected}\' but the plugin declares its type is \'{$a->found}\'.';
|
||||
$string['validationmsg_filenotexists'] = 'Extracted file not found';
|
||||
$string['validationmsg_filesnumber'] = 'Not enough files found in the package';
|
||||
$string['validationmsg_filestatus'] = 'Unable to extract all files';
|
||||
$string['validationmsg_filestatus_info'] = 'Attempting to extract file {$a->file} resulted in error \'{$a->status}\'.';
|
||||
$string['validationmsg_maturity'] = 'Declared maturity level';
|
||||
$string['validationmsg_maturity_help'] = 'The add-on can declare its maturity level. If the maintainer considers the add-on stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
|
||||
$string['validationmsg_maturity_help'] = 'The plugin can declare its maturity level. If the maintainer considers the plugin stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
|
||||
$string['validationmsg_missingexpectedlangenfile'] = 'English language file name mismatch';
|
||||
$string['validationmsg_missingexpectedlangenfile_info'] = 'The given add-on type is missing the expected English language file {$a}.';
|
||||
$string['validationmsg_missingexpectedlangenfile_info'] = 'The given plugin type is missing the expected English language file {$a}.';
|
||||
$string['validationmsg_missinglangenfile'] = 'No English language file found';
|
||||
$string['validationmsg_missinglangenfolder'] = 'Missing English language folder';
|
||||
$string['validationmsg_missingversion'] = 'Add-on does not declare its version';
|
||||
$string['validationmsg_missingversion'] = 'Plugin does not declare its version';
|
||||
$string['validationmsg_missingversionphp'] = 'File version.php not found';
|
||||
$string['validationmsg_multiplelangenfiles'] = 'Multiple English language files found';
|
||||
$string['validationmsg_onedir'] = 'Invalid structure of the ZIP package.';
|
||||
$string['validationmsg_onedir_help'] = 'The ZIP package must contain just one root directory that holds the add-on code. The name of that root directory must match the name of the plugin.';
|
||||
$string['validationmsg_onedir_help'] = 'The ZIP package must contain just one root directory that holds the plugin code. The name of that root directory must match the name of the plugin.';
|
||||
$string['validationmsg_pathwritable'] = 'Write access check';
|
||||
$string['validationmsg_pluginversion'] = 'Add-on version';
|
||||
$string['validationmsg_release'] = 'Add-on release';
|
||||
$string['validationmsg_pluginversion'] = 'Plugin version';
|
||||
$string['validationmsg_release'] = 'Plugin release';
|
||||
$string['validationmsg_requiresmoodle'] = 'Required Moodle version';
|
||||
$string['validationmsg_rootdir'] = 'Name of the add-on to be installed';
|
||||
$string['validationmsg_rootdir_help'] = 'The name of the root directory in the ZIP package forms the name of the add-on to be installed. If the name is not correct, you may wish to rename the root directory in the ZIP prior to installing the add-on.';
|
||||
$string['validationmsg_rootdirinvalid'] = 'Invalid add-on name';
|
||||
$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the add-on name.';
|
||||
$string['validationmsg_rootdir'] = 'Name of the plugin to be installed';
|
||||
$string['validationmsg_rootdir_help'] = 'The name of the root directory in the ZIP package forms the name of the plugin to be installed. If the name is not correct, you may wish to rename the root directory in the ZIP prior to installing the plugin.';
|
||||
$string['validationmsg_rootdirinvalid'] = 'Invalid plugin name';
|
||||
$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the plugin name.';
|
||||
$string['validationmsg_targetexists'] = 'Target location already exists';
|
||||
$string['validationmsg_targetexists_help'] = 'The directory that the add-on is to be installed to, must not exist yet.';
|
||||
$string['validationmsg_targetexists_help'] = 'The directory that the plugin is to be installed to must not yet exist.';
|
||||
$string['validationmsg_unknowntype'] = 'Unknown plugin type';
|
||||
$string['validationmsglevel_debug'] = 'Debug';
|
||||
$string['validationmsglevel_error'] = 'Error';
|
||||
$string['validationmsglevel_info'] = 'OK';
|
||||
$string['validationmsglevel_warning'] = 'Warning';
|
||||
$string['validationresult0'] = 'Validation failed!';
|
||||
$string['validationresult0_help'] = 'A serious problem was detected and so it is not safe to install the add-on. See the validation log messages for details.';
|
||||
$string['validationresult0_help'] = 'A serious problem was detected and so it is not safe to install the plugin. See the validation log messages for details.';
|
||||
$string['validationresult1'] = 'Validation passed!';
|
||||
$string['validationresult1_help'] = 'No serious problems were detected. You can continue with the add-on installation. See the validation log messages for more details and eventual warnings.';
|
||||
$string['validationresult1_help'] = 'The add-on package has been validated and no serious problems were detected.';
|
||||
$string['validationresult2_help'] = 'No serious problems were detected. You can continue with the plugin installation. See the validation log messages for more details and eventual warnings.';
|
||||
$string['validationresult1_help'] = 'The plugin package has been validated and no serious problems were detected.';
|
||||
$string['validationresultinfo'] = 'Info';
|
||||
$string['validationresultmsg'] = 'Message';
|
||||
$string['validationresultstatus'] = 'Status';
|
||||
|
||||
@@ -72,7 +72,7 @@ trait buffered_writer {
|
||||
$entry['other'] = serialize($entry['other']);
|
||||
$entry['origin'] = $PAGE->requestorigin;
|
||||
$entry['ip'] = $PAGE->requestip;
|
||||
$entry['realuserid'] = \core\session\manager::is_loggedinas() ? $_SESSION['USER']->realuser : null;
|
||||
$entry['realuserid'] = \core\session\manager::is_loggedinas() ? $GLOBALS['USER']->realuser : null;
|
||||
|
||||
$this->buffer[] = $entry;
|
||||
$this->count++;
|
||||
|
||||
@@ -43,5 +43,8 @@ function xmldb_tool_log_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2014040600, 'tool', 'log');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
$string['actlogshdr'] = 'Available log stores';
|
||||
$string['configlogplugins'] = 'Please enable all required plugins and arrange then in appropriate order.';
|
||||
$string['configlogplugins'] = 'Please enable all required plugins and arrange them in appropriate order.';
|
||||
$string['logging'] = 'Logging';
|
||||
$string['managelogging'] = 'Manage log stores';
|
||||
$string['reportssupported'] = 'Reports supported';
|
||||
|
||||
@@ -33,5 +33,8 @@ function xmldb_logstore_database_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2014041700, 'logstore', 'database');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -130,8 +130,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
array('context' => context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
$event2->trigger();
|
||||
|
||||
$_SESSION['SESSION'] = new \stdClass();
|
||||
$this->setUser(0);
|
||||
\core\session\manager::init_empty_session();
|
||||
$this->assertFalse(\core\session\manager::is_loggedinas());
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
|
||||
@@ -185,6 +185,11 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
|
||||
// database so that it doesn't cause a DB error. Log a warning so that
|
||||
// developers can avoid doing things which are likely to cause this on a
|
||||
// routine basis.
|
||||
if (\core_text::strlen($action) > 40) {
|
||||
$action = \core_text::substr($action, 0, 37) . '...';
|
||||
debugging('Warning: logged very long action', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
if (!empty($info) && \core_text::strlen($info) > 255) {
|
||||
$info = \core_text::substr($info, 0, 252) . '...';
|
||||
debugging('Warning: logged very long info', DEBUG_DEVELOPER);
|
||||
|
||||
@@ -111,5 +111,8 @@ function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2014041500, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -95,8 +95,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$event2->trigger();
|
||||
logstore_standard_restore::hack_executing(0);
|
||||
|
||||
$_SESSION['SESSION'] = new \stdClass();
|
||||
$this->setUser(0);
|
||||
\core\session\manager::init_empty_session();
|
||||
$this->assertFalse(\core\session\manager::is_loggedinas());
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
|
||||
@@ -104,11 +104,11 @@ if ($mform && ($mform->is_cancelled() || !empty($CFG->preventscheduledtaskchange
|
||||
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
$error = optional_param('error', '', PARAM_RAW);
|
||||
$error = optional_param('error', '', PARAM_NOTAGS);
|
||||
if ($error) {
|
||||
echo $OUTPUT->notification($error, 'notifyerror');
|
||||
}
|
||||
$success = optional_param('success', '', PARAM_RAW);
|
||||
$success = optional_param('success', '', PARAM_NOTAGS);
|
||||
if ($success) {
|
||||
echo $OUTPUT->notification($success, 'notifysuccess');
|
||||
}
|
||||
|
||||
@@ -875,7 +875,6 @@ class tool_uploadcourse_course {
|
||||
$resetdata = new stdClass();
|
||||
$resetdata->id = $course->id;
|
||||
$resetdata->reset_start_date = time();
|
||||
$resetdata->reset_logs = true;
|
||||
$resetdata->reset_events = true;
|
||||
$resetdata->reset_notes = true;
|
||||
$resetdata->delete_blog_associations = true;
|
||||
|
||||
@@ -669,7 +669,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
|
||||
if ($doupdate or $existinguser->password !== $oldpw) {
|
||||
// We want only users that were really updated.
|
||||
user_update_user($existinguser, false);
|
||||
user_update_user($existinguser, false, false);
|
||||
|
||||
$upt->track('status', $struserupdated);
|
||||
$usersupdated++;
|
||||
@@ -687,6 +687,9 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger event.
|
||||
\core\event\user_updated::create_from_userid($existinguser->id)->trigger();
|
||||
|
||||
} else {
|
||||
// no user information changed
|
||||
$upt->track('status', $struseruptodate);
|
||||
@@ -800,7 +803,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
$upt->track('password', '-', 'normal', false);
|
||||
}
|
||||
|
||||
$user->id = user_create_user($user, false);
|
||||
$user->id = user_create_user($user, false, false);
|
||||
$upt->track('username', html_writer::link(new moodle_url('/user/profile.php', array('id'=>$user->id)), s($user->username)), 'normal', false);
|
||||
|
||||
// pre-process custom profile menu fields data from csv file
|
||||
@@ -815,6 +818,9 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
set_user_preference('create_password', 1, $user);
|
||||
}
|
||||
|
||||
// Trigger event.
|
||||
\core\event\user_created::create_from_userid($user->id)->trigger();
|
||||
|
||||
$upt->track('status', $struseradded);
|
||||
$upt->track('id', $user->id, 'normal', false);
|
||||
$usersnew++;
|
||||
|
||||
+260
-348
@@ -63,7 +63,7 @@ if (!defined('E_USER_DEPRECATED')) {
|
||||
/**
|
||||
* phpCAS version. accessible for the user by phpCAS::getVersion().
|
||||
*/
|
||||
define('PHPCAS_VERSION', '1.3.2');
|
||||
define('PHPCAS_VERSION', '1.3.3');
|
||||
|
||||
/**
|
||||
* @addtogroup public
|
||||
@@ -78,6 +78,10 @@ define("CAS_VERSION_1_0", '1.0');
|
||||
* CAS version 2.0
|
||||
*/
|
||||
define("CAS_VERSION_2_0", '2.0');
|
||||
/**
|
||||
* CAS version 3.0
|
||||
*/
|
||||
define("CAS_VERSION_3_0", '3.0');
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// SAML defines
|
||||
@@ -318,18 +322,6 @@ class phpCAS
|
||||
if (is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error(self::$_PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . self::$_PHPCAS_INIT_CALL['file'] . ':' . self::$_PHPCAS_INIT_CALL['line'] . ')');
|
||||
}
|
||||
if (gettype($server_version) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_version (should be `string\')');
|
||||
}
|
||||
if (gettype($server_hostname) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_hostname (should be `string\')');
|
||||
}
|
||||
if (gettype($server_port) != 'integer') {
|
||||
phpCAS :: error('type mismatched for parameter $server_port (should be `integer\')');
|
||||
}
|
||||
if (gettype($server_uri) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_uri (should be `string\')');
|
||||
}
|
||||
|
||||
// store where the initializer is called from
|
||||
$dbg = debug_backtrace();
|
||||
@@ -341,10 +333,14 @@ class phpCAS
|
||||
);
|
||||
|
||||
// initialize the object $_PHPCAS_CLIENT
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, false, $server_hostname, $server_port, $server_uri,
|
||||
$changeSessionID
|
||||
);
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, false, $server_hostname, $server_port, $server_uri,
|
||||
$changeSessionID
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -370,18 +366,6 @@ class phpCAS
|
||||
if (is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error(self::$_PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . self::$_PHPCAS_INIT_CALL['file'] . ':' . self::$_PHPCAS_INIT_CALL['line'] . ')');
|
||||
}
|
||||
if (gettype($server_version) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_version (should be `string\')');
|
||||
}
|
||||
if (gettype($server_hostname) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_hostname (should be `string\')');
|
||||
}
|
||||
if (gettype($server_port) != 'integer') {
|
||||
phpCAS :: error('type mismatched for parameter $server_port (should be `integer\')');
|
||||
}
|
||||
if (gettype($server_uri) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $server_uri (should be `string\')');
|
||||
}
|
||||
|
||||
// store where the initialzer is called from
|
||||
$dbg = debug_backtrace();
|
||||
@@ -393,10 +377,14 @@ class phpCAS
|
||||
);
|
||||
|
||||
// initialize the object $_PHPCAS_CLIENT
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, true, $server_hostname, $server_port, $server_uri,
|
||||
$changeSessionID
|
||||
);
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, true, $server_hostname, $server_port, $server_uri,
|
||||
$changeSessionID
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -636,13 +624,13 @@ class phpCAS
|
||||
*/
|
||||
public static function setLang($lang)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setLang($lang);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($lang) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $lang (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setLang($lang);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
@@ -682,13 +670,13 @@ class phpCAS
|
||||
*/
|
||||
public static function setHTMLHeader($header)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setHTMLHeader($header);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($header) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $header (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setHTMLHeader($header);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -700,13 +688,13 @@ class phpCAS
|
||||
*/
|
||||
public static function setHTMLFooter($footer)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setHTMLFooter($footer);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($footer) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $footer (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setHTMLFooter($footer);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
@@ -729,19 +717,13 @@ class phpCAS
|
||||
public static function setPGTStorage($storage)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setPGTStorage($storage);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called before ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() (called at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ')');
|
||||
}
|
||||
if ( !($storage instanceof CAS_PGTStorage) ) {
|
||||
phpCAS :: error('type mismatched for parameter $storage (should be a CAS_PGTStorage `object\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setPGTStorage($storage);
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -766,25 +748,13 @@ class phpCAS
|
||||
$password='', $table='', $driver_options=null
|
||||
) {
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setPGTStorageDb($dsn_or_pdo, $username, $password, $table, $driver_options);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called before ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() (called at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ')');
|
||||
}
|
||||
if (gettype($username) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $username (should be `string\')');
|
||||
}
|
||||
if (gettype($password) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $password (should be `string\')');
|
||||
}
|
||||
if (gettype($table) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $table (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setPGTStorageDb($dsn_or_pdo, $username, $password, $table, $driver_options);
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -799,19 +769,13 @@ class phpCAS
|
||||
public static function setPGTStorageFile($path = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setPGTStorageFile($path);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called before ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() (called at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ')');
|
||||
}
|
||||
if (gettype($path) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $path (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setPGTStorageFile($path);
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
/** @} */
|
||||
@@ -836,23 +800,13 @@ class phpCAS
|
||||
public static function getProxiedService ($type)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
if (gettype($type) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $type (should be `string\')');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
$res = self::$_PHPCAS_CLIENT->getProxiedService($type);
|
||||
try {
|
||||
$res = self::$_PHPCAS_CLIENT->getProxiedService($type);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
return $res;
|
||||
@@ -872,20 +826,13 @@ class phpCAS
|
||||
*/
|
||||
public static function initializeProxiedService (CAS_ProxiedService $proxiedService)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
self::$_PHPCAS_CLIENT->initializeProxiedService($proxiedService);
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->initializeProxiedService($proxiedService);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -906,23 +853,13 @@ class phpCAS
|
||||
public static function serviceWeb($url, & $err_code, & $output)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string\')');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
$res = self::$_PHPCAS_CLIENT->serviceWeb($url, $err_code, $output);
|
||||
try {
|
||||
$res = self::$_PHPCAS_CLIENT->serviceWeb($url, $err_code, $output);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
|
||||
phpCAS :: traceEnd($res);
|
||||
return $res;
|
||||
@@ -950,28 +887,14 @@ class phpCAS
|
||||
public static function serviceMail($url, $service, $flags, & $err_code, & $err_msg, & $pt)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string\')');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
if (gettype($flags) != 'integer') {
|
||||
phpCAS :: error('type mismatched for parameter $flags (should be `integer\')');
|
||||
try {
|
||||
$res = self::$_PHPCAS_CLIENT->serviceMail($url, $service, $flags, $err_code, $err_msg, $pt);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
|
||||
$res = self::$_PHPCAS_CLIENT->serviceMail($url, $service, $flags, $err_code, $err_msg, $pt);
|
||||
|
||||
phpCAS :: traceEnd($res);
|
||||
return $res;
|
||||
}
|
||||
@@ -998,13 +921,13 @@ class phpCAS
|
||||
*/
|
||||
public static function setCacheTimesForAuthRecheck($n)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setCacheTimesForAuthRecheck($n);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($n) != 'integer') {
|
||||
phpCAS :: error('type mismatched for parameter $n (should be `integer\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setCacheTimesForAuthRecheck($n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1028,9 +951,7 @@ class phpCAS
|
||||
*/
|
||||
public static function setPostAuthenticateCallback ($function, array $additionalArgs = array())
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
self::$_PHPCAS_CLIENT->setPostAuthenticateCallback($function, $additionalArgs);
|
||||
}
|
||||
@@ -1051,9 +972,7 @@ class phpCAS
|
||||
*/
|
||||
public static function setSingleSignoutCallback ($function, array $additionalArgs = array())
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
self::$_PHPCAS_CLIENT->setSingleSignoutCallback($function, $additionalArgs);
|
||||
}
|
||||
@@ -1071,9 +990,7 @@ class phpCAS
|
||||
public static function checkAuthentication()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
$auth = self::$_PHPCAS_CLIENT->checkAuthentication();
|
||||
|
||||
@@ -1094,16 +1011,13 @@ class phpCAS
|
||||
public static function forceAuthentication()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
|
||||
phpCAS::_validateClientExists();
|
||||
$auth = self::$_PHPCAS_CLIENT->forceAuthentication();
|
||||
|
||||
// store where the authentication has been checked and the result
|
||||
self::$_PHPCAS_CLIENT->markAuthenticationCall($auth);
|
||||
|
||||
/* if (!$auth) {
|
||||
/* if (!$auth) {
|
||||
phpCAS :: trace('user is not authenticated, redirecting to the CAS server');
|
||||
self::$_PHPCAS_CLIENT->forceAuthentication();
|
||||
} else {
|
||||
@@ -1122,9 +1036,8 @@ class phpCAS
|
||||
public static function renewAuthentication()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
$auth = self::$_PHPCAS_CLIENT->renewAuthentication();
|
||||
|
||||
// store where the authentication has been checked and the result
|
||||
@@ -1143,9 +1056,7 @@ class phpCAS
|
||||
public static function isAuthenticated()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
// call the isAuthenticated method of the $_PHPCAS_CLIENT object
|
||||
$auth = self::$_PHPCAS_CLIENT->isAuthenticated();
|
||||
@@ -1166,9 +1077,8 @@ class phpCAS
|
||||
*/
|
||||
public static function isSessionAuthenticated()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
return (self::$_PHPCAS_CLIENT->isSessionAuthenticated());
|
||||
}
|
||||
|
||||
@@ -1176,65 +1086,56 @@ class phpCAS
|
||||
* This method returns the CAS user's login name.
|
||||
*
|
||||
* @return string the login name of the authenticated user
|
||||
* @warning should not be called only after phpCAS::forceAuthentication()
|
||||
* @warning should only be called after phpCAS::forceAuthentication()
|
||||
* or phpCAS::checkAuthentication().
|
||||
* */
|
||||
public static function getUser()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
return self::$_PHPCAS_CLIENT->getUser();
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
return self::$_PHPCAS_CLIENT->getUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer attributes about the authenticated user.
|
||||
*
|
||||
* @warning should not be called only after phpCAS::forceAuthentication()
|
||||
* @warning should only be called after phpCAS::forceAuthentication()
|
||||
* or phpCAS::checkAuthentication().
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAttributes()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
return self::$_PHPCAS_CLIENT->getAttributes();
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
return self::$_PHPCAS_CLIENT->getAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer true if there are attributes for the authenticated user.
|
||||
*
|
||||
* @warning should not be called only after phpCAS::forceAuthentication()
|
||||
* @warning should only be called after phpCAS::forceAuthentication()
|
||||
* or phpCAS::checkAuthentication().
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasAttributes()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
return self::$_PHPCAS_CLIENT->hasAttributes();
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
return self::$_PHPCAS_CLIENT->hasAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1243,21 +1144,18 @@ class phpCAS
|
||||
* @param string $key attribute name
|
||||
*
|
||||
* @return bool
|
||||
* @warning should not be called only after phpCAS::forceAuthentication()
|
||||
* @warning should only be called after phpCAS::forceAuthentication()
|
||||
* or phpCAS::checkAuthentication().
|
||||
*/
|
||||
public static function hasAttribute($key)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
return self::$_PHPCAS_CLIENT->hasAttribute($key);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
return self::$_PHPCAS_CLIENT->hasAttribute($key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,21 +1164,18 @@ class phpCAS
|
||||
* @param string $key attribute name
|
||||
*
|
||||
* @return mixed string for a single value or an array if multiple values exist.
|
||||
* @warning should not be called only after phpCAS::forceAuthentication()
|
||||
* @warning should only be called after phpCAS::forceAuthentication()
|
||||
* or phpCAS::checkAuthentication().
|
||||
*/
|
||||
public static function getAttribute($key)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
return self::$_PHPCAS_CLIENT->getAttribute($key);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCalled()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()');
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->wasAuthenticationCallSuccessful()) {
|
||||
phpCAS :: error('authentication was checked (by ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerMethod() . '() at ' . self::$_PHPCAS_CLIENT->getAuthenticationCallerFile() . ':' . self::$_PHPCAS_CLIENT->getAuthenticationCallerLine() . ') but the method returned false');
|
||||
}
|
||||
return self::$_PHPCAS_CLIENT->getAttribute($key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1293,9 +1188,8 @@ class phpCAS
|
||||
*/
|
||||
public static function handleLogoutRequests($check_client = true, $allowed_clients = false)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
return (self::$_PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients));
|
||||
}
|
||||
|
||||
@@ -1307,9 +1201,8 @@ class phpCAS
|
||||
*/
|
||||
public static function getServerLoginURL()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
return self::$_PHPCAS_CLIENT->getServerLoginURL();
|
||||
}
|
||||
|
||||
@@ -1324,13 +1217,14 @@ class phpCAS
|
||||
public static function setServerLoginURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after' . __CLASS__ . '::client()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setServerLoginURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string`)');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setServerLoginURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1345,13 +1239,14 @@ class phpCAS
|
||||
public static function setServerServiceValidateURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after' . __CLASS__ . '::client()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setServerServiceValidateURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string`)');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setServerServiceValidateURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1366,13 +1261,14 @@ class phpCAS
|
||||
public static function setServerProxyValidateURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after' . __CLASS__ . '::client()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setServerProxyValidateURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string`)');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setServerProxyValidateURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1386,13 +1282,14 @@ class phpCAS
|
||||
public static function setServerSamlValidateURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after' . __CLASS__ . '::client()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setServerSamlValidateURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be`string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setServerSamlValidateURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1404,9 +1301,8 @@ class phpCAS
|
||||
*/
|
||||
public static function getServerLogoutURL()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
return self::$_PHPCAS_CLIENT->getServerLogoutURL();
|
||||
}
|
||||
|
||||
@@ -1421,17 +1317,14 @@ class phpCAS
|
||||
public static function setServerLogoutURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error(
|
||||
'this method should only be called after' . __CLASS__ . '::client()'
|
||||
);
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setServerLogoutURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error(
|
||||
'type mismatched for parameter $url (should be `string`)'
|
||||
);
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setServerLogoutURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1446,9 +1339,8 @@ class phpCAS
|
||||
public static function logout($params = "")
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
$parsedParams = array ();
|
||||
if ($params != "") {
|
||||
if (is_string($params)) {
|
||||
@@ -1480,9 +1372,8 @@ class phpCAS
|
||||
public static function logoutWithRedirectService($service)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
if (!is_string($service)) {
|
||||
phpCAS :: error('type mismatched for parameter $service (should be `string\')');
|
||||
}
|
||||
@@ -1532,9 +1423,8 @@ class phpCAS
|
||||
{
|
||||
trigger_error('Function deprecated for cas servers >= 3.3.5.1', E_USER_DEPRECATED);
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
if (!is_string($service)) {
|
||||
phpCAS :: error('type mismatched for parameter $service (should be `string\')');
|
||||
}
|
||||
@@ -1563,16 +1453,14 @@ class phpCAS
|
||||
public static function setFixedCallbackURL($url = '')
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setCallbackURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (!self::$_PHPCAS_CLIENT->isProxy()) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setCallbackURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1587,13 +1475,14 @@ class phpCAS
|
||||
public static function setFixedServiceURL($url)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setURL($url);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($url) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $url (should be `string\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setURL($url);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1604,9 +1493,7 @@ class phpCAS
|
||||
*/
|
||||
public static function getServiceURL()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
return (self::$_PHPCAS_CLIENT->getURL());
|
||||
}
|
||||
|
||||
@@ -1621,13 +1508,13 @@ class phpCAS
|
||||
*/
|
||||
public static function retrievePT($target_service, & $err_code, & $err_msg)
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
try {
|
||||
return (self::$_PHPCAS_CLIENT->retrievePT($target_service, $err_code, $err_msg));
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($target_service) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $target_service(should be `string\')');
|
||||
}
|
||||
return (self::$_PHPCAS_CLIENT->retrievePT($target_service, $err_code, $err_msg));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1642,16 +1529,14 @@ class phpCAS
|
||||
public static function setCasServerCACert($cert, $validate_cn = true)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->setCasServerCACert($cert, $validate_cn);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if (gettype($cert) != 'string') {
|
||||
phpCAS :: error('type mismatched for parameter $cert (should be `string\')');
|
||||
}
|
||||
if (gettype($validate_cn) != 'boolean') {
|
||||
phpCAS :: error('type mismatched for parameter $validate_cn (should be `boolean\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->setCasServerCACert($cert, $validate_cn);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
|
||||
@@ -1663,9 +1548,8 @@ class phpCAS
|
||||
public static function setNoCasServerValidation()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
phpCAS :: trace('You have configured no validation of the legitimacy of the cas server. This is not recommended for production use.');
|
||||
self::$_PHPCAS_CLIENT->setNoCasServerValidation();
|
||||
phpCAS :: traceEnd();
|
||||
@@ -1684,9 +1568,8 @@ class phpCAS
|
||||
public static function setNoClearTicketsFromUrl()
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
self::$_PHPCAS_CLIENT->setNoClearTicketsFromUrl();
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
@@ -1705,9 +1588,8 @@ class phpCAS
|
||||
public static function setExtraCurlOption($key, $value)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
self::$_PHPCAS_CLIENT->setExtraCurlOption($key, $value);
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
@@ -1751,11 +1633,11 @@ class phpCAS
|
||||
public static function allowProxyChain(CAS_ProxyChain_Interface $proxy_chain)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
}
|
||||
if (self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_2_0) {
|
||||
phpCAS :: error('this method can only be used with the cas 2.0 protool');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
if (self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_2_0
|
||||
&& self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_3_0) {
|
||||
phpCAS :: error('this method can only be used with the cas 2.0/3.0 protocols');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->getAllowedProxyChains()->allowProxyChain($proxy_chain);
|
||||
phpCAS :: traceEnd();
|
||||
@@ -1772,9 +1654,7 @@ class phpCAS
|
||||
*/
|
||||
public static function getProxies ()
|
||||
{
|
||||
if ( !is_object(self::$_PHPCAS_CLIENT) ) {
|
||||
phpCAS::error('this method should only be called after '.__CLASS__.'::client()');
|
||||
}
|
||||
phpCAS::_validateProxyExists();
|
||||
|
||||
return(self::$_PHPCAS_CLIENT->getProxies());
|
||||
}
|
||||
@@ -1795,13 +1675,14 @@ class phpCAS
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
phpCAS::log('rebroadcastNodeUrl:'.$rebroadcastNodeUrl);
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->addRebroadcastNode($rebroadcastNodeUrl);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
if ( !(bool)preg_match("/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $rebroadcastNodeUrl)) {
|
||||
phpCAS::error('type mismatched for parameter $rebroadcastNodeUrl (should be `url\')');
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->addRebroadcastNode($rebroadcastNodeUrl);
|
||||
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
@@ -1816,14 +1697,45 @@ class phpCAS
|
||||
public static function addRebroadcastHeader($header)
|
||||
{
|
||||
phpCAS :: traceBegin();
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
phpCAS :: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
|
||||
phpCAS::_validateClientExists();
|
||||
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT->addRebroadcastHeader($header);
|
||||
} catch (Exception $e) {
|
||||
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
|
||||
}
|
||||
self::$_PHPCAS_CLIENT->addRebroadcastHeader($header);
|
||||
|
||||
phpCAS :: traceEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a client already exists
|
||||
*
|
||||
* @throws CAS_OutOfSequenceBeforeClientException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _validateClientExists()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
throw new CAS_OutOfSequenceBeforeClientException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks of a proxy client aready exists
|
||||
*
|
||||
* @throws CAS_OutOfSequenceBeforeProxyException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _validateProxyExists()
|
||||
{
|
||||
if (!is_object(self::$_PHPCAS_CLIENT)) {
|
||||
throw new CAS_OutOfSequenceBeforeProxyException();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ########################################################################
|
||||
// DOCUMENTATION
|
||||
// ########################################################################
|
||||
|
||||
@@ -74,7 +74,7 @@ implements CAS_Exception
|
||||
printf(
|
||||
$lang->getYouWereNotAuthenticated(),
|
||||
htmlentities($client->getURL()),
|
||||
$_SERVER['SERVER_ADMIN']
|
||||
isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:''
|
||||
);
|
||||
phpCAS::trace('CAS URL: '.$cas_url);
|
||||
phpCAS::trace('Authentication failure: '.$failure);
|
||||
@@ -89,6 +89,7 @@ implements CAS_Exception
|
||||
phpCAS::trace('Reason: CAS error');
|
||||
break;
|
||||
case CAS_VERSION_2_0:
|
||||
case CAS_VERSION_3_0:
|
||||
if ( empty($err_code) ) {
|
||||
phpCAS::trace('Reason: no CAS error');
|
||||
} else {
|
||||
|
||||
@@ -25,35 +25,39 @@ function CAS_autoload($class)
|
||||
{
|
||||
// Static to hold the Include Path to CAS
|
||||
static $include_path;
|
||||
// Setup the include path if it's not already set from a previous call
|
||||
if (!$include_path) {
|
||||
$include_path = dirname(dirname(__FILE__));
|
||||
}
|
||||
// Check only for CAS classes
|
||||
if (substr($class, 0, 4) !== 'CAS_') {
|
||||
return false;
|
||||
}
|
||||
// Declare local variable to store the expected full path to the file
|
||||
$file_path = $include_path . '/' . str_replace('_', '/', $class) . '.php';
|
||||
// Setup the include path if it's not already set from a previous call
|
||||
if (empty($include_path)) {
|
||||
$include_path = array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/../test/' );
|
||||
}
|
||||
|
||||
$fp = @fopen($file_path, 'r', true);
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
include $file_path;
|
||||
if (!class_exists($class, false) && !interface_exists($class, false)) {
|
||||
die(
|
||||
new Exception(
|
||||
'Class ' . $class . ' was not present in ' .
|
||||
$file_path .
|
||||
' [CAS_autoload]'
|
||||
)
|
||||
);
|
||||
// Declare local variable to store the expected full path to the file
|
||||
|
||||
foreach ($include_path as $path) {
|
||||
$file_path = $path . '/' . str_replace('_', '/', $class) . '.php';
|
||||
$fp = @fopen($file_path, 'r', true);
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
include $file_path;
|
||||
if (!class_exists($class, false) && !interface_exists($class, false)) {
|
||||
die(
|
||||
new Exception(
|
||||
'Class ' . $class . ' was not present in ' .
|
||||
$file_path .
|
||||
' [CAS_autoload]'
|
||||
)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$e = new Exception(
|
||||
'Class ' . $class . ' could not be loaded from ' .
|
||||
$file_path . ', file does not exist (Path="'
|
||||
. $include_path .'") [CAS_autoload]'
|
||||
. implode(':', $include_path) .'") [CAS_autoload]'
|
||||
);
|
||||
$trace = $e->getTrace();
|
||||
if (isset($trace[2]) && isset($trace[2]['function'])
|
||||
@@ -71,9 +75,13 @@ function CAS_autoload($class)
|
||||
|
||||
// set up __autoload
|
||||
if (function_exists('spl_autoload_register')) {
|
||||
if (!(spl_autoload_functions()) || !in_array('CAS_autoload', spl_autoload_functions())) {
|
||||
if (!(spl_autoload_functions())
|
||||
|| !in_array('CAS_autoload', spl_autoload_functions())
|
||||
) {
|
||||
spl_autoload_register('CAS_autoload');
|
||||
if (function_exists('__autoload') && !in_array('__autoload', spl_autoload_functions())) {
|
||||
if (function_exists('__autoload')
|
||||
&& !in_array('__autoload', spl_autoload_functions())
|
||||
) {
|
||||
// __autoload() was being used, but now would be ignored, add
|
||||
// it to the autoload stack
|
||||
spl_autoload_register('__autoload');
|
||||
|
||||
+571
-137
File diff suppressed because it is too large
Load Diff
@@ -161,7 +161,9 @@ class CAS_CookieJar
|
||||
protected function parseCookieHeader ($line, $defaultDomain)
|
||||
{
|
||||
if (!$defaultDomain) {
|
||||
throw new CAS_InvalidArgumentException('$defaultDomain was not provided.');
|
||||
throw new CAS_InvalidArgumentException(
|
||||
'$defaultDomain was not provided.'
|
||||
);
|
||||
}
|
||||
|
||||
// Set our default values
|
||||
@@ -315,10 +317,14 @@ class CAS_CookieJar
|
||||
protected function cookieMatchesTarget ($cookie, $target)
|
||||
{
|
||||
if (!is_array($target)) {
|
||||
throw new CAS_InvalidArgumentException('$target must be an array of URL attributes as generated by parse_url().');
|
||||
throw new CAS_InvalidArgumentException(
|
||||
'$target must be an array of URL attributes as generated by parse_url().'
|
||||
);
|
||||
}
|
||||
if (!isset($target['host'])) {
|
||||
throw new CAS_InvalidArgumentException('$target must be an array of URL attributes as generated by parse_url().');
|
||||
throw new CAS_InvalidArgumentException(
|
||||
'$target must be an array of URL attributes as generated by parse_url().'
|
||||
);
|
||||
}
|
||||
|
||||
// Verify that the scheme matches
|
||||
@@ -352,15 +358,17 @@ class CAS_CookieJar
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If the cookie host doesn't begin with '.', the host must case-insensitive
|
||||
// match exactly
|
||||
// If the cookie host doesn't begin with '.',
|
||||
// the host must case-insensitive match exactly
|
||||
if (strcasecmp($target['host'], $cookie['domain']) !== 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that the port matches
|
||||
if (isset($cookie['ports']) && !in_array($target['port'], $cookie['ports'])) {
|
||||
if (isset($cookie['ports'])
|
||||
&& !in_array($target['port'], $cookie['ports'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class CAS_Languages_German implements CAS_Languages_LanguageInterface
|
||||
*/
|
||||
public function getYouWereNotAuthenticated()
|
||||
{
|
||||
return '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>';
|
||||
return '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontaktieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,4 +113,4 @@ class CAS_Languages_German implements CAS_Languages_LanguageInterface
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* @file CAS/OutOfSequenceBeforeAuthenticationCallException.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class defines Exceptions that should be thrown when the sequence of
|
||||
* operations is invalid. In this case it should be thrown when an
|
||||
* authentication call has not yet happened.
|
||||
*
|
||||
* @class CAS_OutOfSequenceBeforeAuthenticationCallException
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
class CAS_OutOfSequenceBeforeAuthenticationCallException
|
||||
extends CAS_OutOfSequenceException
|
||||
implements CAS_Exception
|
||||
{
|
||||
/**
|
||||
* Return standard error meessage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ()
|
||||
{
|
||||
parent::__construct('An authentication call hasn\'t happened yet.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* @file CAS/OutOfSequenceBeforeClientException.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class defines Exceptions that should be thrown when the sequence of
|
||||
* operations is invalid. In this case it should be thrown when the client() or
|
||||
* proxy() call has not yet happened and no client or proxy object exists.
|
||||
*
|
||||
* @class CAS_OutOfSequenceBeforeClientException
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
class CAS_OutOfSequenceBeforeClientException
|
||||
extends CAS_OutOfSequenceException
|
||||
implements CAS_Exception
|
||||
{
|
||||
/**
|
||||
* Return standard error message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ()
|
||||
{
|
||||
parent::__construct(
|
||||
'this method cannot be called before phpCAS::client() or phpCAS::proxy()'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* @file CAS/OutOfSequenceBeforeProxyException.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class defines Exceptions that should be thrown when the sequence of
|
||||
* operations is invalid. In this case it should be thrown when the proxy() call
|
||||
* has not yet happened and no proxy object exists.
|
||||
*
|
||||
* @class CAS_OutOfSequenceBeforeProxyException
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
class CAS_OutOfSequenceBeforeProxyException
|
||||
extends CAS_OutOfSequenceException
|
||||
implements CAS_Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Return standard error message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ()
|
||||
{
|
||||
parent::__construct(
|
||||
'this method cannot be called before phpCAS::proxy()'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,9 @@ abstract class CAS_PGTStorage_AbstractStorage
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
phpCAS::error(
|
||||
'defining PGT storage makes no sense when not using a CAS proxy'
|
||||
);
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
@@ -135,8 +135,10 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage
|
||||
* @param string $driver_options any driver options to use when
|
||||
* connecting to the database
|
||||
*/
|
||||
public function __construct($cas_parent, $dsn_or_pdo, $username='', $password='', $table='', $driver_options=null)
|
||||
{
|
||||
public function __construct(
|
||||
$cas_parent, $dsn_or_pdo, $username='', $password='', $table='',
|
||||
$driver_options=null
|
||||
) {
|
||||
phpCAS::traceBegin();
|
||||
// call the ancestor's constructor
|
||||
parent::__construct($cas_parent);
|
||||
@@ -188,7 +190,10 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage
|
||||
// create the PDO object if it doesn't exist already
|
||||
if (!($this->_pdo instanceof PDO)) {
|
||||
try {
|
||||
$this->_pdo = new PDO($this->_dsn, $this->_username, $this->_password, $this->_driver_options);
|
||||
$this->_pdo = new PDO(
|
||||
$this->_dsn, $this->_username, $this->_password,
|
||||
$this->_driver_options
|
||||
);
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
phpCAS::error('Database connection error: ' . $e->getMessage());
|
||||
@@ -247,23 +252,28 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage
|
||||
*/
|
||||
protected function createTableSql()
|
||||
{
|
||||
return 'CREATE TABLE ' . $this->_getTable() . ' (pgt_iou VARCHAR(255) NOT NULL PRIMARY KEY, pgt VARCHAR(255) NOT NULL)';
|
||||
return 'CREATE TABLE ' . $this->_getTable()
|
||||
. ' (pgt_iou VARCHAR(255) NOT NULL PRIMARY KEY, pgt VARCHAR(255) NOT NULL)';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the query used to store a pgt
|
||||
*
|
||||
* @return the store PGT SQL, :pgt and :pgt_iou are the bind params contained in the query
|
||||
* @return the store PGT SQL, :pgt and :pgt_iou are the bind params contained
|
||||
* in the query
|
||||
*/
|
||||
protected function storePgtSql()
|
||||
{
|
||||
return 'INSERT INTO ' . $this->_getTable() . ' (pgt_iou, pgt) VALUES (:pgt_iou, :pgt)';
|
||||
return 'INSERT INTO ' . $this->_getTable()
|
||||
. ' (pgt_iou, pgt) VALUES (:pgt_iou, :pgt)';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the query used to retrieve a pgt. the first column of the first row should contain the pgt
|
||||
* This method returns the query used to retrieve a pgt. the first column
|
||||
* of the first row should contain the pgt
|
||||
*
|
||||
* @return the retrieve PGT SQL, :pgt_iou is the only bind param contained in the query
|
||||
* @return the retrieve PGT SQL, :pgt_iou is the only bind param contained
|
||||
* in the query
|
||||
*/
|
||||
protected function retrievePgtSql()
|
||||
{
|
||||
@@ -273,7 +283,8 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage
|
||||
/**
|
||||
* This method returns the query used to delete a pgt.
|
||||
*
|
||||
* @return the delete PGT SQL, :pgt_iou is the only bind param contained in the query
|
||||
* @return the delete PGT SQL, :pgt_iou is the only bind param contained in
|
||||
* the query
|
||||
*/
|
||||
protected function deletePgtSql()
|
||||
{
|
||||
|
||||
@@ -55,15 +55,20 @@ implements CAS_ProxiedService, CAS_ProxiedService_Testable
|
||||
*
|
||||
* @return void
|
||||
* @throws InvalidArgumentException If the $proxyTicket is invalid.
|
||||
* @throws CAS_OutOfSequenceException If called after a proxy ticket has already been initialized/set.
|
||||
* @throws CAS_OutOfSequenceException If called after a proxy ticket has
|
||||
* already been initialized/set.
|
||||
*/
|
||||
public function setProxyTicket ($proxyTicket)
|
||||
{
|
||||
if (empty($proxyTicket)) {
|
||||
throw new CAS_InvalidArgumentException("Trying to initialize with an empty proxy ticket.");
|
||||
throw new CAS_InvalidArgumentException(
|
||||
'Trying to initialize with an empty proxy ticket.'
|
||||
);
|
||||
}
|
||||
if (!empty($this->_proxyTicket)) {
|
||||
throw new CAS_OutOfSequenceException('Already initialized, cannot change the proxy ticket.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Already initialized, cannot change the proxy ticket.'
|
||||
);
|
||||
}
|
||||
$this->_proxyTicket = $proxyTicket;
|
||||
}
|
||||
@@ -78,7 +83,9 @@ implements CAS_ProxiedService, CAS_ProxiedService_Testable
|
||||
protected function getProxyTicket ()
|
||||
{
|
||||
if (empty($this->_proxyTicket)) {
|
||||
throw new CAS_OutOfSequenceException('No proxy ticket yet. Call $this->initializeProxyTicket() to aquire the proxy ticket.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'No proxy ticket yet. Call $this->initializeProxyTicket() to aquire the proxy ticket.'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_proxyTicket;
|
||||
@@ -105,7 +112,9 @@ implements CAS_ProxiedService, CAS_ProxiedService_Testable
|
||||
public function setCasClient (CAS_Client $casClient)
|
||||
{
|
||||
if (!empty($this->_proxyTicket)) {
|
||||
throw new CAS_OutOfSequenceException('Already initialized, cannot change the CAS_Client.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Already initialized, cannot change the CAS_Client.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_casClient = $casClient;
|
||||
@@ -124,7 +133,9 @@ implements CAS_ProxiedService, CAS_ProxiedService_Testable
|
||||
protected function initializeProxyTicket()
|
||||
{
|
||||
if (!empty($this->_proxyTicket)) {
|
||||
throw new CAS_OutOfSequenceException('Already initialized, cannot initialize again.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Already initialized, cannot initialize again.'
|
||||
);
|
||||
}
|
||||
// Allow usage of a particular CAS_Client for unit testing.
|
||||
if (empty($this->_casClient)) {
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
abstract class CAS_ProxiedService_Http_Abstract
|
||||
extends CAS_ProxiedService_Abstract
|
||||
implements CAS_ProxiedService_Http
|
||||
abstract class CAS_ProxiedService_Http_Abstract extends
|
||||
CAS_ProxiedService_Abstract implements CAS_ProxiedService_Http
|
||||
{
|
||||
/**
|
||||
* The HTTP request mechanism talking to the target service.
|
||||
@@ -64,8 +63,9 @@ implements CAS_ProxiedService_Http
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct (CAS_Request_RequestInterface $requestHandler, CAS_CookieJar $cookieJar)
|
||||
{
|
||||
public function __construct(CAS_Request_RequestInterface $requestHandler,
|
||||
CAS_CookieJar $cookieJar
|
||||
) {
|
||||
$this->requestHandler = $requestHandler;
|
||||
$this->_cookieJar = $cookieJar;
|
||||
}
|
||||
@@ -82,10 +82,12 @@ implements CAS_ProxiedService_Http
|
||||
* @return string
|
||||
* @throws Exception If no service url is available.
|
||||
*/
|
||||
public function getServiceUrl ()
|
||||
public function getServiceUrl()
|
||||
{
|
||||
if (empty($this->_url)) {
|
||||
throw new CAS_ProxiedService_Exception('No URL set via '.get_class($this).'->setUrl($url).');
|
||||
throw new CAS_ProxiedService_Exception(
|
||||
'No URL set via ' . get_class($this) . '->setUrl($url).'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_url;
|
||||
@@ -93,7 +95,7 @@ implements CAS_ProxiedService_Http
|
||||
|
||||
/*********************************************************
|
||||
* Configure the Request
|
||||
*********************************************************/
|
||||
*********************************************************/
|
||||
|
||||
/**
|
||||
* Set the URL of the Request
|
||||
@@ -103,10 +105,12 @@ implements CAS_ProxiedService_Http
|
||||
* @return void
|
||||
* @throws CAS_OutOfSequenceException If called after the Request has been sent.
|
||||
*/
|
||||
public function setUrl ($url)
|
||||
public function setUrl($url)
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set the URL, request already sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set the URL, request already sent.'
|
||||
);
|
||||
}
|
||||
if (!is_string($url)) {
|
||||
throw new CAS_InvalidArgumentException('$url must be a string.');
|
||||
@@ -117,7 +121,7 @@ implements CAS_ProxiedService_Http
|
||||
|
||||
/*********************************************************
|
||||
* 2. Send the Request
|
||||
*********************************************************/
|
||||
*********************************************************/
|
||||
|
||||
/**
|
||||
* Perform the request.
|
||||
@@ -132,10 +136,12 @@ implements CAS_ProxiedService_Http
|
||||
* @throws CAS_ProxiedService_Exception If there is a failure sending the
|
||||
* request to the target service.
|
||||
*/
|
||||
public function send ()
|
||||
public function send()
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot send, request already sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot send, request already sent.'
|
||||
);
|
||||
}
|
||||
|
||||
phpCAS::traceBegin();
|
||||
@@ -144,9 +150,9 @@ implements CAS_ProxiedService_Http
|
||||
$this->initializeProxyTicket();
|
||||
$url = $this->getServiceUrl();
|
||||
if (strstr($url, '?') === false) {
|
||||
$url = $url.'?ticket='.$this->getProxyTicket();
|
||||
$url = $url . '?ticket=' . $this->getProxyTicket();
|
||||
} else {
|
||||
$url = $url.'&ticket='.$this->getProxyTicket();
|
||||
$url = $url . '&ticket=' . $this->getProxyTicket();
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -199,7 +205,7 @@ implements CAS_ProxiedService_Http
|
||||
* @throws CAS_ProxiedService_Exception If there is a failure sending the
|
||||
* request to the target service.
|
||||
*/
|
||||
protected function makeRequest ($url)
|
||||
protected function makeRequest($url)
|
||||
{
|
||||
// Verify that we are not in a redirect loop
|
||||
$this->_numRequests++;
|
||||
@@ -220,9 +226,10 @@ implements CAS_ProxiedService_Http
|
||||
$this->populateRequest($request);
|
||||
|
||||
// Perform the request.
|
||||
phpCAS::trace('Performing proxied service request to \''.$url.'\'');
|
||||
phpCAS::trace('Performing proxied service request to \'' . $url . '\'');
|
||||
if (!$request->send()) {
|
||||
$message = 'Could not perform proxied service request to URL`'.$url.'\'. '.$request->getErrorMessage();
|
||||
$message = 'Could not perform proxied service request to URL`'
|
||||
. $url . '\'. ' . $request->getErrorMessage();
|
||||
phpCAS::trace($message);
|
||||
throw new CAS_ProxiedService_Exception($message);
|
||||
}
|
||||
@@ -231,8 +238,9 @@ implements CAS_ProxiedService_Http
|
||||
$this->_cookieJar->storeCookies($url, $request->getResponseHeaders());
|
||||
|
||||
// Follow any redirects
|
||||
if ($redirectUrl = $this->getRedirectUrl($request->getResponseHeaders())) {
|
||||
phpCAS :: trace('Found redirect:'.$redirectUrl);
|
||||
if ($redirectUrl = $this->getRedirectUrl($request->getResponseHeaders())
|
||||
) {
|
||||
phpCAS::trace('Found redirect:' . $redirectUrl);
|
||||
$this->makeRequest($redirectUrl);
|
||||
} else {
|
||||
|
||||
@@ -249,7 +257,9 @@ implements CAS_ProxiedService_Http
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function populateRequest (CAS_Request_RequestInterface $request);
|
||||
abstract protected function populateRequest(
|
||||
CAS_Request_RequestInterface $request
|
||||
);
|
||||
|
||||
/**
|
||||
* Answer a redirect URL if a redirect header is found, otherwise null.
|
||||
@@ -258,11 +268,12 @@ implements CAS_ProxiedService_Http
|
||||
*
|
||||
* @return string or null
|
||||
*/
|
||||
protected function getRedirectUrl (array $responseHeaders)
|
||||
protected function getRedirectUrl(array $responseHeaders)
|
||||
{
|
||||
// Check for the redirect after authentication
|
||||
foreach ($responseHeaders as $header) {
|
||||
if (preg_match('/^(Location:|URI:)\s*([^\s]+.*)$/', $header, $matches)) {
|
||||
if ( preg_match('/^(Location:|URI:)\s*([^\s]+.*)$/', $header, $matches)
|
||||
) {
|
||||
return trim(array_pop($matches));
|
||||
}
|
||||
}
|
||||
@@ -271,14 +282,14 @@ implements CAS_ProxiedService_Http
|
||||
|
||||
/*********************************************************
|
||||
* 3. Access the response
|
||||
*********************************************************/
|
||||
*********************************************************/
|
||||
|
||||
/**
|
||||
* Answer true if our request has been sent yet.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasBeenSent ()
|
||||
protected function hasBeenSent()
|
||||
{
|
||||
return ($this->_numRequests > 0);
|
||||
}
|
||||
@@ -289,10 +300,12 @@ implements CAS_ProxiedService_Http
|
||||
* @return array An array of header strings.
|
||||
* @throws CAS_OutOfSequenceException If called before the Request has been sent.
|
||||
*/
|
||||
public function getResponseHeaders ()
|
||||
public function getResponseHeaders()
|
||||
{
|
||||
if (!$this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot access response, request not sent yet.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot access response, request not sent yet.'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_responseHeaders;
|
||||
@@ -304,10 +317,12 @@ implements CAS_ProxiedService_Http
|
||||
* @return int
|
||||
* @throws CAS_OutOfSequenceException If called before the Request has been sent.
|
||||
*/
|
||||
public function getResponseStatusCode ()
|
||||
public function getResponseStatusCode()
|
||||
{
|
||||
if (!$this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot access response, request not sent yet.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot access response, request not sent yet.'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_responseStatusCode;
|
||||
@@ -319,10 +334,12 @@ implements CAS_ProxiedService_Http
|
||||
* @return string
|
||||
* @throws CAS_OutOfSequenceException If called before the Request has been sent.
|
||||
*/
|
||||
public function getResponseBody ()
|
||||
public function getResponseBody()
|
||||
{
|
||||
if (!$this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot access response, request not sent yet.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot access response, request not sent yet.'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_responseBody;
|
||||
@@ -334,7 +351,7 @@ implements CAS_ProxiedService_Http
|
||||
*
|
||||
* @return array An array containing cookies. E.g. array('name' => 'val');
|
||||
*/
|
||||
public function getCookies ()
|
||||
public function getCookies()
|
||||
{
|
||||
return $this->_cookieJar->getCookies($this->getServiceUrl());
|
||||
}
|
||||
|
||||
@@ -32,30 +32,31 @@
|
||||
*
|
||||
* Usage Example:
|
||||
*
|
||||
* try {
|
||||
* $service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET);
|
||||
* $service->setUrl('http://www.example.com/path/');
|
||||
* $service->send();
|
||||
* if ($service->getResponseStatusCode() == 200)
|
||||
* return $service->getResponseBody();
|
||||
* else
|
||||
* // The service responded with an error code 404, 500, etc.
|
||||
* throw new Exception('The service responded with an error.');
|
||||
* try {
|
||||
* $service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET);
|
||||
* $service->setUrl('http://www.example.com/path/');
|
||||
* $service->send();
|
||||
* if ($service->getResponseStatusCode() == 200)
|
||||
* return $service->getResponseBody();
|
||||
* else
|
||||
* // The service responded with an error code 404, 500, etc.
|
||||
* throw new Exception('The service responded with an error.');
|
||||
*
|
||||
* } catch (CAS_ProxyTicketException $e) {
|
||||
* if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE)
|
||||
* return "Your login has timed out. You need to log in again.";
|
||||
* else
|
||||
* // Other proxy ticket errors are from bad request format (shouldn't happen)
|
||||
* // or CAS server failure (unlikely) so lets just stop if we hit those.
|
||||
* throw $e;
|
||||
* } catch (CAS_ProxiedService_Exception $e) {
|
||||
* // Something prevented the service request from being sent or received.
|
||||
* // We didn't even get a valid error response (404, 500, etc), so this
|
||||
* // might be caused by a network error or a DNS resolution failure.
|
||||
* // We could handle it in some way, but for now we will just stop.
|
||||
* throw $e;
|
||||
* }
|
||||
* } catch (CAS_ProxyTicketException $e) {
|
||||
* if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE)
|
||||
* return "Your login has timed out. You need to log in again.";
|
||||
* else
|
||||
* // Other proxy ticket errors are from bad request format
|
||||
* // (shouldn't happen) or CAS server failure (unlikely)
|
||||
* // so lets just stop if we hit those.
|
||||
* throw $e;
|
||||
* } catch (CAS_ProxiedService_Exception $e) {
|
||||
* // Something prevented the service request from being sent or received.
|
||||
* // We didn't even get a valid error response (404, 500, etc), so this
|
||||
* // might be caused by a network error or a DNS resolution failure.
|
||||
* // We could handle it in some way, but for now we will just stop.
|
||||
* throw $e;
|
||||
* }
|
||||
*
|
||||
* @class CAS_ProxiedService_Http_Get
|
||||
* @category Authentication
|
||||
|
||||
@@ -32,32 +32,33 @@
|
||||
*
|
||||
* Usage Example:
|
||||
*
|
||||
* try {
|
||||
* $service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST);
|
||||
* $service->setUrl('http://www.example.com/path/');
|
||||
* $service->setContentType('text/xml');
|
||||
* $service->setBody(''<?xml version="1.0"?'.'><methodCall><methodName>example.search</methodName></methodCall>');
|
||||
* $service->send();
|
||||
* if ($service->getResponseStatusCode() == 200)
|
||||
* return $service->getResponseBody();
|
||||
* else
|
||||
* // The service responded with an error code 404, 500, etc.
|
||||
* throw new Exception('The service responded with an error.');
|
||||
* try {
|
||||
* $service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST);
|
||||
* $service->setUrl('http://www.example.com/path/');
|
||||
* $service->setContentType('text/xml');
|
||||
* $service->setBody('<?xml version="1.0"?'.'><methodCall><methodName>example.search</methodName></methodCall>');
|
||||
* $service->send();
|
||||
* if ($service->getResponseStatusCode() == 200)
|
||||
* return $service->getResponseBody();
|
||||
* else
|
||||
* // The service responded with an error code 404, 500, etc.
|
||||
* throw new Exception('The service responded with an error.');
|
||||
*
|
||||
* } catch (CAS_ProxyTicketException $e) {
|
||||
* if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE)
|
||||
* return "Your login has timed out. You need to log in again.";
|
||||
* else
|
||||
* // Other proxy ticket errors are from bad request format (shouldn't happen)
|
||||
* // or CAS server failure (unlikely) so lets just stop if we hit those.
|
||||
* throw $e;
|
||||
* } catch (CAS_ProxiedService_Exception $e) {
|
||||
* // Something prevented the service request from being sent or received.
|
||||
* // We didn't even get a valid error response (404, 500, etc), so this
|
||||
* // might be caused by a network error or a DNS resolution failure.
|
||||
* // We could handle it in some way, but for now we will just stop.
|
||||
* throw $e;
|
||||
* }
|
||||
* } catch (CAS_ProxyTicketException $e) {
|
||||
* if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE)
|
||||
* return "Your login has timed out. You need to log in again.";
|
||||
* else
|
||||
* // Other proxy ticket errors are from bad request format
|
||||
* // (shouldn't happen) or CAS server failure (unlikely) so lets just
|
||||
* // stop if we hit those.
|
||||
* throw $e;
|
||||
* } catch (CAS_ProxiedService_Exception $e) {
|
||||
* // Something prevented the service request from being sent or received.
|
||||
* // We didn't even get a valid error response (404, 500, etc), so this
|
||||
* // might be caused by a network error or a DNS resolution failure.
|
||||
* // We could handle it in some way, but for now we will just stop.
|
||||
* throw $e;
|
||||
* }
|
||||
*
|
||||
* @class CAS_ProxiedService_Http_Post
|
||||
* @category Authentication
|
||||
@@ -95,7 +96,9 @@ extends CAS_ProxiedService_Http_Abstract
|
||||
public function setContentType ($contentType)
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set the content type, request already sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set the content type, request already sent.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_contentType = $contentType;
|
||||
@@ -112,7 +115,9 @@ extends CAS_ProxiedService_Http_Abstract
|
||||
public function setBody ($body)
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set the body, request already sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set the body, request already sent.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_body = $body;
|
||||
@@ -128,7 +133,10 @@ extends CAS_ProxiedService_Http_Abstract
|
||||
protected function populateRequest (CAS_Request_RequestInterface $request)
|
||||
{
|
||||
if (empty($this->_contentType) && !empty($this->_body)) {
|
||||
throw new CAS_ProxiedService_Exception("If you pass a POST body, you must specify a content type via ".get_class($this).'->setContentType($contentType).');
|
||||
throw new CAS_ProxiedService_Exception(
|
||||
"If you pass a POST body, you must specify a content type via "
|
||||
.get_class($this).'->setContentType($contentType).'
|
||||
);
|
||||
}
|
||||
|
||||
$request->makePost();
|
||||
|
||||
@@ -79,7 +79,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function getServiceUrl ()
|
||||
{
|
||||
if (empty($this->_url)) {
|
||||
throw new CAS_ProxiedService_Exception('No URL set via '.get_class($this).'->getServiceUrl($url).');
|
||||
throw new CAS_ProxiedService_Exception(
|
||||
'No URL set via '.get_class($this).'->getServiceUrl($url).'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_url;
|
||||
@@ -100,7 +102,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function setServiceUrl ($url)
|
||||
{
|
||||
if ($this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set the URL, stream already opened.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set the URL, stream already opened.'
|
||||
);
|
||||
}
|
||||
if (!is_string($url) || !strlen($url)) {
|
||||
throw new CAS_InvalidArgumentException('Invalid url.');
|
||||
@@ -127,7 +131,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function setMailbox ($mailbox)
|
||||
{
|
||||
if ($this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set the mailbox, stream already opened.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set the mailbox, stream already opened.'
|
||||
);
|
||||
}
|
||||
if (!is_string($mailbox) || !strlen($mailbox)) {
|
||||
throw new CAS_InvalidArgumentException('Invalid mailbox.');
|
||||
@@ -155,7 +161,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function setOptions ($options)
|
||||
{
|
||||
if ($this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot set options, stream already opened.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot set options, stream already opened.'
|
||||
);
|
||||
}
|
||||
if (!is_int($options)) {
|
||||
throw new CAS_InvalidArgumentException('Invalid options.');
|
||||
@@ -178,14 +186,19 @@ extends CAS_ProxiedService_Abstract
|
||||
* PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE
|
||||
* PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE
|
||||
* PHPCAS_SERVICE_PT_FAILURE
|
||||
* @throws CAS_ProxiedService_Exception If there is a failure sending the request to the target service. */
|
||||
* @throws CAS_ProxiedService_Exception If there is a failure sending the
|
||||
* request to the target service.
|
||||
*/
|
||||
public function open ()
|
||||
{
|
||||
if ($this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Stream already opened.');
|
||||
}
|
||||
if (empty($this->_mailbox)) {
|
||||
throw new CAS_ProxiedService_Exception('You must specify a mailbox via '.get_class($this).'->setMailbox($mailbox)');
|
||||
throw new CAS_ProxiedService_Exception(
|
||||
'You must specify a mailbox via '.get_class($this)
|
||||
.'->setMailbox($mailbox)'
|
||||
);
|
||||
}
|
||||
|
||||
phpCAS::traceBegin();
|
||||
@@ -193,13 +206,16 @@ extends CAS_ProxiedService_Abstract
|
||||
// Get our proxy ticket and append it to our URL.
|
||||
$this->initializeProxyTicket();
|
||||
phpCAS::trace('opening IMAP mailbox `'.$this->_mailbox.'\'...');
|
||||
$this->_stream = @imap_open($this->_mailbox, $this->_username, $this->getProxyTicket(), $this->_options);
|
||||
$this->_stream = @imap_open(
|
||||
$this->_mailbox, $this->_username, $this->getProxyTicket(),
|
||||
$this->_options
|
||||
);
|
||||
if ($this->_stream) {
|
||||
phpCAS::trace('ok');
|
||||
} else {
|
||||
phpCAS::trace('could not open mailbox');
|
||||
// @todo add localization integration.
|
||||
$message = 'IMAP Error: '.$url.' '. var_export(imap_errors(), true);
|
||||
$message = 'IMAP Error: '.$this->_url.' '. var_export(imap_errors(), true);
|
||||
phpCAS::trace($message);
|
||||
throw new CAS_ProxiedService_Exception($message);
|
||||
}
|
||||
@@ -236,7 +252,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function getStream ()
|
||||
{
|
||||
if (!$this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot access stream, not opened yet.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot access stream, not opened yet.'
|
||||
);
|
||||
}
|
||||
return $this->_stream;
|
||||
}
|
||||
@@ -252,7 +270,9 @@ extends CAS_ProxiedService_Abstract
|
||||
public function getImapProxyTicket ()
|
||||
{
|
||||
if (!$this->hasBeenOpened()) {
|
||||
throw new CAS_OutOfSequenceException('Cannot access errors, stream not opened yet.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot access errors, stream not opened yet.'
|
||||
);
|
||||
}
|
||||
return $this->getProxyTicket();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
* This interface defines methods that allow proxy-authenticated service handlers
|
||||
* to be tested in unit tests.
|
||||
*
|
||||
* Classes implementing this interface SHOULD store the CAS_Client passed and initialize
|
||||
* themselves with that client rather than via the static phpCAS method. For example:
|
||||
* Classes implementing this interface SHOULD store the CAS_Client passed and
|
||||
* initialize themselves with that client rather than via the static phpCAS
|
||||
* method. For example:
|
||||
*
|
||||
* / **
|
||||
* * Fetch our proxy ticket.
|
||||
@@ -65,7 +66,8 @@ interface CAS_ProxiedService_Testable
|
||||
* @param CAS_Client $casClient Cas client object
|
||||
*
|
||||
* @return void
|
||||
* @throws CAS_OutOfSequenceException If called after a proxy ticket has already been initialized/set.
|
||||
* @throws CAS_OutOfSequenceException If called after a proxy ticket has
|
||||
* already been initialized/set.
|
||||
*/
|
||||
public function setCasClient (CAS_Client $casClient);
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@ implements CAS_ProxyChain_Interface
|
||||
*/
|
||||
public function __construct(array $chain)
|
||||
{
|
||||
$this->chain = array_values($chain); // Ensure that we have an indexed array
|
||||
// Ensure that we have an indexed array
|
||||
$this->chain = array_values($chain);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,17 +79,25 @@ implements CAS_ProxyChain_Interface
|
||||
$proxy_url = $list[$i];
|
||||
if (preg_match('/^\/.*\/[ixASUXu]*$/s', $search)) {
|
||||
if (preg_match($search, $proxy_url)) {
|
||||
phpCAS::trace("Found regexp " . $search . " matching " . $proxy_url);
|
||||
phpCAS::trace(
|
||||
"Found regexp " . $search . " matching " . $proxy_url
|
||||
);
|
||||
} else {
|
||||
phpCAS::trace("No regexp match " . $search . " != " . $proxy_url);
|
||||
phpCAS::trace(
|
||||
"No regexp match " . $search . " != " . $proxy_url
|
||||
);
|
||||
$mismatch = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (strncasecmp($search, $proxy_url, strlen($search)) == 0) {
|
||||
phpCAS::trace("Found string " . $search . " matching " . $proxy_url);
|
||||
phpCAS::trace(
|
||||
"Found string " . $search . " matching " . $proxy_url
|
||||
);
|
||||
} else {
|
||||
phpCAS::trace("No match " . $search . " != " . $proxy_url);
|
||||
phpCAS::trace(
|
||||
"No match " . $search . " != " . $proxy_url
|
||||
);
|
||||
$mismatch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,10 @@ implements CAS_Exception
|
||||
PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE,
|
||||
);
|
||||
if (!in_array($code, $ptCodes)) {
|
||||
trigger_error('Invalid code '.$code.' passed. Must be one of PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, or PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE.');
|
||||
trigger_error(
|
||||
'Invalid code '.$code
|
||||
.' passed. Must be one of PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, or PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE.'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($message, $code);
|
||||
|
||||
@@ -68,7 +68,9 @@ implements CAS_Request_RequestInterface
|
||||
public function setUrl ($url)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->url = $url;
|
||||
@@ -86,7 +88,9 @@ implements CAS_Request_RequestInterface
|
||||
public function addCookie ($name, $value)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->cookies[$name] = $value;
|
||||
@@ -105,7 +109,9 @@ implements CAS_Request_RequestInterface
|
||||
public function addCookies (array $cookies)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->cookies = array_merge($this->cookies, $cookies);
|
||||
@@ -122,7 +128,9 @@ implements CAS_Request_RequestInterface
|
||||
public function addHeader ($header)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->headers[] = $header;
|
||||
@@ -139,7 +147,9 @@ implements CAS_Request_RequestInterface
|
||||
public function addHeaders (array $headers)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->headers = array_merge($this->headers, $headers);
|
||||
@@ -154,7 +164,9 @@ implements CAS_Request_RequestInterface
|
||||
public function makePost ()
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
$this->isPost = true;
|
||||
@@ -171,10 +183,14 @@ implements CAS_Request_RequestInterface
|
||||
public function setPostBody ($body)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
if (!$this->isPost) {
|
||||
throw new CAS_OutOfSequenceException('Cannot add a POST body to a GET request, use makePost() first.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Cannot add a POST body to a GET request, use makePost() first.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->postBody = $body;
|
||||
@@ -192,7 +208,9 @@ implements CAS_Request_RequestInterface
|
||||
public function setSslCaCert ($caCertPath,$validate_cn=true)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
$this->caCertPath = $caCertPath;
|
||||
$this->validateCN = $validate_cn;
|
||||
@@ -211,10 +229,14 @@ implements CAS_Request_RequestInterface
|
||||
public function send ()
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot send again.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot send again.'
|
||||
);
|
||||
}
|
||||
if (is_null($this->url) || !$this->url) {
|
||||
throw new CAS_OutOfSequenceException('A url must be specified via setUrl() before the request can be sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'A url must be specified via setUrl() before the request can be sent.'
|
||||
);
|
||||
}
|
||||
$this->_sent = true;
|
||||
return $this->sendRequest();
|
||||
@@ -288,7 +310,9 @@ implements CAS_Request_RequestInterface
|
||||
public function getResponseHeaders ()
|
||||
{
|
||||
if (!$this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has not been sent yet. Cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has not been sent yet. Cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
return $this->_responseHeaders;
|
||||
}
|
||||
@@ -302,11 +326,19 @@ implements CAS_Request_RequestInterface
|
||||
public function getResponseStatusCode ()
|
||||
{
|
||||
if (!$this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has not been sent yet. Cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has not been sent yet. Cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
if (!preg_match('/HTTP\/[0-9.]+\s+([0-9]+)\s*(.*)/', $this->_responseHeaders[0], $matches)) {
|
||||
throw new CAS_Request_Exception("Bad response, no status code was found in the first line.");
|
||||
if (!preg_match(
|
||||
'/HTTP\/[0-9.]+\s+([0-9]+)\s*(.*)/',
|
||||
$this->_responseHeaders[0], $matches
|
||||
)
|
||||
) {
|
||||
throw new CAS_Request_Exception(
|
||||
'Bad response, no status code was found in the first line.'
|
||||
);
|
||||
}
|
||||
|
||||
return intval($matches[1]);
|
||||
@@ -321,7 +353,9 @@ implements CAS_Request_RequestInterface
|
||||
public function getResponseBody ()
|
||||
{
|
||||
if (!$this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has not been sent yet. Cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has not been sent yet. Cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_responseBody;
|
||||
@@ -336,7 +370,9 @@ implements CAS_Request_RequestInterface
|
||||
public function getErrorMessage ()
|
||||
{
|
||||
if (!$this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has not been sent yet. Cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has not been sent yet. Cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
return $this->_errorMessage;
|
||||
}
|
||||
|
||||
@@ -64,10 +64,14 @@ implements CAS_Request_MultiRequestInterface
|
||||
public function addRequest (CAS_Request_RequestInterface $request)
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
if (!$request instanceof CAS_Request_CurlRequest) {
|
||||
throw new CAS_InvalidArgumentException('As a CAS_Request_CurlMultiRequest, I can only work with CAS_Request_CurlRequest objects.');
|
||||
throw new CAS_InvalidArgumentException(
|
||||
'As a CAS_Request_CurlMultiRequest, I can only work with CAS_Request_CurlRequest objects.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_requests[] = $request;
|
||||
@@ -81,7 +85,9 @@ implements CAS_Request_MultiRequestInterface
|
||||
public function getNumRequests()
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot '.__METHOD__);
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot '.__METHOD__
|
||||
);
|
||||
}
|
||||
return count($this->_requests);
|
||||
}
|
||||
@@ -100,10 +106,14 @@ implements CAS_Request_MultiRequestInterface
|
||||
public function send ()
|
||||
{
|
||||
if ($this->_sent) {
|
||||
throw new CAS_OutOfSequenceException('Request has already been sent cannot send again.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'Request has already been sent cannot send again.'
|
||||
);
|
||||
}
|
||||
if (!count($this->_requests)) {
|
||||
throw new CAS_OutOfSequenceException('At least one request must be added via addRequest() before the multi-request can be sent.');
|
||||
throw new CAS_OutOfSequenceException(
|
||||
'At least one request must be added via addRequest() before the multi-request can be sent.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_sent = true;
|
||||
|
||||
@@ -75,7 +75,9 @@ implements CAS_Request_RequestInterface
|
||||
$buf = curl_exec($ch);
|
||||
if ( $buf === false ) {
|
||||
phpCAS::trace('curl_exec() failed');
|
||||
$this->storeErrorMessage('CURL error #'.curl_errno($ch).': '.curl_error($ch));
|
||||
$this->storeErrorMessage(
|
||||
'CURL error #'.curl_errno($ch).': '.curl_error($ch)
|
||||
);
|
||||
$res = false;
|
||||
} else {
|
||||
$this->storeResponseBody($buf);
|
||||
@@ -120,7 +122,7 @@ implements CAS_Request_RequestInterface
|
||||
if ($this->validateCN) {
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
|
||||
curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* @file CAS/InvalidArgumentException.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exception that denotes invalid arguments were passed.
|
||||
*
|
||||
* @class CAS_InvalidArgumentException
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
class CAS_TypeMismatchException
|
||||
extends CAS_InvalidArgumentException
|
||||
{
|
||||
/**
|
||||
* Constructor, provides a nice message.
|
||||
*
|
||||
* @param mixed $argument Argument
|
||||
* @param string $argumentName Argument Name
|
||||
* @param string $type Type
|
||||
* @param string $message Error Message
|
||||
* @param integer $code Code
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct (
|
||||
$argument, $argumentName, $type, $message = '', $code = 0
|
||||
) {
|
||||
if (is_object($argument)) {
|
||||
$foundType = get_class($argument).' object';
|
||||
} else {
|
||||
$foundType = gettype($argument);
|
||||
}
|
||||
|
||||
parent::__construct(
|
||||
'type mismatched for parameter '
|
||||
. $argumentName . ' (should be \'' . $type .' \'), '
|
||||
. $foundType . ' given. ' . $message, $code
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,5 +1,5 @@
|
||||
Description of phpCAS 1.3.2 library import
|
||||
Description of phpCAS 1.3.3 library import
|
||||
|
||||
* downloaded from http://downloads.jasig.org/cas-clients/php/current/
|
||||
|
||||
iarenaza
|
||||
merrill
|
||||
|
||||
+39
-25
@@ -111,6 +111,26 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the multi-authentication setting is used, check for the param before connecting to CAS.
|
||||
if ($this->config->multiauth) {
|
||||
$authCAS = optional_param('authCAS', '', PARAM_RAW);
|
||||
if ($authCAS == 'NOCAS') {
|
||||
return;
|
||||
}
|
||||
// Show authentication form for multi-authentication.
|
||||
// Test pgtIou parameter for proxy mode (https connection in background from CAS server to the php server).
|
||||
if ($authCAS != 'CAS' && !isset($_GET['pgtIou'])) {
|
||||
$PAGE->set_url('/login/index.php');
|
||||
$PAGE->navbar->add($CASform);
|
||||
$PAGE->set_title("$site->fullname: $CASform");
|
||||
$PAGE->set_heading($site->fullname);
|
||||
echo $OUTPUT->header();
|
||||
include($CFG->dirroot.'/auth/cas/cas_form.html');
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Connection to CAS server
|
||||
$this->connectCAS();
|
||||
|
||||
@@ -134,27 +154,6 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->config->multiauth) {
|
||||
$authCAS = optional_param('authCAS', '', PARAM_RAW);
|
||||
if ($authCAS == 'NOCAS') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show authentication form for multi-authentication
|
||||
// test pgtIou parameter for proxy mode (https connection
|
||||
// in background from CAS server to the php server)
|
||||
if ($authCAS != 'CAS' && !isset($_GET['pgtIou'])) {
|
||||
$PAGE->set_url('/login/index.php');
|
||||
$PAGE->navbar->add($CASform);
|
||||
$PAGE->set_title("$site->fullname: $CASform");
|
||||
$PAGE->set_heading($site->fullname);
|
||||
echo $OUTPUT->header();
|
||||
include($CFG->dirroot.'/auth/cas/cas_form.html');
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Force CAS authentication (if needed).
|
||||
if (!phpCAS::isAuthenticated()) {
|
||||
phpCAS::setLang($this->config->language);
|
||||
@@ -167,12 +166,27 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
*
|
||||
*/
|
||||
function prelogout_hook() {
|
||||
global $CFG;
|
||||
global $CFG, $USER, $DB;
|
||||
|
||||
if (!empty($this->config->logoutcas)) {
|
||||
$backurl = $CFG->wwwroot;
|
||||
if (!empty($this->config->logoutcas) && $USER->auth == $this->authtype) {
|
||||
$backurl = !empty($this->config->logout_return_url) ? $this->config->logout_return_url : $CFG->wwwroot;
|
||||
$this->connectCAS();
|
||||
phpCAS::logoutWithURL($backurl);
|
||||
// Note: Hack to stable versions to trigger the event before it redirect to CAS logout.
|
||||
$sid = session_id();
|
||||
$event = \core\event\user_loggedout::create(
|
||||
array(
|
||||
'userid' => $USER->id,
|
||||
'objectid' => $USER->id,
|
||||
'other' => array('sessionid' => $sid),
|
||||
)
|
||||
);
|
||||
if ($session = $DB->get_record('sessions', array('sid' => $sid))) {
|
||||
$event->add_record_snapshot('sessions', $session);
|
||||
}
|
||||
\core\session\manager::terminate_current();
|
||||
$event->trigger();
|
||||
|
||||
phpCAS::logoutWithRedirectService($backurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,5 +52,8 @@ function xmldb_auth_cas_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<location>CAS</location>
|
||||
<name>CAS</name>
|
||||
<license>BSD</license>
|
||||
<version>1.3.2</version>
|
||||
<version>1.3.3</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
</libraries>
|
||||
|
||||
@@ -384,6 +384,10 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
if ($old_user = $DB->get_record('user', array('username'=>$username, 'deleted'=>0, 'suspended'=>1, 'mnethostid'=>$CFG->mnet_localhost_id, 'auth'=>$this->authtype))) {
|
||||
$DB->set_field('user', 'suspended', 0, array('id'=>$old_user->id));
|
||||
$trace->output(get_string('auth_dbreviveduser', 'auth_db', array('name'=>$username, 'id'=>$old_user->id)), 1);
|
||||
|
||||
// Trigger user_updated event.
|
||||
\core\event\user_updated::create_from_userid($old_user->id)->trigger();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -410,6 +414,10 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
try {
|
||||
$id = $DB->insert_record ('user', $user); // it is truly a new user
|
||||
|
||||
// Trigger user_created event.
|
||||
\core\event\user_created::create_from_userid($id)->trigger();
|
||||
|
||||
$trace->output(get_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)), 1);
|
||||
} catch (moodle_exception $e) {
|
||||
$trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username), 1);
|
||||
@@ -547,6 +555,9 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
if ($updated) {
|
||||
$DB->set_field('user', 'timemodified', time(), array('id'=>$userid));
|
||||
|
||||
// Trigger user_updated event.
|
||||
\core\event\user_updated::create_from_userid($userid)->trigger();
|
||||
}
|
||||
return $DB->get_record('user', array('id'=>$userid, 'deleted'=>0));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
/** @var string Original error log */
|
||||
protected $oldlog;
|
||||
|
||||
protected function init_auth_database() {
|
||||
public function init_auth_database() {
|
||||
global $DB, $CFG;
|
||||
require_once("$CFG->dirroot/auth/db/auth.php");
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Events tests.
|
||||
*
|
||||
* @package auth_db
|
||||
* @category test
|
||||
* @copyright 2014 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/auth/db/tests/db_test.php');
|
||||
|
||||
class auth_db_events_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the locations in the auth_db API that create a user trigger the user_created event.
|
||||
*/
|
||||
public function test_user_created() {
|
||||
global $DB;
|
||||
|
||||
$this->preventResetByRollback();
|
||||
|
||||
// Initialise the database.
|
||||
$authdbtestcase = new auth_db_testcase();
|
||||
$authdbtestcase->init_auth_database();
|
||||
|
||||
$auth = get_auth_plugin('db');
|
||||
$auth->db_init();
|
||||
|
||||
// Add a user to the auth_db_users table - we will then call sync_users to
|
||||
// deal with the record here. In this case it will create the user.
|
||||
$user = new stdClass();
|
||||
$user->name = 'mark';
|
||||
$user->pass = 'password123';
|
||||
$user->email = 'what@legend.com';
|
||||
$user->id = $DB->insert_record('auth_db_users', $user);
|
||||
|
||||
// Run sync_users and capture the user_created event.
|
||||
$sink = $this->redirectEvents();
|
||||
$trace = new null_progress_trace();
|
||||
$auth->sync_users($trace, false);
|
||||
$events = $sink->get_events();
|
||||
$sink->close();
|
||||
|
||||
// Check that there is only one event.
|
||||
$this->assertEquals(1, count($events));
|
||||
|
||||
// Get the event.
|
||||
$event = array_pop($events);
|
||||
|
||||
// Test that the user created event was triggered - no need to test the other
|
||||
// details of the event as that is done extensively in other unit tests.
|
||||
$this->assertInstanceOf('\core\event\user_created', $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the locations in the auth_db API that update a user trigger the user_updated event.
|
||||
*/
|
||||
public function test_user_updated() {
|
||||
global $CFG, $DB;
|
||||
|
||||
$this->preventResetByRollback();
|
||||
|
||||
// Initialise the database.
|
||||
$authdbtestcase = new auth_db_testcase();
|
||||
$authdbtestcase->init_auth_database();
|
||||
|
||||
$auth = get_auth_plugin('db');
|
||||
$auth->db_init();
|
||||
|
||||
// Add a suspended user.
|
||||
$user = array();
|
||||
$user['username'] = 'mark';
|
||||
$user['suspended'] = '1';
|
||||
$user['mnethostid'] = $CFG->mnet_localhost_id;
|
||||
$user['auth'] = 'db';
|
||||
$this->getDataGenerator()->create_user($user);
|
||||
|
||||
// Add a user to the auth_db_users table - we will then call sync_users to
|
||||
// deal with the record here. In this case it will un-suspend the user.
|
||||
$user = new stdClass();
|
||||
$user->name = 'mark';
|
||||
$user->pass = 'password123';
|
||||
$user->email = 'what@legend.com';
|
||||
$user->id = $DB->insert_record('auth_db_users', $user);
|
||||
|
||||
// Set the config to remove the suspension on the user.
|
||||
set_config('removeuser', AUTH_REMOVEUSER_SUSPEND, 'auth/db');
|
||||
$auth->config->removeuser = AUTH_REMOVEUSER_SUSPEND;
|
||||
|
||||
// Run sync_users and capture the user_updated event.
|
||||
$sink = $this->redirectEvents();
|
||||
$trace = new null_progress_trace();
|
||||
$auth->sync_users($trace, false);
|
||||
$events = $sink->get_events();
|
||||
$sink->close();
|
||||
|
||||
// Check that there is only one event.
|
||||
$this->assertEquals(1, count($events));
|
||||
|
||||
// Get the event.
|
||||
$event = array_pop($events);
|
||||
|
||||
// Test that the user updated event was triggered - no need to test the other
|
||||
// details of the event as that is done extensively in other unit tests.
|
||||
$this->assertInstanceOf('\core\event\user_updated', $event);
|
||||
|
||||
// Run sync_users and capture the user_updated event.
|
||||
$sink = $this->redirectEvents();
|
||||
$auth->update_user_record('mark');
|
||||
$events = $sink->get_events();
|
||||
$sink->close();
|
||||
|
||||
// Check that there is only one event.
|
||||
$this->assertEquals(1, count($events));
|
||||
|
||||
// Get the event.
|
||||
$event = array_pop($events);
|
||||
|
||||
// Test that the user updated event was triggered - no need to test the other
|
||||
// details of the event as that is done extensively in other unit tests.
|
||||
$this->assertInstanceOf('\core\event\user_updated', $event);
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -94,11 +94,14 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
$user->calendartype = $CFG->calendartype;
|
||||
}
|
||||
|
||||
$user->id = user_create_user($user, false);
|
||||
$user->id = user_create_user($user, false, false);
|
||||
|
||||
// Save any custom profile field information.
|
||||
profile_save_data($user);
|
||||
|
||||
// Trigger event.
|
||||
\core\event\user_created::create_from_userid($user->id)->trigger();
|
||||
|
||||
if (! send_confirmation_email($user)) {
|
||||
print_error('auth_emailnoemail','auth_email');
|
||||
}
|
||||
|
||||
+4
-2
@@ -551,7 +551,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
print_error('auth_ldap_create_error', 'auth_ldap');
|
||||
}
|
||||
|
||||
$user->id = user_create_user($user, false);
|
||||
$user->id = user_create_user($user, false, false);
|
||||
|
||||
// Save any custom profile field information
|
||||
profile_save_data($user);
|
||||
@@ -564,6 +564,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
$user = $DB->get_record('user', array('id'=>$user->id));
|
||||
|
||||
\core\event\user_created::create_from_userid($user->id)->trigger();
|
||||
|
||||
if (! send_confirmation_email($user)) {
|
||||
print_error('noemail', 'auth_ldap');
|
||||
}
|
||||
@@ -1027,7 +1029,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
}
|
||||
user_update_user($newuser, false);
|
||||
user_update_user($newuser, false, false);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -42,5 +42,8 @@ function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ $string['notcalledfromserver'] = 'Should not be called from the web server!';
|
||||
$string['noupdatestobedone'] = "No updates to be done\n";
|
||||
$string['nouserentriestoremove'] = "No user entries to be removed\n";
|
||||
$string['nouserentriestorevive'] = "No user entries to be revived\n";
|
||||
$string['nouserstobeadded'] = "No users to be added\n";
|
||||
$string['nouserstobeadded'] = 'No user entries to be added';
|
||||
$string['ntlmsso_attempting'] = 'Attempting Single Sign On via NTLM...';
|
||||
$string['ntlmsso_failed'] = 'Auto-login failed, try the normal login page...';
|
||||
$string['ntlmsso_isdisabled'] = 'NTLM SSO is disabled.';
|
||||
|
||||
@@ -279,6 +279,143 @@ class auth_ldap_plugin_testcase extends advanced_testcase {
|
||||
$this->assertEventLegacyLogData($expectedlog, $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test logging in via LDAP calls a user_loggedin event.
|
||||
*/
|
||||
public function test_ldap_user_signup() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// User to create.
|
||||
$user = array(
|
||||
'username' => 'usersignuptest1',
|
||||
'password' => 'Moodle2014!',
|
||||
'idnumber' => 'idsignuptest1',
|
||||
'firstname' => 'First Name User Test 1',
|
||||
'lastname' => 'Last Name User Test 1',
|
||||
'middlename' => 'Middle Name User Test 1',
|
||||
'lastnamephonetic' => '最後のお名前のテスト一号',
|
||||
'firstnamephonetic' => 'お名前のテスト一号',
|
||||
'alternatename' => 'Alternate Name User Test 1',
|
||||
'email' => 'usersignuptest1@email.com',
|
||||
'description' => 'This is a description for user 1',
|
||||
'city' => 'Perth',
|
||||
'country' => 'au',
|
||||
'mnethostid' => $CFG->mnet_localhost_id,
|
||||
'auth' => 'ldap'
|
||||
);
|
||||
|
||||
if (!extension_loaded('ldap')) {
|
||||
$this->markTestSkipped('LDAP extension is not loaded.');
|
||||
}
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
require_once($CFG->dirroot.'/auth/ldap/auth.php');
|
||||
require_once($CFG->libdir.'/ldaplib.php');
|
||||
|
||||
if (!defined('TEST_AUTH_LDAP_HOST_URL') or !defined('TEST_AUTH_LDAP_BIND_DN') or !defined('TEST_AUTH_LDAP_BIND_PW') or !defined('TEST_AUTH_LDAP_DOMAIN')) {
|
||||
$this->markTestSkipped('External LDAP test server not configured.');
|
||||
}
|
||||
|
||||
// Make sure we can connect the server.
|
||||
$debuginfo = '';
|
||||
if (!$connection = ldap_connect_moodle(TEST_AUTH_LDAP_HOST_URL, 3, 'rfc2307', TEST_AUTH_LDAP_BIND_DN, TEST_AUTH_LDAP_BIND_PW, LDAP_DEREF_NEVER, $debuginfo, false)) {
|
||||
$this->markTestSkipped('Can not connect to LDAP test server: '.$debuginfo);
|
||||
}
|
||||
|
||||
$this->enable_plugin();
|
||||
|
||||
// Create new empty test container.
|
||||
$topdn = 'dc=moodletest,'.TEST_AUTH_LDAP_DOMAIN;
|
||||
|
||||
$this->recursive_delete($connection, TEST_AUTH_LDAP_DOMAIN, 'dc=moodletest');
|
||||
|
||||
$o = array();
|
||||
$o['objectClass'] = array('dcObject', 'organizationalUnit');
|
||||
$o['dc'] = 'moodletest';
|
||||
$o['ou'] = 'MOODLETEST';
|
||||
if (!ldap_add($connection, 'dc=moodletest,'.TEST_AUTH_LDAP_DOMAIN, $o)) {
|
||||
$this->markTestSkipped('Can not create test LDAP container.');
|
||||
}
|
||||
|
||||
// Create a few users.
|
||||
$o = array();
|
||||
$o['objectClass'] = array('organizationalUnit');
|
||||
$o['ou'] = 'users';
|
||||
ldap_add($connection, 'ou='.$o['ou'].','.$topdn, $o);
|
||||
|
||||
// Configure the plugin a bit.
|
||||
set_config('host_url', TEST_AUTH_LDAP_HOST_URL, 'auth/ldap');
|
||||
set_config('start_tls', 0, 'auth/ldap');
|
||||
set_config('ldap_version', 3, 'auth/ldap');
|
||||
set_config('ldapencoding', 'utf-8', 'auth/ldap');
|
||||
set_config('pagesize', '2', 'auth/ldap');
|
||||
set_config('bind_dn', TEST_AUTH_LDAP_BIND_DN, 'auth/ldap');
|
||||
set_config('bind_pw', TEST_AUTH_LDAP_BIND_PW, 'auth/ldap');
|
||||
set_config('user_type', 'rfc2307', 'auth/ldap');
|
||||
set_config('contexts', 'ou=users,'.$topdn, 'auth/ldap');
|
||||
set_config('search_sub', 0, 'auth/ldap');
|
||||
set_config('opt_deref', LDAP_DEREF_NEVER, 'auth/ldap');
|
||||
set_config('user_attribute', 'cn', 'auth/ldap');
|
||||
set_config('memberattribute', 'memberuid', 'auth/ldap');
|
||||
set_config('memberattribute_isdn', 0, 'auth/ldap');
|
||||
set_config('creators', 'cn=creators,'.$topdn, 'auth/ldap');
|
||||
set_config('removeuser', AUTH_REMOVEUSER_KEEP, 'auth/ldap');
|
||||
|
||||
set_config('field_map_email', 'mail', 'auth/ldap');
|
||||
set_config('field_updatelocal_email', 'oncreate', 'auth/ldap');
|
||||
set_config('field_updateremote_email', '0', 'auth/ldap');
|
||||
set_config('field_lock_email', 'unlocked', 'auth/ldap');
|
||||
|
||||
set_config('field_map_firstname', 'givenName', 'auth/ldap');
|
||||
set_config('field_updatelocal_firstname', 'oncreate', 'auth/ldap');
|
||||
set_config('field_updateremote_firstname', '0', 'auth/ldap');
|
||||
set_config('field_lock_firstname', 'unlocked', 'auth/ldap');
|
||||
|
||||
set_config('field_map_lastname', 'sn', 'auth/ldap');
|
||||
set_config('field_updatelocal_lastname', 'oncreate', 'auth/ldap');
|
||||
set_config('field_updateremote_lastname', '0', 'auth/ldap');
|
||||
set_config('field_lock_lastname', 'unlocked', 'auth/ldap');
|
||||
set_config('passtype', 'md5', 'auth/ldap');
|
||||
set_config('create_context', 'ou=users,'.$topdn, 'auth/ldap');
|
||||
|
||||
$this->assertEquals(2, $DB->count_records('user'));
|
||||
$this->assertEquals(0, $DB->count_records('role_assignments'));
|
||||
|
||||
/** @var auth_plugin_ldap $auth */
|
||||
$auth = get_auth_plugin('ldap');
|
||||
|
||||
$sink = $this->redirectEvents();
|
||||
$auth->user_signup((object)$user, false);
|
||||
$this->assertDebuggingCalled('Not sending email due to $CFG->noemailever config setting');
|
||||
$events = $sink->get_events();
|
||||
$sink->close();
|
||||
|
||||
// Verify 2 events get generated.
|
||||
$this->assertCount(2, $events);
|
||||
|
||||
// Get record from db.
|
||||
$dbuser = $DB->get_record('user', array('username' => $user['username']));
|
||||
$user['id'] = $dbuser->id;
|
||||
|
||||
// Last event is user_created.
|
||||
$event = array_pop($events);
|
||||
$this->assertInstanceOf('\core\event\user_created', $event);
|
||||
$this->assertEquals($user['id'], $event->objectid);
|
||||
$this->assertEquals('user_created', $event->get_legacy_eventname());
|
||||
$this->assertEquals(context_user::instance($user['id']), $event->get_context());
|
||||
$expectedlogdata = array(SITEID, 'user', 'add', '/view.php?id='.$event->objectid, fullname($dbuser));
|
||||
$this->assertEventLegacyLogData($expectedlogdata, $event);
|
||||
|
||||
// First event is user_password_updated.
|
||||
$event = array_pop($events);
|
||||
$this->assertInstanceOf('\core\event\user_password_updated', $event);
|
||||
$this->assertEventContextNotUsed($event);
|
||||
|
||||
// Delete user which we just created.
|
||||
ldap_delete($connection, 'cn='.$user['username'].',ou=users,'.$topdn);
|
||||
}
|
||||
|
||||
protected function create_ldap_user($connection, $topdn, $i) {
|
||||
$o = array();
|
||||
$o['objectClass'] = array('inetOrgPerson', 'organizationalPerson', 'person', 'posixAccount');
|
||||
|
||||
@@ -47,5 +47,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* This file contains the mnet services for the mnet authentication plugin
|
||||
*
|
||||
* @since 2.0
|
||||
* @since Moodle 2.0
|
||||
* @package auth_mnet
|
||||
* @copyright 2010 Penny Leach
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
||||
@@ -47,5 +47,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,13 @@
|
||||
if (!empty($_SERVER[$pluginconfig->user_attribute])) { // Shibboleth auto-login
|
||||
$frm = new stdClass();
|
||||
$frm->username = strtolower($_SERVER[$pluginconfig->user_attribute]);
|
||||
$frm->password = substr(base64_encode($_SERVER[$pluginconfig->user_attribute]),0,8);
|
||||
// The random password consists of the first 8 letters of the base 64 encoded user ID
|
||||
// This password is never used unless the user account is converted to manual
|
||||
// The password is never actually used, but needs to be passed to the functions 'user_login' and
|
||||
// 'authenticate_user_login'. Shibboleth returns true for the function 'prevent_local_password', which is
|
||||
// used when setting the password in 'update_internal_user_password'. When 'prevent_local_password'
|
||||
// returns true, the password is set to 'not cached' (AUTH_PASSWORD_NOT_CACHED) in the Moodle DB. However,
|
||||
// rather than setting the password to a hard-coded value, we will generate one each time, in case there are
|
||||
// changes to the Shibboleth plugin and it is actually used.
|
||||
$frm->password = generate_password(8);
|
||||
|
||||
/// Check if the user has actually submitted login data to us
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ abstract class condition extends tree_node {
|
||||
*
|
||||
* Default implementation returns false.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid ID of activity whose completion value is considered
|
||||
* @return boolean True if the availability of something else may rely on it
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class frontend {
|
||||
*
|
||||
* Default returns true.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ abstract class frontend {
|
||||
*
|
||||
* Default returns no parameters.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
* @return array Array of parameters for the JavaScript function
|
||||
@@ -95,7 +95,7 @@ abstract class frontend {
|
||||
/**
|
||||
* Includes JavaScript for the main system and all plugins.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class info {
|
||||
/** @var stdClass Course */
|
||||
/** @var \stdClass Course */
|
||||
protected $course;
|
||||
|
||||
/** @var \course_modinfo Modinfo (available only during some functions) */
|
||||
@@ -52,10 +52,10 @@ abstract class info {
|
||||
/**
|
||||
* Constructs with item details.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param int $visible Value of visible flag (eye icon)
|
||||
* @param string $availability Availability definition (JSON format) or null
|
||||
* @throws coding_exception If data is not valid JSON format
|
||||
* @throws \coding_exception If data is not valid JSON format
|
||||
*/
|
||||
public function __construct($course, $visible, $availability) {
|
||||
// Set basic values.
|
||||
@@ -67,7 +67,7 @@ abstract class info {
|
||||
/**
|
||||
* Obtains the course associated with this availability information.
|
||||
*
|
||||
* @return stdClass Moodle course object
|
||||
* @return \stdClass Moodle course object
|
||||
*/
|
||||
public function get_course() {
|
||||
return $this->course;
|
||||
@@ -128,7 +128,7 @@ abstract class info {
|
||||
* @param string $availability Availability string in JSON format
|
||||
* @param boolean $lax If true, throw exceptions only for invalid structure
|
||||
* @return tree Availability tree
|
||||
* @throws coding_exception If data is not valid JSON format
|
||||
* @throws \coding_exception If data is not valid JSON format
|
||||
*/
|
||||
protected function decode_availability($availability, $lax) {
|
||||
// Decode JSON data.
|
||||
@@ -306,7 +306,7 @@ abstract class info {
|
||||
*
|
||||
* @param string $restoreid Restore identifier
|
||||
* @param int $courseid Target course id
|
||||
* @param base_logger $logger Logger for any warnings
|
||||
* @param \base_logger $logger Logger for any warnings
|
||||
*/
|
||||
public function update_after_restore($restoreid, $courseid, \base_logger $logger) {
|
||||
$tree = $this->get_availability_tree();
|
||||
@@ -342,7 +342,7 @@ abstract class info {
|
||||
* function does that for the conditional availability data for all
|
||||
* modules and sections on the course.
|
||||
*
|
||||
* @param int|stdClass $courseorid Course id or object
|
||||
* @param int|\stdClass $courseorid Course id or object
|
||||
* @param string $table Table name e.g. 'course_modules'
|
||||
* @param int $oldid Previous ID
|
||||
* @param int $newid New ID
|
||||
@@ -407,7 +407,7 @@ abstract class info {
|
||||
* groupmembersonly field for modules. This is off by default because
|
||||
* we are not yet moving the groupmembersonly option into this new API.
|
||||
*
|
||||
* @param stdClass $rec Object possibly containing legacy fields
|
||||
* @param \stdClass $rec Object possibly containing legacy fields
|
||||
* @param bool $section True if this is a section
|
||||
* @param bool $modgroupmembersonly True if groupmembersonly is converted for mods
|
||||
* @return string|null New availability value or null if none
|
||||
@@ -468,7 +468,7 @@ abstract class info {
|
||||
* that it has an AND tree with one or more conditions.
|
||||
*
|
||||
* @param string|null $availability Current availability conditions
|
||||
* @param stdClass $rec Object containing information from old table
|
||||
* @param \stdClass $rec Object containing information from old table
|
||||
* @param bool $show True if 'show' option should be enabled
|
||||
* @return string New availability conditions
|
||||
*/
|
||||
@@ -501,7 +501,7 @@ abstract class info {
|
||||
* that it has an AND tree with one or more conditions.
|
||||
*
|
||||
* @param string|null $availability Current availability conditions
|
||||
* @param stdClass $rec Object containing information from old table
|
||||
* @param \stdClass $rec Object containing information from old table
|
||||
* @param bool $show True if 'show' option should be enabled
|
||||
* @return string New availability conditions
|
||||
*/
|
||||
@@ -598,8 +598,8 @@ abstract class info {
|
||||
* object.
|
||||
*
|
||||
* @param string $info Info string
|
||||
* @param int|stdClass $courseorid
|
||||
* @return Correctly formatted info string
|
||||
* @param int|\stdClass $courseorid
|
||||
* @return string Correctly formatted info string
|
||||
*/
|
||||
public static function format_info($info, $courseorid) {
|
||||
// Don't waste time if there are no special tags.
|
||||
@@ -624,7 +624,7 @@ abstract class info {
|
||||
* JS (using the non-JS version instead, which causes a page reload) if a
|
||||
* completion tickbox value may affect a conditional activity.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid Course-module id
|
||||
* @return bool True if this is used in a condition, false otherwise
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ class info_module extends info {
|
||||
/**
|
||||
* Gets the course-module object. Intended for use by conditions.
|
||||
*
|
||||
* @return cm_info Course module
|
||||
* @return \cm_info Course module
|
||||
*/
|
||||
public function get_course_module() {
|
||||
return $this->cm;
|
||||
@@ -130,11 +130,11 @@ class info_module extends info {
|
||||
* disabled, and you supply a $cm object with necessary fields, and you
|
||||
* don't check course access.
|
||||
*
|
||||
* @param int|stdClass|cm_info $cmorid Object or id representing activity
|
||||
* @param int|\stdClass|\cm_info $cmorid Object or id representing activity
|
||||
* @param int $userid User id (0 = current user)
|
||||
* @param bool $checkcourse If true, checks whether the user has course access
|
||||
* @return bool True if the activity is visible to the specified user
|
||||
* @throws moodle_exception If the cmid doesn't exist
|
||||
* @throws \moodle_exception If the cmid doesn't exist
|
||||
*/
|
||||
public static function is_user_visible($cmorid, $userid = 0, $checkcourse = true) {
|
||||
global $USER, $DB, $CFG;
|
||||
|
||||
@@ -65,7 +65,7 @@ class info_section extends info {
|
||||
/**
|
||||
* Gets the section object. Intended for use by conditions.
|
||||
*
|
||||
* @return section_info Section
|
||||
* @return \section_info Section
|
||||
*/
|
||||
public function get_section() {
|
||||
return $this->section;
|
||||
|
||||
@@ -128,11 +128,11 @@ class tree extends tree_node {
|
||||
* coding_exception (if $lax is false).
|
||||
*
|
||||
* @see decode_availability
|
||||
* @param stdClass $structure Structure (decoded from JSON)
|
||||
* @param \stdClass $structure Structure (decoded from JSON)
|
||||
* @param boolean $lax If true, throw exceptions only for invalid structure
|
||||
* @param boolean $root If true, this is the root tree
|
||||
* @return tree Availability tree
|
||||
* @throws coding_exception If data is not valid structure
|
||||
* @throws \coding_exception If data is not valid structure
|
||||
*/
|
||||
public function __construct($structure, $lax = false, $root = true) {
|
||||
$this->root = $root;
|
||||
@@ -389,12 +389,12 @@ class tree extends tree_node {
|
||||
* for display to staff.
|
||||
*
|
||||
* @param info $info Information about location of condition tree
|
||||
* @throws coding_exception If you call on a non-root tree
|
||||
* @throws \coding_exception If you call on a non-root tree
|
||||
* @return string HTML data (empty string if none)
|
||||
*/
|
||||
public function get_full_information(info $info) {
|
||||
if (!$this->root) {
|
||||
throw new coding_exception('Only supported on root item');
|
||||
throw new \coding_exception('Only supported on root item');
|
||||
}
|
||||
return $this->get_full_information_recursive(false, $info, null, true);
|
||||
}
|
||||
@@ -406,12 +406,12 @@ class tree extends tree_node {
|
||||
*
|
||||
* @param info $info Information about location of condition tree
|
||||
* @param result $result Result object
|
||||
* @throws coding_exception If you call on a non-root tree
|
||||
* @throws \coding_exception If you call on a non-root tree
|
||||
* @return string HTML data (empty string if none)
|
||||
*/
|
||||
public function get_result_information(info $info, result $result) {
|
||||
if (!$this->root) {
|
||||
throw new coding_exception('Only supported on root item');
|
||||
throw new \coding_exception('Only supported on root item');
|
||||
}
|
||||
return $this->get_full_information_recursive(false, $info, $result, true);
|
||||
}
|
||||
@@ -530,7 +530,7 @@ class tree extends tree_node {
|
||||
$negative = true;
|
||||
break;
|
||||
default:
|
||||
throw new coding_exception('Unknown operator');
|
||||
throw new \coding_exception('Unknown operator');
|
||||
}
|
||||
switch($this->op) {
|
||||
case self::OP_AND:
|
||||
@@ -542,7 +542,7 @@ class tree extends tree_node {
|
||||
$andoperator = false;
|
||||
break;
|
||||
default:
|
||||
throw new coding_exception('Unknown operator');
|
||||
throw new \coding_exception('Unknown operator');
|
||||
}
|
||||
|
||||
// Select NOT (or not) for children. It flips if this is a 'not' group.
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class tree_node {
|
||||
/**
|
||||
* Saves tree data back to a structure object.
|
||||
*
|
||||
* @return stdClass Structure object (ready to be made into JSON format)
|
||||
* @return \stdClass Structure object (ready to be made into JSON format)
|
||||
*/
|
||||
public abstract function save();
|
||||
|
||||
@@ -152,11 +152,11 @@ abstract class tree_node {
|
||||
* @param \core_availability\info $info Item we're checking
|
||||
* @param capability_checker $checker
|
||||
* @return array Filtered version of input array
|
||||
* @throws coding_exception If called on a condition that doesn't apply to user lists
|
||||
* @throws \coding_exception If called on a condition that doesn't apply to user lists
|
||||
*/
|
||||
public function filter_user_list(array $users, $not,
|
||||
\core_availability\info $info, capability_checker $checker) {
|
||||
throw new coding_exception('Not implemented (do not call unless '.
|
||||
throw new \coding_exception('Not implemented (do not call unless '.
|
||||
'is_applied_to_user_lists is true)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get cmid.
|
||||
@@ -212,7 +212,7 @@ class condition extends \core_availability\condition {
|
||||
* Used in course/lib.php because we need to disable the completion JS if
|
||||
* a completion value affects a conditional activity.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid Course-module id
|
||||
* @return bool True if this is used in a condition, false otherwise
|
||||
*/
|
||||
|
||||
+2
-2
@@ -47,10 +47,10 @@ M.availability_completion.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
node.one('select[name=cm] > option[value=' + json.cm + ']')) {
|
||||
node.one('select[name=cm]').set('value', json.cm);
|
||||
node.one('select[name=cm]').set('value', '' + json.cm);
|
||||
}
|
||||
if (json.e !== undefined) {
|
||||
node.one('select[name=e]').set('value', json.e);
|
||||
node.one('select[name=e]').set('value', '' + json.e);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.str.availability_completion,r=n.title+' <span class="availability-group"><label>'+'<span class="accesshide">'+n.label_cm+" </span>"+'<select name="cm" title="'+n.label_cm+'">'+'<option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.cms.length;i++){var s=this.cms[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></label> <label><span class="accesshide">'+n.label_completion+' </span><select name="e" title="'+n.label_completion+'">'+'<option value="1">'+n.option_complete+"</option>"+'<option value="0">'+n.option_incomplete+"</option>"+'<option value="2">'+n.option_pass+"</option>"+'<option value="3">'+n.option_fail+"</option>"+"</select></label></span>";var o=e.Node.create("<span>"+r+"</span>");t.cm!==undefined&&o.one("select[name=cm] > option[value="+t.cm+"]")&&o.one("select[name=cm]").set("value",t.cm),t.e!==undefined&&o.one("select[name=e]").set("value",t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return o},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.str.availability_completion,r=n.title+' <span class="availability-group"><label>'+'<span class="accesshide">'+n.label_cm+" </span>"+'<select name="cm" title="'+n.label_cm+'">'+'<option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.cms.length;i++){var s=this.cms[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></label> <label><span class="accesshide">'+n.label_completion+' </span><select name="e" title="'+n.label_completion+'">'+'<option value="1">'+n.option_complete+"</option>"+'<option value="0">'+n.option_incomplete+"</option>"+'<option value="2">'+n.option_pass+"</option>"+'<option value="3">'+n.option_fail+"</option>"+"</select></label></span>";var o=e.Node.create("<span>"+r+"</span>");t.cm!==undefined&&o.one("select[name=cm] > option[value="+t.cm+"]")&&o.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&o.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return o},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+2
-2
@@ -47,10 +47,10 @@ M.availability_completion.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
node.one('select[name=cm] > option[value=' + json.cm + ']')) {
|
||||
node.one('select[name=cm]').set('value', json.cm);
|
||||
node.one('select[name=cm]').set('value', '' + json.cm);
|
||||
}
|
||||
if (json.e !== undefined) {
|
||||
node.one('select[name=e]').set('value', json.e);
|
||||
node.one('select[name=e]').set('value', '' + json.e);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
|
||||
@@ -45,10 +45,10 @@ M.availability_completion.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
node.one('select[name=cm] > option[value=' + json.cm + ']')) {
|
||||
node.one('select[name=cm]').set('value', json.cm);
|
||||
node.one('select[name=cm]').set('value', '' + json.cm);
|
||||
}
|
||||
if (json.e !== undefined) {
|
||||
node.one('select[name=e]').set('value', json.e);
|
||||
node.one('select[name=e]').set('value', '' + json.e);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
|
||||
@@ -52,8 +52,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get direction.
|
||||
|
||||
@@ -74,7 +74,7 @@ class frontend extends \core_availability\frontend {
|
||||
* Given a timestamp, obtains corresponding field values.
|
||||
*
|
||||
* @param int $time Timestamp
|
||||
* @return stdClass Object with fields for year, month, day, hour, minute
|
||||
* @return \stdClass Object with fields for year, month, day, hour, minute
|
||||
*/
|
||||
public static function get_fields_from_time($time) {
|
||||
$calendartype = \core_calendar\type_factory::get_calendar_instance();
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ M.availability_date.form.getNode = function(json) {
|
||||
var fields = Y.JSON.parse(response.responseText);
|
||||
for (var field in fields) {
|
||||
var select = node.one('select[name=x\\[' + field + '\\]]');
|
||||
select.set('value', fields[field]);
|
||||
select.set('value', '' + fields[field]);
|
||||
select.set('disabled', false);
|
||||
}
|
||||
},
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.str.availability_date,r=n.direction_before+' <span class="availability-group">'+'<label><span class="accesshide">'+n.direction_label+" </span>"+'<select name="direction">'+'<option value=">=">'+n.direction_from+"</option>"+'<option value="<">'+n.direction_until+"</option>"+"</select></label></span> "+this.html,i=e.Node.create("<span>"+r+"</span>");if(t.t!==undefined){i.setData("time",t.t),i.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var s=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(s,{on:{success:function(t,n){var r=e.JSON.parse(n.responseText);for(var s in r){var o=i.one("select[name=x\\["+s+"\\]]");o.set("value",r[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.str.availability_date.ajaxerror)}}})}else i.setData("time",this.defaultTime);t.d!==undefined&&i.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),o.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(i.one("a[href=#]")){M.form.dateselector.init_single_date_selector(i);var u=i.one("select[name=x\\[year\\]]"),a=u.set;u.set=function(e,t){a.call(u,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(i)},0)}}return i},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.str.availability_date.ajaxerror)}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.str.availability_date,r=n.direction_before+' <span class="availability-group">'+'<label><span class="accesshide">'+n.direction_label+" </span>"+'<select name="direction">'+'<option value=">=">'+n.direction_from+"</option>"+'<option value="<">'+n.direction_until+"</option>"+"</select></label></span> "+this.html,i=e.Node.create("<span>"+r+"</span>");if(t.t!==undefined){i.setData("time",t.t),i.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var s=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(s,{on:{success:function(t,n){var r=e.JSON.parse(n.responseText);for(var s in r){var o=i.one("select[name=x\\["+s+"\\]]");o.set("value",""+r[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.str.availability_date.ajaxerror)}}})}else i.setData("time",this.defaultTime);t.d!==undefined&&i.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),o.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(i.one("a[href=#]")){M.form.dateselector.init_single_date_selector(i);var u=i.one("select[name=x\\[year\\]]"),a=u.set;u.set=function(e,t){a.call(u,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(i)},0)}}return i},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.str.availability_date.ajaxerror)}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
|
||||
|
||||
availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
Vendored
+1
-1
@@ -53,7 +53,7 @@ M.availability_date.form.getNode = function(json) {
|
||||
var fields = Y.JSON.parse(response.responseText);
|
||||
for (var field in fields) {
|
||||
var select = node.one('select[name=x\\[' + field + '\\]]');
|
||||
select.set('value', fields[field]);
|
||||
select.set('value', '' + fields[field]);
|
||||
select.set('disabled', false);
|
||||
}
|
||||
},
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ M.availability_date.form.getNode = function(json) {
|
||||
var fields = Y.JSON.parse(response.responseText);
|
||||
for (var field in fields) {
|
||||
var select = node.one('select[name=x\\[' + field + '\\]]');
|
||||
select.set('value', fields[field]);
|
||||
select.set('value', '' + fields[field]);
|
||||
select.set('disabled', false);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -46,8 +46,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get grade item id.
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
}
|
||||
if (json.min !== undefined) {
|
||||
node.one('input[name=min]').set('checked', true);
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=M.str.availability_grade,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.grades.length;i++){var s=this.grades[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+n.option_min+'</label> <label><span class="accesshide">'+n.label_min+'</span><input type="text" name="minval" title="'+n.label_min+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+n.option_max+'</label> <label><span class="accesshide">'+n.label_max+'</span><input type="text" name="maxval" title="'+n.label_max+'"/></label>%</span>';var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",t.id),t.min!==undefined&&(o.one("input[name=min]").set("checked",!0),o.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(o.one("input[name=max]").set("checked",!0),o.one("input[name=maxval]").set("value",t.max));var u=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};o.all("input[type=checkbox]").each(u);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),a.delegate("click",function(){u(this,!0)},".availability_grade input[type=checkbox]"),a.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return o},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=M.str.availability_grade,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.grades.length;i++){var s=this.grades[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+n.option_min+'</label> <label><span class="accesshide">'+n.label_min+'</span><input type="text" name="minval" title="'+n.label_min+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+n.option_max+'</label> <label><span class="accesshide">'+n.label_max+'</span><input type="text" name="maxval" title="'+n.label_max+'"/></label>%</span>';var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(o.one("input[name=min]").set("checked",!0),o.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(o.one("input[name=max]").set("checked",!0),o.one("input[name=maxval]").set("value",t.max));var u=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};o.all("input[type=checkbox]").each(u);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),a.delegate("click",function(){u(this,!0)},".availability_grade input[type=checkbox]"),a.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return o},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
}
|
||||
if (json.min !== undefined) {
|
||||
node.one('input[name=min]').set('checked', true);
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
}
|
||||
if (json.min !== undefined) {
|
||||
node.one('input[name=min]').set('checked', true);
|
||||
|
||||
@@ -43,8 +43,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get group id.
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
if (json.creating === undefined) {
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
} else if (json.id === undefined) {
|
||||
node.one('select[name=id]').set('value', 'any');
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n=M.str.availability_group,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.str.moodle.choosedots+"</option>"+'<option value="any">'+n.anygroup+"</option>";for(var i=0;i<this.groups.length;i++){var s=this.groups[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+="</select></span></label>";var o=e.Node.create("<span>"+r+"</span>");t.creating===undefined&&(t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")?o.one("select[name=id]").set("value",t.id):t.id===undefined&&o.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return o},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n=M.str.availability_group,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.str.moodle.choosedots+"</option>"+'<option value="any">'+n.anygroup+"</option>";for(var i=0;i<this.groups.length;i++){var s=this.groups[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+="</select></span></label>";var o=e.Node.create("<span>"+r+"</span>");t.creating===undefined&&(t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")?o.one("select[name=id]").set("value",""+t.id):t.id===undefined&&o.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return o},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
if (json.creating === undefined) {
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
} else if (json.id === undefined) {
|
||||
node.one('select[name=id]').set('value', 'any');
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
if (json.creating === undefined) {
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
} else if (json.id === undefined) {
|
||||
node.one('select[name=id]').set('value', 'any');
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get grouping id.
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ M.availability_grouping.form.getNode = function(json) {
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
node.one('select[name=id]').set('value', '' + json.id);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user